diff --git a/dist/adapters/cubemap-tiles.js b/dist/adapters/cubemap-tiles.js index 9e08f0829..da08167fa 100644 --- a/dist/adapters/cubemap-tiles.js +++ b/dist/adapters/cubemap-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -281,6 +281,9 @@ var NB_VERTICES_BY_PLANE = NB_VERTICES_BY_FACE * CUBE_SEGMENTS * CUBE_SEGMENTS; var NB_VERTICES = 6 * NB_VERTICES_BY_PLANE; var NB_GROUPS_BY_FACE = CUBE_SEGMENTS * CUBE_SEGMENTS; + var ATTR_UV = 'uv'; + var ATTR_ORIGINAL_UV = 'originaluv'; + var ATTR_POSITION = 'position'; function tileId(tile) { return tile.face + ":" + tile.col + "x" + tile.row; @@ -315,12 +318,6 @@ showErrorTile: true, baseBlur: true }, options); - /** - * @member {external:THREE.MeshBasicMaterial[]} - * @private - */ - - _this.materials = []; /** * @member {PSV.adapters.Queue} * @private @@ -333,7 +330,7 @@ * @property {int} facesByTile - number of mesh faces by tile * @property {Record} tiles - loaded tiles * @property {external:THREE.BoxGeometry} geom - * @property {*} originalUvs + * @property {external:THREE.MeshBasicMaterial[]} materials * @property {external:THREE.MeshBasicMaterial} errorMaterial * @private */ @@ -343,7 +340,7 @@ facesByTile: 0, tiles: {}, geom: null, - originalUvs: null, + materials: [], errorMaterial: null }; /** @@ -367,6 +364,10 @@ return _this; } + /** + * @override + */ + var _proto = CubemapTilesAdapter.prototype; @@ -383,11 +384,14 @@ delete this.queue; delete this.loader; delete this.prop.geom; - delete this.prop.originalUvs; delete this.prop.errorMaterial; _CubemapAdapter.prototype.destroy.call(this); - }; + } + /** + * @private + */ + ; _proto.handleEvent = function handleEvent(e) { /* eslint-disable */ @@ -410,13 +414,29 @@ _proto.__cleanup = function __cleanup() { this.queue.clear(); this.prop.tiles = {}; - this.materials.forEach(function (mat) { + this.prop.materials.forEach(function (mat) { var _mat$map; mat == null ? void 0 : (_mat$map = mat.map) == null ? void 0 : _mat$map.dispose(); mat == null ? void 0 : mat.dispose(); }); - this.materials.length = 0; + this.prop.materials.length = 0; + } + /** + * @override + */ + ; + + _proto.supportsTransition = function supportsTransition(panorama) { + return !!panorama.baseUrl; + } + /** + * @override + */ + ; + + _proto.supportsPreload = function supportsPreload(panorama) { + return !!panorama.baseUrl; } /** * @override @@ -438,13 +458,6 @@ return Promise.reject(new photoSphereViewer.PSVError('Panorama nbTiles must be power of 2.')); } - this.prop.tileSize = panorama.faceSize / panorama.nbTiles; - this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles; - - if (this.prop.geom) { - this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone()); - } - if (panorama.baseUrl) { return _CubemapAdapter.prototype.loadTexture.call(this, panorama.baseUrl).then(function (textureData) { return { @@ -476,9 +489,8 @@ geometry.addGroup(i, NB_VERTICES_BY_FACE, k++); } - this.prop.geom = geometry; - this.prop.originalUvs = geometry.getAttribute('uv').clone(); - return new THREE.Mesh(geometry, this.materials); + geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone()); + return new THREE.Mesh(geometry, []); } /** * @summary Applies the base texture and starts the loading of tiles @@ -486,45 +498,72 @@ */ ; - _proto.setTexture = function setTexture(mesh, textureData) { + _proto.setTexture = function setTexture(mesh, textureData, transition) { var _this2 = this; + var panorama = textureData.panorama, + texture = textureData.texture; + + if (transition) { + this.__setTexture(mesh, texture); + + return; + } + this.__cleanup(); - if (textureData.texture) { - for (var i = 0; i < 6; i++) { - var texture = textureData.texture[i]; + this.__setTexture(mesh, texture); + this.prop.materials = mesh.material; + this.prop.geom = mesh.geometry; + this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone()); + this.prop.tileSize = panorama.faceSize / panorama.nbTiles; + this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles; // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); + + setTimeout(function () { + return _this2.__refresh(true); + }); + } + /** + * @private + */ + ; + + _proto.__setTexture = function __setTexture(mesh, texture) { + for (var i = 0; i < 6; i++) { + var material = void 0; + + if (texture) { if (this.config.flipTopBottom && (i === 2 || i === 3)) { - texture.center = new THREE.Vector2(0.5, 0.5); - texture.rotation = Math.PI; + texture[i].center = new THREE.Vector2(0.5, 0.5); + texture[i].rotation = Math.PI; } - var material = new THREE.MeshBasicMaterial({ - map: texture + material = new THREE.MeshBasicMaterial({ + map: texture[i] + }); + } else { + material = new THREE.MeshBasicMaterial({ + opacity: 0, + transparent: true }); - - for (var j = 0; j < NB_GROUPS_BY_FACE; j++) { - this.materials.push(material); - } } - } else { - var _material = new THREE.MeshBasicMaterial({ - opacity: 0, - transparent: true - }); - for (var _i = 0; _i < 6; _i++) { - for (var _j = 0; _j < NB_GROUPS_BY_FACE; _j++) { - this.materials.push(_material); - } + for (var j = 0; j < NB_GROUPS_BY_FACE; j++) { + mesh.material.push(material); } - } // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); - + } + } + /** + * @override + */ + ; - setTimeout(function () { - return _this2.__refresh(true); - }); + _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { + for (var i = 0; i < 6; i++) { + mesh.material[i * NB_GROUPS_BY_FACE].opacity = opacity; + mesh.material[i * NB_GROUPS_BY_FACE].transparent = opacity < 1; + } } /** * @summary Compute visible tiles and load them @@ -546,7 +585,7 @@ camera.updateMatrixWorld(); projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); - var verticesPosition = this.prop.geom.getAttribute('position'); + var verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); var tilesToLoad = []; for (var face = 0; face < 6; face++) { @@ -700,7 +739,7 @@ _proto.__swapMaterial = function __swapMaterial(face, col, row, material) { var _this6 = this; - var uvs = this.prop.geom.getAttribute('uv'); + var uvs = this.prop.geom.getAttribute(ATTR_UV); for (var c = 0; c < this.prop.facesByTile; c++) { var _loop = function _loop(r) { @@ -714,7 +753,7 @@ return g.start === firstVertex; }).materialIndex; - _this6.materials[matIndex] = material; // define new uvs + _this6.prop.materials[matIndex] = material; // define new uvs var top = 1 - r / _this6.prop.facesByTile; var bottom = 1 - (r + 1) / _this6.prop.facesByTile; @@ -765,8 +804,7 @@ return CubemapTilesAdapter; }(cubemap.CubemapAdapter); CubemapTilesAdapter.id = 'cubemap-tiles'; - CubemapTilesAdapter.supportsTransition = false; - CubemapTilesAdapter.supportsPreload = false; + CubemapTilesAdapter.supportsDownload = false; exports.CubemapTilesAdapter = CubemapTilesAdapter; diff --git a/dist/adapters/cubemap-tiles.js.map b/dist/adapters/cubemap-tiles.js.map index 87aa51ca5..d96c12a62 100644 --- a/dist/adapters/cubemap-tiles.js.map +++ b/dist/adapters/cubemap-tiles.js.map @@ -1 +1 @@ -{"version":3,"file":"cubemap-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/utils.js","../../src/adapters/cubemap-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, PSVError, utils } from '../..';\nimport { CUBE_HASHMAP, CubemapAdapter } from '../cubemap';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils';\n\nif (!CubemapAdapter) {\n throw new PSVError('CubemapAdapter is missing, please load cubemap.js before cubemap-tiles.js');\n}\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.CubemapTilesAdapter\n * @param {'left'|'front'|'right'|'back'|'top'|'bottom'} face\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Panorama\n * @summary Configuration of a tiled cubemap\n * @property {PSV.adapters.CubemapAdapter.Cubemap} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} faceSize - size of a face\n * @property {int} nbTiles - number of tiles on a side of a face\n * @property {PSV.adapters.CubemapTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Options\n * @property {boolean} [flipTopBottom=false] - set to true if the top and bottom faces are not correctly oriented\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.CubemapTilesAdapter.Tile\n * @private\n * @property {int} face\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n\nconst CUBE_SEGMENTS = 16;\nconst NB_VERTICES_BY_FACE = 6;\nconst NB_VERTICES_BY_PLANE = NB_VERTICES_BY_FACE * CUBE_SEGMENTS * CUBE_SEGMENTS;\nconst NB_VERTICES = 6 * NB_VERTICES_BY_PLANE;\nconst NB_GROUPS_BY_FACE = CUBE_SEGMENTS * CUBE_SEGMENTS;\n\nfunction tileId(tile) {\n return `${tile.face}:${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 * @summary Adapter for tiled cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapTilesAdapter extends CubemapAdapter {\n\n static id = 'cubemap-tiles';\n static supportsTransition = false;\n static supportsPreload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.CubemapTilesAdapter.Options}\n * @private\n */\n this.config = {\n flipTopBottom: false,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n /**\n * @member {external:THREE.MeshBasicMaterial[]}\n * @private\n */\n this.materials = [];\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} tileSize - size in pixels of a tile\n * @property {int} facesByTile - number of mesh faces by tile\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.BoxGeometry} geom\n * @property {*} originalUvs\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n tileSize : 0,\n facesByTile : 0,\n tiles : {},\n geom : null,\n originalUvs : null,\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 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.originalUvs;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\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.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.materials.length = 0;\n }\n\n /**\n * @override\n * @param {PSV.adapters.CubemapTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.faceSize || !panorama.nbTiles || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.nbTiles > CUBE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama nbTiles must not be greater than ${CUBE_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.nbTiles)) {\n return Promise.reject(new PSVError('Panorama nbTiles must be power of 2.'));\n }\n\n this.prop.tileSize = panorama.faceSize / panorama.nbTiles;\n this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles;\n\n if (this.prop.geom) {\n this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone());\n }\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n }));\n }\n else {\n return Promise.resolve({ panorama });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_SEGMENTS, CUBE_SEGMENTS, CUBE_SEGMENTS)\n .scale(1, 1, -1)\n .toNonIndexed();\n\n geometry.clearGroups();\n for (let i = 0, k = 0; i < NB_VERTICES; i += NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, NB_VERTICES_BY_FACE, k++);\n }\n\n this.prop.geom = geometry;\n this.prop.originalUvs = geometry.getAttribute('uv').clone();\n\n return new THREE.Mesh(geometry, this.materials);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData) {\n this.__cleanup();\n\n if (textureData.texture) {\n for (let i = 0; i < 6; i++) {\n const texture = textureData.texture[i];\n\n if (this.config.flipTopBottom && (i === 2 || i === 3)) {\n texture.center = new THREE.Vector2(0.5, 0.5);\n texture.rotation = Math.PI;\n }\n\n const material = new THREE.MeshBasicMaterial({ map: texture });\n\n for (let j = 0; j < NB_GROUPS_BY_FACE; j++) {\n this.materials.push(material);\n }\n }\n }\n else {\n const material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n\n for (let i = 0; i < 6; i++) {\n for (let j = 0; j < NB_GROUPS_BY_FACE; j++) {\n this.materials.push(material);\n }\n }\n }\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n const panorama = this.psv.config.panorama;\n\n if (!panorama) {\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 verticesPosition = this.prop.geom.getAttribute('position');\n const tilesToLoad = [];\n\n for (let face = 0; face < 6; face++) {\n for (let col = 0; col < panorama.nbTiles; col++) {\n for (let row = 0; row < panorama.nbTiles; row++) {\n // for each tile, find the vertices corresponding to the four corners\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 const verticesIndex = [];\n\n // top-left\n const v0 = face * NB_VERTICES_BY_PLANE\n + row * this.prop.facesByTile * CUBE_SEGMENTS * NB_VERTICES_BY_FACE\n + col * this.prop.facesByTile * NB_VERTICES_BY_FACE;\n\n // bottom-left\n const v1 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile - 1) + 1;\n\n // bottom-right\n const v2 = v1 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // top-right\n const v3 = v0 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByTile >= CUBE_SEGMENTS / 2) {\n // top-center\n const v4 = v0 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 1;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 3;\n\n // left-center\n const v6 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile / 2 - 1) + 1;\n\n // right-center\n const v7 = v6 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // center-center\n const v8 = v6 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5, v6, v7, v8);\n }\n\n // if (init && face === 5 && 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 const angle = vertexPosition.angleTo(this.psv.prop.direction);\n tilesToLoad.push({ face, col, row, angle });\n }\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.CubemapTilesAdapter.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.CubemapTilesAdapter.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\n let { col, row } = tile;\n if (this.config.flipTopBottom && (tile.face === 2 || tile.face === 3)) {\n col = panorama.nbTiles - col - 1;\n row = panorama.nbTiles - row - 1;\n }\n const url = panorama.tileUrl(CUBE_HASHMAP[tile.face], col, 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.face, 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.tileSize, this.prop.tileSize);\n }\n this.__swapMaterial(tile.face, 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} face\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(face, col, row, material) {\n const uvs = this.prop.geom.getAttribute('uv');\n\n for (let c = 0; c < this.prop.facesByTile; c++) {\n for (let r = 0; r < this.prop.facesByTile; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByTile + c;\n const faceRow = row * this.prop.facesByTile + r;\n\n // first vertex for this face (6 vertices in total)\n const firstVertex = NB_VERTICES_BY_PLANE * face + 6 * (CUBE_SEGMENTS * faceRow + faceCol);\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.materials[matIndex] = material;\n\n // define new uvs\n let top = 1 - r / this.prop.facesByTile;\n let bottom = 1 - (r + 1) / this.prop.facesByTile;\n let left = c / this.prop.facesByTile;\n let right = (c + 1) / this.prop.facesByTile;\n\n if (this.config.flipTopBottom && (face === 2 || face === 3)) {\n top = 1 - top;\n bottom = 1 - bottom;\n left = 1 - left;\n right = 1 - right;\n }\n\n uvs.setXY(firstVertex, left, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, top);\n uvs.setXY(firstVertex + 3, left, bottom);\n uvs.setXY(firstVertex + 4, right, bottom);\n uvs.setXY(firstVertex + 5, right, top);\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 * @override\n * @private\n */\n __createCubemapTexture(img) {\n if (img.width !== img.height) {\n utils.logWarn('Invalid base image, the width should equals the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w);\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","CubemapAdapter","PSVError","CUBE_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_PLANE","NB_VERTICES","NB_GROUPS_BY_FACE","tileId","tile","face","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","CubemapTilesAdapter","psv","options","config","flipTopBottom","showErrorTile","baseBlur","materials","queue","prop","tileSize","facesByTile","tiles","geom","originalUvs","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","loadTexture","panorama","faceSize","nbTiles","tileUrl","Promise","reject","isPowerOfTwo","setAttribute","clone","baseUrl","textureData","resolve","createMesh","scale","cubeSize","SPHERE_RADIUS","geometry","BoxGeometry","toNonIndexed","clearGroups","i","k","addGroup","getAttribute","Mesh","setTexture","mesh","center","Vector2","rotation","PI","material","j","push","opacity","transparent","setTimeout","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v3","v4","v5","v6","v7","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","CUBE_HASHMAP","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createCubemapTexture","logWarn","w","supportsTransition","supportsPreload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EAAL,GAAUA,EAAV;EACA,SAAKC,QAAL,GAAgBA,QAAhB;EACA,SAAKC,EAAL,GAAUA,EAAV;EACA,SAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B;EACD;;EArBH;;EAAA,SAuBEC,KAvBF,GAuBE,iBAAQ;EAAA;;EACN,SAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B;EACA,WAAO,KAAKL,EAAL,CAAQ,IAAR,EACJM,IADI,CACC,YAAM;EACV,M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GAAG,CAAxB,EAA2BS,KAA3B,EAAkCH,GAAlC;EACAX,QAAAA,GAAG,CAACe,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BQ,IAA3B,EAAiCD,MAAjC;EACAZ,QAAAA,GAAG,CAACe,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BS,KAA3B,EAAkCF,MAAlC;EACAZ,QAAAA,GAAG,CAACe,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BS,KAA3B,EAAkCH,GAAlC;EA/B4C;;EAC9C,WAAK,IAAIT,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,KAAK9G,IAAL,CAAUE,WAA9B,EAA2C4G,CAAC,EAA5C,EAAgD;EAAA,cAAvCA,CAAuC;EA+B/C;EACF;;EAEDF,IAAAA,GAAG,CAACF,WAAJ,GAAkB,IAAlB;EACD;EAED;EACF;EACA;EACA;EACA;EACA;EACA;EAraA;;EAAA,SAsaEkB,sBAtaF,GAsaE,gCAAuBpK,GAAvB,EAA4B;EAC1B,QAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAtB,EAA8B;EAC5B6B,MAAAA,uBAAK,CAAC0J,OAAN,CAAc,wDAAd;EACD;;EAED,WAAOtK,iBAAiB,CAACC,GAAD,EAAM,KAAKkC,MAAL,CAAYG,QAAlB,EAA4B,UAAAiI,CAAC;EAAA,aAAIA,CAAJ;EAAA,KAA7B,CAAxB;EACD,GA5aH;;EAAA;EAAA,EAAyCzJ,sBAAzC;EAAakB,oBAEJvF,KAAK;EAFDuF,oBAGJwI,qBAAqB;EAHjBxI,oBAIJyI,kBAAkB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"cubemap-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/utils.js","../../src/adapters/cubemap-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, PSVError, utils } from '../..';\nimport { CUBE_HASHMAP, CubemapAdapter } from '../cubemap';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils';\n\nif (!CubemapAdapter) {\n throw new PSVError('CubemapAdapter is missing, please load cubemap.js before cubemap-tiles.js');\n}\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.CubemapTilesAdapter\n * @param {'left'|'front'|'right'|'back'|'top'|'bottom'} face\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Panorama\n * @summary Configuration of a tiled cubemap\n * @property {PSV.adapters.CubemapAdapter.Cubemap} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} faceSize - size of a face\n * @property {int} nbTiles - number of tiles on a side of a face\n * @property {PSV.adapters.CubemapTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapTilesAdapter.Options\n * @property {boolean} [flipTopBottom=false] - set to true if the top and bottom faces are not correctly oriented\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.CubemapTilesAdapter.Tile\n * @private\n * @property {int} face\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n\nconst CUBE_SEGMENTS = 16;\nconst NB_VERTICES_BY_FACE = 6;\nconst NB_VERTICES_BY_PLANE = NB_VERTICES_BY_FACE * CUBE_SEGMENTS * CUBE_SEGMENTS;\nconst NB_VERTICES = 6 * NB_VERTICES_BY_PLANE;\nconst NB_GROUPS_BY_FACE = CUBE_SEGMENTS * CUBE_SEGMENTS;\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.face}:${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 * @summary Adapter for tiled cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapTilesAdapter extends CubemapAdapter {\n\n static id = 'cubemap-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.CubemapTilesAdapter.Options}\n * @private\n */\n this.config = {\n flipTopBottom: false,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} tileSize - size in pixels of a tile\n * @property {int} facesByTile - number of mesh faces by tile\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.BoxGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n tileSize : 0,\n facesByTile : 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.CubemapTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.faceSize || !panorama.nbTiles || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.nbTiles > CUBE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama nbTiles must not be greater than ${CUBE_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.nbTiles)) {\n return Promise.reject(new PSVError('Panorama nbTiles must be power of 2.'));\n }\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n }));\n }\n else {\n return Promise.resolve({ panorama });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_SEGMENTS, CUBE_SEGMENTS, CUBE_SEGMENTS)\n .scale(1, 1, -1)\n .toNonIndexed();\n\n geometry.clearGroups();\n for (let i = 0, k = 0; i < NB_VERTICES; i += NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, NB_VERTICES_BY_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.tileSize = panorama.faceSize / panorama.nbTiles;\n this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles;\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 for (let i = 0; i < 6; i++) {\n let material;\n if (texture) {\n if (this.config.flipTopBottom && (i === 2 || i === 3)) {\n texture[i].center = new THREE.Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n material = new THREE.MeshBasicMaterial({ map: texture[i] });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let j = 0; j < NB_GROUPS_BY_FACE; j++) {\n mesh.material.push(material);\n }\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i * NB_GROUPS_BY_FACE].opacity = opacity;\n mesh.material[i * NB_GROUPS_BY_FACE].transparent = opacity < 1;\n }\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n const panorama = this.psv.config.panorama;\n\n if (!panorama) {\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 verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let face = 0; face < 6; face++) {\n for (let col = 0; col < panorama.nbTiles; col++) {\n for (let row = 0; row < panorama.nbTiles; row++) {\n // for each tile, find the vertices corresponding to the four corners\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 const verticesIndex = [];\n\n // top-left\n const v0 = face * NB_VERTICES_BY_PLANE\n + row * this.prop.facesByTile * CUBE_SEGMENTS * NB_VERTICES_BY_FACE\n + col * this.prop.facesByTile * NB_VERTICES_BY_FACE;\n\n // bottom-left\n const v1 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile - 1) + 1;\n\n // bottom-right\n const v2 = v1 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // top-right\n const v3 = v0 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByTile >= CUBE_SEGMENTS / 2) {\n // top-center\n const v4 = v0 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 1;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE - 3;\n\n // left-center\n const v6 = v0 + CUBE_SEGMENTS * NB_VERTICES_BY_FACE * (this.prop.facesByTile / 2 - 1) + 1;\n\n // right-center\n const v7 = v6 + this.prop.facesByTile * NB_VERTICES_BY_FACE - 3;\n\n // center-center\n const v8 = v6 + this.prop.facesByTile / 2 * NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5, v6, v7, v8);\n }\n\n // if (init && face === 5 && 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 const angle = vertexPosition.angleTo(this.psv.prop.direction);\n tilesToLoad.push({ face, col, row, angle });\n }\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.CubemapTilesAdapter.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.CubemapTilesAdapter.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\n let { col, row } = tile;\n if (this.config.flipTopBottom && (tile.face === 2 || tile.face === 3)) {\n col = panorama.nbTiles - col - 1;\n row = panorama.nbTiles - row - 1;\n }\n const url = panorama.tileUrl(CUBE_HASHMAP[tile.face], col, 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.face, 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.tileSize, this.prop.tileSize);\n }\n this.__swapMaterial(tile.face, 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} face\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(face, col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByTile; c++) {\n for (let r = 0; r < this.prop.facesByTile; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByTile + c;\n const faceRow = row * this.prop.facesByTile + r;\n\n // first vertex for this face (6 vertices in total)\n const firstVertex = NB_VERTICES_BY_PLANE * face + 6 * (CUBE_SEGMENTS * faceRow + faceCol);\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 let top = 1 - r / this.prop.facesByTile;\n let bottom = 1 - (r + 1) / this.prop.facesByTile;\n let left = c / this.prop.facesByTile;\n let right = (c + 1) / this.prop.facesByTile;\n\n if (this.config.flipTopBottom && (face === 2 || face === 3)) {\n top = 1 - top;\n bottom = 1 - bottom;\n left = 1 - left;\n right = 1 - right;\n }\n\n uvs.setXY(firstVertex, left, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, top);\n uvs.setXY(firstVertex + 3, left, bottom);\n uvs.setXY(firstVertex + 4, right, bottom);\n uvs.setXY(firstVertex + 5, right, top);\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 * @override\n * @private\n */\n __createCubemapTexture(img) {\n if (img.width !== img.height) {\n utils.logWarn('Invalid base image, the width should equals the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w);\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","CubemapAdapter","PSVError","CUBE_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_PLANE","NB_VERTICES","NB_GROUPS_BY_FACE","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","face","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","CubemapTilesAdapter","psv","options","config","flipTopBottom","showErrorTile","baseBlur","queue","prop","tileSize","facesByTile","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","faceSize","nbTiles","tileUrl","Promise","reject","isPowerOfTwo","textureData","resolve","createMesh","scale","cubeSize","SPHERE_RADIUS","geometry","BoxGeometry","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","center","Vector2","rotation","PI","opacity","transparent","j","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v3","v4","v5","v6","v7","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","CUBE_HASHMAP","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createCubemapTexture","logWarn","w","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EAAL,GAAUA,EAAV;EACA,SAAKC,QAAL,GAAgBA,QAAhB;EACA,SAAKC,EAAL,GAAUA,EAAV;EACA,SAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B;EACD;;EArBH;;EAAA,SAuBEC,KAvBF,GAuBE,iBAAQ;EAAA;;EACN,SAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B;EACA,WAAO,KAAKL,EAAL,CAAQ,IAAR,EACJM,IADI,CACC,YAAM;EACV,MAAA,KAAI,CAACL,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYK,IAA1B;EACD,KAHI,EAGF,YAAM;EACP,MAAA,KAAI,CAACN,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYM,KAA1B;EACD,KALI,CAAP;EAMD,GA/BH;;EAAA,SAiCEC,MAjCF,GAiCE,kBAAS;EACP,SAAKR,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYQ,SAA1B;EACD,GAnCH;;EAAA,SAqCEC,WArCF,GAqCE,uBAAc;EAC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J,KAAcmB,GAAG,CAAClB,MAAtB,EAA8B;EAC5B6B,MAAAA,uBAAK,CAACiK,OAAN,CAAc,wDAAd;EACD;;EAED,WAAO7K,iBAAiB,CAACC,GAAD,EAAM,KAAKqC,MAAL,CAAYG,QAAlB,EAA4B,UAAAqI,CAAC;EAAA,aAAIA,CAAJ;EAAA,KAA7B,CAAxB;EACD,GAvcH;;EAAA;EAAA,EAAyChK,sBAAzC;EAAaqB,oBAEJ1F,KAAK;EAFD0F,oBAGJ4I,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/cubemap.js b/dist/adapters/cubemap.js index 1d34d665c..11fb5dec6 100644 --- a/dist/adapters/cubemap.js +++ b/dist/adapters/cubemap.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -92,13 +92,29 @@ } /** * @override - * @param {string[] | PSV.adapters.CubemapAdapter.Cubemap} panorama - * @returns {Promise.} */ var _proto = CubemapAdapter.prototype; + _proto.supportsTransition = function supportsTransition() { + return true; + } + /** + * @override + */ + ; + + _proto.supportsPreload = function supportsPreload() { + return true; + } + /** + * @override + * @param {string[] | PSV.adapters.CubemapAdapter.Cubemap} panorama + * @returns {Promise.} + */ + ; + _proto.loadTexture = function loadTexture(panorama) { var _this2 = this; @@ -211,15 +227,14 @@ var texture = textureData.texture; for (var i = 0; i < 6; i++) { - if (mesh.material[i].map) { - mesh.material[i].map.dispose(); - } + var _mesh$material$i$map; if (this.config.flipTopBottom && (i === 2 || i === 3)) { texture[i].center = new THREE.Vector2(0.5, 0.5); texture[i].rotation = Math.PI; } + (_mesh$material$i$map = mesh.material[i].map) == null ? void 0 : _mesh$material$i$map.dispose(); mesh.material[i].map = texture[i]; } } @@ -233,13 +248,24 @@ mesh.material[i].opacity = opacity; mesh.material[i].transparent = opacity < 1; } + } + /** + * @override + */ + ; + + _proto.disposeTexture = function disposeTexture(textureData) { + var _textureData$texture; + + (_textureData$texture = textureData.texture) == null ? void 0 : _textureData$texture.forEach(function (texture) { + return texture.dispose(); + }); }; return CubemapAdapter; }(photoSphereViewer.AbstractAdapter); CubemapAdapter.id = 'cubemap'; - CubemapAdapter.supportsTransition = true; - CubemapAdapter.supportsPreload = true; + CubemapAdapter.supportsDownload = false; exports.CUBE_ARRAY = CUBE_ARRAY; exports.CUBE_HASHMAP = CUBE_HASHMAP; diff --git a/dist/adapters/cubemap.js.map b/dist/adapters/cubemap.js.map index 243f5e39c..94b5e6169 100644 --- a/dist/adapters/cubemap.js.map +++ b/dist/adapters/cubemap.js.map @@ -1 +1 @@ -{"version":3,"file":"cubemap.js","sources":["../../src/adapters/cubemap/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError, SYSTEM, utils } from '../..';\n\n\n/**\n * @typedef {Object} PSV.adapters.CubemapAdapter.Cubemap\n * @summary Object defining a cubemap\n * @property {string} left\n * @property {string} front\n * @property {string} right\n * @property {string} back\n * @property {string} top\n * @property {string} bottom\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapAdapter.Options\n * @property {boolean} [flipTopBottom=false] - set to true if the top and bottom faces are not correctly oriented\n */\n\n\n// PSV faces order is left, front, right, back, top, bottom\n// 3JS faces order is left, right, top, bottom, back, front\nexport const CUBE_ARRAY = [0, 2, 4, 5, 3, 1];\nexport const CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front'];\n\n\n/**\n * @summary Adapter for cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapAdapter extends AbstractAdapter {\n\n static id = 'cubemap';\n static supportsTransition = true;\n static supportsPreload = true;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.CubemapAdapter.Options}\n * @private\n */\n this.config = {\n flipTopBottom: false,\n ...options,\n };\n }\n\n /**\n * @override\n * @param {string[] | PSV.adapters.CubemapAdapter.Cubemap} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n const cleanPanorama = [];\n\n if (Array.isArray(panorama)) {\n if (panorama.length !== 6) {\n return Promise.reject(new PSVError('Must provide exactly 6 image paths when using cubemap.'));\n }\n\n // reorder images\n for (let i = 0; i < 6; i++) {\n cleanPanorama[i] = panorama[CUBE_ARRAY[i]];\n }\n }\n else if (typeof panorama === 'object') {\n if (!CUBE_HASHMAP.every(side => !!panorama[side])) {\n return Promise.reject(new PSVError('Must provide exactly left, front, right, back, top, bottom when using cubemap.'));\n }\n\n // transform into array\n CUBE_HASHMAP.forEach((side, i) => {\n cleanPanorama[i] = panorama[side];\n });\n }\n else {\n return Promise.reject(new PSVError('Invalid cubemap panorama, are you using the right adapter?'));\n }\n\n if (this.psv.config.fisheye) {\n utils.logWarn('fisheye effect with cubemap texture can generate distorsion');\n }\n\n const promises = [];\n const progress = [0, 0, 0, 0, 0, 0];\n\n for (let i = 0; i < 6; i++) {\n promises.push(\n this.psv.textureLoader.loadImage(cleanPanorama[i], (p) => {\n progress[i] = p;\n this.psv.loader.setProgress(utils.sum(progress) / 6);\n })\n .then(img => this.__createCubemapTexture(img))\n );\n }\n\n return Promise.all(promises)\n .then(texture => ({ panorama, texture }));\n }\n\n /**\n * @summary Creates the final texture from image\n * @param {HTMLImageElement} img\n * @returns {external:THREE.Texture}\n * @private\n */\n __createCubemapTexture(img) {\n if (img.width !== img.height) {\n utils.logWarn('Invalid base image, the width equal the height');\n }\n\n // resize image\n if (img.width > SYSTEM.maxTextureWidth) {\n const ratio = SYSTEM.getMaxCanvasWidth() / img.width;\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = img.height * ratio;\n\n const ctx = buffer.getContext('2d');\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 * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize)\n .scale(1, 1, -1);\n\n const materials = [];\n for (let i = 0; i < 6; i++) {\n materials.push(new THREE.MeshBasicMaterial());\n }\n\n return new THREE.Mesh(geometry, materials);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n const { texture } = textureData;\n\n for (let i = 0; i < 6; i++) {\n if (mesh.material[i].map) {\n mesh.material[i].map.dispose();\n }\n\n if (this.config.flipTopBottom && (i === 2 || i === 3)) {\n texture[i].center = new THREE.Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n mesh.material[i].map = texture[i];\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i].opacity = opacity;\n mesh.material[i].transparent = opacity < 1;\n }\n }\n\n}\n"],"names":["CUBE_ARRAY","CUBE_HASHMAP","CubemapAdapter","psv","options","config","flipTopBottom","loadTexture","panorama","cleanPanorama","Array","isArray","length","Promise","reject","PSVError","i","every","side","forEach","fisheye","utils","logWarn","promises","progress","push","textureLoader","loadImage","p","loader","setProgress","sum","then","img","__createCubemapTexture","all","texture","width","height","SYSTEM","maxTextureWidth","ratio","getMaxCanvasWidth","buffer","document","createElement","ctx","getContext","drawImage","createTexture","createMesh","scale","cubeSize","CONSTANTS","SPHERE_RADIUS","geometry","THREE","BoxGeometry","materials","MeshBasicMaterial","Mesh","setTexture","mesh","textureData","material","map","dispose","center","Vector2","rotation","Math","PI","setTextureOpacity","opacity","transparent","AbstractAdapter","id","supportsTransition","supportsPreload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EAGA;EACA;;MACaA,UAAU,GA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A+IE,2BAAkBV,IAAlB,EAAwBW,OAAxB,EAAiC;EAC/B,SAAK,IAAIzD,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,CAApB,EAAuBA,CAAC,EAAxB,EAA4B;EAC1B8C,MAAAA,IAAI,CAACE,QAAL,CAAchD,CAAd,EAAiByD,OAAjB,GAA2BA,OAA3B;EACAX,MAAAA,IAAI,CAACE,QAAL,CAAchD,CAAd,EAAiB0D,WAAjB,GAA+BD,OAAO,GAAG,CAAzC;EACD;EACF,GApJH;;EAAA;EAAA,EAAoCE,iCAApC;EAAazE,eAEJ0E,KAAK;EAFD1E,eAGJ2E,qBAAqB;EAHjB3E,eAIJ4E,kBAAkB;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"cubemap.js","sources":["../../src/adapters/cubemap/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError, SYSTEM, utils } from '../..';\n\n\n/**\n * @typedef {Object} PSV.adapters.CubemapAdapter.Cubemap\n * @summary Object defining a cubemap\n * @property {string} left\n * @property {string} front\n * @property {string} right\n * @property {string} back\n * @property {string} top\n * @property {string} bottom\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapAdapter.Options\n * @property {boolean} [flipTopBottom=false] - set to true if the top and bottom faces are not correctly oriented\n */\n\n\n// PSV faces order is left, front, right, back, top, bottom\n// 3JS faces order is left, right, top, bottom, back, front\nexport const CUBE_ARRAY = [0, 2, 4, 5, 3, 1];\nexport const CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front'];\n\n\n/**\n * @summary Adapter for cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapAdapter extends AbstractAdapter {\n\n static id = 'cubemap';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.CubemapAdapter.Options}\n * @private\n */\n this.config = {\n flipTopBottom: false,\n ...options,\n };\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[] | PSV.adapters.CubemapAdapter.Cubemap} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n const cleanPanorama = [];\n\n if (Array.isArray(panorama)) {\n if (panorama.length !== 6) {\n return Promise.reject(new PSVError('Must provide exactly 6 image paths when using cubemap.'));\n }\n\n // reorder images\n for (let i = 0; i < 6; i++) {\n cleanPanorama[i] = panorama[CUBE_ARRAY[i]];\n }\n }\n else if (typeof panorama === 'object') {\n if (!CUBE_HASHMAP.every(side => !!panorama[side])) {\n return Promise.reject(new PSVError('Must provide exactly left, front, right, back, top, bottom when using cubemap.'));\n }\n\n // transform into array\n CUBE_HASHMAP.forEach((side, i) => {\n cleanPanorama[i] = panorama[side];\n });\n }\n else {\n return Promise.reject(new PSVError('Invalid cubemap panorama, are you using the right adapter?'));\n }\n\n if (this.psv.config.fisheye) {\n utils.logWarn('fisheye effect with cubemap texture can generate distorsion');\n }\n\n const promises = [];\n const progress = [0, 0, 0, 0, 0, 0];\n\n for (let i = 0; i < 6; i++) {\n promises.push(\n this.psv.textureLoader.loadImage(cleanPanorama[i], (p) => {\n progress[i] = p;\n this.psv.loader.setProgress(utils.sum(progress) / 6);\n })\n .then(img => this.__createCubemapTexture(img))\n );\n }\n\n return Promise.all(promises)\n .then(texture => ({ panorama, texture }));\n }\n\n /**\n * @summary Creates the final texture from image\n * @param {HTMLImageElement} img\n * @returns {external:THREE.Texture}\n * @private\n */\n __createCubemapTexture(img) {\n if (img.width !== img.height) {\n utils.logWarn('Invalid base image, the width equal the height');\n }\n\n // resize image\n if (img.width > SYSTEM.maxTextureWidth) {\n const ratio = SYSTEM.getMaxCanvasWidth() / img.width;\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = img.height * ratio;\n\n const ctx = buffer.getContext('2d');\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 * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize)\n .scale(1, 1, -1);\n\n const materials = [];\n for (let i = 0; i < 6; i++) {\n materials.push(new THREE.MeshBasicMaterial());\n }\n\n return new THREE.Mesh(geometry, materials);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n const { texture } = textureData;\n\n for (let i = 0; i < 6; i++) {\n if (this.config.flipTopBottom && (i === 2 || i === 3)) {\n texture[i].center = new THREE.Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n mesh.material[i].map?.dispose();\n mesh.material[i].map = texture[i];\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i].opacity = opacity;\n mesh.material[i].transparent = opacity < 1;\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n textureData.texture?.forEach(texture => texture.dispose());\n }\n\n}\n"],"names":["CUBE_ARRAY","CUBE_HASHMAP","CubemapAdapter","psv","options","config","flipTopBottom","supportsTransition","supportsPreload","loadTexture","panorama","cleanPanorama","Array","isArray","length","Promise","reject","PSVError","i","every","side","forEach","fisheye","utils","logWarn","promises","progress","push","textureLoader","loadImage","p","loader","setProgress","sum","then","img","__createCubemapTexture","all","texture","width","height","SYSTEM","maxTextureWidth","ratio","getMaxCanvasWidth","buffer","document","createElement","ctx","getContext","drawImage","createTexture","createMesh","scale","cubeSize","CONSTANTS","SPHERE_RADIUS","geometry","THREE","BoxGeometry","materials","MeshBasicMaterial","Mesh","setTexture","mesh","textureData","center","Vector2","rotation","Math","PI","material","map","dispose","setTextureOpacity","opacity","transparent","disposeTexture","AbstractAdapter","id","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;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N,IAAI,CAACO,QAAL,CAAcrD,CAAd,EAAiBsD,GAAjB,0CAAsBC,OAAtB;EACAT,MAAAA,IAAI,CAACO,QAAL,CAAcrD,CAAd,EAAiBsD,GAAjB,GAAuBlC,OAAO,CAACpB,CAAD,CAA9B;EACD;EACF;EAED;EACF;EACA;EAxJA;;EAAA,SAyJEwD,iBAzJF,GAyJE,2BAAkBV,IAAlB,EAAwBW,OAAxB,EAAiC;EAC/B,SAAK,IAAIzD,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,CAApB,EAAuBA,CAAC,EAAxB,EAA4B;EAC1B8C,MAAAA,IAAI,CAACO,QAAL,CAAcrD,CAAd,EAAiByD,OAAjB,GAA2BA,OAA3B;EACAX,MAAAA,IAAI,CAACO,QAAL,CAAcrD,CAAd,EAAiB0D,WAAjB,GAA+BD,OAAO,GAAG,CAAzC;EACD;EACF;EAED;EACF;EACA;EAlKA;;EAAA,SAmKEE,cAnKF,GAmKE,wBAAeZ,WAAf,EAA4B;EAAA;;EAC1B,4BAAAA,WAAW,CAAC3B,OAAZ,0CAAqBjB,OAArB,CAA6B,UAAAiB,OAAO;EAAA,aAAIA,OAAO,CAACmC,OAAR,EAAJ;EAAA,KAApC;EACD,GArKH;;EAAA;EAAA,EAAoCK,iCAApC;EAAa5E,eAEJ6E,KAAK;EAFD7E,eAGJ8E,mBAAmB;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/equirectangular-tiles.js b/dist/adapters/equirectangular-tiles.js index 6a040968e..ec53164c1 100644 --- a/dist/adapters/equirectangular-tiles.js +++ b/dist/adapters/equirectangular-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -268,7 +268,7 @@ * @private * @property {int} col * @property {int} row - * @property {int} angle + * @property {float} angle */ /* the faces of the top and bottom rows are made of a single triangle (3 vertices) @@ -303,6 +303,10 @@ * ⋁ */ + var ATTR_UV = 'uv'; + var ATTR_ORIGINAL_UV = 'originaluv'; + var ATTR_POSITION = 'position'; + function tileId(tile) { return tile.col + "x" + tile.row; } @@ -315,8 +319,8 @@ * @memberof PSV.adapters */ - var EquirectangularTilesAdapter = /*#__PURE__*/function (_AbstractAdapter) { - _inheritsLoose(EquirectangularTilesAdapter, _AbstractAdapter); + var EquirectangularTilesAdapter = /*#__PURE__*/function (_EquirectangularAdapt) { + _inheritsLoose(EquirectangularTilesAdapter, _EquirectangularAdapt); /** * @param {PSV.Viewer} psv @@ -325,7 +329,8 @@ function EquirectangularTilesAdapter(psv, options) { var _this; - _this = _AbstractAdapter.call(this, psv) || this; + _this = _EquirectangularAdapt.call(this, psv) || this; + _this.psv.config.useXmpData = false; /** * @member {PSV.adapters.EquirectangularTilesAdapter.Options} * @private @@ -347,12 +352,6 @@ _this.NB_VERTICES_BY_SMALL_FACE = 3; _this.NB_VERTICES = 2 * _this.SPHERE_SEGMENTS * _this.NB_VERTICES_BY_SMALL_FACE + (_this.SPHERE_HORIZONTAL_SEGMENTS - 2) * _this.SPHERE_SEGMENTS * _this.NB_VERTICES_BY_FACE; _this.NB_GROUPS = _this.SPHERE_SEGMENTS * _this.SPHERE_HORIZONTAL_SEGMENTS; - /** - * @member {external:THREE.MeshBasicMaterial[]} - * @private - */ - - _this.materials = []; /** * @member {PSV.adapters.Queue} * @private @@ -367,7 +366,7 @@ * @property {int} facesByRow - number of mesh faces by row * @property {Record} tiles - loaded tiles * @property {external:THREE.SphereGeometry} geom - * @property {*} originalUvs + * @property {external:THREE.MeshBasicMaterial[]} materials * @property {external:THREE.MeshBasicMaterial} errorMaterial * @private */ @@ -379,7 +378,7 @@ facesByRow: 0, tiles: {}, geom: null, - originalUvs: null, + materials: [], errorMaterial: null }; /** @@ -403,6 +402,10 @@ return _this; } + /** + * @override + */ + var _proto = EquirectangularTilesAdapter.prototype; @@ -419,11 +422,14 @@ delete this.queue; delete this.loader; delete this.prop.geom; - delete this.prop.originalUvs; delete this.prop.errorMaterial; - _AbstractAdapter.prototype.destroy.call(this); - }; + _EquirectangularAdapt.prototype.destroy.call(this); + } + /** + * @private + */ + ; _proto.handleEvent = function handleEvent(e) { /* eslint-disable */ @@ -446,13 +452,29 @@ _proto.__cleanup = function __cleanup() { this.queue.clear(); this.prop.tiles = {}; - this.materials.forEach(function (mat) { + this.prop.materials.forEach(function (mat) { var _mat$map; mat == null ? void 0 : (_mat$map = mat.map) == null ? void 0 : _mat$map.dispose(); mat == null ? void 0 : mat.dispose(); }); - this.materials.length = 0; + this.prop.materials.length = 0; + } + /** + * @override + */ + ; + + _proto.supportsTransition = function supportsTransition(panorama) { + return !!panorama.baseUrl; + } + /** + * @override + */ + ; + + _proto.supportsPreload = function supportsPreload(panorama) { + return !!panorama.baseUrl; } /** * @override @@ -462,8 +484,6 @@ ; _proto.loadTexture = function loadTexture(panorama) { - var _this2 = this; - if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) { return Promise.reject(new photoSphereViewer.PSVError('Invalid panorama configuration, are you using the right adapter?')); } @@ -480,15 +500,6 @@ return Promise.reject(new photoSphereViewer.PSVError('Panorama cols and rows must be powers of 2.')); } - this.prop.colSize = panorama.width / panorama.cols; - this.prop.rowSize = panorama.width / 2 / panorama.rows; - this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols; - this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows; - - if (this.prop.geom) { - this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone()); - } - var panoData = { fullWidth: panorama.width, fullHeight: panorama.width / 2, @@ -499,14 +510,10 @@ }; if (panorama.baseUrl) { - return this.psv.textureLoader.loadImage(panorama.baseUrl, function (p) { - return _this2.psv.loader.setProgress(p); - }).then(function (img) { - var texture = _this2.__createBaseTexture(img); - + return _EquirectangularAdapt.prototype.loadTexture.call(this, panorama.baseUrl).then(function (textureData) { return { panorama: panorama, - texture: texture, + texture: textureData.texture, panoData: panoData }; }); @@ -546,9 +553,8 @@ geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++); } - this.prop.geom = geometry; - this.prop.originalUvs = geometry.getAttribute('uv').clone(); - return new THREE.Mesh(geometry, this.materials); + geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone()); + return new THREE.Mesh(geometry, []); } /** * @summary Applies the base texture and starts the loading of tiles @@ -556,16 +562,45 @@ */ ; - _proto.setTexture = function setTexture(mesh, textureData) { - var _this3 = this; + _proto.setTexture = function setTexture(mesh, textureData, transition) { + var _this2 = this; + + var panorama = textureData.panorama, + texture = textureData.texture; + + if (transition) { + this.__setTexture(mesh, texture); + + return; + } this.__cleanup(); + this.__setTexture(mesh, texture); + + this.prop.materials = mesh.material; + this.prop.geom = mesh.geometry; + this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone()); + this.prop.colSize = panorama.width / panorama.cols; + this.prop.rowSize = panorama.width / 2 / panorama.rows; + this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols; + this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows; // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); + + setTimeout(function () { + return _this2.__refresh(true); + }); + } + /** + * @private + */ + ; + + _proto.__setTexture = function __setTexture(mesh, texture) { var material; - if (textureData.texture) { + if (texture) { material = new THREE.MeshBasicMaterial({ - map: textureData.texture + map: texture }); } else { material = new THREE.MeshBasicMaterial({ @@ -575,13 +610,17 @@ } for (var i = 0; i < this.NB_GROUPS; i++) { - this.materials.push(material); - } // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); - + mesh.material.push(material); + } + } + /** + * @override + */ + ; - setTimeout(function () { - return _this3.__refresh(true); - }); + _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { + mesh.material[0].opacity = opacity; + mesh.material[0].transparent = opacity < 1; } /** * @summary Compute visible tiles and load them @@ -591,7 +630,7 @@ ; _proto.__refresh = function __refresh(init) { - var _this4 = this; + var _this3 = this; // eslint-disable-line no-unused-vars var panorama = this.psv.config.panorama; @@ -604,7 +643,7 @@ camera.updateMatrixWorld(); projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); - var verticesPosition = this.prop.geom.getAttribute('position'); + var verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); var tilesToLoad = []; for (var col = 0; col < panorama.cols; col++) { @@ -715,7 +754,7 @@ var vertexVisible = verticesIndex.some(function (vertexIdx) { vertexPosition.set(verticesPosition.getX(vertexIdx), verticesPosition.getY(vertexIdx), verticesPosition.getZ(vertexIdx)); - vertexPosition.applyEuler(_this4.psv.renderer.meshContainer.rotation); + vertexPosition.applyEuler(_this3.psv.renderer.meshContainer.rotation); return frustum.containsPoint(vertexPosition); }); @@ -745,19 +784,19 @@ ; _proto.__loadTiles = function __loadTiles(tiles) { - var _this5 = this; + var _this4 = this; this.queue.disableAllTasks(); tiles.forEach(function (tile) { var id = tileId(tile); - if (_this5.prop.tiles[id]) { - _this5.queue.setPriority(id, tile.angle); + if (_this4.prop.tiles[id]) { + _this4.queue.setPriority(id, tile.angle); } else { - _this5.prop.tiles[id] = true; + _this4.prop.tiles[id] = true; - _this5.queue.enqueue(new Task(id, tile.angle, function (task) { - return _this5.__loadTile(tile, task); + _this4.queue.enqueue(new Task(id, tile.angle, function (task) { + return _this4.__loadTile(tile, task); })); } }); @@ -773,7 +812,7 @@ ; _proto.__loadTile = function __loadTile(tile, task) { - var _this6 = this; + var _this5 = this; var panorama = this.psv.config.panorama; var url = panorama.tileUrl(tile.col, tile.row); @@ -783,26 +822,26 @@ } return new Promise(function (resolve, reject) { - _this6.loader.load(url, resolve, undefined, reject); + _this5.loader.load(url, resolve, undefined, reject); }).then(function (image) { if (!task.isCancelled()) { var material = new THREE.MeshBasicMaterial({ map: photoSphereViewer.utils.createTexture(image) }); - _this6.__swapMaterial(tile.col, tile.row, material); + _this5.__swapMaterial(tile.col, tile.row, material); - _this6.psv.needsUpdate(); + _this5.psv.needsUpdate(); } }).catch(function () { - if (!task.isCancelled() && _this6.config.showErrorTile) { - if (!_this6.prop.errorMaterial) { - _this6.prop.errorMaterial = buildErrorMaterial(_this6.prop.colSize, _this6.prop.rowSize); + if (!task.isCancelled() && _this5.config.showErrorTile) { + if (!_this5.prop.errorMaterial) { + _this5.prop.errorMaterial = buildErrorMaterial(_this5.prop.colSize, _this5.prop.rowSize); } - _this6.__swapMaterial(tile.col, tile.row, _this6.prop.errorMaterial); + _this5.__swapMaterial(tile.col, tile.row, _this5.prop.errorMaterial); - _this6.psv.needsUpdate(); + _this5.psv.needsUpdate(); } }); } @@ -816,39 +855,39 @@ ; _proto.__swapMaterial = function __swapMaterial(col, row, material) { - var _this7 = this; + var _this6 = this; - var uvs = this.prop.geom.getAttribute('uv'); + var uvs = this.prop.geom.getAttribute(ATTR_UV); for (var c = 0; c < this.prop.facesByCol; c++) { var _loop = function _loop(r) { // position of the face (two triangles of the same square) - var faceCol = col * _this7.prop.facesByCol + c; - var faceRow = row * _this7.prop.facesByRow + r; + var faceCol = col * _this6.prop.facesByCol + c; + var faceRow = row * _this6.prop.facesByRow + r; var isFirstRow = faceRow === 0; - var isLastRow = faceRow === _this7.SPHERE_HORIZONTAL_SEGMENTS - 1; // first vertex for this face (3 or 6 vertices in total) + var isLastRow = faceRow === _this6.SPHERE_HORIZONTAL_SEGMENTS - 1; // first vertex for this face (3 or 6 vertices in total) var firstVertex = void 0; if (isFirstRow) { - firstVertex = faceCol * _this7.NB_VERTICES_BY_SMALL_FACE; + firstVertex = faceCol * _this6.NB_VERTICES_BY_SMALL_FACE; } else if (isLastRow) { - firstVertex = _this7.NB_VERTICES - _this7.SPHERE_SEGMENTS * _this7.NB_VERTICES_BY_SMALL_FACE + faceCol * _this7.NB_VERTICES_BY_SMALL_FACE; + firstVertex = _this6.NB_VERTICES - _this6.SPHERE_SEGMENTS * _this6.NB_VERTICES_BY_SMALL_FACE + faceCol * _this6.NB_VERTICES_BY_SMALL_FACE; } else { - firstVertex = _this7.SPHERE_SEGMENTS * _this7.NB_VERTICES_BY_SMALL_FACE + (faceRow - 1) * _this7.SPHERE_SEGMENTS * _this7.NB_VERTICES_BY_FACE + faceCol * _this7.NB_VERTICES_BY_FACE; + firstVertex = _this6.SPHERE_SEGMENTS * _this6.NB_VERTICES_BY_SMALL_FACE + (faceRow - 1) * _this6.SPHERE_SEGMENTS * _this6.NB_VERTICES_BY_FACE + faceCol * _this6.NB_VERTICES_BY_FACE; } // swap material - var matIndex = _this7.prop.geom.groups.find(function (g) { + var matIndex = _this6.prop.geom.groups.find(function (g) { return g.start === firstVertex; }).materialIndex; - _this7.materials[matIndex] = material; // define new uvs + _this6.prop.materials[matIndex] = material; // define new uvs - var top = 1 - r / _this7.prop.facesByRow; - var bottom = 1 - (r + 1) / _this7.prop.facesByRow; - var left = c / _this7.prop.facesByCol; - var right = (c + 1) / _this7.prop.facesByCol; + var top = 1 - r / _this6.prop.facesByRow; + var bottom = 1 - (r + 1) / _this6.prop.facesByRow; + var left = c / _this6.prop.facesByCol; + var right = (c + 1) / _this6.prop.facesByCol; if (isFirstRow) { uvs.setXY(firstVertex, (left + right) / 2, top); @@ -894,10 +933,9 @@ }; return EquirectangularTilesAdapter; - }(photoSphereViewer.AbstractAdapter); + }(photoSphereViewer.EquirectangularAdapter); EquirectangularTilesAdapter.id = 'equirectangular-tiles'; - EquirectangularTilesAdapter.supportsTransition = false; - EquirectangularTilesAdapter.supportsPreload = false; + EquirectangularTilesAdapter.supportsDownload = false; exports.EquirectangularTilesAdapter = EquirectangularTilesAdapter; diff --git a/dist/adapters/equirectangular-tiles.js.map b/dist/adapters/equirectangular-tiles.js.map index 3e2a5f85b..998ad47cb 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/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/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 { AbstractAdapter, CONSTANTS, PSVError, utils } from '../..';\nimport { Queue } from '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/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 {int} 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\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 */\nexport class EquirectangularTilesAdapter extends AbstractAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsTransition = false;\n static supportsPreload = 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 /**\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 {external:THREE.MeshBasicMaterial[]}\n * @private\n */\n this.materials = [];\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 {*} originalUvs\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 originalUvs : null,\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 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.originalUvs;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\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.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.materials.length = 0;\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 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 if (this.prop.geom) {\n this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone());\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 };\n\n if (panorama.baseUrl) {\n return this.psv.textureLoader.loadImage(panorama.baseUrl, p => this.psv.loader.setProgress(p))\n .then((img) => {\n const texture = this.__createBaseTexture(img);\n return { panorama, texture, 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(CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2)\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 this.prop.geom = geometry;\n this.prop.originalUvs = geometry.getAttribute('uv').clone();\n\n return new THREE.Mesh(geometry, this.materials);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData) {\n this.__cleanup();\n\n let material;\n if (textureData.texture) {\n material = new THREE.MeshBasicMaterial({ map: textureData.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 this.materials.push(material);\n }\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\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 const panorama = this.psv.config.panorama;\n\n if (!panorama) {\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 verticesPosition = this.prop.geom.getAttribute('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('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.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","tileId","tile","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","EquirectangularTilesAdapter","psv","options","config","resolution","showErrorTile","baseBlur","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","materials","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","originalUvs","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","loadTexture","panorama","cols","rows","tileUrl","Promise","reject","setAttribute","clone","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","baseUrl","textureLoader","loadImage","p","setProgress","__createBaseTexture","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","getAttribute","Mesh","setTexture","mesh","textureData","material","opacity","transparent","push","setTimeout","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","logWarn","w","AbstractAdapter","supportsTransition","supportsPreload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAWE;E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G,CAAb,EAAgBA,CAAC,GAAG,KAAKtH,IAAL,CAAUI,UAA9B,EAA0CkH,CAAC,EAA3C,EAA+C;EAAA,cAAtCA,CAAsC;EAmD9C;EACF;;EAEDF,IAAAA,GAAG,CAACF,WAAJ,GAAkB,IAAlB;EACD;EAED;EACF;EACA;EACA;EACA;EACA;EAhiBA;;EAAA,SAiiBEhE,mBAjiBF,GAiiBE,6BAAoB1F,GAApB,EAAyB;EACvB,QAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAJ,GAAa,CAA/B,EAAkC;EAChC6B,MAAAA,uBAAK,CAACmK,OAAN,CAAc,0DAAd;EACD;;EAED,WAAO/K,iBAAiB,CAACC,GAAD,EAAM,KAAK0B,MAAL,CAAYG,QAAlB,EAA4B,UAAAkJ,CAAC;EAAA,aAAIA,CAAC,GAAG,CAAR;EAAA,KAA7B,CAAxB;EACD,GAviBH;;EAAA;EAAA,EAAiDC,iCAAjD;EAAazJ,4BAEJ/E,KAAK;EAFD+E,4BAGJ0J,qBAAqB;EAHjB1J,4BAIJ2J,kBAAkB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/tiles-shared/Task.js","../../src/adapters/tiles-shared/Queue.js","../../src/adapters/tiles-shared/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 '../tiles-shared/Queue';\nimport { Task } from '../tiles-shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../tiles-shared/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 */\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 };\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(CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2)\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 const panorama = this.psv.config.panorama;\n\n if (!panorama) {\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 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","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,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,KAAK6B,MAAL,CAAYI,QAAlB,EAA4B,UAAAkJ,CAAC;EAAA,aAAIA,CAAC,GAAG,CAAR;EAAA,KAA7B,CAAxB;EACD,GA1kBH;;EAAA;EAAA,EAAiDC,wCAAjD;EAAa1J,4BAEJlF,KAAK;EAFDkF,4BAGJ2J,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index 8461564b9..51db54161 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.1 + * Photo Sphere Viewer 4.5.2 * @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 06ba183aa..ed4fa794d 100644 --- a/dist/photo-sphere-viewer.d.ts +++ b/dist/photo-sphere-viewer.d.ts @@ -268,9 +268,10 @@ type PanoDataProvider = (image: HTMLImageElement) => PanoData; * Object defining panorama and animation options */ type PanoramaOptions = (ExtendedPosition | {}) & { - zoom?: number; + caption?: string; transition?: boolean | number; showLoader?: boolean; + zoom?: number; sphereCorrection?: SphereCorrection; panoData?: PanoData | PanoDataProvider; }; @@ -555,14 +556,9 @@ declare abstract class AbstractAdapter { static id: string; /** - * @summary Indicates if the adapter supports transitions between panoramas - */ - static supportsTransition: boolean; - - /** - * @summary Indicates if the adapter supports preload + * @summary Indicates if the adapter supports panorama download natively */ - static supportsPreload: boolean; + static supportsDownload: boolean; constructor(parent: Viewer); @@ -571,6 +567,16 @@ declare abstract class AbstractAdapter { */ destroy(); + /** + * @summary Indicates if the adapter supports transitions between panoramas + */ + supportsTransition(panorama: T): boolean; + + /** + * @summary Indicates if the adapter supports preload of a panorama + */ + supportsPreload(panorama: T): boolean; + /** * @summary Loads the panorama texture(s) */ @@ -585,50 +591,63 @@ declare abstract class AbstractAdapter { /** * @summary Applies the texture to the mesh */ - setTexture(mesh: Mesh, textureData: TextureData); + setTexture(mesh: Mesh, textureData: TextureData, transition?: boolean); /** * @summary Changes the opacity of the mesh */ setTextureOpacity(mesh: Mesh, opacity: number); + /** + * @abstract + */ + disposeTexture(textureData: TextureData); + } type AdapterConstructor> = new (psv: Viewer, options?: any) => T; -type AnimationOptions = { - properties: { [K: string]: { start: number, end: number } }; +type AnimationOptions = { + properties: { [key in keyof T]: { start: number, end: number } }; duration: number; delay?: number; easing?: string | ((progress: number) => number); - onTick: (properties: { [K: string]: number }, progress: number) => void; + onTick: (properties: { [key in keyof T]: number }, progress: number) => void; }; /** * @summary Interpolation helper for animations * @description - * Implements the Promise API with an additional "cancel" and "finally" methods. + * Implements the Promise API with an additional "cancel" method. * The promise is resolved when the animation is complete and rejected if the animation is cancelled. */ -declare class Animation implements Promise { +declare class Animation implements PromiseLike { - constructor(options: AnimationOptions); + constructor(options: AnimationOptions); - // @ts-ignore - then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + then(onFulfilled?: ((completed: boolean) => TResult | PromiseLike) | undefined | null): PromiseLike; - // @ts-ignore - catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + cancel(); - // @ts-ignore - finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + /** + * @deprecated does not accept a rejection handler anymore + */ + then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; - cancel(); + /** + * @deprecated not supported anymore + */ + catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + /** + * @deprecated not supported anymore + */ + finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; /** - * @summary Returns a resolved animation promise + * @deprecated not supported anymore */ - static resolve(): Animation; + static resolve(): Animation; } @@ -1006,6 +1025,7 @@ type ViewerOptions = { panorama?: any; adapter?: AdapterConstructor | [AdapterConstructor, any]; caption?: string; + downloadUrl?: string; loadingImg?: string; loadingTxt?: string; size?: Size; @@ -1051,7 +1071,7 @@ type ViewerProps = { hFov: number; aspect: number; autorotateEnabled: boolean; - animationPromise: Animation; + animationPromise: Animation; loadingPromise: Promise; startTimeout: any; size: Size; @@ -1208,7 +1228,7 @@ declare class Viewer extends EventEmitter { /** * @summary Rotates and zooms the view with a smooth animation */ - animate(options: AnimateOptions): Animation; + animate(options: AnimateOptions): Animation; /** * @summary Stops the ongoing animation diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index 3c6438d8c..a94c382f2 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -14,12 +14,20 @@ * @namespace PSV.constants */ + /** + * @summary Default duration of the transition between panoramas + * @memberOf PSV.constants + * @type {number} + * @constant + */ + var DEFAULT_TRANSITION = 1500; /** * @summary Number of pixels bellow which a mouse move will be considered as a click * @memberOf PSV.constants * @type {number} * @constant */ + var MOVE_THRESHOLD = 4; /** * @summary Delay in milliseconds between two clicks to consider a double click @@ -77,6 +85,14 @@ */ var VIEWER_DATA = 'photoSphereViewer'; + /** + * @summary Property added the the main Mesh object + * @memberOf PSV.constants + * @type {string} + * @constant + */ + + var MESH_USER_DATA = 'psvSphere'; /** * @summary Available actions * @memberOf PSV.constants @@ -439,6 +455,7 @@ var constants = /*#__PURE__*/Object.freeze({ __proto__: null, + DEFAULT_TRANSITION: DEFAULT_TRANSITION, MOVE_THRESHOLD: MOVE_THRESHOLD, DBLCLICK_DELAY: DBLCLICK_DELAY, LONGTOUCH_DELAY: LONGTOUCH_DELAY, @@ -447,6 +464,7 @@ INERTIA_WINDOW: INERTIA_WINDOW, SPHERE_RADIUS: SPHERE_RADIUS, VIEWER_DATA: VIEWER_DATA, + MESH_USER_DATA: MESH_USER_DATA, ACTIONS: ACTIONS, EVENTS: EVENTS, CHANGE_EVENTS: CHANGE_EVENTS, @@ -1521,16 +1539,20 @@ * @summary Interpolation helper for animations * @memberOf PSV * @description - * Implements the Promise API with an additional "cancel" and "finally" methods. - * The promise is resolved when the animation is complete and rejected if the animation is cancelled. + * Implements the Promise API with an additional "cancel" method. + * The promise is resolved with `true` when the animation is completed and `false` if the animation is cancelled. * @example - * new Animation({ + * const anim = new Animation({ * properties: { * width: {start: 100, end: 200} * }, * duration: 5000, * onTick: (properties) => element.style.width = `${properties.width}px`; - * }) + * }); + * + * anim.then((completed) => ...); + * + * anim.cancel() */ var Animation = /*#__PURE__*/function () { @@ -1547,12 +1569,7 @@ function Animation(options) { var _this = this; - this.__cancelled = false; - this.__resolved = false; - this.__promise = new Promise(function (resolve, reject) { - _this.__resolve = resolve; - _this.__reject = reject; - }); + this.__callbacks = []; if (options) { if (!options.easing || typeof options.easing === 'string') { @@ -1565,15 +1582,17 @@ if (options.delay) { this.__delayTimeout = setTimeout(function () { _this.__delayTimeout = null; - window.requestAnimationFrame(function (t) { + _this.__animationFrame = window.requestAnimationFrame(function (t) { return _this.__run(t); }); }, options.delay); } else { - window.requestAnimationFrame(function (t) { + this.__animationFrame = window.requestAnimationFrame(function (t) { return _this.__run(t); }); } + } else { + this.__resolved = true; } } /** @@ -1588,12 +1607,7 @@ _proto.__run = function __run(timestamp) { var _this2 = this; - // the animation has been cancelled - if (this.__cancelled) { - return; - } // first iteration - - + // first iteration if (this.__start === null) { this.__start = timestamp; } // compute progress @@ -1610,7 +1624,7 @@ } }); this.options.onTick(current, progress); - window.requestAnimationFrame(function (t) { + this.__animationFrame = window.requestAnimationFrame(function (t) { return _this2.__run(t); }); } else { @@ -1621,18 +1635,30 @@ } }); this.options.onTick(current, 1.0); - window.requestAnimationFrame(function () { + this.__animationFrame = window.requestAnimationFrame(function () { _this2.__resolved = true; - _this2.__resolve(); + _this2.__resolve(true); }); } } /** - * @summary Animation chaining - * @param {Function} [onFulfilled] - Called when the animation is complete, can return a new animation - * @param {Function} [onRejected] - Called when the animation is cancelled - * @returns {PSV.Animation} + * @private + */ + ; + + _proto.__resolve = function __resolve(value) { + this.__callbacks.forEach(function (cb) { + return cb(value); + }); + + this.__callbacks.length = 0; + } + /** + * @summary Promise chaining + * @param {Function} [onFulfilled] - Called when the animation is complete (true) or cancelled (false) + * @param {Function} [onRejected] - deprecated + * @returns {PSV.Promise} */ ; @@ -1647,39 +1673,17 @@ onRejected = null; } - var p = new Animation(); // Allow cancellation to climb up the promise chain - - p.__promise.then(null, function () { - return _this3.cancel(); - }); - - this.__promise.then(function () { - return p.__resolve(onFulfilled ? onFulfilled() : undefined); - }, function () { - return p.__reject(onRejected ? onRejected() : undefined); - }); - - return p; - } - /** - * @summary Alias to `.then(null, onRejected)` - * @param {Function} onRejected - Called when the animation has been cancelled - * @returns {PSV.Animation} - */ - ; + if (onRejected) { + logWarn('Animation#then does not accept a rejection handler anymore'); + } - _proto.catch = function _catch(onRejected) { - return this.then(undefined, onRejected); - } - /** - * @summary Alias to `.then(onFinally, onFinally)` - * @param {Function} onFinally - Called when the animation is either complete or cancelled - * @returns {PSV.Animation} - */ - ; + if (this.__resolved || this.__cancelled) { + return Promise.resolve(this.__resolved).then(onFulfilled); + } - _proto.finally = function _finally(onFinally) { - return this.then(onFinally, onFinally); + return new Promise(function (resolve) { + _this3.__callbacks.push(resolve); + }).then(onFulfilled); } /** * @summary Cancels the animation @@ -1690,30 +1694,44 @@ if (!this.__cancelled && !this.__resolved) { this.__cancelled = true; - this.__reject(); + this.__resolve(false); if (this.__delayTimeout) { - window.cancelAnimationFrame(this.__delayTimeout); + window.clearTimeout(this.__delayTimeout); this.__delayTimeout = null; } + + if (this.__animationFrame) { + window.cancelAnimationFrame(this.__animationFrame); + this.__animationFrame = null; + } } } /** - * @summary Returns a resolved animation promise - * @returns {PSV.Animation} + * @deprecated not supported anymore */ ; - Animation.resolve = function resolve() { - var p = Promise.resolve(); - - p.cancel = function () {}; + _proto.catch = function _catch() { + logWarn('Animation#catch is not supported anymore'); + return this.then(); + } + /** + * @deprecated not supported anymore + */ + ; - p.finally = function (onFinally) { - return p.then(onFinally, onFinally); - }; + _proto.finally = function _finally(onFinally) { + logWarn('Animation#finally is not supported anymore'); + return this.then(onFinally); + } + /** + * @deprecated not supported anymore + */ + ; - return p; + Animation.resolve = function resolve() { + logWarn('Animation.resolve is not supported anymore'); }; return Animation; @@ -2375,18 +2393,26 @@ } /** * @override - * @description Asks the browser to download the panorama source file */ var _proto = DownloadButton.prototype; + _proto.isSupported = function isSupported() { + return this.psv.adapter.constructor.supportsDownload || !!this.psv.config.downloadUrl; + } + /** + * @override + * @description Asks the browser to download the panorama source file + */ + ; + _proto.onClick = function onClick() { var _this = this; var link = document.createElement('a'); - link.href = this.psv.config.panorama; - link.download = this.psv.config.panorama; + link.href = this.psv.config.downloadUrl || this.psv.config.panorama; + link.download = link.href.split('/').pop(); this.psv.container.appendChild(link); link.click(); setTimeout(function () { @@ -3639,14 +3665,7 @@ */ /** - * @summary Indicates if the adapter supports transitions between panoramas - * @member {boolean} - * @readonly - * @static - */ - - /** - * @summary Indicates if the adapter supports preload + * @summary Indicates if the adapter supports panorama download natively * @type {boolean} * @readonly * @static @@ -3673,6 +3692,28 @@ _proto.destroy = function destroy() { delete this.psv; } + /** + * @summary Indicates if the adapter supports transitions between panoramas + * @param {*} panorama + * @return {boolean} + */ + ; + + _proto.supportsTransition = function supportsTransition(panorama) { + // eslint-disable-line no-unused-vars + return false; + } + /** + * @summary Indicates if the adapter supports preload of a panorama + * @param {*} panorama + * @return {boolean} + */ + ; + + _proto.supportsPreload = function supportsPreload(panorama) { + // eslint-disable-line no-unused-vars + return false; + } /** * @abstract * @summary Loads the panorama texture(s) @@ -3704,10 +3745,12 @@ * @summary Applies the texture to the mesh * @param {external:THREE.Mesh} mesh * @param {PSV.TextureData} textureData + * @param {boolean} [transition=false] */ ; - _proto.setTexture = function setTexture(mesh, textureData) { + _proto.setTexture = function setTexture(mesh, textureData, transition) { + // eslint-disable-line no-unused-vars throw new PSVError('setTexture not implemented'); } @@ -3722,13 +3765,23 @@ _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { // eslint-disable-line no-unused-vars throw new PSVError('setTextureOpacity not implemented'); + } + /** + * @abstract + * @summary Clear a loaded texture from memory + * @param {PSV.TextureData} textureData + */ + ; + + _proto.disposeTexture = function disposeTexture(textureData) { + // eslint-disable-line no-unused-vars + throw new PSVError('disposeTexture not implemented'); }; return AbstractAdapter; }(); AbstractAdapter.id = null; - AbstractAdapter.supportsTransition = false; - AbstractAdapter.supportsPreload = false; + AbstractAdapter.supportsDownload = false; /** * @typedef {Object} PSV.adapters.EquirectangularAdapter.Options @@ -3770,14 +3823,30 @@ } /** * @override - * @param {string} panorama - * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] - * @returns {Promise.} */ var _proto = EquirectangularAdapter.prototype; + _proto.supportsTransition = function supportsTransition() { + return true; + } + /** + * @override + */ + ; + + _proto.supportsPreload = function supportsPreload() { + return true; + } + /** + * @override + * @param {string} panorama + * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @returns {Promise.} + */ + ; + _proto.loadTexture = function loadTexture(panorama, newPanoData) { var _this2 = this; @@ -3831,7 +3900,7 @@ 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); } - if (panoData.fullWidth !== panoData.fullHeight * 2) { + if ((newPanoData || xmpPanoData) && panoData.fullWidth !== panoData.fullHeight * 2) { logWarn('Invalid panoData, fullWidth should be twice fullHeight'); } @@ -3957,12 +4026,10 @@ ; _proto.setTexture = function setTexture(mesh, textureData) { - var texture = textureData.texture; - - if (mesh.material.map) { - mesh.material.map.dispose(); - } + var _mesh$material$map; + var texture = textureData.texture; + (_mesh$material$map = mesh.material.map) == null ? void 0 : _mesh$material$map.dispose(); mesh.material.map = texture; } /** @@ -3973,13 +4040,22 @@ _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { mesh.material.opacity = opacity; mesh.material.transparent = opacity < 1; + } + /** + * @override + */ + ; + + _proto.disposeTexture = function disposeTexture(textureData) { + var _textureData$texture; + + (_textureData$texture = textureData.texture) == null ? void 0 : _textureData$texture.dispose(); }; return EquirectangularAdapter; }(AbstractAdapter); EquirectangularAdapter.id = 'equirectangular'; - EquirectangularAdapter.supportsTransition = true; - EquirectangularAdapter.supportsPreload = true; + EquirectangularAdapter.supportsDownload = true; /** * @namespace PSV.plugins @@ -4054,6 +4130,7 @@ adapter: null, plugins: [], caption: null, + downloadUrl: null, loadingImg: null, loadingTxt: 'Loading...', size: null, @@ -4573,18 +4650,12 @@ /** * @summary Sets the bar caption * @param {string} html - * @throws {PSV.PSVError} when the caption element is not present */ ; _proto.setCaption = function setCaption(html) { var caption = this.getButton('caption', false); - - if (!caption) { - throw new PSVError('Cannot set caption, the navbar caption container is not initialized.'); - } - - caption.setCaption(html); + caption == null ? void 0 : caption.setCaption(html); } /** * @summary Returns a button by its identifier @@ -5709,7 +5780,7 @@ _proto.viewerCoordsToVector3 = function viewerCoordsToVector3(viewerPoint) { var sphereIntersect = this.getIntersections(viewerPoint).filter(function (i) { - return i.object.userData.psvSphere; + return i.object.userData[MESH_USER_DATA]; }); if (sphereIntersect) { @@ -6552,7 +6623,8 @@ onTick: function onTick(properties) { _this7.__move(properties, false); } - }).finally(function () { + }); + this.prop.animationPromise.then(function () { _this7.state.moving = false; }); } @@ -6749,6 +6821,8 @@ * @param {PSV.Viewer} psv */ function Renderer(psv) { + var _this$mesh$userData; + var _this; _this = _AbstractService.call(this, psv) || this; @@ -6759,11 +6833,10 @@ */ _this.renderer = new THREE.WebGLRenderer({ - alpha: true + alpha: true, + antialias: true }); - _this.renderer.context.disable(_this.renderer.context.DEPTH_TEST); - _this.renderer.setPixelRatio(SYSTEM.pixelRatio); _this.renderer.domElement.className = 'psv-canvas'; @@ -6788,9 +6861,7 @@ */ _this.mesh = _this.psv.adapter.createMesh(); - _this.mesh.userData = { - psvSphere: true - }; + _this.mesh.userData = (_this$mesh$userData = {}, _this$mesh$userData[MESH_USER_DATA] = true, _this$mesh$userData); /** * @member {external:THREE.Group} * @readonly @@ -7071,10 +7142,11 @@ var _this3 = this; var positionProvided = isExtendedPosition(options); - var zoomProvided = ('zoom' in options); + var zoomProvided = ('zoom' in options); // create temp group and new mesh, half size to be in "front" of the first one + var group = new THREE.Group(); var mesh = this.psv.adapter.createMesh(0.5); - this.psv.adapter.setTexture(mesh, textureData); + this.psv.adapter.setTexture(mesh, textureData, true); this.psv.adapter.setTextureOpacity(mesh, 0); this.setPanoramaPose(textureData.panoData, mesh); this.setSphereCorrection(options.sphereCorrection, group); // rotate the new sphere to make the target position face the camera @@ -7092,8 +7164,7 @@ group.add(mesh); this.scene.add(group); - this.psv.needsUpdate(); - return new Animation({ + var animation = new Animation({ properties: { opacity: { start: 0.0, @@ -7117,25 +7188,32 @@ _this3.psv.needsUpdate(); } - }).then(function () { - // remove temp sphere and transfer the texture to the main sphere - _this3.setTexture(textureData); + }); + animation.then(function (completed) { + if (completed) { + // remove temp sphere and transfer the texture to the main mesh + _this3.setTexture(textureData); - _this3.psv.adapter.setTextureOpacity(_this3.mesh, 1); + _this3.psv.adapter.setTextureOpacity(_this3.mesh, 1); - _this3.setPanoramaPose(textureData.panoData); + _this3.setPanoramaPose(textureData.panoData); - _this3.setSphereCorrection(options.sphereCorrection); + _this3.setSphereCorrection(options.sphereCorrection); // actually rotate the camera + + + if (positionProvided) { + _this3.psv.rotate(options); + } + } else { + _this3.psv.adapter.disposeTexture(textureData); + } _this3.scene.remove(group); mesh.geometry.dispose(); - mesh.geometry = null; // actually rotate the camera - - if (positionProvided) { - _this3.psv.rotate(options); - } + mesh.geometry = null; }); + return animation; } /** * @summary Calls `dispose` on all objects and textures @@ -7321,7 +7399,7 @@ ; _proto.preloadPanorama = function preloadPanorama(panorama) { - if (this.psv.adapter.constructor.supportsPreload) { + if (this.psv.adapter.supportsPreload(panorama)) { return this.psv.adapter.loadTexture(panorama); } else { return Promise.resolve(); @@ -8579,16 +8657,15 @@ ; _proto.setPanorama = function setPanorama(path, options) { - var _this3 = this; + var _this$prop$transition, + _this3 = this; if (options === void 0) { options = {}; } - if (this.prop.loadingPromise !== null) { - this.textureLoader.abortLoading(); - } // apply default parameters on first load - + this.textureLoader.abortLoading(); + (_this$prop$transition = this.prop.transitionAnimation) == null ? void 0 : _this$prop$transition.cancel(); // apply default parameters on first load if (!this.prop.ready) { if (!('sphereCorrection' in options)) { @@ -8601,13 +8678,17 @@ } if (options.transition === undefined || options.transition === true) { - options.transition = 1500; + options.transition = DEFAULT_TRANSITION; } if (options.showLoader === undefined) { options.showLoader = true; } + if (options.caption === undefined) { + options.caption = this.config.caption; + } + var positionProvided = isExtendedPosition(options); var zoomProvided = ('zoom' in options); @@ -8617,27 +8698,31 @@ this.hideError(); this.config.panorama = path; + this.config.caption = options.caption; var done = function done(err) { _this3.loader.hide(); - _this3.renderer.show(); - _this3.prop.loadingPromise = null; if (isAbortError(err)) { - console.warn(err); return false; } else if (err) { + _this3.navbar.setCaption(''); + _this3.showError(_this3.config.lang.loadError); console.error(err); - return Promise.reject(err); + throw err; } else { + _this3.navbar.setCaption(_this3.config.caption); + return true; } }; + this.navbar.setCaption("" + (this.config.loadingTxt || '') + ""); + if (options.showLoader || !this.prop.ready) { this.loader.show(); } @@ -8645,14 +8730,18 @@ var loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData).then(function (textureData) { // check if another panorama was requested if (textureData.panorama !== _this3.config.panorama) { - return Promise.reject(getAbortError()); + _this3.adapter.disposeTexture(textureData); + + throw getAbortError(); } return textureData; }); - if (!options.transition || !this.prop.ready || !this.adapter.constructor.supportsTransition) { + if (!options.transition || !this.prop.ready || !this.adapter.supportsTransition(this.config.panorama)) { this.prop.loadingPromise = loadingPromise.then(function (textureData) { + _this3.renderer.show(); + _this3.renderer.setTexture(textureData); _this3.renderer.setPanoramaPose(textureData.panoData); @@ -8671,7 +8760,14 @@ this.prop.loadingPromise = loadingPromise.then(function (textureData) { _this3.loader.hide(); - return _this3.renderer.transition(textureData, options); + _this3.prop.transitionAnimation = _this3.renderer.transition(textureData, options); + return _this3.prop.transitionAnimation.then(function (completed) { + _this3.prop.transitionAnimation = null; + + if (!completed) { + throw getAbortError(); + } + }); }).then(done, done); } @@ -8926,7 +9022,7 @@ this.zoom(options.zoom); } - return Animation.resolve(); + return new Animation(); } this.prop.animationPromise = new Animation({ @@ -8957,7 +9053,7 @@ if (this.prop.animationPromise) { return new Promise(function (resolve) { - _this6.prop.animationPromise.finally(resolve); + _this6.prop.animationPromise.then(resolve); _this6.prop.animationPromise.cancel(); diff --git a/dist/photo-sphere-viewer.js.map b/dist/photo-sphere-viewer.js.map index 234a6eab9..635afd73f 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/data/constants.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/PSVError.js","../src/utils/psv.js","../src/utils/index.js","../src/Animation.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/data/system.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/adapters/AbstractAdapter.js","../src/adapters/equirectangular/index.js","../src/plugins/AbstractPlugin.js","../src/data/config.js","../src/buttons/CaptionButton.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/utils/Dynamic.js","../src/utils/MultiDynamic.js","../src/Viewer.js"],"sourcesContent":["/**\n * @namespace PSV.constants\n */\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 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 */\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 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 */\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 */\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};\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","/**\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 // manual implementation for IE11 and SVGElement\n if (!element.classList) {\n let currentClassName = element.getAttribute('class') || '';\n const currentActive = currentClassName.indexOf(className) !== -1;\n const regex = new RegExp('(?:^|\\\\s)' + className + '(?:\\\\s|$)');\n\n if ((active === undefined || active) && !currentActive) {\n currentClassName += currentClassName.length > 0 ? ' ' + className : className;\n }\n else if (!active) {\n currentClassName = currentClassName.replace(regex, ' ');\n }\n\n element.setAttribute('class', currentClassName);\n }\n else 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 const matches = el.matches || el.msMatchesSelector;\n let test = el;\n // When el is document or window, the matches does not exist\n if (!matches) {\n return null;\n }\n\n do {\n if (matches.bind(test)(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 Map between keyboard events `keyCode|which` and `key`\n * @memberOf PSV.utils\n * @type {Object}\n * @readonly\n * @private\n */\nconst KEYMAP = {\n 13 : 'Enter',\n 17 : 'Control',\n 27 : 'Escape',\n 32 : ' ',\n 33 : 'PageUp',\n 34 : 'PageDown',\n 37 : 'ArrowLeft',\n 38 : 'ArrowUp',\n 39 : 'ArrowRight',\n 40 : 'ArrowDown',\n 46 : 'Delete',\n 107: '+',\n 109: '-',\n};\n\n/**\n * @summary Map for non standard keyboard events `key` for IE and Edge\n * @see https://github.com/shvaikalesh/shim-keyboard-event-key\n * @type {Object}\n * @readonly\n * @private\n */\nconst MS_KEYMAP = {\n Add : '+',\n Del : 'Delete',\n Down : 'ArrowDown',\n Esc : 'Escape',\n Left : 'ArrowLeft',\n Right : 'ArrowRight',\n Spacebar: ' ',\n Subtract: '-',\n Up : 'ArrowUp',\n};\n\n/**\n * @summary Returns the key name of a KeyboardEvent\n * @memberOf PSV.utils\n * @param {KeyboardEvent} evt\n * @returns {string}\n */\nexport function getEventKey(evt) {\n let key = evt.key || KEYMAP[evt.keyCode || evt.which];\n\n if (key && MS_KEYMAP[key]) {\n key = MS_KEYMAP[key];\n }\n\n return key;\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 /* eslint-disable-next-line max-len */\n return (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n /* eslint-disable-next-line max-len */\n (elt.requestFullscreen || elt.mozRequestFullScreen || elt.webkitRequestFullscreen || elt.msRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n /* eslint-disable-next-line max-len */\n (document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen).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 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","/**\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 * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound } 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.Math.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.Math.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 = (zeroCenter ? parsed + Math.PI : parsed) % (Math.PI * 2);\n\n if (parsed < 0) {\n parsed += Math.PI * 2;\n }\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","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser';\nexport * from './math';\nexport * from './misc';\nexport * from './psv';\n","import { EASINGS } from './data/constants';\nimport { each } from './utils';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.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\n * @description\n * Implements the Promise API with an additional \"cancel\" and \"finally\" methods.\n * The promise is resolved when the animation is complete and rejected if the animation is cancelled.\n * @example\n * 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 */\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.Animation.OnTick} options.onTick - called on each frame\n */\n constructor(options) {\n this.__cancelled = false;\n this.__resolved = false;\n\n this.__promise = new Promise((resolve, reject) => {\n this.__resolve = resolve;\n this.__reject = reject;\n });\n\n if (options) {\n if (!options.easing || typeof options.easing === 'string') {\n options.easing = EASINGS[options.easing || 'linear'];\n }\n this.__start = null;\n this.options = options;\n\n if (options.delay) {\n this.__delayTimeout = setTimeout(() => {\n this.__delayTimeout = null;\n window.requestAnimationFrame(t => this.__run(t));\n }, options.delay);\n }\n else {\n window.requestAnimationFrame(t => this.__run(t));\n }\n }\n }\n\n /**\n * @summary Main loop for the animation\n * @param {number} timestamp\n * @private\n */\n __run(timestamp) {\n // the animation has been cancelled\n if (this.__cancelled) {\n return;\n }\n\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\n this.options.onTick(current, progress);\n\n 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\n this.options.onTick(current, 1.0);\n\n window.requestAnimationFrame(() => {\n this.__resolved = true;\n this.__resolve();\n });\n }\n }\n\n /**\n * @summary Animation chaining\n * @param {Function} [onFulfilled] - Called when the animation is complete, can return a new animation\n * @param {Function} [onRejected] - Called when the animation is cancelled\n * @returns {PSV.Animation}\n */\n then(onFulfilled = null, onRejected = null) {\n const p = new Animation();\n\n // Allow cancellation to climb up the promise chain\n p.__promise.then(null, () => this.cancel());\n\n this.__promise.then(\n () => p.__resolve(onFulfilled ? onFulfilled() : undefined),\n () => p.__reject(onRejected ? onRejected() : undefined)\n );\n\n return p;\n }\n\n /**\n * @summary Alias to `.then(null, onRejected)`\n * @param {Function} onRejected - Called when the animation has been cancelled\n * @returns {PSV.Animation}\n */\n catch(onRejected) {\n return this.then(undefined, onRejected);\n }\n\n /**\n * @summary Alias to `.then(onFinally, onFinally)`\n * @param {Function} onFinally - Called when the animation is either complete or cancelled\n * @returns {PSV.Animation}\n */\n finally(onFinally) {\n return this.then(onFinally, onFinally);\n }\n\n /**\n * @summary Cancels the animation\n */\n cancel() {\n if (!this.__cancelled && !this.__resolved) {\n this.__cancelled = true;\n this.__reject();\n\n if (this.__delayTimeout) {\n window.cancelAnimationFrame(this.__delayTimeout);\n this.__delayTimeout = null;\n }\n }\n }\n\n /**\n * @summary Returns a resolved animation promise\n * @returns {PSV.Animation}\n */\n static resolve() {\n const p = Promise.resolve();\n p.cancel = () => {\n };\n p.finally = (onFinally) => {\n return p.then(onFinally, onFinally);\n };\n return p;\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 { getEventKey, 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 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 (getEventKey(e) === 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 && this.prop.visible) {\n this.hide();\n }\n else if (supported && !this.prop.visible) {\n this.show();\n }\n });\n }\n else if (!supportedOrObject) {\n this.hide();\n this.prop.supported = false;\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 // classList not supported on IE11, className is read-only !!!!\n container.querySelector('svg').setAttribute('class', '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 { AbstractButton } from './AbstractButton';\nimport download from '../icons/download.svg';\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.panorama;\n link.download = this.psv.config.panorama;\n this.psv.container.appendChild(link);\n link.click();\n\n setTimeout(() => {\n this.psv.container.removeChild(link);\n }, 100);\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 this.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 if (this.psv.panel) {\n this.psv.panel.hide(IDS.MENU);\n }\n }\n\n}\n","import { PSVError } from '../PSVError';\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 {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 {Promise}\n * @private\n */\nfunction isTouchEnabled() {\n return new Promise((resolve) => {\n const listener = (e) => {\n if (e) {\n resolve(true);\n }\n else {\n resolve(false);\n }\n\n window.removeEventListener('touchstart', listener);\n };\n\n window.addEventListener('touchstart', listener, false);\n\n // after 10 secs auto-reject the promise\n setTimeout(listener, 10000);\n });\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 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 * @package\n * @package\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 { getEventKey } from '../utils';\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 /**\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': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\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 { getEventKey } from '../utils';\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 /**\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': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\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 } 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\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 {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mousedown : false,\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 this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n\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.__stopZoomChange();\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.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 'mousedown': this.__initZoomChangeWithMouse(e); break;\n case 'touchstart': this.__initZoomChangeByTouch(e); break;\n case 'mousemove': this.__changeZoomWithMouse(e); break;\n case 'touchmove': this.__changeZoomByTouch(e); break;\n case 'mouseup': this.__stopZoomChange(e); break;\n case 'touchend': this.__stopZoomChange(e); break;\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 { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\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 * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __initZoomChangeWithMouse(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __initZoomChangeByTouch(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Handles mouse up events\n * @private\n */\n __stopZoomChange() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = false;\n this.prop.buttondown = false;\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __changeZoomWithMouse(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n\n evt.preventDefault();\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __changeZoomByTouch(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Zoom change\n * @param {number} x - mouse/touch position\n * @private\n */\n __changeZoom(x) {\n const userInput = x - this.zoomRange.getBoundingClientRect().left;\n const zoomLevel = userInput / this.zoomRange.offsetWidth * 100;\n this.psv.zoom(zoomLevel);\n }\n\n}\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 transitions between panoramas\n * @member {boolean}\n * @readonly\n * @static\n */\n static supportsTransition = false;\n\n /**\n * @summary Indicates if the adapter supports preload\n * @type {boolean}\n * @readonly\n * @static\n */\n static supportsPreload = 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 * @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 */\n setTexture(mesh, textureData) { // 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","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 */\nexport class EquirectangularAdapter extends AbstractAdapter {\n\n static id = 'equirectangular';\n static supportsTransition = true;\n static supportsPreload = 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 * @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 (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.indexOf('GPano:') !== -1) {\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(SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2)\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 const { texture } = textureData;\n\n if (mesh.material.map) {\n mesh.material.map.dispose();\n }\n\n mesh.material.map = 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","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 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 '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 { AbstractButton } from './AbstractButton';\nimport { EVENTS } from '../data/constants';\nimport info from '../icons/info.svg';\n\n/**\n * @summary Navigation bar caption button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CaptionButton extends AbstractButton {\n\n static id = 'caption';\n static icon = info;\n\n /**\n * @param {PSV.components.NavbarCaption} caption\n */\n constructor(caption) {\n super(caption, 'psv-button--hover-scale psv-caption-button');\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, 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.HIDE_NOTIFICATION: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.psv.notification.prop.visible) {\n this.psv.notification.hide();\n }\n else {\n this.psv.notification.show(this.parent.prop.caption);\n this.toggleActive(true);\n }\n }\n\n}\n","import { CaptionButton } from '../buttons/CaptionButton';\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 * @member {PSV.buttons.CaptionButton}\n * @readonly\n * @private\n */\n this.button = new CaptionButton(this);\n this.button.hide();\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {string} caption\n * @property {boolean} contentVisible - if the content is visible in the navbar\n * @property {number} contentWidth - with of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : this.button.prop.width,\n caption : '',\n contentVisible: true,\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.button;\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.prop.caption = html || '';\n this.content.innerHTML = this.prop.caption;\n\n if (html) {\n this.show(false);\n\n this.content.style.display = '';\n this.prop.contentWidth = this.content.offsetWidth;\n\n this.refreshUi();\n }\n else {\n this.hide();\n }\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 && !this.prop.contentVisible) {\n this.content.style.display = '';\n this.prop.contentVisible = true;\n this.button.hide(false);\n }\n else if (availableWidth < this.prop.contentWidth && this.prop.contentVisible) {\n this.content.style.display = 'none';\n this.prop.contentVisible = false;\n this.button.show(false);\n }\n }\n\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\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 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 (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 ZoomInButton,\n ZoomRangeButton,\n ZoomOutButton,\n DownloadButton,\n FullscreenButton,\n MoveRightButton,\n MoveLeftButton,\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 /* eslint-disable no-new */\n this.__cleanButtons(buttons).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 (button === 'caption') {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else if (button === 'zoom') {\n new ZoomOutButton(this);\n new ZoomRangeButton(this);\n new ZoomInButton(this);\n }\n else if (button === 'move') {\n new MoveLeftButton(this);\n new MoveRightButton(this);\n new MoveUpButton(this);\n new MoveDownButton(this);\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 * @throws {PSV.PSVError} when the caption element is not present\n */\n setCaption(html) {\n const caption = this.getButton('caption', false);\n\n if (!caption) {\n throw new PSVError('Cannot set caption, the navbar caption container is not initialized.');\n }\n\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 { 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 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 * @summary Displays a notification on the viewer\n * @param {Object|string} config\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.content.innerHTML = config.content;\n this.prop.visible = true;\n\n this.container.classList.add('psv-notification--visible');\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @fires PSV.hide-notification\n */\n hide() {\n if (this.prop.visible) {\n this.container.classList.remove('psv-notification--visible');\n\n this.prop.visible = false;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { getEventKey } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { PSVError } from '../PSVError';\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.container.addEventListener('mouseup', this);\n\n document.addEventListener('keydown', this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n document.removeEventListener('keydown', 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 // @formatter:off\n case 'mouseup': this.prop.dissmisable && this.hide(); break;\n case 'keydown': getEventKey(e) === KEY_CODES.Escape && this.prop.dissmisable && this.hide(); 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('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 || !this.prop.contentId || this.prop.contentId === 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 { getEventKey, 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 document.addEventListener('keydown', this);\n }\n\n /**\n * @override\n */\n destroy() {\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 document.removeEventListener('keydown', 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 'keydown': getEventKey(e) === KEY_CODES.Escape && this.hide(); 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 (getEventKey(e) === 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 { 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.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.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.psvSphere);\n\n if (sphereIntersect) {\n return sphereIntersect.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.Math.degToRad(panoData?.poseHeading || 0),\n tilt: THREE.Math.degToRad(panoData?.posePitch || 0),\n roll: THREE.Math.degToRad(panoData?.poseRoll || 0),\n };\n }\n\n}\n","import * as THREE from 'three';\nimport { Animation } from '../Animation';\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 {\n clone,\n distance,\n each,\n getClosest,\n getEventKey,\n getPosition,\n isEmpty,\n isFullscreenEnabled,\n normalizeWheel,\n throttle\n} from '../utils';\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} evt\n * @private\n */\n __onKeyDown(evt) {\n const key = getEventKey(evt);\n\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = 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 if (!this.state.keyboardEnabled) {\n return;\n }\n\n if (this.config.keyboard[key] === ACTIONS.TOGGLE_AUTOROTATE) {\n this.psv.toggleAutorotate();\n }\n else if (this.config.keyboard[key] && !this.state.keyHandler.time) {\n /* eslint-disable */\n switch (this.config.keyboard[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 .finally(() => {\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.Math.degToRad(this.prop.hFov),\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.Math.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 '../Animation';\nimport { EVENTS, 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 });\n this.renderer.context.disable(this.renderer.context.DEPTH_TEST);\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 = { psvSphere: 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].indexOf('fisheye') !== -1) {\n this.__onPositionUpdated();\n }\n if (evt.args[0].indexOf('mousemove') !== -1) {\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);\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 const group = new THREE.Group();\n\n const mesh = this.psv.adapter.createMesh(0.5);\n this.psv.adapter.setTexture(mesh, textureData);\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 this.psv.needsUpdate();\n\n return 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 .then(() => {\n // remove temp sphere and transfer the texture to the main sphere\n this.setTexture(textureData);\n this.psv.adapter.setTextureOpacity(this.mesh, 1);\n this.setPanoramaPose(textureData.panoData);\n this.setSphereCorrection(options.sphereCorrection);\n\n this.scene.remove(group);\n mesh.geometry.dispose();\n mesh.geometry = null;\n\n // actually rotate the camera\n if (positionProvided) {\n this.psv.rotate(options);\n }\n });\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.constructor.supportsPreload) {\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 { bound } from './index';\n\n/**\n * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame)\n * @memberOf PSV\n * @package\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 */\n constructor(fn, defaultValue = 0, min = -Infinity, max = Infinity) {\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 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 = 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} values\n */\n setValue(values) {\n const next = bound(values, this.min, this.max);\n this.target = next;\n this.mode = Dynamic.STOP;\n if (next !== this.current) {\n this.current = next;\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 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 = 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.Dynamic} evolving together\n * @memberOf PSV\n * @package\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 * as THREE from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Animation } from './Animation';\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, 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 each,\n exitFullscreen,\n getAbortError,\n getAngle,\n getShortestArc,\n isAbortError,\n isExtendedPosition,\n isFullscreenEnabled,\n logWarn,\n pluginInterop,\n requestFullscreen,\n throttle,\n toggleClass\n} from './utils';\nimport { Dynamic } from './utils/Dynamic';\nimport { MultiDynamic } from './utils/MultiDynamic';\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),\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, this.dataHelper.cleanPosition(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 SYSTEM.isTouchEnabled.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 if (this.prop.loadingPromise !== null) {\n this.textureLoader.abortLoading();\n }\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 = 1500;\n }\n if (options.showLoader === undefined) {\n options.showLoader = true;\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\n const done = (err) => {\n this.loader.hide();\n this.renderer.show();\n\n this.prop.loadingPromise = null;\n\n if (isAbortError(err)) {\n console.warn(err);\n return false;\n }\n else if (err) {\n this.showError(this.config.lang.loadError);\n console.error(err);\n return Promise.reject(err);\n }\n else {\n return true;\n }\n };\n\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 return Promise.reject(getAbortError());\n }\n return textureData;\n });\n\n if (!options.transition || !this.prop.ready || !this.adapter.constructor.supportsTransition) {\n this.prop.loadingPromise = loadingPromise\n .then((textureData) => {\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 return this.renderer.transition(textureData, options);\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 this.navbar.setCaption(value);\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 Animation.resolve();\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.finally(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.Math.degToRad(this.config.moveSpeed * 50));\n }\n\n}\n"],"names":["MOVE_THRESHOLD","DBLCLICK_DELAY","LONGTOUCH_DELAY","TWOFINGERSOVERLAY_DELAY","CTRLZOOM_TIMEOUT","INERTIA_WINDOW","SPHERE_RADIUS","VIEWER_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","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","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","toggleClass","element","className","active","classList","currentClassName","getAttribute","currentActive","indexOf","regex","RegExp","undefined","length","replace","setAttribute","toggle","contains","add","remove","addClasses","split","forEach","name","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","msMatchesSelector","bind","SVGElement","parentElement","getPosition","left","top","offsetLeft","scrollLeft","clientLeft","offsetTop","scrollTop","clientTop","offsetParent","KEYMAP","MS_KEYMAP","Add","Del","Down","Esc","Left","Right","Spacebar","Subtract","Up","getEventKey","evt","key","keyCode","which","isFullscreenEnabled","elt","document","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","call","exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","getStyle","prop","window","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","isInteger","value","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","s","i","toLowerCase","throttle","func","wait","self","args","result","timeout","previous","later","Date","now","apply","remaining","arguments","clearTimeout","setTimeout","isPlainObject","obj","Object","getPrototypeOf","proto","prototype","toString","deepmerge","target","src","first","merge","Array","isArray","e","keys","clone","isEmpty","constructor","each","object","callback","isNil","val","firstNonNull","values","PSVError","message","Error","captureStackTrace","stack","create","pluginInterop","plugin","entries","p","getAbortError","error","isAbortError","err","logWarn","console","warn","isExtendedPosition","some","key1","key2","getXMPValue","data","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","degToRad","parseAngle","angle","zeroCenter","halfCircle","unit","createTexture","img","texture","Texture","needsUpdate","minFilter","LinearFilter","generateMipmaps","quaternion","Quaternion","applyEulerInverse","vector","euler","setFromEuler","invert","applyQuaternion","Animation","options","__cancelled","__resolved","__promise","Promise","resolve","reject","__resolve","__reject","easing","__start","delay","__delayTimeout","requestAnimationFrame","__run","timestamp","progress","duration","current","properties","start","end","onTick","then","onFulfilled","onRejected","cancel","catch","finally","onFinally","cancelAnimationFrame","AbstractComponent","psv","children","push","visible","container","createElement","appendChild","destroy","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","tabbable","id","enabled","supported","collapsed","width","offsetWidth","icon","__setIcon","config","lang","title","tabIndex","addEventListener","onClick","stopPropagation","checkSupported","supportedOrObject","isSupported","initial","promise","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","AutorotateButton","on","off","handleEvent","type","toggleAutorotate","play","playActive","CustomButton","random","substr","content","DownloadButton","link","href","panorama","download","click","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","panel","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","getButton","menuIcon","buttons","dataKey","menu","button","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","names","context","getContext","listener","removeEventListener","getParameter","MAX_TEXTURE_SIZE","maxWidth","height","fillStyle","fillRect","getImageData","onmousewheel","FULLSCREEN_EVT_MAP","validExits","filter","exit","PressHandler","time","down","getTime","up","cb","elapsed","getOrientedArrow","direction","arrow","AbstractMoveButton","move","handler","__onMouseUp","__onMouseDown","__stopAll","dynamics","position","roll","stop","MoveDownButton","MoveLeftButton","MoveRightButton","MoveUpButton","AbstractZoomButton","zoom","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mousedown","mediaMinWidth","zoomRange","zoomValue","ready","__moveZoomValue","getZoomLevel","once","__stopZoomChange","__initZoomChangeWithMouse","__initZoomChangeByTouch","__changeZoomWithMouse","__changeZoomByTouch","size","level","__changeZoom","clientX","changedTouches","buttondown","preventDefault","userInput","getBoundingClientRect","zoomLevel","AbstractAdapter","loadTexture","newPanoData","createMesh","scale","setTexture","mesh","textureData","setTextureOpacity","opacity","supportsTransition","supportsPreload","EquirectangularAdapter","resolution","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","useXmpData","textureLoader","loadImage","loader","setProgress","xmpPanoData","__loadXMP","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","__createEquirectangularTexture","onProgress","loadFile","blob","__loadBlobAsString","binary","substring","reader","FileReader","onload","onerror","readAsText","ratio","resizedPanoData","buffer","drawImage","geometry","SphereGeometry","material","MeshBasicMaterial","Mesh","dispose","transparent","AbstractPlugin","init","EventEmitter","DEFAULTS","adapter","plugins","caption","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","CaptionButton","notification","info","NavbarCaption","contentVisible","contentWidth","setCaption","html","availableWidth","AVAILABLE_BUTTONS","registerButton","defaultPosition","unshift","pos","Navbar","setButtons","item","__cleanButtons","warnNotFound","totalWidth","visibleButtons","collapsableButtons","Loader","clientWidth","tickness","lastChild","inner","round","maxHeight","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","trigger","Notification","Overlay","contentId","dissmisable","image","text","subtext","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","keyHandler","resizer","closeBtn","__onTouchStart","__onMouseMove","__onTouchMove","wasVisible","focus","__startResize","__resize","touches","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","psvSphere","vector3ToViewerCoords","vectorClone","project","camera","sphericalCoordsToViewerCoords","raycaster","setFromCamera","intersectObjects","scene","cleanSphereCorrection","pan","tilt","cleanPanoramaPose","EventsHandler","state","moveThreshold","keyboardEnabled","moving","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","__onKeyDown","__onKeyUp","__onTouchEnd","__fullscreenToggled","__onMouseEnter","__onMouseLeave","__onMouseWheel","enableKeyboard","disableKeyboard","overlay","__startMove","__stopMove","__move","__moveAbsolute","objectsObservers","viewerPos","intersections","dataHelper","emit","observer","CustomEvent","originalEvent","intersection","find","__click","__cancelLongTouch","__cancelTwoFingersOverlay","__startMoveZoom","__stopMoveZoom","gestureIcon","__moveZoom","mousewheelIcon","delta","step","force","startKeyboardControl","stopKeyboardControl","stopAutorotate","stopAnimation","__logMouseMove","__stopMoveInertia","norm","animationPromise","longtouch","boundingRect","rightclick","viewerX","viewerY","sphereIntersection","sphericalCoords","objects","o","textureCoords","textureX","textureY","NaN","hFov","currentPosition","rotate","containerRect","goto","Renderer","WebGLRenderer","alpha","DEPTH_TEST","setPixelRatio","domElement","Scene","PerspectiveCamera","Group","Raycaster","canvasContainer","background","cursor","setAnimationLoop","__cleanTHREEScene","__onSizeUpdated","__onZoomUpdated","__onPositionUpdated","setSize","updateProjectionMatrix","set","lookAt","copy","multiplyScalar","negate","__renderLoop","d","update","render","setPanoramaPose","cleanCorrection","setSphereCorrection","transition","positionProvided","zoomProvided","group","verticalAxis","rotateOnWorldAxis","horizontalAxis","cross","getWorldDirection","normalize","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","Dynamic","fn","mode","STOP","speedMult","currentSpeed","setSpeed","POSITION","INFINITE","setValue","next","dstStop","targetSpeed","MultiDynamic","positions","steps","rolls","hasUpdates","dynamic","Cache","Viewer","autorotateEnabled","loadingPromise","startTimeout","getElementById","eventsHandler","__updateSpeeds","__resizeRefresh","resize","opts","setPanorama","startAutorotate","reason","getPlugin","pluginId","pluginCtor","getSize","isAutorotateEnabled","clientHeight","path","showLoader","hideError","done","showError","setOptions","setOption","option","errorIcon","isDefaultPrevented","change","animate","animProperties","tOffset","dZoom","dim","enterFullscreen","observeObjects","userDataKey"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACO,IAAMA,cAAc,GAAG,CAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IA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A;;EA0DpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBA/DA;;EAgEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAtEA;;EAuEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA7EA;;EA8EpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eApFA;;EAqFpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YA3FA;;EA4FpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAK,iBAjGA;;EAkGpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAI,kBAxGA;;EAyGpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OA9GA;;EA+GpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,MAAM,EAAc,QApHA;;EAqHpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBA1HA;;EA2HpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAjIA;;EAkIpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAzIA;;EA0IpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAhJA;;EAiJpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,QAAQ,EAAY,UAtJA;;EAuJpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ;EA7JA,CAAf;EAgKP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,aAAa,GAAG;EAC3B;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,oBAAoB,EAAE,sBARK;;EAS3B;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,mBAAmB,EAAG;EAhBK,CAAtB;EAmBP;EACA;EACA;EACA;EACA;EACA;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;EACA;EACA;EACA;EACA;EACA;EA52BA;;EAAA,SA62BE0L,cA72BF,GA62BE,wBAAeC,WAAf,EAA4Bjf,QAA5B,EAAsC;EAAA;;EACpC,SAAK1U,IAAL,CAAUsoB,gBAAV,CAA2BqL,WAA3B,IAA0C;EAAEjf,MAAAA,QAAQ,EAARA;EAAF,KAA1C;EAEA,WAAO,YAAM;EACX,aAAO,MAAI,CAAC1U,IAAL,CAAUsoB,gBAAV,CAA2BqL,WAA3B,CAAP;EACD,KAFD;EAGD;EAED;EACF;EACA;EACA;EAx3BA;;EAAA,SAy3BEpd,SAz3BF,GAy3BE,qBAAY;EACV,SAAKsT,cAAL;EACA,SAAKC,aAAL;EAEA,SAAKxI,OAAL,CAAarrB,MAAM,CAACsB,QAApB;EACD;EAED;EACF;EACA;EACA;EAn4BA;;EAAA,SAo4BEq6B,cAp4BF,GAo4BE,0BAAiB;EACf,SAAKpb,QAAL,CAAcS,IAAd,CAAmBuZ,QAAnB,CAA4B,KAAK/gB,MAAL,CAAY8N,SAAZ,GAAwB,EAApD;EACA,SAAK/G,QAAL,CAAcC,QAAd,CAAuB+Z,QAAvB,CAAgCvmB,KAAK,CAAC5Q,IAAN,CAAW6Q,QAAX,CAAoB,KAAKuF,MAAL,CAAY6N,SAAZ,GAAwB,EAA5C,CAAhC;EACD,GAv4BH;;EAAA;EAAA,EAA4Bd,mBAA5B;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"photo-sphere-viewer.js","sources":["../src/data/constants.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/PSVError.js","../src/utils/psv.js","../src/utils/index.js","../src/Animation.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/data/system.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/adapters/AbstractAdapter.js","../src/adapters/equirectangular/index.js","../src/plugins/AbstractPlugin.js","../src/data/config.js","../src/buttons/CaptionButton.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/utils/Dynamic.js","../src/utils/MultiDynamic.js","../src/Viewer.js"],"sourcesContent":["/**\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 */\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 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 */\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 */\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};\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","/**\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 // manual implementation for IE11 and SVGElement\n if (!element.classList) {\n let currentClassName = element.getAttribute('class') || '';\n const currentActive = currentClassName.indexOf(className) !== -1;\n const regex = new RegExp('(?:^|\\\\s)' + className + '(?:\\\\s|$)');\n\n if ((active === undefined || active) && !currentActive) {\n currentClassName += currentClassName.length > 0 ? ' ' + className : className;\n }\n else if (!active) {\n currentClassName = currentClassName.replace(regex, ' ');\n }\n\n element.setAttribute('class', currentClassName);\n }\n else 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 const matches = el.matches || el.msMatchesSelector;\n let test = el;\n // When el is document or window, the matches does not exist\n if (!matches) {\n return null;\n }\n\n do {\n if (matches.bind(test)(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 Map between keyboard events `keyCode|which` and `key`\n * @memberOf PSV.utils\n * @type {Object}\n * @readonly\n * @private\n */\nconst KEYMAP = {\n 13 : 'Enter',\n 17 : 'Control',\n 27 : 'Escape',\n 32 : ' ',\n 33 : 'PageUp',\n 34 : 'PageDown',\n 37 : 'ArrowLeft',\n 38 : 'ArrowUp',\n 39 : 'ArrowRight',\n 40 : 'ArrowDown',\n 46 : 'Delete',\n 107: '+',\n 109: '-',\n};\n\n/**\n * @summary Map for non standard keyboard events `key` for IE and Edge\n * @see https://github.com/shvaikalesh/shim-keyboard-event-key\n * @type {Object}\n * @readonly\n * @private\n */\nconst MS_KEYMAP = {\n Add : '+',\n Del : 'Delete',\n Down : 'ArrowDown',\n Esc : 'Escape',\n Left : 'ArrowLeft',\n Right : 'ArrowRight',\n Spacebar: ' ',\n Subtract: '-',\n Up : 'ArrowUp',\n};\n\n/**\n * @summary Returns the key name of a KeyboardEvent\n * @memberOf PSV.utils\n * @param {KeyboardEvent} evt\n * @returns {string}\n */\nexport function getEventKey(evt) {\n let key = evt.key || KEYMAP[evt.keyCode || evt.which];\n\n if (key && MS_KEYMAP[key]) {\n key = MS_KEYMAP[key];\n }\n\n return key;\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 /* eslint-disable-next-line max-len */\n return (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n /* eslint-disable-next-line max-len */\n (elt.requestFullscreen || elt.mozRequestFullScreen || elt.webkitRequestFullscreen || elt.msRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n /* eslint-disable-next-line max-len */\n (document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen).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 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","/**\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 * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound } 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.Math.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.Math.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 = (zeroCenter ? parsed + Math.PI : parsed) % (Math.PI * 2);\n\n if (parsed < 0) {\n parsed += Math.PI * 2;\n }\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","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser';\nexport * from './math';\nexport * from './misc';\nexport * from './psv';\n","import { EASINGS } from './data/constants';\nimport { each, logWarn } from './utils';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.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\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.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 {PSV.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","/**\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 { getEventKey, 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 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 (getEventKey(e) === 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 && this.prop.visible) {\n this.hide();\n }\n else if (supported && !this.prop.visible) {\n this.show();\n }\n });\n }\n else if (!supportedOrObject) {\n this.hide();\n this.prop.supported = false;\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 // classList not supported on IE11, className is read-only !!!!\n container.querySelector('svg').setAttribute('class', '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 { AbstractButton } from './AbstractButton';\nimport download from '../icons/download.svg';\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 */\n isSupported() {\n return this.psv.adapter.constructor.supportsDownload || !!this.psv.config.downloadUrl;\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","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 this.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 if (this.psv.panel) {\n this.psv.panel.hide(IDS.MENU);\n }\n }\n\n}\n","import { PSVError } from '../PSVError';\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 {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 {Promise}\n * @private\n */\nfunction isTouchEnabled() {\n return new Promise((resolve) => {\n const listener = (e) => {\n if (e) {\n resolve(true);\n }\n else {\n resolve(false);\n }\n\n window.removeEventListener('touchstart', listener);\n };\n\n window.addEventListener('touchstart', listener, false);\n\n // after 10 secs auto-reject the promise\n setTimeout(listener, 10000);\n });\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 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 * @package\n * @package\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 { getEventKey } from '../utils';\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 /**\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': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\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 { getEventKey } from '../utils';\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 /**\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': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\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 } 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\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 {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mousedown : false,\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 this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n\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.__stopZoomChange();\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.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 'mousedown': this.__initZoomChangeWithMouse(e); break;\n case 'touchstart': this.__initZoomChangeByTouch(e); break;\n case 'mousemove': this.__changeZoomWithMouse(e); break;\n case 'touchmove': this.__changeZoomByTouch(e); break;\n case 'mouseup': this.__stopZoomChange(e); break;\n case 'touchend': this.__stopZoomChange(e); break;\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 { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\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 * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __initZoomChangeWithMouse(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __initZoomChangeByTouch(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Handles mouse up events\n * @private\n */\n __stopZoomChange() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = false;\n this.prop.buttondown = false;\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __changeZoomWithMouse(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n\n evt.preventDefault();\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __changeZoomByTouch(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Zoom change\n * @param {number} x - mouse/touch position\n * @private\n */\n __changeZoom(x) {\n const userInput = x - this.zoomRange.getBoundingClientRect().left;\n const zoomLevel = userInput / this.zoomRange.offsetWidth * 100;\n this.psv.zoom(zoomLevel);\n }\n\n}\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","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 */\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.indexOf('GPano:') !== -1) {\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(SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2)\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 const { texture } = textureData;\n\n mesh.material.map?.dispose();\n mesh.material.map = 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","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 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 '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 { AbstractButton } from './AbstractButton';\nimport { EVENTS } from '../data/constants';\nimport info from '../icons/info.svg';\n\n/**\n * @summary Navigation bar caption button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CaptionButton extends AbstractButton {\n\n static id = 'caption';\n static icon = info;\n\n /**\n * @param {PSV.components.NavbarCaption} caption\n */\n constructor(caption) {\n super(caption, 'psv-button--hover-scale psv-caption-button');\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, 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.HIDE_NOTIFICATION: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.psv.notification.prop.visible) {\n this.psv.notification.hide();\n }\n else {\n this.psv.notification.show(this.parent.prop.caption);\n this.toggleActive(true);\n }\n }\n\n}\n","import { CaptionButton } from '../buttons/CaptionButton';\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 * @member {PSV.buttons.CaptionButton}\n * @readonly\n * @private\n */\n this.button = new CaptionButton(this);\n this.button.hide();\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {string} caption\n * @property {boolean} contentVisible - if the content is visible in the navbar\n * @property {number} contentWidth - with of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : this.button.prop.width,\n caption : '',\n contentVisible: true,\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.button;\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.prop.caption = html || '';\n this.content.innerHTML = this.prop.caption;\n\n if (html) {\n this.show(false);\n\n this.content.style.display = '';\n this.prop.contentWidth = this.content.offsetWidth;\n\n this.refreshUi();\n }\n else {\n this.hide();\n }\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 && !this.prop.contentVisible) {\n this.content.style.display = '';\n this.prop.contentVisible = true;\n this.button.hide(false);\n }\n else if (availableWidth < this.prop.contentWidth && this.prop.contentVisible) {\n this.content.style.display = 'none';\n this.prop.contentVisible = false;\n this.button.show(false);\n }\n }\n\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\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 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 (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 ZoomInButton,\n ZoomRangeButton,\n ZoomOutButton,\n DownloadButton,\n FullscreenButton,\n MoveRightButton,\n MoveLeftButton,\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 /* eslint-disable no-new */\n this.__cleanButtons(buttons).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 (button === 'caption') {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else if (button === 'zoom') {\n new ZoomOutButton(this);\n new ZoomRangeButton(this);\n new ZoomInButton(this);\n }\n else if (button === 'move') {\n new MoveLeftButton(this);\n new MoveRightButton(this);\n new MoveUpButton(this);\n new MoveDownButton(this);\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('caption', 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 { 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 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 * @summary Displays a notification on the viewer\n * @param {Object|string} config\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.content.innerHTML = config.content;\n this.prop.visible = true;\n\n this.container.classList.add('psv-notification--visible');\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @fires PSV.hide-notification\n */\n hide() {\n if (this.prop.visible) {\n this.container.classList.remove('psv-notification--visible');\n\n this.prop.visible = false;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { getEventKey } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { PSVError } from '../PSVError';\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.container.addEventListener('mouseup', this);\n\n document.addEventListener('keydown', this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n document.removeEventListener('keydown', 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 // @formatter:off\n case 'mouseup': this.prop.dissmisable && this.hide(); break;\n case 'keydown': getEventKey(e) === KEY_CODES.Escape && this.prop.dissmisable && this.hide(); 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('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 || !this.prop.contentId || this.prop.contentId === 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 { getEventKey, 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 document.addEventListener('keydown', this);\n }\n\n /**\n * @override\n */\n destroy() {\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 document.removeEventListener('keydown', 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 'keydown': getEventKey(e) === KEY_CODES.Escape && this.hide(); 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 (getEventKey(e) === 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.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.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) {\n return sphereIntersect.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.Math.degToRad(panoData?.poseHeading || 0),\n tilt: THREE.Math.degToRad(panoData?.posePitch || 0),\n roll: THREE.Math.degToRad(panoData?.poseRoll || 0),\n };\n }\n\n}\n","import * as THREE from 'three';\nimport { Animation } from '../Animation';\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 {\n clone,\n distance,\n each,\n getClosest,\n getEventKey,\n getPosition,\n isEmpty,\n isFullscreenEnabled,\n normalizeWheel,\n throttle\n} from '../utils';\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} evt\n * @private\n */\n __onKeyDown(evt) {\n const key = getEventKey(evt);\n\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = 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 if (!this.state.keyboardEnabled) {\n return;\n }\n\n if (this.config.keyboard[key] === ACTIONS.TOGGLE_AUTOROTATE) {\n this.psv.toggleAutorotate();\n }\n else if (this.config.keyboard[key] && !this.state.keyHandler.time) {\n /* eslint-disable */\n switch (this.config.keyboard[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.Math.degToRad(this.prop.hFov),\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.Math.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 '../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].indexOf('fisheye') !== -1) {\n this.__onPositionUpdated();\n }\n if (evt.args[0].indexOf('mousemove') !== -1) {\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);\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 { bound } from './index';\n\n/**\n * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame)\n * @memberOf PSV\n * @package\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 */\n constructor(fn, defaultValue = 0, min = -Infinity, max = Infinity) {\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 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 = 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} values\n */\n setValue(values) {\n const next = bound(values, this.min, this.max);\n this.target = next;\n this.mode = Dynamic.STOP;\n if (next !== this.current) {\n this.current = next;\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 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 = 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.Dynamic} evolving together\n * @memberOf PSV\n * @package\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 * as THREE from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Animation } from './Animation';\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 each,\n exitFullscreen,\n getAbortError,\n getAngle,\n getShortestArc,\n isAbortError,\n isExtendedPosition,\n isFullscreenEnabled,\n logWarn,\n pluginInterop,\n requestFullscreen,\n throttle,\n toggleClass\n} from './utils';\nimport { Dynamic } from './utils/Dynamic';\nimport { MultiDynamic } from './utils/MultiDynamic';\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),\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, this.dataHelper.cleanPosition(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 SYSTEM.isTouchEnabled.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\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\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 this.navbar.setCaption(value);\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.Math.degToRad(this.config.moveSpeed * 50));\n }\n\n}\n"],"names":["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","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","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","toggleClass","element","className","active","classList","currentClassName","getAttribute","currentActive","indexOf","regex","RegExp","undefined","length","replace","setAttribute","toggle","contains","add","remove","addClasses","split","forEach","name","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","msMatchesSelector","bind","SVGElement","parentElement","getPosition","left","top","offsetLeft","scrollLeft","clientLeft","offsetTop","scrollTop","clientTop","offsetParent","KEYMAP","MS_KEYMAP","Add","Del","Down","Esc","Left","Right","Spacebar","Subtract","Up","getEventKey","evt","key","keyCode","which","isFullscreenEnabled","elt","document","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","call","exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","getStyle","prop","window","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","isInteger","value","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","s","i","toLowerCase","throttle","func","wait","self","args","result","timeout","previous","later","Date","now","apply","remaining","arguments","clearTimeout","setTimeout","isPlainObject","obj","Object","getPrototypeOf","proto","prototype","toString","deepmerge","target","src","first","merge","Array","isArray","e","keys","clone","isEmpty","constructor","each","object","callback","isNil","val","firstNonNull","values","PSVError","message","Error","captureStackTrace","stack","create","pluginInterop","plugin","entries","p","getAbortError","error","isAbortError","err","logWarn","console","warn","isExtendedPosition","some","key1","key2","getXMPValue","data","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","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","Promise","resolve","push","cancel","cancelAnimationFrame","catch","finally","onFinally","AbstractComponent","psv","children","visible","container","createElement","appendChild","destroy","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","tabbable","id","enabled","supported","collapsed","width","offsetWidth","icon","__setIcon","config","lang","title","tabIndex","addEventListener","onClick","stopPropagation","checkSupported","supportedOrObject","isSupported","initial","promise","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","AutorotateButton","on","off","handleEvent","type","toggleAutorotate","play","playActive","CustomButton","random","substr","content","DownloadButton","adapter","supportsDownload","downloadUrl","link","href","panorama","download","pop","click","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","panel","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","getButton","menuIcon","buttons","dataKey","menu","button","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","names","context","getContext","listener","removeEventListener","getParameter","MAX_TEXTURE_SIZE","maxWidth","height","fillStyle","fillRect","getImageData","onmousewheel","FULLSCREEN_EVT_MAP","validExits","filter","exit","PressHandler","time","down","getTime","up","elapsed","getOrientedArrow","direction","arrow","AbstractMoveButton","move","handler","__onMouseUp","__onMouseDown","__stopAll","dynamics","position","roll","stop","MoveDownButton","MoveLeftButton","MoveRightButton","MoveUpButton","AbstractZoomButton","zoom","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mousedown","mediaMinWidth","zoomRange","zoomValue","ready","__moveZoomValue","getZoomLevel","once","__stopZoomChange","__initZoomChangeWithMouse","__initZoomChangeByTouch","__changeZoomWithMouse","__changeZoomByTouch","size","level","__changeZoom","clientX","changedTouches","buttondown","preventDefault","userInput","getBoundingClientRect","zoomLevel","AbstractAdapter","supportsTransition","supportsPreload","loadTexture","newPanoData","createMesh","scale","setTexture","mesh","textureData","transition","setTextureOpacity","opacity","disposeTexture","EquirectangularAdapter","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","substring","reader","FileReader","onload","onerror","readAsText","ratio","resizedPanoData","buffer","drawImage","geometry","SphereGeometry","material","MeshBasicMaterial","Mesh","dispose","transparent","AbstractPlugin","init","EventEmitter","DEFAULTS","plugins","caption","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","CaptionButton","notification","info","NavbarCaption","contentVisible","contentWidth","setCaption","html","availableWidth","AVAILABLE_BUTTONS","registerButton","defaultPosition","unshift","pos","Navbar","setButtons","item","__cleanButtons","warnNotFound","totalWidth","visibleButtons","collapsableButtons","Loader","clientWidth","tickness","lastChild","inner","round","maxHeight","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","trigger","Notification","Overlay","contentId","dissmisable","image","text","subtext","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","keyHandler","resizer","closeBtn","__onTouchStart","__onMouseMove","__onTouchMove","wasVisible","focus","__startResize","__resize","touches","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","moving","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","__onKeyDown","__onKeyUp","__onTouchEnd","__fullscreenToggled","__onMouseEnter","__onMouseLeave","__onMouseWheel","enableKeyboard","disableKeyboard","overlay","__startMove","__stopMove","__move","__moveAbsolute","objectsObservers","viewerPos","intersections","dataHelper","emit","observer","CustomEvent","originalEvent","intersection","find","__click","__cancelLongTouch","__cancelTwoFingersOverlay","__startMoveZoom","__stopMoveZoom","gestureIcon","__moveZoom","mousewheelIcon","delta","step","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","goto","Renderer","WebGLRenderer","alpha","antialias","setPixelRatio","domElement","Scene","PerspectiveCamera","Group","Raycaster","canvasContainer","background","cursor","setAnimationLoop","__cleanTHREEScene","__onSizeUpdated","__onZoomUpdated","__onPositionUpdated","setSize","updateProjectionMatrix","set","lookAt","copy","multiplyScalar","negate","__renderLoop","d","update","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","Dynamic","fn","mode","STOP","speedMult","currentSpeed","setSpeed","POSITION","INFINITE","setValue","next","dstStop","targetSpeed","MultiDynamic","positions","steps","rolls","hasUpdates","dynamic","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","isDefaultPrevented","change","animate","animProperties","tOffset","dZoom","dim","enterFullscreen","observeObjects","userDataKey"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACO,IAAMA,kBAAkB,GAAG,IAA3B;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,CAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,eAAe,GAAG,GAAxB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,uBAAuB,GAAG,GAAhC;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,gBAAgB,GAAG,IAAzB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,aAAa,GAAG,EAAtB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,WAAW,GAAG,mBAApB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,WAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,OAAO,GAAG;EACrBC,EAAAA,aAAa,EAAM,kBADE;EAErBC,EAAAA,eAAe,EAAI,oBAFE;EAGrBC,EAAAA,iBAAiB,EAAE,sBAHE;EAIrBC,EAAAA,gBAAgB,EAAG,qBAJE;EAKrBC,EAAAA,OAAO,EAAY,QALE;EAMrBC,EAAAA,QAAQ,EAAW,SANE;EAOrBC,EAAAA,iBAAiB,EAAE;EAPE,CAAhB;EAUP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YAPA;;EAQpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eAfA;;EAgBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eAtBA;;EAuBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OA7BA;;EA8BpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAS,aApCA;;EAqCpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,cAA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AAYmO,SAAZ,GAAwB,EAApD;EACA,SAAKjH,QAAL,CAAcC,QAAd,CAAuBka,QAAvB,CAAgC7mB,KAAK,CAAC5Q,IAAN,CAAW6Q,QAAX,CAAoB,KAAKuF,MAAL,CAAYkO,SAAZ,GAAwB,EAA5C,CAAhC;EACD,GAp5BH;;EAAA;EAAA,EAA4Bb,mBAA5B;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/autorotate-keypoints.js b/dist/plugins/autorotate-keypoints.js index 6e391c20d..4931d11da 100644 --- a/dist/plugins/autorotate-keypoints.js +++ b/dist/plugins/autorotate-keypoints.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @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 3380b4fac..eee19c76b 100644 --- a/dist/plugins/compass.css +++ b/dist/plugins/compass.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.1 + * Photo Sphere Viewer 4.5.2 * @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.js b/dist/plugins/compass.js index 9b2db119d..247723d9e 100644 --- a/dist/plugins/compass.js +++ b/dist/plugins/compass.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @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/gyroscope.js b/dist/plugins/gyroscope.js index d7afabd79..9fa3757d5 100644 --- a/dist/plugins/gyroscope.js +++ b/dist/plugins/gyroscope.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @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.css b/dist/plugins/markers.css index 775fc5e72..a079569f4 100644 --- a/dist/plugins/markers.css +++ b/dist/plugins/markers.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.1 + * Photo Sphere Viewer 4.5.2 * @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.d.ts b/dist/plugins/markers.d.ts index 37ea06ec8..88d2b3f2b 100644 --- a/dist/plugins/markers.d.ts +++ b/dist/plugins/markers.d.ts @@ -35,7 +35,9 @@ type MarkerProperties = Partial & { id: string; width?: number; height?: number; + orientation?: 'front' | 'horizontal' | 'vertical-left' | 'vertical-right'; scale?: number | [number, number] | { zoom?: [number, number], longitude?: [number, number] }; + opacity?: number; className?: string; style?: Record; svgStyle?: Record; @@ -207,7 +209,7 @@ declare class MarkersPlugin extends AbstractPlugin { /** * @summary Rotate the view to face the marker */ - gotoMarker(markerId: string, speed: string | number): Animation; + gotoMarker(markerId: string, speed: string | number): Animation; /** * @summary Hides a marker diff --git a/dist/plugins/markers.js b/dist/plugins/markers.js index 15c28af5a..2e145051c 100644 --- a/dist/plugins/markers.js +++ b/dist/plugins/markers.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -720,6 +720,8 @@ this.visible = this.config.visible !== false; if (!this.is3d()) { + var _this$config$opacity; + // reset CSS class if (this.isNormal()) { this.$el.setAttribute('class', 'psv-marker psv-marker--normal'); @@ -741,6 +743,8 @@ } // apply style + this.$el.style.opacity = (_this$config$opacity = this.config.opacity) != null ? _this$config$opacity : 1; + if (this.config.style) { photoSphereViewer.utils.deepmerge(this.$el.style, this.config.style); } @@ -999,10 +1003,12 @@ switch (this.type) { case MARKER_TYPES.imageLayer: if (!this.$el) { - var _mesh$userData; + var _this$config$opacity2, _mesh$userData; var material = new THREE.MeshBasicMaterial({ - transparent: true + transparent: true, + opacity: (_this$config$opacity2 = this.config.opacity) != null ? _this$config$opacity2 : 1, + depthTest: false }); var geometry = new THREE.PlaneGeometry(1, 1); var mesh = new THREE.Mesh(geometry, material); @@ -1026,15 +1032,38 @@ this.loader.setRequestHeader(this.psv.config.requestHeaders(this.config.imageLayer)); } - this.$el.children[0].material.map = this.loader.load(this.config.imageLayer, function () { - return _this3.psv.needsUpdate(); + this.$el.children[0].material.map = this.loader.load(this.config.imageLayer, function (texture) { + texture.anisotropy = 4; + + _this3.psv.needsUpdate(); }); this.props.def = this.config.imageLayer; } this.$el.children[0].position.set(this.props.anchor.x - 0.5, this.props.anchor.y - 0.5, 0); this.$el.position.copy(this.props.positions3D[0]); - this.$el.lookAt(0, 0, 0); // 100 is magic number that gives a coherent size at default zoom level + + switch (this.config.orientation) { + case 'horizontal': + this.$el.lookAt(0, this.$el.position.y, 0); + this.$el.rotateX(this.props.position.latitude < 0 ? -Math.PI / 2 : Math.PI / 2); + break; + + case 'vertical-left': + this.$el.lookAt(0, 0, 0); + this.$el.rotateY(-Math.PI * 0.4); + break; + + case 'vertical-right': + this.$el.lookAt(0, 0, 0); + this.$el.rotateY(Math.PI * 0.4); + break; + + default: + this.$el.lookAt(0, 0, 0); + break; + } // 100 is magic number that gives a coherent size at default zoom level + this.$el.scale.set(this.config.width / 100 * photoSphereViewer.SYSTEM.pixelRatio, this.config.height / 100 * photoSphereViewer.SYSTEM.pixelRatio, 1); break; @@ -1131,9 +1160,7 @@ ; _proto.isSupported = function isSupported() { - var _this$plugin; - - return (_this$plugin = this.plugin) == null ? void 0 : _this$plugin.config.hideButton; + return !!this.plugin; } /** * @summary Handles events @@ -1228,9 +1255,7 @@ ; _proto.isSupported = function isSupported() { - var _this$plugin; - - return (_this$plugin = this.plugin) == null ? void 0 : _this$plugin.config.listButton; + return !!this.plugin; } /** * @summary Handles events @@ -1272,8 +1297,6 @@ /** * @typedef {Object} PSV.plugins.MarkersPlugin.Options - * @property {boolean} [hideButton=true] - adds a button to show/hide the markers - * @property {boolean} [listButton=true] - adds a button to show the list of markers * @property {boolean} [clickEventOnMarker=false] If a `click` event is triggered on the viewer additionally to the `select-marker` event. * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers] */ @@ -1336,15 +1359,18 @@ */ _this.config = _extends({ - hideButton: true, - listButton: true, clickEventOnMarker: false }, options); + + if ((options == null ? void 0 : options.listButton) === false || (options == null ? void 0 : options.hideButton) === false) { + photoSphereViewer.utils.logWarn('MarkersPlugin: listButton and hideButton options are deprecated. ' + 'Please define the global navbar options according to your needs.'); + } /** * @member {HTMLElement} * @readonly */ + _this.container = document.createElement('div'); _this.container.className = 'psv-markers'; _this.container.style.cursor = _this.psv.config.mousemove ? 'move' : 'default'; @@ -2294,13 +2320,8 @@ this.psv.panel.hide(); } } else { - if (this.config.hideButton) { - markersButton == null ? void 0 : markersButton.show(); - } - - if (this.config.listButton) { - markersListButton == null ? void 0 : markersListButton.show(); - } + markersButton == null ? void 0 : markersButton.show(); + markersListButton == null ? void 0 : markersListButton.show(); if (this.psv.panel.isVisible(ID_PANEL_MARKERS_LIST)) { this.showMarkersList(); diff --git a/dist/plugins/markers.js.map b/dist/plugins/markers.js.map index dd9a74ee5..48c847172 100644 --- a/dist/plugins/markers.js.map +++ b/dist/plugins/markers.js.map @@ -1 +1 @@ -{"version":3,"file":"markers.js","sources":["../../src/plugins/markers/constants.js","../../src/utils/math.js","../../src/PSVError.js","../../src/utils/psv.js","../../src/plugins/markers/utils.js","../../src/plugins/markers/Marker.js","../../src/plugins/markers/MarkersButton.js","../../src/plugins/markers/MarkersListButton.js","../../src/plugins/markers/index.js"],"sourcesContent":["import icon from './pin-list.svg';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.MarkersPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event goto-marker-done\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the animation to a marker is done\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n GOTO_MARKER_DONE : 'goto-marker-done',\n /**\n * @event leave-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user puts the cursor away from a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n LEAVE_MARKER : 'leave-marker',\n /**\n * @event over-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user puts the cursor hover a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n OVER_MARKER : 'over-marker',\n /**\n * @event filter:render-markers-list\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Used to alter the list of markers displayed on the side-panel\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n * @returns {PSV.plugins.MarkersPlugin.Marker[]}\n */\n RENDER_MARKERS_LIST: 'render-markers-list',\n /**\n * @event select-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler\n * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker}\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data\n */\n SELECT_MARKER : 'select-marker',\n /**\n * @event select-marker-list\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when a marker is selected from the side panel\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n SELECT_MARKER_LIST : 'select-marker-list',\n /**\n * @event unselect-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when a marker was selected and the user clicks elsewhere\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n UNSELECT_MARKER : 'unselect-marker',\n /**\n * @event hide-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are hidden\n */\n HIDE_MARKERS : 'hide-markers',\n /**\n * @event set-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the list of markers changes\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n */\n SET_MARKERS : 'set-markers',\n /**\n * @event show-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are shown\n */\n SHOW_MARKERS : 'show-markers',\n};\n\n/**\n * @summary Namespace for SVG creation\n * @type {string}\n * @constant\n * @private\n */\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @summary Property name added to marker elements\n * @type {string}\n * @constant\n * @private\n */\nexport const MARKER_DATA = 'psvMarker';\n\n/**\n * @summary Panel identifier for marker content\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL_MARKER = 'marker';\n\n/**\n * @summary Panel identifier for markers list\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL_MARKERS_LIST = 'markersList';\n\n/**\n * @summary Markers list template\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n * @param {string} title\n * @param {string} dataKey\n * @returns {string}\n * @constant\n * @private\n */\nexport const MARKERS_LIST_TEMPLATE = (markers, title, dataKey) => `\n
\n

${icon} ${title}

\n
    \n ${markers.map(marker => `\n
  • \n ${marker.type === 'image' ? `` : ''}\n ${marker.getListContent()}\n
  • \n `).join('')}\n
\n
\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 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 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 * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound } 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.Math.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.Math.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 = (zeroCenter ? parsed + Math.PI : parsed) % (Math.PI * 2);\n\n if (parsed < 0) {\n parsed += Math.PI * 2;\n }\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 { CONSTANTS, utils } from '../..';\n\n/**\n * Returns intermediary point between two points on the sphere\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @param {number[]} p1\n * @param {number[]} p2\n * @param {number} f\n * @returns {number[]}\n * @private\n */\nexport function greatArcIntermediaryPoint(p1, p2, f) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const r = utils.greatArcDistance(p1, p2);\n const a = Math.sin((1 - f) * r) / Math.sin(r);\n const b = Math.sin(f * r) / Math.sin(r);\n const x = a * Math.cos(φ1) * Math.cos(λ1) + b * Math.cos(φ2) * Math.cos(λ2);\n const y = a * Math.cos(φ1) * Math.sin(λ1) + b * Math.cos(φ2) * Math.sin(λ2);\n const z = a * Math.sin(φ1) + b * Math.sin(φ2);\n\n return [\n Math.atan2(y, x),\n Math.atan2(z, Math.sqrt(x * x + y * y)),\n ];\n}\n\n/**\n * @summary Computes the center point of a polygon\n * @todo Get \"visual center\" (https://blog.mapbox.com/a-new-algorithm-for-finding-a-visual-center-of-a-polygon-7c77e6492fbc)\n * @param {number[][]} polygon\n * @returns {number[]}\n * @private\n */\nexport function getPolygonCenter(polygon) {\n // apply offsets to avoid crossing the origin\n const workPoints = [polygon[0]];\n\n let k = 0;\n for (let i = 1; i < polygon.length; i++) {\n const d = polygon[i - 1][0] - polygon[i][0];\n if (d > Math.PI) { // crossed the origin left to right\n k += 1;\n }\n else if (d < -Math.PI) { // crossed the origin right to left\n k -= 1;\n }\n workPoints.push([polygon[i][0] + k * 2 * Math.PI, polygon[i][1]]);\n }\n\n const sum = workPoints.reduce((intermediary, point) => [intermediary[0] + point[0], intermediary[1] + point[1]]);\n return [utils.parseAngle(sum[0] / polygon.length), sum[1] / polygon.length];\n}\n\n/**\n * @summary Computes the middle point of a polyline\n * @param {number[][]} polyline\n * @returns {number[]}\n * @private\n */\nexport function getPolylineCenter(polyline) {\n // compute each segment length + total length\n let length = 0;\n const lengths = [];\n\n for (let i = 0; i < polyline.length - 1; i++) {\n const l = utils.greatArcDistance(polyline[i], polyline[i + 1]) * CONSTANTS.SPHERE_RADIUS;\n\n lengths.push(l);\n length += l;\n }\n\n // iterate until length / 2\n let consumed = 0;\n\n for (let j = 0; j < polyline.length - 1; j++) {\n // once the segment containing the middle point is found, computes the intermediary point\n if (consumed + lengths[j] > length / 2) {\n const r = (length / 2 - consumed) / lengths[j];\n return greatArcIntermediaryPoint(polyline[j], polyline[j + 1], r);\n }\n\n consumed += lengths[j];\n }\n\n // this never happens\n return polyline[Math.round(polyline.length / 2)];\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, SYSTEM, utils } from '../..';\nimport { getShortestArc, logWarn } from '../../utils';\nimport { MARKER_DATA, SVG_NS } from './constants';\nimport { getPolygonCenter, getPolylineCenter } from './utils';\n\n/**\n * @summary Types of marker\n * @memberOf PSV.plugins.MarkersPlugin\n * @enum {string}\n * @constant\n * @private\n */\nconst MARKER_TYPES = {\n image : 'image',\n imageLayer : 'imageLayer',\n html : 'html',\n polygonPx : 'polygonPx',\n polygonRad : 'polygonRad',\n polylinePx : 'polylinePx',\n polylineRad: 'polylineRad',\n square : 'square',\n rect : 'rect',\n circle : 'circle',\n ellipse : 'ellipse',\n path : 'path',\n};\n\n/**\n * @typedef {Object} PSV.plugins.MarkersPlugin.Properties\n * @summary Marker properties, see {@link https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#markers-options}\n */\n\n/**\n * @summary Object representing a marker\n * @memberOf PSV.plugins.MarkersPlugin\n */\nexport class Marker {\n\n /**\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @param {PSV.Viewer} psv\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n constructor(properties, psv) {\n if (!properties.id) {\n throw new PSVError('missing marker id');\n }\n\n /**\n * @member {PSV.Viewer}\n * @readonly\n * @protected\n */\n this.psv = psv;\n\n /**\n * @member {string}\n * @readonly\n */\n this.id = properties.id;\n\n /**\n * @member {string}\n * @readonly\n */\n this.type = Marker.getType(properties, false);\n\n /**\n * @member {boolean}\n * @protected\n */\n this.visible = true;\n\n /**\n * @member {HTMLElement|SVGElement|THREE.Object3D}\n * @readonly\n */\n this.$el = null;\n\n /**\n * @summary Original configuration of the marker\n * @member {PSV.plugins.MarkersPlugin.Properties}\n * @readonly\n */\n this.config = {};\n\n /**\n * @summary User data associated to the marker\n * @member {any}\n */\n this.data = undefined;\n\n /**\n * @summary Tooltip instance for this marker\n * @member {PSV.components.Tooltip}\n */\n this.tooltip = null;\n\n /**\n * @summary Computed properties\n * @member {Object}\n * @protected\n * @property {boolean} dynamicSize\n * @property {PSV.Point} anchor\n * @property {PSV.Position} position - position in spherical coordinates\n * @property {PSV.Point} position2D - position in viewer coordinates\n * @property {external:THREE.Vector3[]} positions3D - positions in 3D space\n * @property {number} width\n * @property {number} height\n * @property {*} def\n */\n this.props = {\n dynamicSize: false,\n anchor : null,\n position : null,\n position2D : null,\n positions3D: null,\n width : null,\n height : null,\n def : null,\n };\n\n /**\n * @summary THREE file loader\n * @type {THREE:TextureLoader}\n * @private\n */\n this.loader = null;\n\n if (this.is3d()) {\n this.loader = new THREE.TextureLoader();\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\n // create element\n if (this.isNormal()) {\n this.$el = document.createElement('div');\n }\n else if (this.isPolygon()) {\n this.$el = document.createElementNS(SVG_NS, 'polygon');\n }\n else if (this.isPolyline()) {\n this.$el = document.createElementNS(SVG_NS, 'polyline');\n }\n else if (this.isSvg()) {\n this.$el = document.createElementNS(SVG_NS, this.type);\n }\n\n if (!this.is3d()) {\n this.$el.id = `psv-marker-${this.id}`;\n this.$el[MARKER_DATA] = this;\n }\n\n this.update(properties);\n }\n\n /**\n * @summary Destroys the marker\n */\n destroy() {\n delete this.$el[MARKER_DATA];\n delete this.$el;\n delete this.config;\n delete this.props;\n delete this.psv;\n }\n\n /**\n * @summary Checks if it is a 3D marker (imageLayer)\n * @returns {boolean}\n */\n is3d() {\n return this.type === MARKER_TYPES.imageLayer;\n }\n\n /**\n * @summary Checks if it is a normal marker (image or html)\n * @returns {boolean}\n */\n isNormal() {\n return this.type === MARKER_TYPES.image\n || this.type === MARKER_TYPES.html;\n }\n\n /**\n * @summary Checks if it is a polygon/polyline marker\n * @returns {boolean}\n */\n isPoly() {\n return this.isPolygon()\n || this.isPolyline();\n }\n\n /**\n * @summary Checks if it is a polygon/polyline using pixel coordinates\n * @returns {boolean}\n */\n isPolyPx() {\n return this.type === MARKER_TYPES.polygonPx\n || this.type === MARKER_TYPES.polylinePx;\n }\n\n /**\n * @summary Checks if it is a polygon/polyline using radian coordinates\n * @returns {boolean}\n */\n isPolyRad() {\n return this.type === MARKER_TYPES.polygonRad\n || this.type === MARKER_TYPES.polylineRad;\n }\n\n /**\n * @summary Checks if it is a polygon marker\n * @returns {boolean}\n */\n isPolygon() {\n return this.type === MARKER_TYPES.polygonPx\n || this.type === MARKER_TYPES.polygonRad;\n }\n\n /**\n * @summary Checks if it is a polyline marker\n * @returns {boolean}\n */\n isPolyline() {\n return this.type === MARKER_TYPES.polylinePx\n || this.type === MARKER_TYPES.polylineRad;\n }\n\n /**\n * @summary Checks if it is an SVG marker\n * @returns {boolean}\n */\n isSvg() {\n return this.type === MARKER_TYPES.square\n || this.type === MARKER_TYPES.rect\n || this.type === MARKER_TYPES.circle\n || this.type === MARKER_TYPES.ellipse\n || this.type === MARKER_TYPES.path;\n }\n\n /**\n * @summary Computes marker scale from zoom level\n * @param {number} zoomLevel\n * @param {PSV.Position} position\n * @returns {number}\n */\n getScale(zoomLevel, position) {\n if (!this.config.scale) {\n return 1;\n }\n if (typeof this.config.scale === 'function') {\n return this.config.scale(zoomLevel, position);\n }\n\n let scale = 1;\n if (Array.isArray(this.config.scale.zoom)) {\n const bounds = this.config.scale.zoom;\n scale *= bounds[0] + (bounds[1] - bounds[0]) * CONSTANTS.EASINGS.inQuad(zoomLevel / 100);\n }\n if (Array.isArray(this.config.scale.longitude)) {\n const bounds = this.config.scale.longitude;\n const halfFov = THREE.Math.degToRad(this.psv.prop.hFov) / 2;\n const arc = Math.abs(getShortestArc(this.props.position.longitude, position.longitude));\n scale *= bounds[1] + (bounds[0] - bounds[1]) * CONSTANTS.EASINGS.outQuad(Math.max(0, (halfFov - arc) / halfFov));\n }\n return scale;\n }\n\n /**\n * @summary Returns the markers list content for the marker, it can be either :\n * - the `listContent`\n * - the `tooltip.content`\n * - the `html`\n * - the `id`\n * @returns {*}\n */\n getListContent() {\n if (this.config.listContent) {\n return this.config.listContent;\n }\n else if (this.config.tooltip?.content) {\n return this.config.tooltip.content;\n }\n else if (this.config.html) {\n return this.config.html;\n }\n else {\n return this.id;\n }\n }\n\n /**\n * @summary Display the tooltip of this marker\n * @param {{clientX: number, clientY: number}} [mousePosition]\n */\n showTooltip(mousePosition) {\n if (this.visible && this.config.tooltip?.content && this.props.position2D) {\n const config = {\n content : this.config.tooltip.content,\n position: this.config.tooltip.position,\n data : this,\n };\n\n if (this.isPoly()) {\n const viewerPos = utils.getPosition(this.psv.container);\n\n config.box = { // separate the tooltip from the cursor\n width : this.psv.tooltip.size.arrow * 2,\n height: this.psv.tooltip.size.arrow * 2,\n };\n\n if (mousePosition) {\n config.top = mousePosition.clientY - viewerPos.top - this.psv.tooltip.size.arrow / 2;\n config.left = mousePosition.clientX - viewerPos.left - this.psv.tooltip.size.arrow;\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n }\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n config.box = {\n width : this.props.width,\n height: this.props.height,\n };\n }\n\n if (this.tooltip) {\n this.tooltip.move(config);\n }\n else {\n this.tooltip = this.psv.tooltip.create(config);\n }\n }\n }\n\n /**\n * @summary Hides the tooltip of this marker\n */\n hideTooltip() {\n if (this.tooltip) {\n this.tooltip.hide();\n this.tooltip = null;\n }\n }\n\n /**\n * @summary Updates the marker with new properties\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n update(properties) {\n const newType = Marker.getType(properties, true);\n\n if (newType !== undefined && newType !== this.type) {\n throw new PSVError('cannot change marker type');\n }\n\n utils.deepmerge(this.config, properties);\n if (typeof this.config.tooltip === 'string') {\n this.config.tooltip = { content: this.config.tooltip };\n }\n\n this.data = this.config.data;\n this.visible = this.config.visible !== false;\n\n if (!this.is3d()) {\n // reset CSS class\n if (this.isNormal()) {\n this.$el.setAttribute('class', 'psv-marker psv-marker--normal');\n }\n else {\n this.$el.setAttribute('class', 'psv-marker psv-marker--svg');\n }\n\n // add CSS classes\n if (this.config.className) {\n utils.addClasses(this.$el, this.config.className);\n }\n\n if (this.config.tooltip) {\n utils.addClasses(this.$el, 'psv-marker--has-tooltip');\n }\n if (this.config.content) {\n utils.addClasses(this.$el, 'psv-marler--has-content');\n }\n\n // apply style\n if (this.config.style) {\n utils.deepmerge(this.$el.style, this.config.style);\n }\n }\n\n // parse anchor\n this.props.anchor = utils.parsePosition(this.config.anchor);\n\n // clean scale\n if (this.config.scale) {\n if (typeof this.config.scale === 'number') {\n logWarn('Single value marker scale is deprecated, please use an array of two values.');\n this.config.scale = { zoom: [0, this.config.scale] };\n }\n if (Array.isArray(this.config.scale)) {\n this.config.scale = { zoom: this.config.scale };\n }\n }\n\n if (this.isNormal()) {\n this.__updateNormal();\n }\n else if (this.isPoly()) {\n this.__updatePoly();\n }\n else if (this.isSvg()) {\n this.__updateSvg();\n }\n else if (this.is3d()) {\n this.__update3d();\n }\n }\n\n /**\n * @summary Updates a normal marker\n * @private\n */\n __updateNormal() {\n if (!utils.isExtendedPosition(this.config)) {\n throw new PSVError('missing marker position, latitude/longitude or x/y');\n }\n\n if (this.config.image && (!this.config.width || !this.config.height)) {\n throw new PSVError('missing marker width/height');\n }\n\n if (this.config.width && this.config.height) {\n this.props.dynamicSize = false;\n this.props.width = this.config.width;\n this.props.height = this.config.height;\n this.$el.style.width = this.config.width + 'px';\n this.$el.style.height = this.config.height + 'px';\n }\n else {\n this.props.dynamicSize = true;\n }\n\n if (this.config.image) {\n this.props.def = this.config.image;\n this.$el.style.backgroundImage = `url(${this.config.image})`;\n }\n else if (this.config.html) {\n this.props.def = this.config.html;\n this.$el.innerHTML = this.config.html;\n }\n\n // set anchor\n this.$el.style.transformOrigin = `${this.props.anchor.x * 100}% ${this.props.anchor.y * 100}%`;\n\n // convert texture coordinates to spherical coordinates\n this.props.position = this.psv.dataHelper.cleanPosition(this.config);\n\n // compute x/y/z position\n this.props.positions3D = [this.psv.dataHelper.sphericalCoordsToVector3(this.props.position)];\n }\n\n /**\n * @summary Updates an SVG marker\n * @private\n */\n __updateSvg() {\n if (!utils.isExtendedPosition(this.config)) {\n throw new PSVError('missing marker position, latitude/longitude or x/y');\n }\n\n this.props.dynamicSize = true;\n\n // set content\n switch (this.type) {\n case MARKER_TYPES.square:\n this.props.def = {\n x : 0,\n y : 0,\n width : this.config.square,\n height: this.config.square,\n };\n break;\n\n case MARKER_TYPES.rect:\n if (Array.isArray(this.config.rect)) {\n this.props.def = {\n x : 0,\n y : 0,\n width : this.config.rect[0],\n height: this.config.rect[1],\n };\n }\n else {\n this.props.def = {\n x : 0,\n y : 0,\n width : this.config.rect.width,\n height: this.config.rect.height,\n };\n }\n break;\n\n case MARKER_TYPES.circle:\n this.props.def = {\n cx: this.config.circle,\n cy: this.config.circle,\n r : this.config.circle,\n };\n break;\n\n case MARKER_TYPES.ellipse:\n if (Array.isArray(this.config.ellipse)) {\n this.props.def = {\n cx: this.config.ellipse[0],\n cy: this.config.ellipse[1],\n rx: this.config.ellipse[0],\n ry: this.config.ellipse[1],\n };\n }\n else {\n this.props.def = {\n cx: this.config.ellipse.rx,\n cy: this.config.ellipse.ry,\n rx: this.config.ellipse.rx,\n ry: this.config.ellipse.ry,\n };\n }\n break;\n\n case MARKER_TYPES.path:\n this.props.def = {\n d: this.config.path,\n };\n break;\n\n // no default\n }\n\n utils.each(this.props.def, (value, prop) => {\n this.$el.setAttributeNS(null, prop, value);\n });\n\n // set style\n if (this.config.svgStyle) {\n utils.each(this.config.svgStyle, (value, prop) => {\n this.$el.setAttributeNS(null, utils.dasherize(prop), value);\n });\n }\n else {\n this.$el.setAttributeNS(null, 'fill', 'rgba(0,0,0,0.5)');\n }\n\n // convert texture coordinates to spherical coordinates\n this.props.position = this.psv.dataHelper.cleanPosition(this.config);\n\n // compute x/y/z position\n this.props.positions3D = [this.psv.dataHelper.sphericalCoordsToVector3(this.props.position)];\n }\n\n /**\n * @summary Updates a polygon marker\n * @private\n */\n __updatePoly() {\n this.props.dynamicSize = true;\n\n // set style\n if (this.config.svgStyle) {\n utils.each(this.config.svgStyle, (value, prop) => {\n this.$el.setAttributeNS(null, utils.dasherize(prop), value);\n });\n\n if (this.isPolyline() && !this.config.svgStyle.fill) {\n this.$el.setAttributeNS(null, 'fill', 'none');\n }\n }\n else if (this.isPolygon()) {\n this.$el.setAttributeNS(null, 'fill', 'rgba(0,0,0,0.5)');\n }\n else if (this.isPolyline()) {\n this.$el.setAttributeNS(null, 'fill', 'none');\n this.$el.setAttributeNS(null, 'stroke', 'rgb(0,0,0)');\n }\n\n // fold arrays: [1,2,3,4] => [[1,2],[3,4]]\n const actualPoly = this.config.polygonPx || this.config.polygonRad || this.config.polylinePx || this.config.polylineRad;\n if (!Array.isArray(actualPoly[0])) {\n for (let i = 0; i < actualPoly.length; i++) {\n actualPoly.splice(i, 2, [actualPoly[i], actualPoly[i + 1]]);\n }\n }\n\n // convert texture coordinates to spherical coordinates\n if (this.isPolyPx()) {\n this.props.def = actualPoly.map((coord) => {\n const sphericalCoords = this.psv.dataHelper.textureCoordsToSphericalCoords({ x: coord[0], y: coord[1] });\n return [sphericalCoords.longitude, sphericalCoords.latitude];\n });\n }\n // clean angles\n else {\n this.props.def = actualPoly.map((coord) => {\n return [utils.parseAngle(coord[0]), utils.parseAngle(coord[1], true)];\n });\n }\n\n const centroid = this.isPolygon()\n ? getPolygonCenter(this.props.def)\n : getPolylineCenter(this.props.def);\n\n this.props.position = {\n longitude: centroid[0],\n latitude : centroid[1],\n };\n\n // compute x/y/z positions\n this.props.positions3D = this.props.def.map((coord) => {\n return this.psv.dataHelper.sphericalCoordsToVector3({ longitude: coord[0], latitude: coord[1] });\n });\n }\n\n /**\n * @summary Updates a 3D marker\n * @private\n */\n __update3d() {\n if (!this.config.width || !this.config.height) {\n throw new PSVError('missing marker width/height');\n }\n\n this.props.dynamicSize = false;\n this.props.width = this.config.width;\n this.props.height = this.config.height;\n\n // convert texture coordinates to spherical coordinates\n this.props.position = this.psv.dataHelper.cleanPosition(this.config);\n\n // compute x/y/z position\n this.props.positions3D = [this.psv.dataHelper.sphericalCoordsToVector3(this.props.position)];\n\n switch (this.type) {\n case MARKER_TYPES.imageLayer:\n if (!this.$el) {\n const material = new THREE.MeshBasicMaterial({ transparent: true });\n const geometry = new THREE.PlaneGeometry(1, 1);\n const mesh = new THREE.Mesh(geometry, material);\n mesh.userData = { [MARKER_DATA]: this };\n this.$el = new THREE.Group().add(mesh);\n\n // overwrite the visible property to be tied to the Marker instance\n // and do it without context bleed\n Object.defineProperty(this.$el, 'visible', {\n enumerable: true,\n get : function () {\n return this.children[0].userData[MARKER_DATA].visible;\n },\n set : function (visible) {\n this.children[0].userData[MARKER_DATA].visible = visible;\n },\n });\n }\n\n if (this.props.def !== this.config.imageLayer) {\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(this.config.imageLayer));\n }\n this.$el.children[0].material.map = this.loader.load(this.config.imageLayer, () => this.psv.needsUpdate());\n this.props.def = this.config.imageLayer;\n }\n\n this.$el.children[0].position.set(\n this.props.anchor.x - 0.5,\n this.props.anchor.y - 0.5,\n 0\n );\n\n this.$el.position.copy(this.props.positions3D[0]);\n this.$el.lookAt(0, 0, 0);\n // 100 is magic number that gives a coherent size at default zoom level\n this.$el.scale.set(this.config.width / 100 * SYSTEM.pixelRatio, this.config.height / 100 * SYSTEM.pixelRatio, 1);\n break;\n\n // no default\n }\n }\n\n /**\n * @summary Determines the type of a marker by the available properties\n * @param {Marker.Properties} properties\n * @param {boolean} [allowNone=false]\n * @returns {string}\n * @throws {PSV.PSVError} when the marker's type cannot be found\n */\n static getType(properties, allowNone = false) {\n const found = [];\n\n utils.each(MARKER_TYPES, (type) => {\n if (properties[type]) {\n found.push(type);\n }\n });\n\n if (found.length === 0 && !allowNone) {\n throw new PSVError(`missing marker content, either ${Object.keys(MARKER_TYPES).join(', ')}`);\n }\n else if (found.length > 1) {\n throw new PSVError(`multiple marker content, either ${Object.keys(MARKER_TYPES).join(', ')}`);\n }\n\n return found[0];\n }\n\n}\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport pin from './pin.svg';\n\n/**\n * @summary Navigation bar markers button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MarkersButton extends AbstractButton {\n\n static id = 'markers';\n static icon = pin;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-markers-button', true);\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n */\n this.plugin = this.psv.getPlugin('markers');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.SHOW_MARKERS, this);\n this.plugin.on(EVENTS.HIDE_MARKERS, this);\n\n this.toggleActive(true);\n }\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.SHOW_MARKERS, this);\n this.plugin.off(EVENTS.HIDE_MARKERS, this);\n }\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return this.plugin?.config.hideButton;\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.SHOW_MARKERS: this.toggleActive(true); break;\n case EVENTS.HIDE_MARKERS: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles markers\n */\n onClick() {\n if (this.plugin.prop.visible) {\n this.plugin.hide();\n }\n else {\n this.plugin.show();\n }\n }\n\n}\n","import { AbstractButton, CONSTANTS } from '../..';\nimport { ID_PANEL_MARKERS_LIST } from './constants';\nimport pinList from './pin-list.svg';\n\n/**\n * @summary Navigation bar markers list button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MarkersListButton extends AbstractButton {\n\n static id = 'markersList';\n static icon = pinList;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-markers-list-button', true);\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n */\n this.plugin = this.psv.getPlugin('markers');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return this.plugin?.config.listButton;\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 CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === ID_PANEL_MARKERS_LIST); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles markers list\n */\n onClick() {\n this.plugin.toggleMarkersList();\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport {\n EVENTS,\n ID_PANEL_MARKER,\n ID_PANEL_MARKERS_LIST,\n MARKER_DATA,\n MARKERS_LIST_TEMPLATE,\n SVG_NS\n} from './constants';\nimport { Marker } from './Marker';\nimport { MarkersButton } from './MarkersButton';\nimport { MarkersListButton } from './MarkersListButton';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.MarkersPlugin.Options\n * @property {boolean} [hideButton=true] - adds a button to show/hide the markers\n * @property {boolean} [listButton=true] - adds a button to show the list of markers\n * @property {boolean} [clickEventOnMarker=false] If a `click` event is triggered on the viewer additionally to the `select-marker` event.\n * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers]\n */\n\n/**\n * @typedef {Object} PSV.plugins.MarkersPlugin.SelectMarkerData\n * @summary Data of the `select-marker` event\n * @property {boolean} dblclick - if the selection originated from a double click, the simple click is always fired before the double click\n * @property {boolean} rightclick - if the selection originated from a right click\n */\n\n\n// add markers buttons\nDEFAULTS.lang[MarkersButton.id] = 'Markers';\nDEFAULTS.lang[MarkersListButton.id] = 'Markers list';\nregisterButton(MarkersButton, 'caption:left');\nregisterButton(MarkersListButton, 'caption:left');\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Displays various markers on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class MarkersPlugin extends AbstractPlugin {\n\n static id = 'markers';\n\n /**\n * @deprecated use the EVENTS constants of the module\n */\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.MarkersPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @summary All registered markers\n * @member {Object}\n */\n this.markers = {};\n\n /**\n * @type {Object}\n * @property {boolean} visible - Visibility of the component\n * @property {PSV.plugins.MarkersPlugin.Marker} currentMarker - Last selected marker\n * @property {PSV.plugins.MarkersPlugin.Marker} hoveringMarker - Marker under the cursor\n * @private\n */\n this.prop = {\n visible : true,\n currentMarker : null,\n hoveringMarker: null,\n stopObserver : null,\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin.Options}\n */\n this.config = {\n hideButton : true,\n listButton : true,\n clickEventOnMarker: false,\n ...options,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = 'psv-markers';\n this.container.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n\n /**\n * @member {SVGElement}\n * @readonly\n */\n this.svgContainer = document.createElementNS(SVG_NS, 'svg');\n this.svgContainer.setAttribute('class', 'psv-markers-svg-container');\n this.container.appendChild(this.svgContainer);\n\n // Markers events via delegation\n this.container.addEventListener('mouseenter', this, true);\n this.container.addEventListener('mouseleave', this, true);\n this.container.addEventListener('mousemove', this, true);\n this.container.addEventListener('contextmenu', this);\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.container.appendChild(this.container);\n\n // Viewer events\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n this.psv.on(CONSTANTS.EVENTS.DOUBLE_CLICK, this);\n this.psv.on(CONSTANTS.EVENTS.RENDER, this);\n this.psv.on(CONSTANTS.EVENTS.CONFIG_CHANGED, this);\n\n if (this.config.markers) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.setMarkers(this.config.markers);\n delete this.config.markers;\n });\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.clearMarkers(false);\n\n this.prop.stopObserver?.();\n\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n this.psv.off(CONSTANTS.EVENTS.DOUBLE_CLICK, this);\n this.psv.off(CONSTANTS.EVENTS.RENDER, this);\n this.psv.off(CONSTANTS.EVENTS.CONFIG_CHANGED, this);\n\n this.psv.container.removeChild(this.container);\n\n delete this.svgContainer;\n delete this.markers;\n delete this.container;\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 'mouseenter': this.__onMouseEnter(e, this.__getTargetMarker(e.target)); break;\n case 'mouseleave': this.__onMouseLeave(e, this.__getTargetMarker(e.target)); break;\n case 'mousemove': this.__onMouseMove(e, this.__getTargetMarker(e.target)); break;\n case 'contextmenu': e.preventDefault(); break;\n case CONSTANTS.EVENTS.CLICK: this.__onClick(e, e.args[0], false); break;\n case CONSTANTS.EVENTS.DOUBLE_CLICK: this.__onClick(e, e.args[0], true); break;\n case CONSTANTS.EVENTS.RENDER: this.renderMarkers(); break;\n case CONSTANTS.OBJECT_EVENTS.ENTER_OBJECT: this.__onMouseEnter(e.detail.originalEvent, e.detail.data); break;\n case CONSTANTS.OBJECT_EVENTS.LEAVE_OBJECT: this.__onMouseLeave(e.detail.originalEvent, e.detail.data); break;\n case CONSTANTS.OBJECT_EVENTS.HOVER_OBJECT: this.__onMouseMove(e.detail.originalEvent, e.detail.data); break;\n case CONSTANTS.EVENTS.CONFIG_CHANGED:\n this.container.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Shows all markers\n * @fires PSV.plugins.MarkersPlugin.show-markers\n */\n show() {\n this.prop.visible = true;\n\n this.renderMarkers();\n\n this.trigger(EVENTS.SHOW_MARKERS);\n }\n\n /**\n * @summary Hides all markers\n * @fires PSV.plugins.MarkersPlugin.hide-markers\n */\n hide() {\n this.prop.visible = false;\n\n this.renderMarkers();\n\n this.trigger(EVENTS.HIDE_MARKERS);\n }\n\n /**\n * @summary Toggles the visibility of all tooltips\n */\n toggleAllTooltips() {\n this.prop.showAllTooltips = !this.prop.showAllTooltips;\n this.renderMarkers();\n }\n\n /**\n * @summary Displays all tooltips\n */\n showAllTooltips() {\n this.prop.showAllTooltips = true;\n this.renderMarkers();\n }\n\n /**\n * @summary Hides all tooltips\n */\n hideAllTooltips() {\n this.prop.showAllTooltips = false;\n this.renderMarkers();\n }\n\n /**\n * @summary Returns the total number of markers\n * @returns {number}\n */\n getNbMarkers() {\n return Object.keys(this.markers).length;\n }\n\n /**\n * @summary Returns all the markers\n * @return {PSV.plugins.MarkersPlugin.Marker[]}\n */\n getMarkers() {\n return Object.values(this.markers);\n }\n\n /**\n * @summary Adds a new marker to viewer\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @param {boolean} [render=true] - renders the marker immediately\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n * @throws {PSV.PSVError} when the marker's id is missing or already exists\n */\n addMarker(properties, render = true) {\n if (this.markers[properties.id]) {\n throw new PSVError(`marker \"${properties.id}\" already exists`);\n }\n\n const marker = new Marker(properties, this.psv);\n\n if (marker.isNormal()) {\n this.container.appendChild(marker.$el);\n }\n else if (marker.isPoly() || marker.isSvg()) {\n this.svgContainer.appendChild(marker.$el);\n }\n else if (marker.is3d()) {\n this.psv.renderer.scene.add(marker.$el);\n }\n\n this.markers[marker.id] = marker;\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n\n return marker;\n }\n\n /**\n * @summary Returns the internal marker object for a marker id\n * @param {string} markerId\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n * @throws {PSV.PSVError} when the marker cannot be found\n */\n getMarker(markerId) {\n const id = typeof markerId === 'object' ? markerId.id : markerId;\n\n if (!this.markers[id]) {\n throw new PSVError(`cannot find marker \"${id}\"`);\n }\n\n return this.markers[id];\n }\n\n /**\n * @summary Returns the last marker selected by the user\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n */\n getCurrentMarker() {\n return this.prop.currentMarker;\n }\n\n /**\n * @summary Updates the existing marker with the same id\n * @description Every property can be changed but you can't change its type (Eg: `image` to `html`).\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @param {boolean} [render=true] - renders the marker immediately\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n */\n updateMarker(properties, render = true) {\n const marker = this.getMarker(properties.id);\n\n marker.update(properties);\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n\n if (marker.is3d()) {\n this.psv.needsUpdate();\n }\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n\n return marker;\n }\n\n /**\n * @summary Removes a marker from the viewer\n * @param {string} markerId\n * @param {boolean} [render=true] - renders the marker immediately\n */\n removeMarker(markerId, render = true) {\n const marker = this.getMarker(markerId);\n\n if (marker.isNormal()) {\n this.container.removeChild(marker.$el);\n }\n else if (marker.isPoly() || marker.isSvg()) {\n this.svgContainer.removeChild(marker.$el);\n }\n else if (marker.is3d()) {\n this.psv.renderer.scene.remove(marker.$el);\n this.psv.needsUpdate();\n }\n\n if (this.prop.hoveringMarker === marker) {\n this.prop.hoveringMarker = null;\n }\n\n if (this.prop.currentMarker === marker) {\n this.prop.currentMarker = null;\n }\n\n marker.hideTooltip();\n\n marker.destroy();\n delete this.markers[marker.id];\n\n if (render) {\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Removes multiple markers\n * @param {string[]} markerIds\n * @param {boolean} [render=true] - renders the markers immediately\n */\n removeMarkers(markerIds, render = true) {\n markerIds.forEach(markerId => this.removeMarker(markerId, false));\n\n if (render) {\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Replaces all markers\n * @param {PSV.plugins.MarkersPlugin.Properties[]} markers\n * @param {boolean} [render=true] - renders the marker immediately\n */\n setMarkers(markers, render = true) {\n this.clearMarkers(false);\n\n utils.each(markers, marker => this.addMarker(marker, false));\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Removes all markers\n * @param {boolean} [render=true] - renders the markers immediately\n */\n clearMarkers(render = true) {\n utils.each(this.markers, marker => this.removeMarker(marker, false));\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Rotate the view to face the marker\n * @param {string} markerId\n * @param {string|number} [speed] - rotates smoothy, see {@link PSV.Viewer#animate}\n * @fires PSV.plugins.MarkersPlugin.goto-marker-done\n * @return {PSV.Animation} A promise that will be resolved when the animation finishes\n */\n gotoMarker(markerId, speed) {\n const marker = this.getMarker(markerId);\n\n return this.psv.animate({\n ...marker.props.position,\n speed,\n })\n .then(() => {\n this.trigger(EVENTS.GOTO_MARKER_DONE, marker);\n });\n }\n\n /**\n * @summary Hides a marker\n * @param {string} markerId\n */\n hideMarker(markerId) {\n this.toggleMarker(markerId, false);\n }\n\n /**\n * @summary Shows a marker\n * @param {string} markerId\n */\n showMarker(markerId) {\n this.toggleMarker(markerId, true);\n }\n\n /**\n * @summary Toggles a marker\n * @param {string} markerId\n * @param {boolean} [visible]\n */\n toggleMarker(markerId, visible = null) {\n const marker = this.getMarker(markerId);\n marker.visible = visible === null ? !marker.visible : visible;\n if (marker.is3d()) {\n this.psv.needsUpdate();\n }\n else {\n this.renderMarkers();\n }\n }\n\n /**\n * @summary Opens the panel with the content of the marker\n * @param {string} markerId\n */\n showMarkerPanel(markerId) {\n const marker = this.getMarker(markerId);\n\n if (marker?.config?.content) {\n this.psv.panel.show({\n id : ID_PANEL_MARKER,\n content: marker.config.content,\n });\n }\n else {\n this.psv.panel.hide(ID_PANEL_MARKER);\n }\n }\n\n /**\n * @summary Toggles the visibility of the list of markers\n */\n toggleMarkersList() {\n if (this.psv.panel.prop.contentId === ID_PANEL_MARKERS_LIST) {\n this.hideMarkersList();\n }\n else {\n this.showMarkersList();\n }\n }\n\n /**\n * @summary Opens side panel with the list of markers\n * @fires PSV.plugins.MarkersPlugin.filter:render-markers-list\n */\n showMarkersList() {\n let markers = [];\n utils.each(this.markers, (marker) => {\n if (marker.visible && !marker.config.hideList) {\n markers.push(marker);\n }\n });\n\n markers = this.change(EVENTS.RENDER_MARKERS_LIST, markers);\n\n this.psv.panel.show({\n id : ID_PANEL_MARKERS_LIST,\n content : MARKERS_LIST_TEMPLATE(\n markers,\n this.psv.config.lang[MarkersButton.id],\n utils.dasherize(MARKER_DATA)\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const markerId = li ? li.dataset[MARKER_DATA] : undefined;\n\n if (markerId) {\n const marker = this.getMarker(markerId);\n\n this.trigger(EVENTS.SELECT_MARKER_LIST, marker);\n\n this.gotoMarker(marker, 1000);\n this.hideMarkersList();\n }\n },\n });\n }\n\n /**\n * @summary Closes side panel if it contains the list of markers\n */\n hideMarkersList() {\n this.psv.panel.hide(ID_PANEL_MARKERS_LIST);\n }\n\n /**\n * @summary Updates the visibility and the position of all markers\n */\n renderMarkers() {\n const zoomLevel = this.psv.getZoomLevel();\n const viewerPosition = this.psv.getPosition();\n\n utils.each(this.markers, (marker) => {\n let isVisible = this.prop.visible && marker.visible;\n let position = null;\n\n if (isVisible && marker.is3d()) {\n position = this.__getMarkerPosition(marker);\n isVisible = this.__isMarkerVisible(marker, position);\n }\n else if (isVisible && marker.isPoly()) {\n const positions = this.__getPolyPositions(marker);\n isVisible = positions.length > (marker.isPolygon() ? 2 : 1);\n\n if (isVisible) {\n position = this.__getMarkerPosition(marker);\n\n const points = positions.map(pos => (pos.x - position.x) + ',' + (pos.y - position.y)).join(' ');\n\n marker.$el.setAttributeNS(null, 'points', points);\n marker.$el.setAttributeNS(null, 'transform', `translate(${position.x} ${position.y})`);\n }\n }\n else if (isVisible) {\n if (marker.props.dynamicSize) {\n this.__updateMarkerSize(marker);\n }\n\n position = this.__getMarkerPosition(marker);\n isVisible = this.__isMarkerVisible(marker, position);\n\n if (isVisible) {\n const scale = marker.getScale(zoomLevel, viewerPosition);\n\n if (marker.isSvg()) {\n // simulate transform-origin relative to SVG element\n const x = position.x + marker.props.width * marker.props.anchor.x * (1 - scale);\n const y = position.y + marker.props.width * marker.props.anchor.y * (1 - scale);\n marker.$el.setAttributeNS(null, 'transform', `translate(${x}, ${y}) scale(${scale}, ${scale})`);\n }\n else {\n marker.$el.style.transform = `translate3D(${position.x}px, ${position.y}px, 0px) scale(${scale}, ${scale})`;\n }\n }\n }\n\n marker.props.position2D = isVisible ? position : null;\n\n if (!marker.is3d()) {\n utils.toggleClass(marker.$el, 'psv-marker--visible', isVisible);\n }\n\n if (isVisible && (this.prop.showAllTooltips || (marker === this.prop.hoveringMarker && !marker.isPoly()))) {\n marker.showTooltip();\n }\n else if (!isVisible || marker !== this.prop.hoveringMarker) {\n marker.hideTooltip();\n }\n });\n }\n\n /**\n * @summary Determines if a point marker is visible
\n * It tests if the point is in the general direction of the camera, then check if it's in the viewport\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.Point} position\n * @returns {boolean}\n * @private\n */\n __isMarkerVisible(marker, position) {\n return marker.props.positions3D[0].dot(this.psv.prop.direction) > 0\n && position.x + marker.props.width >= 0\n && position.x - marker.props.width <= this.psv.prop.size.width\n && position.y + marker.props.height >= 0\n && position.y - marker.props.height <= this.psv.prop.size.height;\n }\n\n /**\n * @summary Computes the real size of a marker\n * @description This is done by removing all it's transformations (if any) and making it visible\n * before querying its bounding rect\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __updateMarkerSize(marker) {\n utils.addClasses(marker.$el, 'psv-marker--transparent');\n\n let transform;\n if (marker.isSvg()) {\n transform = marker.$el.getAttributeNS(null, 'transform');\n marker.$el.removeAttributeNS(null, 'transform');\n }\n else {\n transform = marker.$el.style.transform;\n marker.$el.style.transform = '';\n }\n\n const rect = marker.$el.getBoundingClientRect();\n marker.props.width = rect.width;\n marker.props.height = rect.height;\n\n utils.removeClasses(marker.$el, 'psv-marker--transparent');\n\n if (transform) {\n if (marker.isSvg()) {\n marker.$el.setAttributeNS(null, 'transform', transform);\n }\n else {\n marker.$el.style.transform = transform;\n }\n }\n\n // the size is no longer dynamic once known\n marker.props.dynamicSize = false;\n }\n\n /**\n * @summary Computes viewer coordinates of a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @returns {PSV.Point}\n * @private\n */\n __getMarkerPosition(marker) {\n if (marker.isPoly()) {\n return this.psv.dataHelper.sphericalCoordsToViewerCoords(marker.props.position);\n }\n else {\n const position = this.psv.dataHelper.vector3ToViewerCoords(marker.props.positions3D[0]);\n\n position.x -= marker.props.width * marker.props.anchor.x;\n position.y -= marker.props.height * marker.props.anchor.y;\n\n return position;\n }\n }\n\n /**\n * @summary Computes viewer coordinates of each point of a polygon/polyline
\n * It handles points behind the camera by creating intermediary points suitable for the projector\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @returns {PSV.Point[]}\n * @private\n */\n __getPolyPositions(marker) {\n const nbVectors = marker.props.positions3D.length;\n\n // compute if each vector is visible\n const positions3D = marker.props.positions3D.map((vector) => {\n return {\n vector : vector,\n visible: vector.dot(this.psv.prop.direction) > 0,\n };\n });\n\n // get pairs of visible/invisible vectors for each invisible vector connected to a visible vector\n const toBeComputed = [];\n positions3D.forEach((pos, i) => {\n if (!pos.visible) {\n const neighbours = [\n i === 0 ? positions3D[nbVectors - 1] : positions3D[i - 1],\n i === nbVectors - 1 ? positions3D[0] : positions3D[i + 1],\n ];\n\n neighbours.forEach((neighbour) => {\n if (neighbour.visible) {\n toBeComputed.push({\n visible : neighbour,\n invisible: pos,\n index : i,\n });\n }\n });\n }\n });\n\n // compute intermediary vector for each pair (the loop is reversed for splice to insert at the right place)\n toBeComputed.reverse().forEach((pair) => {\n positions3D.splice(pair.index, 0, {\n vector : this.__getPolyIntermediaryPoint(pair.visible.vector, pair.invisible.vector),\n visible: true,\n });\n });\n\n // translate vectors to screen pos\n return positions3D\n .filter(pos => pos.visible)\n .map(pos => this.psv.dataHelper.vector3ToViewerCoords(pos.vector));\n }\n\n /**\n * Given one point in the same direction of the camera and one point behind the camera,\n * computes an intermediary point on the great circle delimiting the half sphere visible by the camera.\n * The point is shifted by .01 rad because the projector cannot handle points exactly on this circle.\n * TODO : does not work with fisheye view (must not use the great circle)\n * {@link http://math.stackexchange.com/a/1730410/327208}\n * @param P1 {external:THREE.Vector3}\n * @param P2 {external:THREE.Vector3}\n * @returns {external:THREE.Vector3}\n * @private\n */\n __getPolyIntermediaryPoint(P1, P2) {\n const C = this.psv.prop.direction.clone().normalize();\n const N = new THREE.Vector3().crossVectors(P1, P2).normalize();\n const V = new THREE.Vector3().crossVectors(N, P1).normalize();\n const X = P1.clone().multiplyScalar(-C.dot(V));\n const Y = V.clone().multiplyScalar(C.dot(P1));\n const H = new THREE.Vector3().addVectors(X, Y).normalize();\n const a = new THREE.Vector3().crossVectors(H, C);\n return H.applyAxisAngle(a, 0.01).multiplyScalar(CONSTANTS.SPHERE_RADIUS);\n }\n\n /**\n * @summary Returns the marker associated to an event target\n * @param {EventTarget} target\n * @param {boolean} [closest=false]\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n * @private\n */\n __getTargetMarker(target, closest = false) {\n const target2 = closest ? utils.getClosest(target, '.psv-marker') : target;\n return target2 ? target2[MARKER_DATA] : undefined;\n }\n\n /**\n * @summary Checks if an event target is in the tooltip\n * @param {EventTarget} target\n * @param {PSV.components.Tooltip} tooltip\n * @returns {boolean}\n * @private\n */\n __targetOnTooltip(target, tooltip) {\n return target && tooltip ? utils.hasParent(target, tooltip.container) : false;\n }\n\n /**\n * @summary Handles mouse enter events, show the tooltip for non polygon markers\n * @param {MouseEvent} e\n * @param {PSV.plugins.MarkersPlugin.Marker} [marker]\n * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseEnter(e, marker) {\n if (marker && !marker.isPoly()) {\n this.prop.hoveringMarker = marker;\n\n this.trigger(EVENTS.OVER_MARKER, marker);\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n }\n\n /**\n * @summary Handles mouse leave events, hide the tooltip\n * @param {MouseEvent} e\n * @param {PSV.plugins.MarkersPlugin.Marker} [marker]\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @private\n */\n __onMouseLeave(e, marker) {\n // do not hide if we enter the tooltip itself while hovering a polygon\n if (marker && !(marker.isPoly() && this.__targetOnTooltip(e.relatedTarget, marker.tooltip))) {\n this.trigger(EVENTS.LEAVE_MARKER, marker);\n\n this.prop.hoveringMarker = null;\n\n if (!this.prop.showAllTooltips) {\n marker.hideTooltip();\n }\n }\n }\n\n /**\n * @summary Handles mouse move events, refreshUi the tooltip for polygon markers\n * @param {MouseEvent} e\n * @param {PSV.plugins.MarkersPlugin.Marker} [targetMarker]\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseMove(e, targetMarker) {\n let marker;\n\n if (targetMarker?.isPoly()) {\n marker = targetMarker;\n }\n // do not hide if we enter the tooltip itself while hovering a polygon\n else if (this.prop.hoveringMarker && this.__targetOnTooltip(e.target, this.prop.hoveringMarker.tooltip)) {\n marker = this.prop.hoveringMarker;\n }\n\n if (marker) {\n if (!this.prop.hoveringMarker) {\n this.trigger(EVENTS.OVER_MARKER, marker);\n\n this.prop.hoveringMarker = marker;\n }\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n else if (this.prop.hoveringMarker?.isPoly()) {\n this.trigger(EVENTS.LEAVE_MARKER, this.prop.hoveringMarker);\n\n if (!this.prop.showAllTooltips) {\n this.prop.hoveringMarker.hideTooltip();\n }\n\n this.prop.hoveringMarker = null;\n }\n }\n\n /**\n * @summary Handles mouse click events, select the marker and open the panel if necessary\n * @param {Event} e\n * @param {Object} data\n * @param {boolean} dblclick\n * @fires PSV.plugins.MarkersPlugin.select-marker\n * @fires PSV.plugins.MarkersPlugin.unselect-marker\n * @private\n */\n __onClick(e, data, dblclick) {\n let marker = data.objects.find(o => o.userData[MARKER_DATA])?.userData[MARKER_DATA];\n\n if (!marker) {\n marker = this.__getTargetMarker(data.target, true);\n }\n\n if (marker) {\n this.prop.currentMarker = marker;\n\n this.trigger(EVENTS.SELECT_MARKER, marker, {\n dblclick : dblclick,\n rightclick: data.rightclick,\n });\n\n if (this.config.clickEventOnMarker) {\n // add the marker to event data\n data.marker = marker;\n }\n else {\n e.stopPropagation();\n }\n\n // the marker could have been deleted in an event handler\n if (this.markers[marker.id]) {\n this.showMarkerPanel(marker.id);\n }\n }\n else if (this.prop.currentMarker) {\n this.trigger(EVENTS.UNSELECT_MARKER, this.prop.currentMarker);\n\n this.psv.panel.hide(ID_PANEL_MARKER);\n\n this.prop.currentMarker = null;\n }\n }\n\n /**\n * @summary Updates the visiblity of the panel and the buttons\n * @private\n */\n __refreshUi() {\n const nbMarkers = Object.values(this.markers).filter(m => !m.config.hideList).length;\n const markersButton = this.psv.navbar.getButton(MarkersButton.id, false);\n const markersListButton = this.psv.navbar.getButton(MarkersListButton.id, false);\n\n if (nbMarkers === 0) {\n markersButton?.hide();\n markersListButton?.hide();\n\n if (this.psv.panel.isVisible(ID_PANEL_MARKERS_LIST)) {\n this.psv.panel.hide();\n }\n else if (this.psv.panel.isVisible(ID_PANEL_MARKER)) {\n this.psv.panel.hide();\n }\n }\n else {\n if (this.config.hideButton) {\n markersButton?.show();\n }\n if (this.config.listButton) {\n markersListButton?.show();\n }\n\n if (this.psv.panel.isVisible(ID_PANEL_MARKERS_LIST)) {\n this.showMarkersList();\n }\n else if (this.psv.panel.isVisible(ID_PANEL_MARKER)) {\n this.prop.currentMarker ? this.showMarkerPanel(this.prop.currentMarker) : this.psv.panel.hide();\n }\n }\n }\n\n /**\n * @summary Adds or remove the objects observer if there are 3D markers\n * @private\n */\n __checkObjectsObserver() {\n const has3d = Object.values(this.markers).some(marker => marker.is3d());\n\n if (!has3d && this.prop.stopObserver) {\n this.prop.stopObserver();\n this.prop.stopObserver = null;\n }\n else if (has3d && !this.prop.stopObserver) {\n this.prop.stopObserver = this.psv.observeObjects(MARKER_DATA, this);\n }\n }\n\n}\n"],"names":["EVENTS","GOTO_MARKER_DONE","LEAVE_MARKER","OVER_MARKER","RENDER_MARKERS_LIST","SELECT_MARKER","SELECT_MARKER_LIST","UNSELECT_MARKER","HIDE_MARKERS","SET_MARKERS","SHOW_MARKERS","SVG_NS","MARKER_DATA","ID_PANEL_MARKER","ID_PANEL_MARKERS_LIST","MARKERS_LIST_TEMPLATE","markers","title","dataKey","icon","map","marker","config","id","type","image","getListContent","join","getShortestArc","from","to","tCandidates","Math","PI","reduce","value","candidate","newCandidate","abs","Infinity","PSVError","message","Error","captureStackTrace","stack","prototype","Object","create","name","constructor","logWarn","console","warn","THREE","Quaternion","greatArcIntermediaryPoint","p1","p2","f","λ1","φ1","λ2","φ2","r","utils","greatArcDistance","a","sin","b","x","cos","y","z","atan2","sqrt","getPolygonCenter","polygon","workPoints","k","i","length","d","push","sum","intermediary","point","parseAngle","getPolylineCenter","polyline","lengths","l","CONSTANTS","SPHERE_RADIUS","consumed","j","round","MARKER_TYPES","imageLayer","html","polygonPx","polygonRad","polylinePx","polylineRad","square","rect","circle","ellipse","path","Marker","properties","psv","getType","visible","$el","data","undefined","tooltip","props","dynamicSize","anchor","position","position2D","positions3D","width","height","def","loader","is3d","TextureLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","isNormal","document","createElement","isPolygon","createElementNS","isPolyline","isSvg","update","destroy","isPoly","isPolyPx","isPolyRad","getScale","zoomLevel","scale","Array","isArray","zoom","bounds","EASINGS","inQuad","longitude","halfFov","degToRad","prop","hFov","arc","outQuad","max","listContent","content","showTooltip","mousePosition","viewerPos","getPosition","container","box","size","arrow","top","clientY","left","clientX","move","hideTooltip","hide","newType","deepmerge","setAttribute","className","addClasses","style","parsePosition","__updateNormal","__updatePoly","__updateSvg","__update3d","isExtendedPosition","backgroundImage","innerHTML","transformOrigin","dataHelper","cleanPosition","sphericalCoordsToVector3","cx","cy","rx","ry","each","setAttributeNS","svgStyle","dasherize","fill","actualPoly","splice","coord","sphericalCoords","textureCoordsToSphericalCoords","latitude","centroid","material","MeshBasicMaterial","transparent","geometry","PlaneGeometry","mesh","Mesh","userData","Group","add","defineProperty","enumerable","get","children","set","load","needsUpdate","copy","lookAt","SYSTEM","pixelRatio","allowNone","found","keys","MarkersButton","navbar","plugin","getPlugin","on","toggleActive","off","isSupported","hideButton","handleEvent","e","onClick","show","AbstractButton","pin","MarkersListButton","OPEN_PANEL","CLOSE_PANEL","listButton","args","toggleMarkersList","pinList","DEFAULTS","lang","registerButton","MarkersPlugin","options","currentMarker","hoveringMarker","stopObserver","clickEventOnMarker","cursor","mousemove","svgContainer","appendChild","addEventListener","init","CLICK","DOUBLE_CLICK","RENDER","CONFIG_CHANGED","once","READY","setMarkers","clearMarkers","removeChild","__onMouseEnter","__getTargetMarker","target","__onMouseLeave","__onMouseMove","preventDefault","__onClick","renderMarkers","OBJECT_EVENTS","ENTER_OBJECT","detail","originalEvent","LEAVE_OBJECT","HOVER_OBJECT","trigger","toggleAllTooltips","showAllTooltips","hideAllTooltips","getNbMarkers","getMarkers","values","addMarker","render","renderer","scene","__refreshUi","__checkObjectsObserver","getMarker","markerId","getCurrentMarker","updateMarker","removeMarker","remove","removeMarkers","markerIds","forEach","gotoMarker","speed","animate","then","hideMarker","toggleMarker","showMarker","showMarkerPanel","panel","contentId","hideMarkersList","showMarkersList","hideList","change","noMargin","clickHandler","li","getClosest","dataset","getZoomLevel","viewerPosition","isVisible","__getMarkerPosition","__isMarkerVisible","positions","__getPolyPositions","points","pos","__updateMarkerSize","transform","toggleClass","dot","direction","getAttributeNS","removeAttributeNS","getBoundingClientRect","removeClasses","sphericalCoordsToViewerCoords","vector3ToViewerCoords","nbVectors","vector","toBeComputed","neighbours","neighbour","invisible","index","reverse","pair","__getPolyIntermediaryPoint","filter","P1","P2","C","clone","normalize","N","Vector3","crossVectors","V","X","multiplyScalar","Y","H","addVectors","applyAxisAngle","closest","target2","__targetOnTooltip","hasParent","relatedTarget","targetMarker","dblclick","objects","find","o","rightclick","stopPropagation","nbMarkers","m","markersButton","getButton","markersListButton","has3d","some","observeObjects","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAK,kBAPD;;EAQpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAdD;;EAepB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aArBD;;EAsBpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,mBAAmB,EAAE,qBA7BD;;EA8BpB;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAQ,eAtCD;;EAuCpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAG,oBA7CD;;EA8CpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAM,iBApDD;;EAqDpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cA1DD;;EA2DpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aAjED;;EAkEpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS;EAvED;EA0EtB;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,MAAM,GAAG,4BAAf;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,WAAW,GAAG,WAApB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,eAAe,GAAG,QAAxB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,qBAAqB,GAAG,aAA9B;EAEP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,qBAAqB,GAAG,SAAxBA,qBAAwB,CAACC,OAAD,EAAUC,KAAV,EAAiBC,OAAjB;EAAA,8GAEAC,OAFA,SAEQ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B,YAAAA,iBAAiB,CAAEvJ,IAAnB;EACD;;EAED,UAAI,KAAK3I,GAAL,CAASyN,KAAT,CAAea,SAAf,CAAyBtU,qBAAzB,CAAJ,EAAqD;EACnD,aAAK4T,eAAL;EACD,OAFD,MAGK,IAAI,KAAK5N,GAAL,CAASyN,KAAT,CAAea,SAAf,CAAyBvU,eAAzB,CAAJ,EAA+C;EAClD,aAAKgJ,IAAL,CAAU2G,aAAV,GAA0B,KAAK8D,eAAL,CAAqB,KAAKzK,IAAL,CAAU2G,aAA/B,CAA1B,GAA0E,KAAK1J,GAAL,CAASyN,KAAT,CAAerJ,IAAf,EAA1E;EACD;EACF;EACF;EAED;EACF;EACA;EACA;EAj5BA;;EAAA,SAk5BEmI,sBAl5BF,GAk5BE,kCAAyB;EACvB,QAAM4F,KAAK,GAAGnW,MAAM,CAACiQ,MAAP,CAAc,KAAK/R,OAAnB,EAA4BkY,IAA5B,CAAiC,UAAA7X,MAAM;EAAA,aAAIA,MAAM,CAAC0G,IAAP,EAAJ;EAAA,KAAvC,CAAd;;EAEA,QAAI,CAACkR,KAAD,IAAU,KAAKpP,IAAL,CAAU6G,YAAxB,EAAsC;EACpC,WAAK7G,IAAL,CAAU6G,YAAV;EACA,WAAK7G,IAAL,CAAU6G,YAAV,GAAyB,IAAzB;EACD,KAHD,MAIK,IAAIuI,KAAK,IAAI,CAAC,KAAKpP,IAAL,CAAU6G,YAAxB,EAAsC;EACzC,WAAK7G,IAAL,CAAU6G,YAAV,GAAyB,KAAK5J,GAAL,CAASqS,cAAT,CAAwBvY,WAAxB,EAAqC,IAArC,CAAzB;EACD;EACF,GA55BH;;EAAA;EAAA,EAAmCwY,gCAAnC;EAAa9I,cAEJ/O,KAAK;EAFD+O,cAOJtQ,SAASA;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"markers.js","sources":["../../src/plugins/markers/constants.js","../../src/utils/math.js","../../src/PSVError.js","../../src/utils/psv.js","../../src/plugins/markers/utils.js","../../src/plugins/markers/Marker.js","../../src/plugins/markers/MarkersButton.js","../../src/plugins/markers/MarkersListButton.js","../../src/plugins/markers/index.js"],"sourcesContent":["import icon from './pin-list.svg';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.MarkersPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event goto-marker-done\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the animation to a marker is done\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n GOTO_MARKER_DONE : 'goto-marker-done',\n /**\n * @event leave-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user puts the cursor away from a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n LEAVE_MARKER : 'leave-marker',\n /**\n * @event over-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user puts the cursor hover a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n OVER_MARKER : 'over-marker',\n /**\n * @event filter:render-markers-list\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Used to alter the list of markers displayed on the side-panel\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n * @returns {PSV.plugins.MarkersPlugin.Marker[]}\n */\n RENDER_MARKERS_LIST: 'render-markers-list',\n /**\n * @event select-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler\n * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker}\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data\n */\n SELECT_MARKER : 'select-marker',\n /**\n * @event select-marker-list\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when a marker is selected from the side panel\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n SELECT_MARKER_LIST : 'select-marker-list',\n /**\n * @event unselect-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when a marker was selected and the user clicks elsewhere\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n UNSELECT_MARKER : 'unselect-marker',\n /**\n * @event hide-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are hidden\n */\n HIDE_MARKERS : 'hide-markers',\n /**\n * @event set-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the list of markers changes\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n */\n SET_MARKERS : 'set-markers',\n /**\n * @event show-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are shown\n */\n SHOW_MARKERS : 'show-markers',\n};\n\n/**\n * @summary Namespace for SVG creation\n * @type {string}\n * @constant\n * @private\n */\nexport const SVG_NS = 'http://www.w3.org/2000/svg';\n\n/**\n * @summary Property name added to marker elements\n * @type {string}\n * @constant\n * @private\n */\nexport const MARKER_DATA = 'psvMarker';\n\n/**\n * @summary Panel identifier for marker content\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL_MARKER = 'marker';\n\n/**\n * @summary Panel identifier for markers list\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL_MARKERS_LIST = 'markersList';\n\n/**\n * @summary Markers list template\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n * @param {string} title\n * @param {string} dataKey\n * @returns {string}\n * @constant\n * @private\n */\nexport const MARKERS_LIST_TEMPLATE = (markers, title, dataKey) => `\n
\n

${icon} ${title}

\n
    \n ${markers.map(marker => `\n
  • \n ${marker.type === 'image' ? `` : ''}\n ${marker.getListContent()}\n
  • \n `).join('')}\n
\n
\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 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 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 * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound } 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.Math.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.Math.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 = (zeroCenter ? parsed + Math.PI : parsed) % (Math.PI * 2);\n\n if (parsed < 0) {\n parsed += Math.PI * 2;\n }\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 { CONSTANTS, utils } from '../..';\n\n/**\n * Returns intermediary point between two points on the sphere\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @param {number[]} p1\n * @param {number[]} p2\n * @param {number} f\n * @returns {number[]}\n * @private\n */\nexport function greatArcIntermediaryPoint(p1, p2, f) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const r = utils.greatArcDistance(p1, p2);\n const a = Math.sin((1 - f) * r) / Math.sin(r);\n const b = Math.sin(f * r) / Math.sin(r);\n const x = a * Math.cos(φ1) * Math.cos(λ1) + b * Math.cos(φ2) * Math.cos(λ2);\n const y = a * Math.cos(φ1) * Math.sin(λ1) + b * Math.cos(φ2) * Math.sin(λ2);\n const z = a * Math.sin(φ1) + b * Math.sin(φ2);\n\n return [\n Math.atan2(y, x),\n Math.atan2(z, Math.sqrt(x * x + y * y)),\n ];\n}\n\n/**\n * @summary Computes the center point of a polygon\n * @todo Get \"visual center\" (https://blog.mapbox.com/a-new-algorithm-for-finding-a-visual-center-of-a-polygon-7c77e6492fbc)\n * @param {number[][]} polygon\n * @returns {number[]}\n * @private\n */\nexport function getPolygonCenter(polygon) {\n // apply offsets to avoid crossing the origin\n const workPoints = [polygon[0]];\n\n let k = 0;\n for (let i = 1; i < polygon.length; i++) {\n const d = polygon[i - 1][0] - polygon[i][0];\n if (d > Math.PI) { // crossed the origin left to right\n k += 1;\n }\n else if (d < -Math.PI) { // crossed the origin right to left\n k -= 1;\n }\n workPoints.push([polygon[i][0] + k * 2 * Math.PI, polygon[i][1]]);\n }\n\n const sum = workPoints.reduce((intermediary, point) => [intermediary[0] + point[0], intermediary[1] + point[1]]);\n return [utils.parseAngle(sum[0] / polygon.length), sum[1] / polygon.length];\n}\n\n/**\n * @summary Computes the middle point of a polyline\n * @param {number[][]} polyline\n * @returns {number[]}\n * @private\n */\nexport function getPolylineCenter(polyline) {\n // compute each segment length + total length\n let length = 0;\n const lengths = [];\n\n for (let i = 0; i < polyline.length - 1; i++) {\n const l = utils.greatArcDistance(polyline[i], polyline[i + 1]) * CONSTANTS.SPHERE_RADIUS;\n\n lengths.push(l);\n length += l;\n }\n\n // iterate until length / 2\n let consumed = 0;\n\n for (let j = 0; j < polyline.length - 1; j++) {\n // once the segment containing the middle point is found, computes the intermediary point\n if (consumed + lengths[j] > length / 2) {\n const r = (length / 2 - consumed) / lengths[j];\n return greatArcIntermediaryPoint(polyline[j], polyline[j + 1], r);\n }\n\n consumed += lengths[j];\n }\n\n // this never happens\n return polyline[Math.round(polyline.length / 2)];\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, SYSTEM, utils } from '../..';\nimport { getShortestArc, logWarn } from '../../utils';\nimport { MARKER_DATA, SVG_NS } from './constants';\nimport { getPolygonCenter, getPolylineCenter } from './utils';\n\n/**\n * @summary Types of marker\n * @memberOf PSV.plugins.MarkersPlugin\n * @enum {string}\n * @constant\n * @private\n */\nconst MARKER_TYPES = {\n image : 'image',\n imageLayer : 'imageLayer',\n html : 'html',\n polygonPx : 'polygonPx',\n polygonRad : 'polygonRad',\n polylinePx : 'polylinePx',\n polylineRad: 'polylineRad',\n square : 'square',\n rect : 'rect',\n circle : 'circle',\n ellipse : 'ellipse',\n path : 'path',\n};\n\n/**\n * @typedef {Object} PSV.plugins.MarkersPlugin.Properties\n * @summary Marker properties, see {@link https://photo-sphere-viewer.js.org/plugins/plugin-markers.html#markers-options}\n */\n\n/**\n * @summary Object representing a marker\n * @memberOf PSV.plugins.MarkersPlugin\n */\nexport class Marker {\n\n /**\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @param {PSV.Viewer} psv\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n constructor(properties, psv) {\n if (!properties.id) {\n throw new PSVError('missing marker id');\n }\n\n /**\n * @member {PSV.Viewer}\n * @readonly\n * @protected\n */\n this.psv = psv;\n\n /**\n * @member {string}\n * @readonly\n */\n this.id = properties.id;\n\n /**\n * @member {string}\n * @readonly\n */\n this.type = Marker.getType(properties, false);\n\n /**\n * @member {boolean}\n * @protected\n */\n this.visible = true;\n\n /**\n * @member {HTMLElement|SVGElement|THREE.Object3D}\n * @readonly\n */\n this.$el = null;\n\n /**\n * @summary Original configuration of the marker\n * @member {PSV.plugins.MarkersPlugin.Properties}\n * @readonly\n */\n this.config = {};\n\n /**\n * @summary User data associated to the marker\n * @member {any}\n */\n this.data = undefined;\n\n /**\n * @summary Tooltip instance for this marker\n * @member {PSV.components.Tooltip}\n */\n this.tooltip = null;\n\n /**\n * @summary Computed properties\n * @member {Object}\n * @protected\n * @property {boolean} dynamicSize\n * @property {PSV.Point} anchor\n * @property {PSV.Position} position - position in spherical coordinates\n * @property {PSV.Point} position2D - position in viewer coordinates\n * @property {external:THREE.Vector3[]} positions3D - positions in 3D space\n * @property {number} width\n * @property {number} height\n * @property {*} def\n */\n this.props = {\n dynamicSize: false,\n anchor : null,\n position : null,\n position2D : null,\n positions3D: null,\n width : null,\n height : null,\n def : null,\n };\n\n /**\n * @summary THREE file loader\n * @type {THREE:TextureLoader}\n * @private\n */\n this.loader = null;\n\n if (this.is3d()) {\n this.loader = new THREE.TextureLoader();\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\n // create element\n if (this.isNormal()) {\n this.$el = document.createElement('div');\n }\n else if (this.isPolygon()) {\n this.$el = document.createElementNS(SVG_NS, 'polygon');\n }\n else if (this.isPolyline()) {\n this.$el = document.createElementNS(SVG_NS, 'polyline');\n }\n else if (this.isSvg()) {\n this.$el = document.createElementNS(SVG_NS, this.type);\n }\n\n if (!this.is3d()) {\n this.$el.id = `psv-marker-${this.id}`;\n this.$el[MARKER_DATA] = this;\n }\n\n this.update(properties);\n }\n\n /**\n * @summary Destroys the marker\n */\n destroy() {\n delete this.$el[MARKER_DATA];\n delete this.$el;\n delete this.config;\n delete this.props;\n delete this.psv;\n }\n\n /**\n * @summary Checks if it is a 3D marker (imageLayer)\n * @returns {boolean}\n */\n is3d() {\n return this.type === MARKER_TYPES.imageLayer;\n }\n\n /**\n * @summary Checks if it is a normal marker (image or html)\n * @returns {boolean}\n */\n isNormal() {\n return this.type === MARKER_TYPES.image\n || this.type === MARKER_TYPES.html;\n }\n\n /**\n * @summary Checks if it is a polygon/polyline marker\n * @returns {boolean}\n */\n isPoly() {\n return this.isPolygon()\n || this.isPolyline();\n }\n\n /**\n * @summary Checks if it is a polygon/polyline using pixel coordinates\n * @returns {boolean}\n */\n isPolyPx() {\n return this.type === MARKER_TYPES.polygonPx\n || this.type === MARKER_TYPES.polylinePx;\n }\n\n /**\n * @summary Checks if it is a polygon/polyline using radian coordinates\n * @returns {boolean}\n */\n isPolyRad() {\n return this.type === MARKER_TYPES.polygonRad\n || this.type === MARKER_TYPES.polylineRad;\n }\n\n /**\n * @summary Checks if it is a polygon marker\n * @returns {boolean}\n */\n isPolygon() {\n return this.type === MARKER_TYPES.polygonPx\n || this.type === MARKER_TYPES.polygonRad;\n }\n\n /**\n * @summary Checks if it is a polyline marker\n * @returns {boolean}\n */\n isPolyline() {\n return this.type === MARKER_TYPES.polylinePx\n || this.type === MARKER_TYPES.polylineRad;\n }\n\n /**\n * @summary Checks if it is an SVG marker\n * @returns {boolean}\n */\n isSvg() {\n return this.type === MARKER_TYPES.square\n || this.type === MARKER_TYPES.rect\n || this.type === MARKER_TYPES.circle\n || this.type === MARKER_TYPES.ellipse\n || this.type === MARKER_TYPES.path;\n }\n\n /**\n * @summary Computes marker scale from zoom level\n * @param {number} zoomLevel\n * @param {PSV.Position} position\n * @returns {number}\n */\n getScale(zoomLevel, position) {\n if (!this.config.scale) {\n return 1;\n }\n if (typeof this.config.scale === 'function') {\n return this.config.scale(zoomLevel, position);\n }\n\n let scale = 1;\n if (Array.isArray(this.config.scale.zoom)) {\n const bounds = this.config.scale.zoom;\n scale *= bounds[0] + (bounds[1] - bounds[0]) * CONSTANTS.EASINGS.inQuad(zoomLevel / 100);\n }\n if (Array.isArray(this.config.scale.longitude)) {\n const bounds = this.config.scale.longitude;\n const halfFov = THREE.Math.degToRad(this.psv.prop.hFov) / 2;\n const arc = Math.abs(getShortestArc(this.props.position.longitude, position.longitude));\n scale *= bounds[1] + (bounds[0] - bounds[1]) * CONSTANTS.EASINGS.outQuad(Math.max(0, (halfFov - arc) / halfFov));\n }\n return scale;\n }\n\n /**\n * @summary Returns the markers list content for the marker, it can be either :\n * - the `listContent`\n * - the `tooltip.content`\n * - the `html`\n * - the `id`\n * @returns {*}\n */\n getListContent() {\n if (this.config.listContent) {\n return this.config.listContent;\n }\n else if (this.config.tooltip?.content) {\n return this.config.tooltip.content;\n }\n else if (this.config.html) {\n return this.config.html;\n }\n else {\n return this.id;\n }\n }\n\n /**\n * @summary Display the tooltip of this marker\n * @param {{clientX: number, clientY: number}} [mousePosition]\n */\n showTooltip(mousePosition) {\n if (this.visible && this.config.tooltip?.content && this.props.position2D) {\n const config = {\n content : this.config.tooltip.content,\n position: this.config.tooltip.position,\n data : this,\n };\n\n if (this.isPoly()) {\n const viewerPos = utils.getPosition(this.psv.container);\n\n config.box = { // separate the tooltip from the cursor\n width : this.psv.tooltip.size.arrow * 2,\n height: this.psv.tooltip.size.arrow * 2,\n };\n\n if (mousePosition) {\n config.top = mousePosition.clientY - viewerPos.top - this.psv.tooltip.size.arrow / 2;\n config.left = mousePosition.clientX - viewerPos.left - this.psv.tooltip.size.arrow;\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n }\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n config.box = {\n width : this.props.width,\n height: this.props.height,\n };\n }\n\n if (this.tooltip) {\n this.tooltip.move(config);\n }\n else {\n this.tooltip = this.psv.tooltip.create(config);\n }\n }\n }\n\n /**\n * @summary Hides the tooltip of this marker\n */\n hideTooltip() {\n if (this.tooltip) {\n this.tooltip.hide();\n this.tooltip = null;\n }\n }\n\n /**\n * @summary Updates the marker with new properties\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n update(properties) {\n const newType = Marker.getType(properties, true);\n\n if (newType !== undefined && newType !== this.type) {\n throw new PSVError('cannot change marker type');\n }\n\n utils.deepmerge(this.config, properties);\n if (typeof this.config.tooltip === 'string') {\n this.config.tooltip = { content: this.config.tooltip };\n }\n\n this.data = this.config.data;\n this.visible = this.config.visible !== false;\n\n if (!this.is3d()) {\n // reset CSS class\n if (this.isNormal()) {\n this.$el.setAttribute('class', 'psv-marker psv-marker--normal');\n }\n else {\n this.$el.setAttribute('class', 'psv-marker psv-marker--svg');\n }\n\n // add CSS classes\n if (this.config.className) {\n utils.addClasses(this.$el, this.config.className);\n }\n\n if (this.config.tooltip) {\n utils.addClasses(this.$el, 'psv-marker--has-tooltip');\n }\n if (this.config.content) {\n utils.addClasses(this.$el, 'psv-marler--has-content');\n }\n\n // apply style\n this.$el.style.opacity = this.config.opacity ?? 1;\n if (this.config.style) {\n utils.deepmerge(this.$el.style, this.config.style);\n }\n }\n\n // parse anchor\n this.props.anchor = utils.parsePosition(this.config.anchor);\n\n // clean scale\n if (this.config.scale) {\n if (typeof this.config.scale === 'number') {\n logWarn('Single value marker scale is deprecated, please use an array of two values.');\n this.config.scale = { zoom: [0, this.config.scale] };\n }\n if (Array.isArray(this.config.scale)) {\n this.config.scale = { zoom: this.config.scale };\n }\n }\n\n if (this.isNormal()) {\n this.__updateNormal();\n }\n else if (this.isPoly()) {\n this.__updatePoly();\n }\n else if (this.isSvg()) {\n this.__updateSvg();\n }\n else if (this.is3d()) {\n this.__update3d();\n }\n }\n\n /**\n * @summary Updates a normal marker\n * @private\n */\n __updateNormal() {\n if (!utils.isExtendedPosition(this.config)) {\n throw new PSVError('missing marker position, latitude/longitude or x/y');\n }\n\n if (this.config.image && (!this.config.width || !this.config.height)) {\n throw new PSVError('missing marker width/height');\n }\n\n if (this.config.width && this.config.height) {\n this.props.dynamicSize = false;\n this.props.width = this.config.width;\n this.props.height = this.config.height;\n this.$el.style.width = this.config.width + 'px';\n this.$el.style.height = this.config.height + 'px';\n }\n else {\n this.props.dynamicSize = true;\n }\n\n if (this.config.image) {\n this.props.def = this.config.image;\n this.$el.style.backgroundImage = `url(${this.config.image})`;\n }\n else if (this.config.html) {\n this.props.def = this.config.html;\n this.$el.innerHTML = this.config.html;\n }\n\n // set anchor\n this.$el.style.transformOrigin = `${this.props.anchor.x * 100}% ${this.props.anchor.y * 100}%`;\n\n // convert texture coordinates to spherical coordinates\n this.props.position = this.psv.dataHelper.cleanPosition(this.config);\n\n // compute x/y/z position\n this.props.positions3D = [this.psv.dataHelper.sphericalCoordsToVector3(this.props.position)];\n }\n\n /**\n * @summary Updates an SVG marker\n * @private\n */\n __updateSvg() {\n if (!utils.isExtendedPosition(this.config)) {\n throw new PSVError('missing marker position, latitude/longitude or x/y');\n }\n\n this.props.dynamicSize = true;\n\n // set content\n switch (this.type) {\n case MARKER_TYPES.square:\n this.props.def = {\n x : 0,\n y : 0,\n width : this.config.square,\n height: this.config.square,\n };\n break;\n\n case MARKER_TYPES.rect:\n if (Array.isArray(this.config.rect)) {\n this.props.def = {\n x : 0,\n y : 0,\n width : this.config.rect[0],\n height: this.config.rect[1],\n };\n }\n else {\n this.props.def = {\n x : 0,\n y : 0,\n width : this.config.rect.width,\n height: this.config.rect.height,\n };\n }\n break;\n\n case MARKER_TYPES.circle:\n this.props.def = {\n cx: this.config.circle,\n cy: this.config.circle,\n r : this.config.circle,\n };\n break;\n\n case MARKER_TYPES.ellipse:\n if (Array.isArray(this.config.ellipse)) {\n this.props.def = {\n cx: this.config.ellipse[0],\n cy: this.config.ellipse[1],\n rx: this.config.ellipse[0],\n ry: this.config.ellipse[1],\n };\n }\n else {\n this.props.def = {\n cx: this.config.ellipse.rx,\n cy: this.config.ellipse.ry,\n rx: this.config.ellipse.rx,\n ry: this.config.ellipse.ry,\n };\n }\n break;\n\n case MARKER_TYPES.path:\n this.props.def = {\n d: this.config.path,\n };\n break;\n\n // no default\n }\n\n utils.each(this.props.def, (value, prop) => {\n this.$el.setAttributeNS(null, prop, value);\n });\n\n // set style\n if (this.config.svgStyle) {\n utils.each(this.config.svgStyle, (value, prop) => {\n this.$el.setAttributeNS(null, utils.dasherize(prop), value);\n });\n }\n else {\n this.$el.setAttributeNS(null, 'fill', 'rgba(0,0,0,0.5)');\n }\n\n // convert texture coordinates to spherical coordinates\n this.props.position = this.psv.dataHelper.cleanPosition(this.config);\n\n // compute x/y/z position\n this.props.positions3D = [this.psv.dataHelper.sphericalCoordsToVector3(this.props.position)];\n }\n\n /**\n * @summary Updates a polygon marker\n * @private\n */\n __updatePoly() {\n this.props.dynamicSize = true;\n\n // set style\n if (this.config.svgStyle) {\n utils.each(this.config.svgStyle, (value, prop) => {\n this.$el.setAttributeNS(null, utils.dasherize(prop), value);\n });\n\n if (this.isPolyline() && !this.config.svgStyle.fill) {\n this.$el.setAttributeNS(null, 'fill', 'none');\n }\n }\n else if (this.isPolygon()) {\n this.$el.setAttributeNS(null, 'fill', 'rgba(0,0,0,0.5)');\n }\n else if (this.isPolyline()) {\n this.$el.setAttributeNS(null, 'fill', 'none');\n this.$el.setAttributeNS(null, 'stroke', 'rgb(0,0,0)');\n }\n\n // fold arrays: [1,2,3,4] => [[1,2],[3,4]]\n const actualPoly = this.config.polygonPx || this.config.polygonRad || this.config.polylinePx || this.config.polylineRad;\n if (!Array.isArray(actualPoly[0])) {\n for (let i = 0; i < actualPoly.length; i++) {\n actualPoly.splice(i, 2, [actualPoly[i], actualPoly[i + 1]]);\n }\n }\n\n // convert texture coordinates to spherical coordinates\n if (this.isPolyPx()) {\n this.props.def = actualPoly.map((coord) => {\n const sphericalCoords = this.psv.dataHelper.textureCoordsToSphericalCoords({ x: coord[0], y: coord[1] });\n return [sphericalCoords.longitude, sphericalCoords.latitude];\n });\n }\n // clean angles\n else {\n this.props.def = actualPoly.map((coord) => {\n return [utils.parseAngle(coord[0]), utils.parseAngle(coord[1], true)];\n });\n }\n\n const centroid = this.isPolygon()\n ? getPolygonCenter(this.props.def)\n : getPolylineCenter(this.props.def);\n\n this.props.position = {\n longitude: centroid[0],\n latitude : centroid[1],\n };\n\n // compute x/y/z positions\n this.props.positions3D = this.props.def.map((coord) => {\n return this.psv.dataHelper.sphericalCoordsToVector3({ longitude: coord[0], latitude : coord[1] });\n });\n }\n\n /**\n * @summary Updates a 3D marker\n * @private\n */\n __update3d() {\n if (!this.config.width || !this.config.height) {\n throw new PSVError('missing marker width/height');\n }\n\n this.props.dynamicSize = false;\n this.props.width = this.config.width;\n this.props.height = this.config.height;\n\n // convert texture coordinates to spherical coordinates\n this.props.position = this.psv.dataHelper.cleanPosition(this.config);\n\n // compute x/y/z position\n this.props.positions3D = [this.psv.dataHelper.sphericalCoordsToVector3(this.props.position)];\n\n switch (this.type) {\n case MARKER_TYPES.imageLayer:\n if (!this.$el) {\n const material = new THREE.MeshBasicMaterial({\n transparent: true,\n opacity : this.config.opacity ?? 1,\n depthTest : false,\n });\n const geometry = new THREE.PlaneGeometry(1, 1);\n const mesh = new THREE.Mesh(geometry, material);\n mesh.userData = { [MARKER_DATA]: this };\n this.$el = new THREE.Group().add(mesh);\n\n // overwrite the visible property to be tied to the Marker instance\n // and do it without context bleed\n Object.defineProperty(this.$el, 'visible', {\n enumerable: true,\n get : function () {\n return this.children[0].userData[MARKER_DATA].visible;\n },\n set : function (visible) {\n this.children[0].userData[MARKER_DATA].visible = visible;\n },\n });\n }\n\n if (this.props.def !== this.config.imageLayer) {\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(this.config.imageLayer));\n }\n this.$el.children[0].material.map = this.loader.load(this.config.imageLayer, (texture) => {\n texture.anisotropy = 4;\n this.psv.needsUpdate();\n });\n this.props.def = this.config.imageLayer;\n }\n\n this.$el.children[0].position.set(\n this.props.anchor.x - 0.5,\n this.props.anchor.y - 0.5,\n 0\n );\n\n this.$el.position.copy(this.props.positions3D[0]);\n\n switch (this.config.orientation) {\n case 'horizontal':\n this.$el.lookAt(0, this.$el.position.y, 0);\n this.$el.rotateX(this.props.position.latitude < 0 ? -Math.PI / 2 : Math.PI / 2);\n break;\n case 'vertical-left':\n this.$el.lookAt(0, 0, 0);\n this.$el.rotateY(-Math.PI * 0.4);\n break;\n case 'vertical-right':\n this.$el.lookAt(0, 0, 0);\n this.$el.rotateY(Math.PI * 0.4);\n break;\n default:\n this.$el.lookAt(0, 0, 0);\n break;\n }\n\n // 100 is magic number that gives a coherent size at default zoom level\n this.$el.scale.set(this.config.width / 100 * SYSTEM.pixelRatio, this.config.height / 100 * SYSTEM.pixelRatio, 1);\n break;\n\n // no default\n }\n }\n\n /**\n * @summary Determines the type of a marker by the available properties\n * @param {Marker.Properties} properties\n * @param {boolean} [allowNone=false]\n * @returns {string}\n * @throws {PSV.PSVError} when the marker's type cannot be found\n */\n static getType(properties, allowNone = false) {\n const found = [];\n\n utils.each(MARKER_TYPES, (type) => {\n if (properties[type]) {\n found.push(type);\n }\n });\n\n if (found.length === 0 && !allowNone) {\n throw new PSVError(`missing marker content, either ${Object.keys(MARKER_TYPES).join(', ')}`);\n }\n else if (found.length > 1) {\n throw new PSVError(`multiple marker content, either ${Object.keys(MARKER_TYPES).join(', ')}`);\n }\n\n return found[0];\n }\n\n}\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport pin from './pin.svg';\n\n/**\n * @summary Navigation bar markers button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MarkersButton extends AbstractButton {\n\n static id = 'markers';\n static icon = pin;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-markers-button', true);\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n */\n this.plugin = this.psv.getPlugin('markers');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.SHOW_MARKERS, this);\n this.plugin.on(EVENTS.HIDE_MARKERS, this);\n\n this.toggleActive(true);\n }\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.SHOW_MARKERS, this);\n this.plugin.off(EVENTS.HIDE_MARKERS, this);\n }\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\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.SHOW_MARKERS: this.toggleActive(true); break;\n case EVENTS.HIDE_MARKERS: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles markers\n */\n onClick() {\n if (this.plugin.prop.visible) {\n this.plugin.hide();\n }\n else {\n this.plugin.show();\n }\n }\n\n}\n","import { AbstractButton, CONSTANTS } from '../..';\nimport { ID_PANEL_MARKERS_LIST } from './constants';\nimport pinList from './pin-list.svg';\n\n/**\n * @summary Navigation bar markers list button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MarkersListButton extends AbstractButton {\n\n static id = 'markersList';\n static icon = pinList;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-markers-list-button', true);\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n */\n this.plugin = this.psv.getPlugin('markers');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\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 CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === ID_PANEL_MARKERS_LIST); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles markers list\n */\n onClick() {\n this.plugin.toggleMarkersList();\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport {\n EVENTS,\n ID_PANEL_MARKER,\n ID_PANEL_MARKERS_LIST,\n MARKER_DATA,\n MARKERS_LIST_TEMPLATE,\n SVG_NS\n} from './constants';\nimport { Marker } from './Marker';\nimport { MarkersButton } from './MarkersButton';\nimport { MarkersListButton } from './MarkersListButton';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.MarkersPlugin.Options\n * @property {boolean} [clickEventOnMarker=false] If a `click` event is triggered on the viewer additionally to the `select-marker` event.\n * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers]\n */\n\n/**\n * @typedef {Object} PSV.plugins.MarkersPlugin.SelectMarkerData\n * @summary Data of the `select-marker` event\n * @property {boolean} dblclick - if the selection originated from a double click, the simple click is always fired before the double click\n * @property {boolean} rightclick - if the selection originated from a right click\n */\n\n\n// add markers buttons\nDEFAULTS.lang[MarkersButton.id] = 'Markers';\nDEFAULTS.lang[MarkersListButton.id] = 'Markers list';\nregisterButton(MarkersButton, 'caption:left');\nregisterButton(MarkersListButton, 'caption:left');\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Displays various markers on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class MarkersPlugin extends AbstractPlugin {\n\n static id = 'markers';\n\n /**\n * @deprecated use the EVENTS constants of the module\n */\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.MarkersPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @summary All registered markers\n * @member {Object}\n */\n this.markers = {};\n\n /**\n * @type {Object}\n * @property {boolean} visible - Visibility of the component\n * @property {PSV.plugins.MarkersPlugin.Marker} currentMarker - Last selected marker\n * @property {PSV.plugins.MarkersPlugin.Marker} hoveringMarker - Marker under the cursor\n * @private\n */\n this.prop = {\n visible : true,\n currentMarker : null,\n hoveringMarker: null,\n stopObserver : null,\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin.Options}\n */\n this.config = {\n clickEventOnMarker: false,\n ...options,\n };\n\n if (options?.listButton === false || options?.hideButton === false) {\n utils.logWarn('MarkersPlugin: listButton and hideButton options are deprecated. '\n + 'Please define the global navbar options according to your needs.');\n }\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = 'psv-markers';\n this.container.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n\n /**\n * @member {SVGElement}\n * @readonly\n */\n this.svgContainer = document.createElementNS(SVG_NS, 'svg');\n this.svgContainer.setAttribute('class', 'psv-markers-svg-container');\n this.container.appendChild(this.svgContainer);\n\n // Markers events via delegation\n this.container.addEventListener('mouseenter', this, true);\n this.container.addEventListener('mouseleave', this, true);\n this.container.addEventListener('mousemove', this, true);\n this.container.addEventListener('contextmenu', this);\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.container.appendChild(this.container);\n\n // Viewer events\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n this.psv.on(CONSTANTS.EVENTS.DOUBLE_CLICK, this);\n this.psv.on(CONSTANTS.EVENTS.RENDER, this);\n this.psv.on(CONSTANTS.EVENTS.CONFIG_CHANGED, this);\n\n if (this.config.markers) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.setMarkers(this.config.markers);\n delete this.config.markers;\n });\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.clearMarkers(false);\n\n this.prop.stopObserver?.();\n\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n this.psv.off(CONSTANTS.EVENTS.DOUBLE_CLICK, this);\n this.psv.off(CONSTANTS.EVENTS.RENDER, this);\n this.psv.off(CONSTANTS.EVENTS.CONFIG_CHANGED, this);\n\n this.psv.container.removeChild(this.container);\n\n delete this.svgContainer;\n delete this.markers;\n delete this.container;\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 'mouseenter': this.__onMouseEnter(e, this.__getTargetMarker(e.target)); break;\n case 'mouseleave': this.__onMouseLeave(e, this.__getTargetMarker(e.target)); break;\n case 'mousemove': this.__onMouseMove(e, this.__getTargetMarker(e.target)); break;\n case 'contextmenu': e.preventDefault(); break;\n case CONSTANTS.EVENTS.CLICK: this.__onClick(e, e.args[0], false); break;\n case CONSTANTS.EVENTS.DOUBLE_CLICK: this.__onClick(e, e.args[0], true); break;\n case CONSTANTS.EVENTS.RENDER: this.renderMarkers(); break;\n case CONSTANTS.OBJECT_EVENTS.ENTER_OBJECT: this.__onMouseEnter(e.detail.originalEvent, e.detail.data); break;\n case CONSTANTS.OBJECT_EVENTS.LEAVE_OBJECT: this.__onMouseLeave(e.detail.originalEvent, e.detail.data); break;\n case CONSTANTS.OBJECT_EVENTS.HOVER_OBJECT: this.__onMouseMove(e.detail.originalEvent, e.detail.data); break;\n case CONSTANTS.EVENTS.CONFIG_CHANGED:\n this.container.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Shows all markers\n * @fires PSV.plugins.MarkersPlugin.show-markers\n */\n show() {\n this.prop.visible = true;\n\n this.renderMarkers();\n\n this.trigger(EVENTS.SHOW_MARKERS);\n }\n\n /**\n * @summary Hides all markers\n * @fires PSV.plugins.MarkersPlugin.hide-markers\n */\n hide() {\n this.prop.visible = false;\n\n this.renderMarkers();\n\n this.trigger(EVENTS.HIDE_MARKERS);\n }\n\n /**\n * @summary Toggles the visibility of all tooltips\n */\n toggleAllTooltips() {\n this.prop.showAllTooltips = !this.prop.showAllTooltips;\n this.renderMarkers();\n }\n\n /**\n * @summary Displays all tooltips\n */\n showAllTooltips() {\n this.prop.showAllTooltips = true;\n this.renderMarkers();\n }\n\n /**\n * @summary Hides all tooltips\n */\n hideAllTooltips() {\n this.prop.showAllTooltips = false;\n this.renderMarkers();\n }\n\n /**\n * @summary Returns the total number of markers\n * @returns {number}\n */\n getNbMarkers() {\n return Object.keys(this.markers).length;\n }\n\n /**\n * @summary Returns all the markers\n * @return {PSV.plugins.MarkersPlugin.Marker[]}\n */\n getMarkers() {\n return Object.values(this.markers);\n }\n\n /**\n * @summary Adds a new marker to viewer\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @param {boolean} [render=true] - renders the marker immediately\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n * @throws {PSV.PSVError} when the marker's id is missing or already exists\n */\n addMarker(properties, render = true) {\n if (this.markers[properties.id]) {\n throw new PSVError(`marker \"${properties.id}\" already exists`);\n }\n\n const marker = new Marker(properties, this.psv);\n\n if (marker.isNormal()) {\n this.container.appendChild(marker.$el);\n }\n else if (marker.isPoly() || marker.isSvg()) {\n this.svgContainer.appendChild(marker.$el);\n }\n else if (marker.is3d()) {\n this.psv.renderer.scene.add(marker.$el);\n }\n\n this.markers[marker.id] = marker;\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n\n return marker;\n }\n\n /**\n * @summary Returns the internal marker object for a marker id\n * @param {string} markerId\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n * @throws {PSV.PSVError} when the marker cannot be found\n */\n getMarker(markerId) {\n const id = typeof markerId === 'object' ? markerId.id : markerId;\n\n if (!this.markers[id]) {\n throw new PSVError(`cannot find marker \"${id}\"`);\n }\n\n return this.markers[id];\n }\n\n /**\n * @summary Returns the last marker selected by the user\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n */\n getCurrentMarker() {\n return this.prop.currentMarker;\n }\n\n /**\n * @summary Updates the existing marker with the same id\n * @description Every property can be changed but you can't change its type (Eg: `image` to `html`).\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @param {boolean} [render=true] - renders the marker immediately\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n */\n updateMarker(properties, render = true) {\n const marker = this.getMarker(properties.id);\n\n marker.update(properties);\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n\n if (marker.is3d()) {\n this.psv.needsUpdate();\n }\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n\n return marker;\n }\n\n /**\n * @summary Removes a marker from the viewer\n * @param {string} markerId\n * @param {boolean} [render=true] - renders the marker immediately\n */\n removeMarker(markerId, render = true) {\n const marker = this.getMarker(markerId);\n\n if (marker.isNormal()) {\n this.container.removeChild(marker.$el);\n }\n else if (marker.isPoly() || marker.isSvg()) {\n this.svgContainer.removeChild(marker.$el);\n }\n else if (marker.is3d()) {\n this.psv.renderer.scene.remove(marker.$el);\n this.psv.needsUpdate();\n }\n\n if (this.prop.hoveringMarker === marker) {\n this.prop.hoveringMarker = null;\n }\n\n if (this.prop.currentMarker === marker) {\n this.prop.currentMarker = null;\n }\n\n marker.hideTooltip();\n\n marker.destroy();\n delete this.markers[marker.id];\n\n if (render) {\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Removes multiple markers\n * @param {string[]} markerIds\n * @param {boolean} [render=true] - renders the markers immediately\n */\n removeMarkers(markerIds, render = true) {\n markerIds.forEach(markerId => this.removeMarker(markerId, false));\n\n if (render) {\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Replaces all markers\n * @param {PSV.plugins.MarkersPlugin.Properties[]} markers\n * @param {boolean} [render=true] - renders the marker immediately\n */\n setMarkers(markers, render = true) {\n this.clearMarkers(false);\n\n utils.each(markers, marker => this.addMarker(marker, false));\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Removes all markers\n * @param {boolean} [render=true] - renders the markers immediately\n */\n clearMarkers(render = true) {\n utils.each(this.markers, marker => this.removeMarker(marker, false));\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\n this.__checkObjectsObserver();\n\n this.trigger(EVENTS.SET_MARKERS, this.getMarkers());\n }\n }\n\n /**\n * @summary Rotate the view to face the marker\n * @param {string} markerId\n * @param {string|number} [speed] - rotates smoothy, see {@link PSV.Viewer#animate}\n * @fires PSV.plugins.MarkersPlugin.goto-marker-done\n * @return {PSV.Animation} A promise that will be resolved when the animation finishes\n */\n gotoMarker(markerId, speed) {\n const marker = this.getMarker(markerId);\n\n return this.psv.animate({\n ...marker.props.position,\n speed,\n })\n .then(() => {\n this.trigger(EVENTS.GOTO_MARKER_DONE, marker);\n });\n }\n\n /**\n * @summary Hides a marker\n * @param {string} markerId\n */\n hideMarker(markerId) {\n this.toggleMarker(markerId, false);\n }\n\n /**\n * @summary Shows a marker\n * @param {string} markerId\n */\n showMarker(markerId) {\n this.toggleMarker(markerId, true);\n }\n\n /**\n * @summary Toggles a marker\n * @param {string} markerId\n * @param {boolean} [visible]\n */\n toggleMarker(markerId, visible = null) {\n const marker = this.getMarker(markerId);\n marker.visible = visible === null ? !marker.visible : visible;\n if (marker.is3d()) {\n this.psv.needsUpdate();\n }\n else {\n this.renderMarkers();\n }\n }\n\n /**\n * @summary Opens the panel with the content of the marker\n * @param {string} markerId\n */\n showMarkerPanel(markerId) {\n const marker = this.getMarker(markerId);\n\n if (marker?.config?.content) {\n this.psv.panel.show({\n id : ID_PANEL_MARKER,\n content: marker.config.content,\n });\n }\n else {\n this.psv.panel.hide(ID_PANEL_MARKER);\n }\n }\n\n /**\n * @summary Toggles the visibility of the list of markers\n */\n toggleMarkersList() {\n if (this.psv.panel.prop.contentId === ID_PANEL_MARKERS_LIST) {\n this.hideMarkersList();\n }\n else {\n this.showMarkersList();\n }\n }\n\n /**\n * @summary Opens side panel with the list of markers\n * @fires PSV.plugins.MarkersPlugin.filter:render-markers-list\n */\n showMarkersList() {\n let markers = [];\n utils.each(this.markers, (marker) => {\n if (marker.visible && !marker.config.hideList) {\n markers.push(marker);\n }\n });\n\n markers = this.change(EVENTS.RENDER_MARKERS_LIST, markers);\n\n this.psv.panel.show({\n id : ID_PANEL_MARKERS_LIST,\n content : MARKERS_LIST_TEMPLATE(\n markers,\n this.psv.config.lang[MarkersButton.id],\n utils.dasherize(MARKER_DATA)\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const markerId = li ? li.dataset[MARKER_DATA] : undefined;\n\n if (markerId) {\n const marker = this.getMarker(markerId);\n\n this.trigger(EVENTS.SELECT_MARKER_LIST, marker);\n\n this.gotoMarker(marker, 1000);\n this.hideMarkersList();\n }\n },\n });\n }\n\n /**\n * @summary Closes side panel if it contains the list of markers\n */\n hideMarkersList() {\n this.psv.panel.hide(ID_PANEL_MARKERS_LIST);\n }\n\n /**\n * @summary Updates the visibility and the position of all markers\n */\n renderMarkers() {\n const zoomLevel = this.psv.getZoomLevel();\n const viewerPosition = this.psv.getPosition();\n\n utils.each(this.markers, (marker) => {\n let isVisible = this.prop.visible && marker.visible;\n let position = null;\n\n if (isVisible && marker.is3d()) {\n position = this.__getMarkerPosition(marker);\n isVisible = this.__isMarkerVisible(marker, position);\n }\n else if (isVisible && marker.isPoly()) {\n const positions = this.__getPolyPositions(marker);\n isVisible = positions.length > (marker.isPolygon() ? 2 : 1);\n\n if (isVisible) {\n position = this.__getMarkerPosition(marker);\n\n const points = positions.map(pos => (pos.x - position.x) + ',' + (pos.y - position.y)).join(' ');\n\n marker.$el.setAttributeNS(null, 'points', points);\n marker.$el.setAttributeNS(null, 'transform', `translate(${position.x} ${position.y})`);\n }\n }\n else if (isVisible) {\n if (marker.props.dynamicSize) {\n this.__updateMarkerSize(marker);\n }\n\n position = this.__getMarkerPosition(marker);\n isVisible = this.__isMarkerVisible(marker, position);\n\n if (isVisible) {\n const scale = marker.getScale(zoomLevel, viewerPosition);\n\n if (marker.isSvg()) {\n // simulate transform-origin relative to SVG element\n const x = position.x + marker.props.width * marker.props.anchor.x * (1 - scale);\n const y = position.y + marker.props.width * marker.props.anchor.y * (1 - scale);\n marker.$el.setAttributeNS(null, 'transform', `translate(${x}, ${y}) scale(${scale}, ${scale})`);\n }\n else {\n marker.$el.style.transform = `translate3D(${position.x}px, ${position.y}px, 0px) scale(${scale}, ${scale})`;\n }\n }\n }\n\n marker.props.position2D = isVisible ? position : null;\n\n if (!marker.is3d()) {\n utils.toggleClass(marker.$el, 'psv-marker--visible', isVisible);\n }\n\n if (isVisible && (this.prop.showAllTooltips || (marker === this.prop.hoveringMarker && !marker.isPoly()))) {\n marker.showTooltip();\n }\n else if (!isVisible || marker !== this.prop.hoveringMarker) {\n marker.hideTooltip();\n }\n });\n }\n\n /**\n * @summary Determines if a point marker is visible
\n * It tests if the point is in the general direction of the camera, then check if it's in the viewport\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.Point} position\n * @returns {boolean}\n * @private\n */\n __isMarkerVisible(marker, position) {\n return marker.props.positions3D[0].dot(this.psv.prop.direction) > 0\n && position.x + marker.props.width >= 0\n && position.x - marker.props.width <= this.psv.prop.size.width\n && position.y + marker.props.height >= 0\n && position.y - marker.props.height <= this.psv.prop.size.height;\n }\n\n /**\n * @summary Computes the real size of a marker\n * @description This is done by removing all it's transformations (if any) and making it visible\n * before querying its bounding rect\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __updateMarkerSize(marker) {\n utils.addClasses(marker.$el, 'psv-marker--transparent');\n\n let transform;\n if (marker.isSvg()) {\n transform = marker.$el.getAttributeNS(null, 'transform');\n marker.$el.removeAttributeNS(null, 'transform');\n }\n else {\n transform = marker.$el.style.transform;\n marker.$el.style.transform = '';\n }\n\n const rect = marker.$el.getBoundingClientRect();\n marker.props.width = rect.width;\n marker.props.height = rect.height;\n\n utils.removeClasses(marker.$el, 'psv-marker--transparent');\n\n if (transform) {\n if (marker.isSvg()) {\n marker.$el.setAttributeNS(null, 'transform', transform);\n }\n else {\n marker.$el.style.transform = transform;\n }\n }\n\n // the size is no longer dynamic once known\n marker.props.dynamicSize = false;\n }\n\n /**\n * @summary Computes viewer coordinates of a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @returns {PSV.Point}\n * @private\n */\n __getMarkerPosition(marker) {\n if (marker.isPoly()) {\n return this.psv.dataHelper.sphericalCoordsToViewerCoords(marker.props.position);\n }\n else {\n const position = this.psv.dataHelper.vector3ToViewerCoords(marker.props.positions3D[0]);\n\n position.x -= marker.props.width * marker.props.anchor.x;\n position.y -= marker.props.height * marker.props.anchor.y;\n\n return position;\n }\n }\n\n /**\n * @summary Computes viewer coordinates of each point of a polygon/polyline
\n * It handles points behind the camera by creating intermediary points suitable for the projector\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @returns {PSV.Point[]}\n * @private\n */\n __getPolyPositions(marker) {\n const nbVectors = marker.props.positions3D.length;\n\n // compute if each vector is visible\n const positions3D = marker.props.positions3D.map((vector) => {\n return {\n vector : vector,\n visible: vector.dot(this.psv.prop.direction) > 0,\n };\n });\n\n // get pairs of visible/invisible vectors for each invisible vector connected to a visible vector\n const toBeComputed = [];\n positions3D.forEach((pos, i) => {\n if (!pos.visible) {\n const neighbours = [\n i === 0 ? positions3D[nbVectors - 1] : positions3D[i - 1],\n i === nbVectors - 1 ? positions3D[0] : positions3D[i + 1],\n ];\n\n neighbours.forEach((neighbour) => {\n if (neighbour.visible) {\n toBeComputed.push({\n visible : neighbour,\n invisible: pos,\n index : i,\n });\n }\n });\n }\n });\n\n // compute intermediary vector for each pair (the loop is reversed for splice to insert at the right place)\n toBeComputed.reverse().forEach((pair) => {\n positions3D.splice(pair.index, 0, {\n vector : this.__getPolyIntermediaryPoint(pair.visible.vector, pair.invisible.vector),\n visible: true,\n });\n });\n\n // translate vectors to screen pos\n return positions3D\n .filter(pos => pos.visible)\n .map(pos => this.psv.dataHelper.vector3ToViewerCoords(pos.vector));\n }\n\n /**\n * Given one point in the same direction of the camera and one point behind the camera,\n * computes an intermediary point on the great circle delimiting the half sphere visible by the camera.\n * The point is shifted by .01 rad because the projector cannot handle points exactly on this circle.\n * TODO : does not work with fisheye view (must not use the great circle)\n * {@link http://math.stackexchange.com/a/1730410/327208}\n * @param P1 {external:THREE.Vector3}\n * @param P2 {external:THREE.Vector3}\n * @returns {external:THREE.Vector3}\n * @private\n */\n __getPolyIntermediaryPoint(P1, P2) {\n const C = this.psv.prop.direction.clone().normalize();\n const N = new THREE.Vector3().crossVectors(P1, P2).normalize();\n const V = new THREE.Vector3().crossVectors(N, P1).normalize();\n const X = P1.clone().multiplyScalar(-C.dot(V));\n const Y = V.clone().multiplyScalar(C.dot(P1));\n const H = new THREE.Vector3().addVectors(X, Y).normalize();\n const a = new THREE.Vector3().crossVectors(H, C);\n return H.applyAxisAngle(a, 0.01).multiplyScalar(CONSTANTS.SPHERE_RADIUS);\n }\n\n /**\n * @summary Returns the marker associated to an event target\n * @param {EventTarget} target\n * @param {boolean} [closest=false]\n * @returns {PSV.plugins.MarkersPlugin.Marker}\n * @private\n */\n __getTargetMarker(target, closest = false) {\n const target2 = closest ? utils.getClosest(target, '.psv-marker') : target;\n return target2 ? target2[MARKER_DATA] : undefined;\n }\n\n /**\n * @summary Checks if an event target is in the tooltip\n * @param {EventTarget} target\n * @param {PSV.components.Tooltip} tooltip\n * @returns {boolean}\n * @private\n */\n __targetOnTooltip(target, tooltip) {\n return target && tooltip ? utils.hasParent(target, tooltip.container) : false;\n }\n\n /**\n * @summary Handles mouse enter events, show the tooltip for non polygon markers\n * @param {MouseEvent} e\n * @param {PSV.plugins.MarkersPlugin.Marker} [marker]\n * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseEnter(e, marker) {\n if (marker && !marker.isPoly()) {\n this.prop.hoveringMarker = marker;\n\n this.trigger(EVENTS.OVER_MARKER, marker);\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n }\n\n /**\n * @summary Handles mouse leave events, hide the tooltip\n * @param {MouseEvent} e\n * @param {PSV.plugins.MarkersPlugin.Marker} [marker]\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @private\n */\n __onMouseLeave(e, marker) {\n // do not hide if we enter the tooltip itself while hovering a polygon\n if (marker && !(marker.isPoly() && this.__targetOnTooltip(e.relatedTarget, marker.tooltip))) {\n this.trigger(EVENTS.LEAVE_MARKER, marker);\n\n this.prop.hoveringMarker = null;\n\n if (!this.prop.showAllTooltips) {\n marker.hideTooltip();\n }\n }\n }\n\n /**\n * @summary Handles mouse move events, refreshUi the tooltip for polygon markers\n * @param {MouseEvent} e\n * @param {PSV.plugins.MarkersPlugin.Marker} [targetMarker]\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseMove(e, targetMarker) {\n let marker;\n\n if (targetMarker?.isPoly()) {\n marker = targetMarker;\n }\n // do not hide if we enter the tooltip itself while hovering a polygon\n else if (this.prop.hoveringMarker && this.__targetOnTooltip(e.target, this.prop.hoveringMarker.tooltip)) {\n marker = this.prop.hoveringMarker;\n }\n\n if (marker) {\n if (!this.prop.hoveringMarker) {\n this.trigger(EVENTS.OVER_MARKER, marker);\n\n this.prop.hoveringMarker = marker;\n }\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n else if (this.prop.hoveringMarker?.isPoly()) {\n this.trigger(EVENTS.LEAVE_MARKER, this.prop.hoveringMarker);\n\n if (!this.prop.showAllTooltips) {\n this.prop.hoveringMarker.hideTooltip();\n }\n\n this.prop.hoveringMarker = null;\n }\n }\n\n /**\n * @summary Handles mouse click events, select the marker and open the panel if necessary\n * @param {Event} e\n * @param {Object} data\n * @param {boolean} dblclick\n * @fires PSV.plugins.MarkersPlugin.select-marker\n * @fires PSV.plugins.MarkersPlugin.unselect-marker\n * @private\n */\n __onClick(e, data, dblclick) {\n let marker = data.objects.find(o => o.userData[MARKER_DATA])?.userData[MARKER_DATA];\n\n if (!marker) {\n marker = this.__getTargetMarker(data.target, true);\n }\n\n if (marker) {\n this.prop.currentMarker = marker;\n\n this.trigger(EVENTS.SELECT_MARKER, marker, {\n dblclick : dblclick,\n rightclick: data.rightclick,\n });\n\n if (this.config.clickEventOnMarker) {\n // add the marker to event data\n data.marker = marker;\n }\n else {\n e.stopPropagation();\n }\n\n // the marker could have been deleted in an event handler\n if (this.markers[marker.id]) {\n this.showMarkerPanel(marker.id);\n }\n }\n else if (this.prop.currentMarker) {\n this.trigger(EVENTS.UNSELECT_MARKER, this.prop.currentMarker);\n\n this.psv.panel.hide(ID_PANEL_MARKER);\n\n this.prop.currentMarker = null;\n }\n }\n\n /**\n * @summary Updates the visiblity of the panel and the buttons\n * @private\n */\n __refreshUi() {\n const nbMarkers = Object.values(this.markers).filter(m => !m.config.hideList).length;\n const markersButton = this.psv.navbar.getButton(MarkersButton.id, false);\n const markersListButton = this.psv.navbar.getButton(MarkersListButton.id, false);\n\n if (nbMarkers === 0) {\n markersButton?.hide();\n markersListButton?.hide();\n\n if (this.psv.panel.isVisible(ID_PANEL_MARKERS_LIST)) {\n this.psv.panel.hide();\n }\n else if (this.psv.panel.isVisible(ID_PANEL_MARKER)) {\n this.psv.panel.hide();\n }\n }\n else {\n markersButton?.show();\n markersListButton?.show();\n\n if (this.psv.panel.isVisible(ID_PANEL_MARKERS_LIST)) {\n this.showMarkersList();\n }\n else if (this.psv.panel.isVisible(ID_PANEL_MARKER)) {\n this.prop.currentMarker ? this.showMarkerPanel(this.prop.currentMarker) : this.psv.panel.hide();\n }\n }\n }\n\n /**\n * @summary Adds or remove the objects observer if there are 3D markers\n * @private\n */\n __checkObjectsObserver() {\n const has3d = Object.values(this.markers).some(marker => marker.is3d());\n\n if (!has3d && this.prop.stopObserver) {\n this.prop.stopObserver();\n this.prop.stopObserver = null;\n }\n else if (has3d && !this.prop.stopObserver) {\n this.prop.stopObserver = this.psv.observeObjects(MARKER_DATA, this);\n }\n }\n\n}\n"],"names":["EVENTS","GOTO_MARKER_DONE","LEAVE_MARKER","OVER_MARKER","RENDER_MARKERS_LIST","SELECT_MARKER","SELECT_MARKER_LIST","UNSELECT_MARKER","HIDE_MARKERS","SET_MARKERS","SHOW_MARKERS","SVG_NS","MARKER_DATA","ID_PANEL_MARKER","ID_PANEL_MARKERS_LIST","MARKERS_LIST_TEMPLATE","markers","title","dataKey","icon","map","marker","config","id","type","image","getListContent","join","getShortestArc","from","to","tCandidates","Math","PI","reduce","value","candidate","newCandidate","abs","Infinity","PSVError","message","Error","captureStackTrace","stack","prototype","Object","create","name","constructor","logWarn","console","warn","THREE","Quaternion","greatArcIntermediaryPoint","p1","p2","f","λ1","φ1","λ2","φ2","r","utils","greatArcDistance","a","sin","b","x","cos","y","z","atan2","sqrt","getPolygonCenter","polygon","workPoints","k","i","length","d","push","sum","intermediary","point","parseAngle","getPolylineCenter","polyline","lengths","l","CONSTANTS","SPHERE_RADIUS","consumed","j","round","MARKER_TYPES","imageLayer","html","polygonPx","polygonRad","polylinePx","polylineRad","square","rect","circle","ellipse","path","Marker","properties","psv","getType","visible","$el","data","undefined","tooltip","props","dynamicSize","anchor","position","position2D","positions3D","width","height","def","loader","is3d","TextureLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","isNormal","document","createElement","isPolygon","createElementNS","isPolyline","isSvg","update","destroy","isPoly","isPolyPx","isPolyRad","getScale","zoomLevel","scale","Array","isArray","zoom","bounds","EASINGS","inQuad","longitude","halfFov","degToRad","prop","hFov","arc","outQuad","max","listContent","content","showTooltip","mousePosition","viewerPos","getPosition","container","box","size","arrow","top","clientY","left","clientX","move","hideTooltip","hide","newType","deepmerge","setAttribute","className","addClasses","style","opacity","parsePosition","__updateNormal","__updatePoly","__updateSvg","__update3d","isExtendedPosition","backgroundImage","innerHTML","transformOrigin","dataHelper","cleanPosition","sphericalCoordsToVector3","cx","cy","rx","ry","each","setAttributeNS","svgStyle","dasherize","fill","actualPoly","splice","coord","sphericalCoords","textureCoordsToSphericalCoords","latitude","centroid","material","MeshBasicMaterial","transparent","depthTest","geometry","PlaneGeometry","mesh","Mesh","userData","Group","add","defineProperty","enumerable","get","children","set","load","texture","anisotropy","needsUpdate","copy","orientation","lookAt","rotateX","rotateY","SYSTEM","pixelRatio","allowNone","found","keys","MarkersButton","navbar","plugin","getPlugin","on","toggleActive","off","isSupported","handleEvent","e","onClick","show","AbstractButton","pin","MarkersListButton","OPEN_PANEL","CLOSE_PANEL","args","toggleMarkersList","pinList","DEFAULTS","lang","registerButton","MarkersPlugin","options","currentMarker","hoveringMarker","stopObserver","clickEventOnMarker","listButton","hideButton","cursor","mousemove","svgContainer","appendChild","addEventListener","init","CLICK","DOUBLE_CLICK","RENDER","CONFIG_CHANGED","once","READY","setMarkers","clearMarkers","removeChild","__onMouseEnter","__getTargetMarker","target","__onMouseLeave","__onMouseMove","preventDefault","__onClick","renderMarkers","OBJECT_EVENTS","ENTER_OBJECT","detail","originalEvent","LEAVE_OBJECT","HOVER_OBJECT","trigger","toggleAllTooltips","showAllTooltips","hideAllTooltips","getNbMarkers","getMarkers","values","addMarker","render","renderer","scene","__refreshUi","__checkObjectsObserver","getMarker","markerId","getCurrentMarker","updateMarker","removeMarker","remove","removeMarkers","markerIds","forEach","gotoMarker","speed","animate","then","hideMarker","toggleMarker","showMarker","showMarkerPanel","panel","contentId","hideMarkersList","showMarkersList","hideList","change","noMargin","clickHandler","li","getClosest","dataset","getZoomLevel","viewerPosition","isVisible","__getMarkerPosition","__isMarkerVisible","positions","__getPolyPositions","points","pos","__updateMarkerSize","transform","toggleClass","dot","direction","getAttributeNS","removeAttributeNS","getBoundingClientRect","removeClasses","sphericalCoordsToViewerCoords","vector3ToViewerCoords","nbVectors","vector","toBeComputed","neighbours","neighbour","invisible","index","reverse","pair","__getPolyIntermediaryPoint","filter","P1","P2","C","clone","normalize","N","Vector3","crossVectors","V","X","multiplyScalar","Y","H","addVectors","applyAxisAngle","closest","target2","__targetOnTooltip","hasParent","relatedTarget","targetMarker","dblclick","objects","find","o","rightclick","stopPropagation","nbMarkers","m","markersButton","getButton","markersListButton","has3d","some","observeObjects","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAK,kBAPD;;EAQpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAdD;;EAepB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aArBD;;EAsBpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,mBAAmB,EAAE,qBA7BD;;EA8BpB;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAQ,eAtCD;;EAuCpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAG,oBA7CD;;EA8CpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAM,iBApDD;;EAqDpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cA1DD;;EA2DpB;EACF;EACA;EACA;EACA;EAC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lH,IAAL,CAAUkH,YAAV,GAAyB,KAAKjK,GAAL,CAAS4S,cAAT,CAAwB9Y,WAAxB,EAAqC,IAArC,CAAzB;EACD;EACF,GA35BH;;EAAA;EAAA,EAAmC+Y,gCAAnC;EAAahJ,cAEJpP,KAAK;EAFDoP,cAOJ3Q,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/resolution.d.ts b/dist/plugins/resolution.d.ts index 50e804d91..0daced467 100644 --- a/dist/plugins/resolution.d.ts +++ b/dist/plugins/resolution.d.ts @@ -9,6 +9,11 @@ type Resolution = { type ResolutionPluginOptions = { resolutions: Resolution[]; + showBadge?: boolean; +}; + +declare const EVENTS: { + RESOLUTION_CHANGED: 'resolution-changed', }; /** @@ -16,10 +21,6 @@ type ResolutionPluginOptions = { */ declare class ResolutionPlugin extends AbstractPlugin { - static EVENTS: { - RESOLUTION_CHANGED: 'resolution-changed', - }; - constructor(psv: Viewer, options: ResolutionPluginOptions); /** @@ -44,4 +45,4 @@ declare class ResolutionPlugin extends AbstractPlugin { } -export { Resolution, ResolutionPlugin, ResolutionPluginOptions }; +export { EVENTS, Resolution, ResolutionPlugin, ResolutionPluginOptions }; diff --git a/dist/plugins/resolution.js b/dist/plugins/resolution.js index 4173a6541..fa1d9264b 100644 --- a/dist/plugins/resolution.js +++ b/dist/plugins/resolution.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -104,6 +104,7 @@ /** * @typedef {Object} PSV.plugins.ResolutionPlugin.Options * @property {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions - list of available resolutions + * @property {boolean} [showBadge=true] - show the resolution id as a badge on the settings button */ photoSphereViewer.DEFAULTS.lang.resolution = 'Quality'; @@ -161,7 +162,9 @@ * @type {PSV.plugins.ResolutionPlugin.Options} */ - _this.config = _extends({}, options); + _this.config = _extends({ + showBadge: true + }, options); return _this; } /** @@ -194,6 +197,9 @@ }, apply: function apply(resolution) { return _this2.setResolution(resolution); + }, + badge: !this.config.showBadge ? null : function () { + return _this2.prop.resolution; } }); this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.PANORAMA_LOADED, this); @@ -286,7 +292,10 @@ }); if (this.prop.resolution !== (resolution == null ? void 0 : resolution.id)) { + var _this$settings; + this.prop.resolution = resolution == null ? void 0 : resolution.id; + (_this$settings = this.settings) == null ? void 0 : _this$settings.updateBadge(); this.trigger(EVENTS.RESOLUTION_CHANGED, this.prop.resolution); } } diff --git a/dist/plugins/resolution.js.map b/dist/plugins/resolution.js.map index b531d8b24..7682aa0bc 100644 --- a/dist/plugins/resolution.js.map +++ b/dist/plugins/resolution.js.map @@ -1 +1 @@ -{"version":3,"file":"resolution.js","sources":["../../src/plugins/resolution/constants.js","../../src/plugins/resolution/utils.js","../../src/plugins/resolution/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.ResolutionPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event resolution-changed\n * @memberof PSV.plugins.ResolutionPlugin\n * @summary Triggered when the resolution is changed\n * @param {string} resolutionId\n */\n RESOLUTION_CHANGED: 'resolution-changed',\n};\n","/**\n * @summary Returns deep equality between objects\n * {@link https://gist.github.com/egardner/efd34f270cc33db67c0246e837689cb9}\n * @param obj1\n * @param obj2\n * @return {boolean}\n * @private\n */\nexport function deepEqual(obj1, obj2) {\n if (obj1 === obj2) {\n return true;\n }\n else if (isObject(obj1) && isObject(obj2)) {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (const prop of Object.keys(obj1)) {\n if (!deepEqual(obj1[prop], obj2[prop])) {\n return false;\n }\n }\n return true;\n }\n else {\n return false;\n }\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj != null;\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError } from '../..';\nimport { EVENTS } from './constants';\nimport { deepEqual } from './utils';\n\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Resolution\n * @property {string} id\n * @property {string} label\n * @property {*} panorama\n */\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Options\n * @property {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions - list of available resolutions\n */\n\n\nDEFAULTS.lang.resolution = 'Quality';\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds a setting to choose between multiple resolutions of the panorama.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class ResolutionPlugin extends AbstractPlugin {\n\n static id = 'resolution';\n\n /**\n * @deprecated use the EVENTS constants of the module\n */\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.ResolutionPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @readonly\n * @private\n */\n this.settings = null;\n\n /**\n * @summary Available resolutions\n * @member {PSV.plugins.ResolutionPlugin.Resolution[]}\n */\n this.resolutions = [];\n\n /**\n * @summary Available resolutions\n * @member {Object.}\n * @private\n */\n this.resolutionsById = {};\n\n /**\n * @type {Object}\n * @property {string} resolution - Current resolution\n * @private\n */\n this.prop = {\n resolution: null,\n };\n\n /**\n * @type {PSV.plugins.ResolutionPlugin.Options}\n */\n this.config = {\n ...options,\n };\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.settings = this.psv.getPlugin('settings');\n\n if (!this.settings) {\n throw new PSVError('Resolution plugin requires the Settings plugin');\n }\n\n this.settings.addSetting({\n id : ResolutionPlugin.id,\n type : 'options',\n label : this.psv.config.lang.resolution,\n current: () => this.prop.resolution,\n options: () => this.__getSettingsOptions(),\n apply : resolution => this.setResolution(resolution),\n });\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n if (this.config.resolutions) {\n this.setResolutions(this.config.resolutions);\n delete this.config.resolutions;\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n this.settings.removeSetting(ResolutionPlugin.id);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.PANORAMA_LOADED) {\n this.__refreshResolution();\n }\n }\n\n /**\n * @summary Changes the available resolutions\n * @param {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions\n */\n setResolutions(resolutions) {\n this.resolutions = resolutions;\n this.resolutionsById = {};\n\n resolutions.forEach((resolution) => {\n if (!resolution.id) {\n throw new PSVError('Missing resolution id');\n }\n this.resolutionsById[resolution.id] = resolution;\n });\n\n this.__refreshResolution();\n }\n\n /**\n * @summary Changes the current resolution\n * @param {string} id\n */\n setResolution(id) {\n if (!this.resolutionsById[id]) {\n throw new PSVError(`Resolution ${id} unknown`);\n }\n\n return this.psv.setPanorama(this.resolutionsById[id].panorama, { transition: false, showLoader: false });\n }\n\n /**\n * @summary Returns the current resolution\n * @return {string}\n */\n getResolution() {\n return this.prop.resolution;\n }\n\n /**\n * @summary Updates current resolution on panorama load\n * @private\n */\n __refreshResolution() {\n const resolution = this.resolutions.find(r => deepEqual(this.psv.config.panorama, r.panorama));\n if (this.prop.resolution !== resolution?.id) {\n this.prop.resolution = resolution?.id;\n this.trigger(EVENTS.RESOLUTION_CHANGED, this.prop.resolution);\n }\n }\n\n /**\n * @summary Returns options for Settings plugin\n * @return {PSV.plugins.SettingsPlugin.Option[]}\n * @private\n */\n __getSettingsOptions() {\n return this.resolutions\n .map(resolution => ({\n id : resolution.id,\n label: resolution.label,\n }));\n }\n\n}\n"],"names":["EVENTS","RESOLUTION_CHANGED","deepEqual","obj1","obj2","isObject","Object","keys","length","prop","obj","DEFAULTS","lang","resolution","ResolutionPlugin","psv","options","settings","resolutions","resolutionsById","config","init","getPlugin","PSVError","addSetting","id","type","label","current","__getSettingsOptions","apply","setResolution","on","CONSTANTS","PANORAMA_LOADED","setResolutions","destroy","off","removeSetting","handleEvent","e","__refreshResolution","forEach","setPanorama","panorama","transition","showLoader","getResolution","find","r","trigger","map","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAE;EAPA;;ECNtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,SAASC,SAAT,CAAmBC,IAAnB,EAAyBC,IAAzB,EAA+B;EACpC,MAAID,IAAI,KAAKC,IAAb,EAAmB;EACjB,WAAO,IAAP;EACD,GAFD,MAGK,IAAIC,QAAQ,CAACF,IAAD,CAAR,IAAkBE,QAAQ,CAACD,IAAD,CAA9B,EAAsC;EACzC,QAAIE,MAAM,CAACC,IAAP,CAAYJ,IAAZ,EAAkBK,MAAlB,KAA6BF,MAAM,CAACC,IAAP,CAAYH,IAAZ,EAAkBI,MAAnD,EAA2D;EACzD,aAAO,KAAP;EACD;;EACD,oCAAmBF,MAAM,CAACC,IAAP,CAAYJ,IAAZ,CAAnB,kCAAsC;EAAjC,UAAMM,IAAI,mBAAV;;EACH,UAAI,CAACP,SAAS,CAACC,IAAI,CAACM,IAAD,CAAL,EAAaL,IAAI,CAACK,IAAD,CAAjB,CAAd,EAAwC;EACtC,eAAO,KAAP;EACD;EACF;;EACD,WAAO,IAAP;EACD,GAVI,MAWA;EACH,WAAO,KAAP;EACD;EACF;;EAED,SAASJ,QAAT,CAAkBK,GAAlB,EAAuB;EACrB,SAAO,OAAOA,GAAP,KAAe,QAAf,IAA2BA,GAAG,IAAI,IAAzC;EACD;;ECzBD;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;AAGAC,4BAAQ,CAACC,IAAT,CAAcC,UAAd,GAA2B,SAA3B;EAMA;EACA;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AASA;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"resolution.js","sources":["../../src/plugins/resolution/constants.js","../../src/plugins/resolution/utils.js","../../src/plugins/resolution/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.ResolutionPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event resolution-changed\n * @memberof PSV.plugins.ResolutionPlugin\n * @summary Triggered when the resolution is changed\n * @param {string} resolutionId\n */\n RESOLUTION_CHANGED: 'resolution-changed',\n};\n","/**\n * @summary Returns deep equality between objects\n * {@link https://gist.github.com/egardner/efd34f270cc33db67c0246e837689cb9}\n * @param obj1\n * @param obj2\n * @return {boolean}\n * @private\n */\nexport function deepEqual(obj1, obj2) {\n if (obj1 === obj2) {\n return true;\n }\n else if (isObject(obj1) && isObject(obj2)) {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (const prop of Object.keys(obj1)) {\n if (!deepEqual(obj1[prop], obj2[prop])) {\n return false;\n }\n }\n return true;\n }\n else {\n return false;\n }\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj != null;\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError } from '../..';\nimport { EVENTS } from './constants';\nimport { deepEqual } from './utils';\n\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Resolution\n * @property {string} id\n * @property {string} label\n * @property {*} panorama\n */\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Options\n * @property {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions - list of available resolutions\n * @property {boolean} [showBadge=true] - show the resolution id as a badge on the settings button\n */\n\n\nDEFAULTS.lang.resolution = 'Quality';\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds a setting to choose between multiple resolutions of the panorama.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class ResolutionPlugin extends AbstractPlugin {\n\n static id = 'resolution';\n\n /**\n * @deprecated use the EVENTS constants of the module\n */\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.ResolutionPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @readonly\n * @private\n */\n this.settings = null;\n\n /**\n * @summary Available resolutions\n * @member {PSV.plugins.ResolutionPlugin.Resolution[]}\n */\n this.resolutions = [];\n\n /**\n * @summary Available resolutions\n * @member {Object.}\n * @private\n */\n this.resolutionsById = {};\n\n /**\n * @type {Object}\n * @property {string} resolution - Current resolution\n * @private\n */\n this.prop = {\n resolution: null,\n };\n\n /**\n * @type {PSV.plugins.ResolutionPlugin.Options}\n */\n this.config = {\n showBadge: true,\n ...options,\n };\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.settings = this.psv.getPlugin('settings');\n\n if (!this.settings) {\n throw new PSVError('Resolution plugin requires the Settings plugin');\n }\n\n this.settings.addSetting({\n id : ResolutionPlugin.id,\n type : 'options',\n label : this.psv.config.lang.resolution,\n current: () => this.prop.resolution,\n options: () => this.__getSettingsOptions(),\n apply : resolution => this.setResolution(resolution),\n badge : !this.config.showBadge ? null : () => this.prop.resolution,\n });\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n if (this.config.resolutions) {\n this.setResolutions(this.config.resolutions);\n delete this.config.resolutions;\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n this.settings.removeSetting(ResolutionPlugin.id);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.PANORAMA_LOADED) {\n this.__refreshResolution();\n }\n }\n\n /**\n * @summary Changes the available resolutions\n * @param {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions\n */\n setResolutions(resolutions) {\n this.resolutions = resolutions;\n this.resolutionsById = {};\n\n resolutions.forEach((resolution) => {\n if (!resolution.id) {\n throw new PSVError('Missing resolution id');\n }\n this.resolutionsById[resolution.id] = resolution;\n });\n\n this.__refreshResolution();\n }\n\n /**\n * @summary Changes the current resolution\n * @param {string} id\n */\n setResolution(id) {\n if (!this.resolutionsById[id]) {\n throw new PSVError(`Resolution ${id} unknown`);\n }\n\n return this.psv.setPanorama(this.resolutionsById[id].panorama, { transition: false, showLoader: false });\n }\n\n /**\n * @summary Returns the current resolution\n * @return {string}\n */\n getResolution() {\n return this.prop.resolution;\n }\n\n /**\n * @summary Updates current resolution on panorama load\n * @private\n */\n __refreshResolution() {\n const resolution = this.resolutions.find(r => deepEqual(this.psv.config.panorama, r.panorama));\n if (this.prop.resolution !== resolution?.id) {\n this.prop.resolution = resolution?.id;\n this.settings?.updateBadge();\n this.trigger(EVENTS.RESOLUTION_CHANGED, this.prop.resolution);\n }\n }\n\n /**\n * @summary Returns options for Settings plugin\n * @return {PSV.plugins.SettingsPlugin.Option[]}\n * @private\n */\n __getSettingsOptions() {\n return this.resolutions\n .map(resolution => ({\n id : resolution.id,\n label: resolution.label,\n }));\n }\n\n}\n"],"names":["EVENTS","RESOLUTION_CHANGED","deepEqual","obj1","obj2","isObject","Object","keys","length","prop","obj","DEFAULTS","lang","resolution","ResolutionPlugin","psv","options","settings","resolutions","resolutionsById","config","showBadge","init","getPlugin","PSVError","addSetting","id","type","label","current","__getSettingsOptions","apply","setResolution","badge","on","CONSTANTS","PANORAMA_LOADED","setResolutions","destroy","off","removeSetting","handleEvent","e","__refreshResolution","forEach","setPanorama","panorama","transition","showLoader","getResolution","find","r","updateBadge","trigger","map","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAE;EAPA;;ECNtB;EACA;EACA;EACA;EACA;EACA;EACA;EACA;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d;EAAqBC,MAAAA,UAAU,EAAE;EAAjC,KAAxD,CAAP;EACD;EAED;EACF;EACA;EACA;EA3IA;;EAAA,SA4IEC,aA5IF,GA4IE,yBAAgB;EACd,WAAO,KAAKxC,IAAL,CAAUI,UAAjB;EACD;EAED;EACF;EACA;EACA;EAnJA;;EAAA,SAoJE8B,mBApJF,GAoJE,+BAAsB;EAAA;;EACpB,QAAM9B,UAAU,GAAG,KAAKK,WAAL,CAAiBgC,IAAjB,CAAsB,UAAAC,CAAC;EAAA,aAAIjD,SAAS,CAAC,MAAI,CAACa,GAAL,CAASK,MAAT,CAAgB0B,QAAjB,EAA2BK,CAAC,CAACL,QAA7B,CAAb;EAAA,KAAvB,CAAnB;;EACA,QAAI,KAAKrC,IAAL,CAAUI,UAAV,MAAyBA,UAAzB,oBAAyBA,UAAU,CAAEa,EAArC,CAAJ,EAA6C;EAAA;;EAC3C,WAAKjB,IAAL,CAAUI,UAAV,GAAuBA,UAAvB,oBAAuBA,UAAU,CAAEa,EAAnC;EACA,6BAAKT,QAAL,oCAAemC,WAAf;EACA,WAAKC,OAAL,CAAarD,MAAM,CAACC,kBAApB,EAAwC,KAAKQ,IAAL,CAAUI,UAAlD;EACD;EACF;EAED;EACF;EACA;EACA;EACA;EAjKA;;EAAA,SAkKEiB,oBAlKF,GAkKE,gCAAuB;EACrB,WAAO,KAAKZ,WAAL,CACJoC,GADI,CACA,UAAAzC,UAAU;EAAA,aAAK;EAClBa,QAAAA,EAAE,EAAKb,UAAU,CAACa,EADA;EAElBE,QAAAA,KAAK,EAAEf,UAAU,CAACe;EAFA,OAAL;EAAA,KADV,CAAP;EAKD,GAxKH;;EAAA;EAAA,EAAsC2B,gCAAtC;EAAazC,iBAEJY,KAAK;EAFDZ,iBAOJd,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/settings.css b/dist/plugins/settings.css index f7778687f..ba8c42d01 100644 --- a/dist/plugins/settings.css +++ b/dist/plugins/settings.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.1 + * Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -40,4 +40,15 @@ -webkit-transform: scaleX(-1); transform: scaleX(-1); } + +.psv-settings-badge { + position: absolute; + top: 10%; + right: 10%; + border-radius: 0.2em; + padding: 0.2em; + background: #111; + color: white; + font: 10px/0.9 monospace; +} /*# sourceMappingURL=settings.css.map */ \ No newline at end of file diff --git a/dist/plugins/settings.css.map b/dist/plugins/settings.css.map index 2fcb40cfe..724fc4eaa 100644 --- a/dist/plugins/settings.css.map +++ b/dist/plugins/settings.css.map @@ -1 +1 @@ -{"version":3,"sources":["","style.scss"],"names":[],"mappings":"AAAA;;;;;GAAA;ACAA;EACE,mBAAO;MAAP,WAAO;UAAP,OAAO;EACP,iBAAiB;AACnB;AACA;EACE,mBAAU;MAAV,cAAU;UAAV,UAAU;AACZ;AACA;EACE,mBAAU;MAAV,cAAU;UAAV,UAAU;EACV,WAAW;EACX,UAAU;AACZ;AACA;EACE,UAAU;EACV,WAAW;AACb;AACA;EACE,iBAAiB;AACnB;AACA;EACE,gBAAgB;AAClB;AACA;EACE,qCAAqC;EACrC,kBAAkB;AACpB;AACA;EACE,6BAAqB;UAArB,qBAAqB;AACvB","file":"settings.css","sourcesContent":[null,".psv-settings-item-label {\n flex: 1;\n font-weight: bold;\n}\n.psv-settings-item-value {\n flex: none;\n}\n.psv-settings-item-icon {\n flex: none;\n height: 1em;\n width: 1em;\n}\n.psv-settings-item-icon svg {\n width: 1em;\n height: 1em;\n}\n.psv-settings-item-icon:first-child {\n margin-right: 1em;\n}\n.psv-settings-item-icon:last-child {\n margin-left: 1em;\n}\n.psv-settings-item--header {\n border-bottom: 1px solid currentcolor;\n margin-bottom: 1em;\n}\n.psv-settings-item--header svg {\n transform: scaleX(-1);\n}"]} \ No newline at end of file +{"version":3,"sources":["","style.scss"],"names":[],"mappings":"AAAA;;;;;GAAA;ACAA;EACE,mBAAO;MAAP,WAAO;UAAP,OAAO;EACP,iBAAiB;AACnB;AACA;EACE,mBAAU;MAAV,cAAU;UAAV,UAAU;AACZ;AACA;EACE,mBAAU;MAAV,cAAU;UAAV,UAAU;EACV,WAAW;EACX,UAAU;AACZ;AACA;EACE,UAAU;EACV,WAAW;AACb;AACA;EACE,iBAAiB;AACnB;AACA;EACE,gBAAgB;AAClB;AACA;EACE,qCAAqC;EACrC,kBAAkB;AACpB;AACA;EACE,6BAAqB;UAArB,qBAAqB;AACvB;;AAEA;EACE,kBAAkB;EAClB,QAAQ;EACR,UAAU;EACV,oBAAoB;EACpB,cAAc;EACd,gBAAgB;EAChB,YAAY;EACZ,wBAAwB;AAC1B","file":"settings.css","sourcesContent":[null,".psv-settings-item-label {\n flex: 1;\n font-weight: bold;\n}\n.psv-settings-item-value {\n flex: none;\n}\n.psv-settings-item-icon {\n flex: none;\n height: 1em;\n width: 1em;\n}\n.psv-settings-item-icon svg {\n width: 1em;\n height: 1em;\n}\n.psv-settings-item-icon:first-child {\n margin-right: 1em;\n}\n.psv-settings-item-icon:last-child {\n margin-left: 1em;\n}\n.psv-settings-item--header {\n border-bottom: 1px solid currentcolor;\n margin-bottom: 1em;\n}\n.psv-settings-item--header svg {\n transform: scaleX(-1);\n}\n\n.psv-settings-badge {\n position: absolute;\n top: 10%;\n right: 10%;\n border-radius: 0.2em;\n padding: 0.2em;\n background: #111;\n color: white;\n font: 10px/0.9 monospace;\n}"]} \ No newline at end of file diff --git a/dist/plugins/settings.d.ts b/dist/plugins/settings.d.ts index 1a8eecaf8..83bbc0899 100644 --- a/dist/plugins/settings.d.ts +++ b/dist/plugins/settings.d.ts @@ -1,3 +1,4 @@ +import { Event } from 'uevent'; import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; /** @@ -6,6 +7,7 @@ import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; type BaseSetting = { id: string; label: string; + badge?: () => string; }; /** @@ -37,6 +39,10 @@ type SettingOption = { type Setting = OptionsSetting | ToggleSetting; +declare const EVENTS: { + SETTING_CHANGED: 'setting-changed', +}; + /** * @summary Adds a button to access various settings. */ @@ -70,6 +76,11 @@ declare class SettingsPlugin extends AbstractPlugin { */ showSettings(); + /** + * @summary Triggered when a setting is changed + */ + on(e: 'setting-changed', cb: (e: Event, settingId: string, value: any) => void): this; + } -export { BaseSetting, OptionsSetting, Setting, SettingOption, SettingsPlugin, ToggleSetting }; +export { BaseSetting, EVENTS, OptionsSetting, Setting, SettingOption, SettingsPlugin, ToggleSetting }; diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index 074b6ee35..e74d661e0 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -44,6 +44,23 @@ var switchOn = "\n"; + /** + * @summary Available events + * @enum {string} + * @memberof PSV.plugins.ResolutionPlugin + * @constant + */ + + var EVENTS = { + /** + * @event setting-changed + * @memberof PSV.plugins.SettingsPlugin + * @summary Triggered when a setting is changed + * @param {string} settingId + * @param {any} value + */ + SETTING_CHANGED: 'setting-changed' + }; /** * @summary Panel identifier for settings content * @type {string} @@ -130,6 +147,17 @@ */ _this.plugin = _this.psv.getPlugin('settings'); + /** + * @member {HTMLElement} + * @private + * @readonly + */ + + _this.badge = document.createElement('div'); + _this.badge.className = 'psv-settings-badge'; + _this.badge.style.display = 'none'; + + _this.container.appendChild(_this.badge); if (_this.plugin) { _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.OPEN_PANEL, _assertThisInitialized(_this)); @@ -192,6 +220,16 @@ _proto.onClick = function onClick() { this.plugin.toggleSettings(); + } + /** + * @summary Changes the badge value + * @param {string} value + */ + ; + + _proto.setBadge = function setBadge(value) { + this.badge.innerText = value; + this.badge.style.display = value ? '' : 'none'; }; return SettingsButton; @@ -205,6 +243,7 @@ * @property {string} id - identifier of the setting * @property {string} label - label of the setting * @property {'options' | 'toggle'} type - type of the setting + * @property {function} [badge] - function which returns the value of the button badge */ /** @@ -266,7 +305,14 @@ var _proto = SettingsPlugin.prototype; _proto.init = function init() { - _AbstractPlugin.prototype.init.call(this); + var _this2 = this; + + _AbstractPlugin.prototype.init.call(this); // buttons are initialized just after plugins + + + setTimeout(function () { + return _this2.updateBadge(); + }); } /** * @package @@ -297,11 +343,19 @@ throw new photoSphereViewer.PSVError('Unsupported setting type'); } + if (setting.badge && this.settings.some(function (s) { + return s.badge; + })) { + photoSphereViewer.utils.logWarn('More than one setting with a badge are declared, the result is unpredictable.'); + } + this.settings.push(setting); if (this.psv.panel.prop.contentId === ID_PANEL) { this.showSettings(); } + + this.updateBadge(); } /** * @summary Removes a setting @@ -327,6 +381,8 @@ if (this.psv.panel.prop.contentId === ID_PANEL) { this.showSettings(); } + + this.updateBadge(); } } /** @@ -355,7 +411,7 @@ ; _proto.showSettings = function showSettings() { - var _this2 = this; + var _this3 = this; this.psv.panel.show({ id: ID_PANEL, @@ -372,7 +428,7 @@ var li = e.target ? photoSphereViewer.utils.getClosest(e.target, 'li') : undefined; var settingId = li ? li.dataset[SETTING_DATA] : undefined; - var setting = _this2.settings.find(function (s) { + var setting = _this3.settings.find(function (s) { return s.id === settingId; }); @@ -381,12 +437,16 @@ case 'toggle': setting.toggle(); - _this2.showSettings(); + _this3.trigger(EVENTS.SETTING_CHANGED, setting.id, setting.active()); + + _this3.showSettings(); + + _this3.updateBadge(); break; case 'options': - _this2.__showOptions(setting); + _this3.__showOptions(setting); break; @@ -403,7 +463,7 @@ ; _proto.__showOptions = function __showOptions(setting) { - var _this3 = this; + var _this4 = this; var current = setting.current(); this.psv.panel.show({ @@ -418,20 +478,38 @@ var optionId = li ? li.dataset[SETTING_DATA] : undefined; if (optionId === '__back') { - _this3.showSettings(); + _this4.showSettings(); } else { setting.apply(optionId); - _this3.hideSettings(); + _this4.trigger(EVENTS.SETTING_CHANGED, setting.id, setting.current()); + + _this4.hideSettings(); + + _this4.updateBadge(); } } }); + } + /** + * @summary Updates the badge in the button + */ + ; + + _proto.updateBadge = function updateBadge() { + var _this$settings$find, _this$psv$navbar$getB; + + var value = (_this$settings$find = this.settings.find(function (s) { + return s.badge; + })) == null ? void 0 : _this$settings$find.badge(); + (_this$psv$navbar$getB = this.psv.navbar.getButton(SettingsButton.id, false)) == null ? void 0 : _this$psv$navbar$getB.setBadge(value); }; return SettingsPlugin; }(photoSphereViewer.AbstractPlugin); SettingsPlugin.id = 'settings'; + exports.EVENTS = EVENTS; exports.SettingsPlugin = SettingsPlugin; Object.defineProperty(exports, '__esModule', { value: true }); diff --git a/dist/plugins/settings.js.map b/dist/plugins/settings.js.map index ff4502418..31ca85fde 100644 --- a/dist/plugins/settings.js.map +++ b/dist/plugins/settings.js.map @@ -1 +1 @@ -{"version":3,"file":"settings.js","sources":["../../src/plugins/settings/constants.js","../../src/plugins/settings/SettingsButton.js","../../src/plugins/settings/index.js"],"sourcesContent":["import check from './check.svg';\nimport chevron from './chevron.svg';\nimport icon from './settings.svg';\nimport switchOff from './switch-off.svg';\nimport switchOn from './switch-on.svg';\n\n/**\n * @summary Panel identifier for settings content\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL = 'settings';\n\n/**\n * @summary Property name added to settings items\n * @type {string}\n * @constant\n * @private\n */\nexport const SETTING_DATA = 'settingId';\n\n/**\n * @summary Setting item template, by type\n * @constant\n * @private\n */\nexport const SETTINGS_TEMPLATE_ = {\n options: (setting, optionsCurrent) => `\n ${setting.label}\n ${optionsCurrent(setting)}\n ${chevron}\n `,\n toggle : setting => `\n ${setting.label}\n ${setting.active() ? switchOn : switchOff}\n `,\n};\n\n/**\n * @summary Settings list template\n * @param {PSV.plugins.SettingsPlugin.Setting[]} settings\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionsCurrent\n * @returns {string}\n * @constant\n * @private\n */\nexport const SETTINGS_TEMPLATE = (settings, title, dataKey, optionsCurrent) => `\n
\n

${icon} ${title}

\n
    \n ${settings.map(s => `\n
  • \n ${SETTINGS_TEMPLATE_[s.type](s, optionsCurrent)}\n
  • \n `).join('')}\n
\n
\n`;\n\n/**\n * @summary Settings options template\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionActive\n * @returns {string}\n * @constant\n * @private\n */\nexport const SETTING_OPTIONS_TEMPLATE = (setting, title, dataKey, optionActive) => `\n
\n

${icon} ${title}

\n
    \n
  • \n ${chevron}\n ${setting.label}\n
  • \n ${setting.options().map(s => `\n
  • \n ${optionActive(s) ? check : ''}\n ${s.label}\n
  • \n `).join('')}\n
\n
\n`;\n","import { AbstractButton, CONSTANTS } from '../..';\nimport { ID_PANEL } from './constants';\nimport icon from './settings.svg';\n\n/**\n * @summary Navigation bar settings button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class SettingsButton extends AbstractButton {\n\n static id = 'settings';\n static icon = icon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-settings-button', true);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('settings');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\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 CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === ID_PANEL); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles settings\n */\n onClick() {\n this.plugin.toggleSettings();\n }\n\n}\n","import { AbstractPlugin, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { ID_PANEL, SETTING_DATA, SETTING_OPTIONS_TEMPLATE, SETTINGS_TEMPLATE, SETTINGS_TEMPLATE_ } from './constants';\nimport { SettingsButton } from './SettingsButton';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.SettingsPlugin.Setting\n * @summary Description of a setting\n * @property {string} id - identifier of the setting\n * @property {string} label - label of the setting\n * @property {'options' | 'toggle'} type - type of the setting\n */\n\n/**\n * @typedef {PSV.plugins.SettingsPlugin.Setting} PSV.plugins.SettingsPlugin.OptionsSetting\n * @summary Description of a 'options' setting\n * @property {'options'} type - type of the setting\n * @property {function} current - function which returns the current option id\n * @property {function} options - function which the possible options as an array of {@link PSV.plugins.SettingsPlugin.Option}\n * @property {function} apply - function called with the id of the selected option\n */\n\n/**\n * @typedef {PSV.plugins.SettingsPlugin.Setting} PSV.plugins.SettingsPlugin.ToggleSetting\n * @summary Description of a 'toggle' setting\n * @property {'toggle'} type - type of the setting\n * @property {function} active - function which return whereas the setting is active or not\n * @property {function} toggle - function called when the setting is toggled\n */\n\n/**\n * @typedef {Object} PSV.plugins.SettingsPlugin.Option\n * @summary Option of an 'option' setting\n * @property {string} id - identifier of the option\n * @property {string} label - label of the option\n */\n\n\n// add settings button\nDEFAULTS.lang[SettingsButton.id] = 'Settings';\nregisterButton(SettingsButton, 'fullscreen:left');\n\n\n/**\n * @summary Adds a button to access various settings.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class SettingsPlugin extends AbstractPlugin {\n\n static id = 'settings';\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin.Setting[]}\n * @private\n */\n this.settings = [];\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n }\n\n /**\n * @package\n */\n destroy() {\n delete this.settings;\n\n super.destroy();\n }\n\n /**\n * @summary Registers a new setting\n * @param {PSV.plugins.SettingsPlugin.Setting} setting\n */\n addSetting(setting) {\n if (!setting.id) {\n throw new PSVError('Missing setting id');\n }\n if (!setting.type) {\n throw new PSVError('Missing setting type');\n }\n if (!SETTINGS_TEMPLATE_[setting.type]) {\n throw new PSVError('Unsupported setting type');\n }\n\n this.settings.push(setting);\n\n if (this.psv.panel.prop.contentId === ID_PANEL) {\n this.showSettings();\n }\n }\n\n /**\n * @summary Removes a setting\n * @param {string} id\n */\n removeSetting(id) {\n let idx = -1;\n // FIXME use findIndex, one day, when IE11 is totally dead\n this.settings.some((setting, i) => {\n if (setting.id === id) {\n idx = i;\n return true;\n }\n return false;\n });\n if (idx !== -1) {\n this.settings.splice(idx, 1);\n\n if (this.psv.panel.prop.contentId === ID_PANEL) {\n this.showSettings();\n }\n }\n }\n\n /**\n * @summary Toggles the settings panel\n */\n toggleSettings() {\n if (this.psv.panel.prop.contentId === ID_PANEL) {\n this.hideSettings();\n }\n else {\n this.showSettings();\n }\n }\n\n /**\n * @summary Hides the settings panel\n */\n hideSettings() {\n this.psv.panel.hide(ID_PANEL);\n }\n\n /**\n * @summary Shows the settings panel\n */\n showSettings() {\n this.psv.panel.show({\n id : ID_PANEL,\n content : SETTINGS_TEMPLATE(\n this.settings,\n this.psv.config.lang[SettingsButton.id],\n utils.dasherize(SETTING_DATA),\n (setting) => { // retrocompatibility with \"current\" returning a label\n const current = setting.current();\n const option = setting.options().find(opt => opt.id === current);\n return option?.label || current;\n }\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const settingId = li ? li.dataset[SETTING_DATA] : undefined;\n const setting = this.settings.find(s => s.id === settingId);\n\n if (setting) {\n switch (setting.type) {\n case 'toggle':\n setting.toggle();\n this.showSettings();\n break;\n\n case 'options':\n this.__showOptions(setting);\n break;\n\n default:\n // noop\n }\n }\n },\n });\n }\n\n /**\n * @summary Shows setting options panel\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @private\n */\n __showOptions(setting) {\n const current = setting.current();\n\n this.psv.panel.show({\n id : ID_PANEL,\n content : SETTING_OPTIONS_TEMPLATE(\n setting,\n this.psv.config.lang[SettingsButton.id],\n utils.dasherize(SETTING_DATA),\n (option) => { // retrocompatibility with options having an \"active\" flag\n return 'active' in option ? option.active : option.id === current;\n }\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const optionId = li ? li.dataset[SETTING_DATA] : undefined;\n\n if (optionId === '__back') {\n this.showSettings();\n }\n else {\n setting.apply(optionId);\n this.hideSettings();\n }\n },\n });\n }\n\n}\n"],"names":["ID_PANEL","SETTING_DATA","SETTINGS_TEMPLATE_","options","setting","optionsCurrent","label","chevron","toggle","active","switchOn","switchOff","SETTINGS_TEMPLATE","settings","title","dataKey","icon","map","s","id","type","join","SETTING_OPTIONS_TEMPLATE","optionActive","check","SettingsButton","navbar","plugin","psv","getPlugin","on","CONSTANTS","EVENTS","OPEN_PANEL","CLOSE_PANEL","destroy","off","isSupported","handleEvent","e","toggleActive","args","onClick","toggleSettings","AbstractButton","DEFAULTS","lang","registerButton","SettingsPlugin","init","addSetting","PSVError","push","panel","prop","contentId","showSettings","removeSetting","idx","some","i","splice","hideSettings","hide","show","content","config","utils","dasherize","current","option","find","opt","noMargin","clickHandler","li","target","getClosest","undefined","settingId","dataset","__showOptions","optionId","apply","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMA,QAAQ,GAAG,UAAjB;EAEP;EACA;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A,EAAoCsB,gCAApC;EAAapC,eAEJ7B,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"settings.js","sources":["../../src/plugins/settings/constants.js","../../src/plugins/settings/SettingsButton.js","../../src/plugins/settings/index.js"],"sourcesContent":["import check from './check.svg';\nimport chevron from './chevron.svg';\nimport icon from './settings.svg';\nimport switchOff from './switch-off.svg';\nimport switchOn from './switch-on.svg';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.ResolutionPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event setting-changed\n * @memberof PSV.plugins.SettingsPlugin\n * @summary Triggered when a setting is changed\n * @param {string} settingId\n * @param {any} value\n */\n SETTING_CHANGED: 'setting-changed',\n};\n\n\n/**\n * @summary Panel identifier for settings content\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL = 'settings';\n\n/**\n * @summary Property name added to settings items\n * @type {string}\n * @constant\n * @private\n */\nexport const SETTING_DATA = 'settingId';\n\n/**\n * @summary Setting item template, by type\n * @constant\n * @private\n */\nexport const SETTINGS_TEMPLATE_ = {\n options: (setting, optionsCurrent) => `\n ${setting.label}\n ${optionsCurrent(setting)}\n ${chevron}\n `,\n toggle : setting => `\n ${setting.label}\n ${setting.active() ? switchOn : switchOff}\n `,\n};\n\n/**\n * @summary Settings list template\n * @param {PSV.plugins.SettingsPlugin.Setting[]} settings\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionsCurrent\n * @returns {string}\n * @constant\n * @private\n */\nexport const SETTINGS_TEMPLATE = (settings, title, dataKey, optionsCurrent) => `\n
\n

${icon} ${title}

\n
    \n ${settings.map(s => `\n
  • \n ${SETTINGS_TEMPLATE_[s.type](s, optionsCurrent)}\n
  • \n `).join('')}\n
\n
\n`;\n\n/**\n * @summary Settings options template\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionActive\n * @returns {string}\n * @constant\n * @private\n */\nexport const SETTING_OPTIONS_TEMPLATE = (setting, title, dataKey, optionActive) => `\n
\n

${icon} ${title}

\n
    \n
  • \n ${chevron}\n ${setting.label}\n
  • \n ${setting.options().map(s => `\n
  • \n ${optionActive(s) ? check : ''}\n ${s.label}\n
  • \n `).join('')}\n
\n
\n`;\n","import { AbstractButton, CONSTANTS } from '../..';\nimport { ID_PANEL } from './constants';\nimport icon from './settings.svg';\n\n/**\n * @summary Navigation bar settings button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class SettingsButton extends AbstractButton {\n\n static id = 'settings';\n static icon = icon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-settings-button', true);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('settings');\n\n /**\n * @member {HTMLElement}\n * @private\n * @readonly\n */\n this.badge = document.createElement('div');\n this.badge.className = 'psv-settings-badge';\n this.badge.style.display = 'none';\n this.container.appendChild(this.badge);\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\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 CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === ID_PANEL); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles settings\n */\n onClick() {\n this.plugin.toggleSettings();\n }\n\n /**\n * @summary Changes the badge value\n * @param {string} value\n */\n setBadge(value) {\n this.badge.innerText = value;\n this.badge.style.display = value ? '' : 'none';\n }\n\n}\n","import { AbstractPlugin, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport {\n EVENTS,\n ID_PANEL,\n SETTING_DATA,\n SETTING_OPTIONS_TEMPLATE,\n SETTINGS_TEMPLATE,\n SETTINGS_TEMPLATE_\n} from './constants';\nimport { SettingsButton } from './SettingsButton';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.SettingsPlugin.Setting\n * @summary Description of a setting\n * @property {string} id - identifier of the setting\n * @property {string} label - label of the setting\n * @property {'options' | 'toggle'} type - type of the setting\n * @property {function} [badge] - function which returns the value of the button badge\n */\n\n/**\n * @typedef {PSV.plugins.SettingsPlugin.Setting} PSV.plugins.SettingsPlugin.OptionsSetting\n * @summary Description of a 'options' setting\n * @property {'options'} type - type of the setting\n * @property {function} current - function which returns the current option id\n * @property {function} options - function which the possible options as an array of {@link PSV.plugins.SettingsPlugin.Option}\n * @property {function} apply - function called with the id of the selected option\n */\n\n/**\n * @typedef {PSV.plugins.SettingsPlugin.Setting} PSV.plugins.SettingsPlugin.ToggleSetting\n * @summary Description of a 'toggle' setting\n * @property {'toggle'} type - type of the setting\n * @property {function} active - function which return whereas the setting is active or not\n * @property {function} toggle - function called when the setting is toggled\n */\n\n/**\n * @typedef {Object} PSV.plugins.SettingsPlugin.Option\n * @summary Option of an 'option' setting\n * @property {string} id - identifier of the option\n * @property {string} label - label of the option\n */\n\n\n// add settings button\nDEFAULTS.lang[SettingsButton.id] = 'Settings';\nregisterButton(SettingsButton, 'fullscreen:left');\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds a button to access various settings.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class SettingsPlugin extends AbstractPlugin {\n\n static id = 'settings';\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin.Setting[]}\n * @private\n */\n this.settings = [];\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n // buttons are initialized just after plugins\n setTimeout(() => this.updateBadge());\n }\n\n /**\n * @package\n */\n destroy() {\n delete this.settings;\n\n super.destroy();\n }\n\n /**\n * @summary Registers a new setting\n * @param {PSV.plugins.SettingsPlugin.Setting} setting\n */\n addSetting(setting) {\n if (!setting.id) {\n throw new PSVError('Missing setting id');\n }\n if (!setting.type) {\n throw new PSVError('Missing setting type');\n }\n if (!SETTINGS_TEMPLATE_[setting.type]) {\n throw new PSVError('Unsupported setting type');\n }\n\n if (setting.badge && this.settings.some(s => s.badge)) {\n utils.logWarn('More than one setting with a badge are declared, the result is unpredictable.');\n }\n\n this.settings.push(setting);\n\n if (this.psv.panel.prop.contentId === ID_PANEL) {\n this.showSettings();\n }\n\n this.updateBadge();\n }\n\n /**\n * @summary Removes a setting\n * @param {string} id\n */\n removeSetting(id) {\n let idx = -1;\n // FIXME use findIndex, one day, when IE11 is totally dead\n this.settings.some((setting, i) => {\n if (setting.id === id) {\n idx = i;\n return true;\n }\n return false;\n });\n if (idx !== -1) {\n this.settings.splice(idx, 1);\n\n if (this.psv.panel.prop.contentId === ID_PANEL) {\n this.showSettings();\n }\n\n this.updateBadge();\n }\n }\n\n /**\n * @summary Toggles the settings panel\n */\n toggleSettings() {\n if (this.psv.panel.prop.contentId === ID_PANEL) {\n this.hideSettings();\n }\n else {\n this.showSettings();\n }\n }\n\n /**\n * @summary Hides the settings panel\n */\n hideSettings() {\n this.psv.panel.hide(ID_PANEL);\n }\n\n /**\n * @summary Shows the settings panel\n */\n showSettings() {\n this.psv.panel.show({\n id : ID_PANEL,\n content : SETTINGS_TEMPLATE(\n this.settings,\n this.psv.config.lang[SettingsButton.id],\n utils.dasherize(SETTING_DATA),\n (setting) => { // retrocompatibility with \"current\" returning a label\n const current = setting.current();\n const option = setting.options().find(opt => opt.id === current);\n return option?.label || current;\n }\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const settingId = li ? li.dataset[SETTING_DATA] : undefined;\n const setting = this.settings.find(s => s.id === settingId);\n\n if (setting) {\n switch (setting.type) {\n case 'toggle':\n setting.toggle();\n this.trigger(EVENTS.SETTING_CHANGED, setting.id, setting.active());\n this.showSettings();\n this.updateBadge();\n break;\n\n case 'options':\n this.__showOptions(setting);\n break;\n\n default:\n // noop\n }\n }\n },\n });\n }\n\n /**\n * @summary Shows setting options panel\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @private\n */\n __showOptions(setting) {\n const current = setting.current();\n\n this.psv.panel.show({\n id : ID_PANEL,\n content : SETTING_OPTIONS_TEMPLATE(\n setting,\n this.psv.config.lang[SettingsButton.id],\n utils.dasherize(SETTING_DATA),\n (option) => { // retrocompatibility with options having an \"active\" flag\n return 'active' in option ? option.active : option.id === current;\n }\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const optionId = li ? li.dataset[SETTING_DATA] : undefined;\n\n if (optionId === '__back') {\n this.showSettings();\n }\n else {\n setting.apply(optionId);\n this.trigger(EVENTS.SETTING_CHANGED, setting.id, setting.current());\n this.hideSettings();\n this.updateBadge();\n }\n },\n });\n }\n\n /**\n * @summary Updates the badge in the button\n */\n updateBadge() {\n const value = this.settings.find(s => s.badge)?.badge();\n this.psv.navbar.getButton(SettingsButton.id, false)?.setBadge(value);\n }\n\n}\n"],"names":["EVENTS","SETTING_CHANGED","ID_PANEL","SETTING_DATA","SETTINGS_TEMPLATE_","options","setting","optionsCurrent","label","chevron","toggle","active","switchOn","switchOff","SETTINGS_TEMPLATE","settings","title","dataKey","icon","map","s","id","type","join","SETTING_OPTIONS_TEMPLATE","optionActive","check","SettingsButton","navbar","plugin","psv","getPlugin","badge","document","createElement","className","style","display","container","appendChild","on","CONSTANTS","OPEN_PANEL","CLOSE_PANEL","destroy","off","isSupported","handleEvent","e","toggleActive","args","onClick","toggleSettings","setBadge","value","innerText","AbstractButton","DEFAULTS","lang","registerButton","SettingsPlugin","init","setTimeout","updateBadge","addSetting","PSVError","some","utils","logWarn","push","panel","prop","contentId","showSettings","removeSetting","idx","i","splice","hideSettings","hide","show","content","config","dasherize","current","option","find","opt","noMargin","clickHandler","li","target","getClosest","undefined","settingId","dataset","trigger","__showOptions","optionId","apply","getButton","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA;;MACaA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAE;EARG;EAYtB;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,QAAQ,GAAG,UAAjB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,YAAY,GAAG,WAArB;EAEP;EACA;EACA;EACA;EACA;;EACO,IAAMC,kBAAkB,GAAG;EAChCC,EAAAA,OAAO,EAAE,iBAACC,OAAD,EAAUC,cAAV;EAAA,gEACmCD,OAAO,CAACE,KAD3C,+DAEmCD,cAAc,CAACD,OAAD,CAFjD,8DAGkCG,OAHlC;EAAA,GADuB;EAMhCC,EAAAA,MAAM,EAAG,gBAAAJ,OAAO;EAAA,gEAC4BA,OAAO,CAACE,KADpC,gEAE4BF,OAAO,CAACK,MAAR,KAAmBC,QAAnB,GAA8BC,SAF1D;EAAA;EANgB,CAA3B;EAYP;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,iBAAiB,GAAG,SAApBA,iBAAoB,CAACC,QAAD,EAAWC,KAAX,EAAkBC,OAAlB,EAA2BV,cAA3B;EAAA,qFAEIW,IAFJ,SAEYF,KAFZ,yDAI3BD,QAAQ,CAACI,GAAT,CAAa,UAAAC,CAAC;EAAA,+DACyBH,OADzB,WACqCG,CAAC,CAACC,EADvC,qBAEVjB,k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ACA,YAAMK,QAAQ,GAAGR,EAAE,GAAGA,EAAE,CAACK,OAAH,CAAW5F,YAAX,CAAH,GAA8B0F,SAAjD;;EAEA,YAAIK,QAAQ,KAAK,QAAjB,EAA2B;EACzB,UAAA,MAAI,CAACzB,YAAL;EACD,SAFD,MAGK;EACHnE,UAAAA,OAAO,CAAC6F,KAAR,CAAcD,QAAd;;EACA,UAAA,MAAI,CAACF,OAAL,CAAahG,MAAM,CAACC,eAApB,EAAqCK,OAAO,CAACe,EAA7C,EAAiDf,OAAO,CAAC8E,OAAR,EAAjD;;EACA,UAAA,MAAI,CAACN,YAAL;;EACA,UAAA,MAAI,CAACf,WAAL;EACD;EACF;EAxBiB,KAApB;EA0BD;EAED;EACF;EACA;EA7LA;;EAAA,SA8LEA,WA9LF,GA8LE,uBAAc;EAAA;;EACZ,QAAMT,KAAK,0BAAG,KAAKvC,QAAL,CAAcuE,IAAd,CAAmB,UAAAlE,CAAC;EAAA,aAAIA,CAAC,CAACY,KAAN;EAAA,KAApB,CAAH,qBAAG,oBAAkCA,KAAlC,EAAd;EACA,kCAAKF,GAAL,CAASF,MAAT,CAAgBwE,SAAhB,CAA0BzE,cAAc,CAACN,EAAzC,EAA6C,KAA7C,4CAAqDgC,QAArD,CAA8DC,KAA9D;EACD,GAjMH;;EAAA;EAAA,EAAoC+C,gCAApC;EAAazC,eAEJvC,KAAK;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/stereo.js b/dist/plugins/stereo.js index 9626d4aea..23dd5a3b2 100644 --- a/dist/plugins/stereo.js +++ b/dist/plugins/stereo.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @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 43ed5365e..a84e489da 100644 --- a/dist/plugins/virtual-tour.css +++ b/dist/plugins/virtual-tour.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.5.1 + * Photo Sphere Viewer 4.5.2 * @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.d.ts b/dist/plugins/virtual-tour.d.ts index 6e8968f88..e151b7e0d 100644 --- a/dist/plugins/virtual-tour.d.ts +++ b/dist/plugins/virtual-tour.d.ts @@ -34,6 +34,10 @@ type VirtualTourNodeLink = { type VirtualTourArrowStyle = { color?: string; hoverColor?: string; + outlineColor?: number; + /** + * @deprecated + */ opacity?: number; scale?: [number, number]; }; @@ -60,6 +64,7 @@ type VirtualTourPluginPluginOptions = { startNodeId?: string; preload?: boolean | ((node: VirtualTourNode, link: VirtualTourNodeLink) => boolean); rotateSpeed?: boolean | string | number; + transition?: boolean | number; markerStyle?: MarkerProperties; arrowStyle?: VirtualTourArrowStyle; markerLatOffset?: number; diff --git a/dist/plugins/virtual-tour.js b/dist/plugins/virtual-tour.js index 90f8f469d..a8e7d9321 100644 --- a/dist/plugins/virtual-tour.js +++ b/dist/plugins/virtual-tour.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -149,7 +149,6 @@ function setMeshColor(mesh, color) { mesh.material.color.set(color); - mesh.material.emissive.set(color); } /** * @summary Returns the distance between two GPS points @@ -259,10 +258,12 @@ return ClientSideDatasource; }(AbstractDatasource); - var metadata={version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"};var uuid="B5839B4F-7D11-4EC3-B454-059BC0185A1B";var type="BufferGeometry";var data={attributes:{position:{itemSize:3,type:"Float32Array",array:[50,0,25,50,20,25,0,10,50,50,0,25,100,10,50,50,20,25,50,10,0,0,10,50,50,20,25,100,10,50,50,10,0,50,20,25,50,0,25,0,10,50,50,10,0,50,10,0,100,10,50,50,0,25],normalized:false},normal:{itemSize:3,type:"Float32Array",array:[0.447214,0,0.894427,0.447214,0,0.894427,0.447214,0,0.894427,-0.447214,0,0.894427,-0.447214,0,0.894427,-0.447214,0,0.894427,-0.348155,0.870388,-0.348155,-0.348155,0.870388,-0.348155,-0.348155,0.870388,-0.348155,0.348155,0.870388,-0.348155,0.348155,0.870388,-0.348155,0.348155,0.870388,-0.348155,-0.348155,-0.870388,-0.348155,-0.348155,-0.870388,-0.348155,-0.348155,-0.870388,-0.348155,0.348155,-0.870388,-0.348155,0.348155,-0.870388,-0.348155,0.348155,-0.870388,-0.348155],normalized:false}},boundingSphere:{center:[50,10,25],radius:55.901699}};var arrowGeometryJson = {metadata:metadata,uuid:uuid,type:type,data:data}; + var metadata$1={version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"};var uuid$1="8B1A6E5B-A7CC-4471-9CA0-BD64D80ABB79";var type$1="BufferGeometry";var data$1={attributes:{position:{itemSize:3,type:"Float32Array",array:[-25,-15,-2.5,0,0,-2.5,0,-5,-2.5,0,-5,-2.5,0,0,-2.5,25,-15,-2.5,0,-5,-2.5,25,-15,-2.5,25,-20,-2.5,0,-5,-2.5,-25,-20,-2.5,-25,-15,-2.5,25,-15,2.5,25,-20,2.5,25,-15,-2.5,25,-15,-2.5,25,-20,2.5,25,-20,-2.5,25,-20,2.5,0,-5,2.5,25,-20,-2.5,25,-20,-2.5,0,-5,2.5,0,-5,-2.5,0,-5,2.5,-25,-20,2.5,0,-5,-2.5,0,-5,-2.5,-25,-20,2.5,-25,-20,-2.5,-25,-20,2.5,-25,-15,2.5,-25,-20,-2.5,-25,-20,-2.5,-25,-15,2.5,-25,-15,-2.5,-25,-15,2.5,0,0,2.5,-25,-15,-2.5,-25,-15,-2.5,0,0,2.5,0,0,-2.5,0,0,2.5,25,-15,2.5,0,0,-2.5,0,0,-2.5,25,-15,2.5,25,-15,-2.5,25,-20,2.5,25,-15,2.5,0,-5,2.5,0,-5,2.5,25,-15,2.5,0,0,2.5,0,-5,2.5,0,0,2.5,-25,-15,2.5,-25,-15,2.5,-25,-20,2.5,0,-5,2.5],normalized:false},normal:{itemSize:3,type:"Float32Array",array:[0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],normalized:false}},boundingSphere:{center:[0,-10,0],radius:27.041634}};var arrowGeometryJson = {metadata:metadata$1,uuid:uuid$1,type:type$1,data:data$1}; var arrowIconSvg = "\n"; + var metadata={version:4.5,type:"BufferGeometry",generator:"BufferGeometry.toJSON"};var uuid="B12A1453-6E56-40AC-840B-BA7DF5DB9E2A";var type="BufferGeometry";var data={attributes:{position:{itemSize:3,type:"Float32Array",array:[-26,-21.766189,-3.5,-26,-14.433809,-3.5,0,-6.16619,-3.5,0,-6.16619,-3.5,-26,-14.433809,-3.5,0,1.16619,-3.5,0,-6.16619,-3.5,0,1.16619,-3.5,26,-14.43381,-3.5,26,-14.43381,-3.5,26,-21.766191,-3.5,0,-6.16619,-3.5,-26,-14.433809,3.5,0,1.16619,3.5,-26,-14.433809,-3.5,-26,-14.433809,-3.5,0,1.16619,3.5,0,1.16619,-3.5,0,1.16619,3.5,26,-14.43381,3.5,0,1.16619,-3.5,0,1.16619,-3.5,26,-14.43381,3.5,26,-14.43381,-3.5,26,-14.43381,3.5,26,-21.766191,3.5,26,-14.43381,-3.5,26,-14.43381,-3.5,26,-21.766191,3.5,26,-21.766191,-3.5,26,-21.766191,3.5,0,-6.16619,3.5,26,-21.766191,-3.5,26,-21.766191,-3.5,0,-6.16619,3.5,0,-6.16619,-3.5,0,-6.16619,3.5,-26,-21.766189,3.5,0,-6.16619,-3.5,0,-6.16619,-3.5,-26,-21.766189,3.5,-26,-21.766189,-3.5,-26,-21.766189,3.5,-26,-14.433809,3.5,-26,-21.766189,-3.5,-26,-21.766189,-3.5,-26,-14.433809,3.5,-26,-14.433809,-3.5,-26,-21.766189,3.5,0,-6.16619,3.5,-26,-14.433809,3.5,-26,-14.433809,3.5,0,-6.16619,3.5,0,1.16619,3.5,0,1.16619,3.5,0,-6.16619,3.5,26,-14.43381,3.5,26,-14.43381,3.5,0,-6.16619,3.5,26,-21.766191,3.5],normalized:false},normal:{itemSize:3,type:"Float32Array",array:[0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1],normalized:false}},boundingSphere:{center:[0,-10.3,0],radius:28.630814}};var arrowOutlineGeometryJson = {metadata:metadata,uuid:uuid,type:type,data:data}; + var nodesList = "\n"; /** @@ -372,9 +373,9 @@ */ var DEFAULT_ARROW = { - color: 0x0055aa, + color: 0xaaaaaa, hoverColor: 0xaa5500, - opacity: 0.8, + outlineColor: 0x000000, scale: [0.5, 2] }; /** @@ -383,23 +384,24 @@ * @private */ - var ARROW_GEOM = function () { + var _ref = function () { var loader = new THREE.ObjectLoader(); - var geom = loader.parseGeometries([arrowGeometryJson])[arrowGeometryJson.uuid]; - geom.scale(0.01, 0.015, 0.015); - geom.computeBoundingBox(); - var b = geom.boundingBox; - geom.translate(-(b.max.x - b.min.y) / 2, -(b.max.y - b.min.y) / 2, -(b.max.z - b.min.z) / 2); - geom.rotateX(Math.PI); - return geom; - }(); - /** - * @summary Panel identifier for nodes list - * @type {string} - * @constant - * @private - */ - + var geometries = loader.parseGeometries([arrowGeometryJson, arrowOutlineGeometryJson]); + var arrow = geometries[arrowGeometryJson.uuid]; + var arrowOutline = geometries[arrowOutlineGeometryJson.uuid]; + var scale = 0.015; + var rot = Math.PI / 2; + arrow.scale(scale, scale, scale); + arrow.rotateX(rot); + arrowOutline.scale(scale, scale, scale); + arrowOutline.rotateX(rot); + return { + ARROW_GEOM: arrow, + ARROW_OUTLINE_GEOM: arrowOutline + }; + }(), + ARROW_GEOM = _ref.ARROW_GEOM, + ARROW_OUTLINE_GEOM = _ref.ARROW_OUTLINE_GEOM; var ID_PANEL_NODES_LIST = 'virtualTourNodesList'; /** * @summary Nodes list template @@ -466,9 +468,7 @@ ; _proto.isSupported = function isSupported() { - var _this$plugin; - - return (_this$plugin = this.plugin) == null ? void 0 : _this$plugin.config.listButton; + return !!this.plugin && !this.plugin.isServerSide(); } /** * @summary Handles events @@ -639,9 +639,9 @@ /** * @typedef {Object} PSV.plugins.VirtualTourPlugin.ArrowStyle * @summary Style of the arrow in 3D mode - * @property {string} [color=#0055aa] - * @property {string} [hoverColor=#aa5500] - * @property {number} [opacity=0.8] + * @property {string} [color=0xaaaaaa] + * @property {string} [hoverColor=0xaa5500] + * @property {number} [outlineColor=0x000000] * @property {number[]} [scale=[0.5,2]] */ @@ -656,7 +656,7 @@ * @property {string} [startNodeId] - id of the initial node, if not defined the first node will be used * @property {boolean|PSV.plugins.VirtualTourPlugin.Preload} [preload=false] - preload linked panoramas * @property {boolean|string|number} [rotateSpeed='20rpm'] - speed of rotation when clicking on a link, if 'false' the viewer won't rotate at all - * @property {boolean} [listButton] - adds a button to show the list of nodes, defaults to `true` only in client data mode + * @property {boolean|number} [transition=1500] - duration of the transition between nodes * @property {boolean} [linksOnCompass] - if the Compass plugin is enabled, displays the links on the compass, defaults to `true` on in markers render mode * @property {PSV.plugins.MarkersPlugin.Properties} [markerStyle] - global marker style * @property {PSV.plugins.VirtualTourPlugin.ArrowStyle} [arrowStyle] - global arrow style @@ -674,7 +674,6 @@ // add markers buttons photoSphereViewer.DEFAULTS.lang[NodesListButton.id] = 'Locations'; - photoSphereViewer.DEFAULTS.lang.loading = 'Loading...'; photoSphereViewer.registerButton(NodesListButton, 'caption:left'); /** * @summary Create virtual tours by linking multiple panoramas @@ -725,19 +724,28 @@ renderMode: MODE_3D, preload: false, rotateSpeed: '20rpm', + transition: photoSphereViewer.CONSTANTS.DEFAULT_TRANSITION, markerLatOffset: -0.1, arrowPosition: 'bottom', - linksOnCompass: (options == null ? void 0 : options.renderMode) === MODE_MARKERS, - listButton: (options == null ? void 0 : options.dataMode) !== MODE_SERVER + linksOnCompass: (options == null ? void 0 : options.renderMode) === MODE_MARKERS }, options, { markerStyle: _extends({}, DEFAULT_MARKER, options == null ? void 0 : options.markerStyle), arrowStyle: _extends({}, DEFAULT_ARROW, options == null ? void 0 : options.arrowStyle) }); + + if ((options == null ? void 0 : options.listButton) === false) { + photoSphereViewer.utils.logWarn('VirtualTourPlugin: listButton option is deprecated. ' + 'Please define the global navbar options according to your needs.'); + } + + if ((options == null ? void 0 : options.listButton) === true && _this.config.dataMode === MODE_SERVER) { + photoSphereViewer.utils.logWarn('VirtualTourPlugin: the list button is not supported in server mode.'); + } /** * @type {PSV.plugins.MarkersPlugin} * @private */ + _this.markers = null; /** * @type {PSV.plugins.CompassPlugin} @@ -760,7 +768,7 @@ if (_this.is3D()) { _this.arrowsGroup = new THREE.Group(); var localLight = new THREE.PointLight(0xffffff, 1, 0); - localLight.position.set(2, 0, 0); + localLight.position.set(0, _this.config.arrowPosition === 'bottom' ? 2 : -2, 0); _this.arrowsGroup.add(localLight); } @@ -975,16 +983,13 @@ return Promise.all([// if this node is already preloading, wait for it Promise.resolve(this.preload[nodeId]).then(function () { if (_this3.prop.loadingNode !== nodeId) { - return Promise.reject(photoSphereViewer.utils.getAbortError()); + throw photoSphereViewer.utils.getAbortError(); } - _this3.psv.textureLoader.abortLoading(); - return _this3.datasource.loadNode(nodeId); }), Promise.resolve(fromLinkPosition ? this.config.rotateSpeed : false).then(function (speed) { - if (!speed) { - return Promise.resolve(); - } else { + // eslint-disable-line consistent-return + if (speed) { return _this3.psv.animate(_extends({}, fromLinkPosition, { speed: speed })); @@ -997,11 +1002,9 @@ var node = _ref[0]; if (_this3.prop.loadingNode !== nodeId) { - return Promise.reject(photoSphereViewer.utils.getAbortError()); + throw photoSphereViewer.utils.getAbortError(); } - _this3.psv.navbar.setCaption("" + _this3.psv.config.lang.loading + ""); - _this3.prop.currentNode = node; if (_this3.prop.currentTooltip) { @@ -1021,15 +1024,18 @@ (_this3$markers = _this3.markers) == null ? void 0 : _this3$markers.clearMarkers(); (_this3$compass = _this3.compass) == null ? void 0 : _this3$compass.clearHotspots(); return Promise.all([_this3.psv.setPanorama(node.panorama, { + transition: _this3.config.transition, + caption: node.caption, panoData: node.panoData, sphereCorrection: node.sphereCorrection - }).catch(function (err) { - // the error is already displayed by the core - return Promise.reject(photoSphereViewer.utils.isAbortError(err) ? err : null); + }).then(function (completed) { + if (!completed) { + throw photoSphereViewer.utils.getAbortError(); + } }), _this3.datasource.loadLinkedNodes(nodeId)]); }).then(function () { if (_this3.prop.loadingNode !== nodeId) { - return Promise.reject(photoSphereViewer.utils.getAbortError()); + throw photoSphereViewer.utils.getAbortError(); } var node = _this3.prop.currentNode; @@ -1045,8 +1051,6 @@ _this3.__renderLinks(node); _this3.__preload(node); - - _this3.psv.navbar.setCaption(node.caption || _this3.psv.config.caption); /** * @event node-changed * @memberof PSV.plugins.VirtualTourPlugin @@ -1066,17 +1070,17 @@ return true; }).catch(function (err) { if (photoSphereViewer.utils.isAbortError(err)) { - return Promise.resolve(false); - } else if (err) { - _this3.psv.showError(_this3.psv.config.lang.loadError); + return false; } + _this3.psv.showError(_this3.psv.config.lang.loadError); + _this3.psv.loader.hide(); _this3.psv.navbar.setCaption(''); _this3.prop.loadingNode = null; - return Promise.reject(err); + throw err; }); } /** @@ -1096,15 +1100,9 @@ positions.push(position); if (_this4.is3D()) { - var _link$arrowStyle, _link$arrowStyle2, _mesh$userData; - - var arrow = ARROW_GEOM.clone(); - var mat = new THREE.MeshLambertMaterial({ - transparent: true, - opacity: ((_link$arrowStyle = link.arrowStyle) == null ? void 0 : _link$arrowStyle.opacity) || _this4.config.arrowStyle.opacity - }); - var mesh = new THREE.Mesh(arrow, mat); - setMeshColor(mesh, ((_link$arrowStyle2 = link.arrowStyle) == null ? void 0 : _link$arrowStyle2.color) || _this4.config.arrowStyle.color); + var _mesh$userData, _link$arrowStyle, _link$arrowStyle2; + + var mesh = new THREE.Mesh(ARROW_GEOM, new THREE.MeshLambertMaterial()); mesh.userData = (_mesh$userData = {}, _mesh$userData[LINK_DATA] = link, _mesh$userData.longitude = position.longitude, _mesh$userData); mesh.rotation.order = 'YXZ'; mesh.rotateY(-position.longitude); @@ -1114,7 +1112,17 @@ latitude: 0 }, mesh.position).multiplyScalar(1 / photoSphereViewer.CONSTANTS.SPHERE_RADIUS); + var outlineMesh = new THREE.Mesh(ARROW_OUTLINE_GEOM, new THREE.MeshBasicMaterial({ + side: THREE.BackSide + })); + outlineMesh.position.copy(mesh.position); + outlineMesh.rotation.copy(mesh.rotation); + setMeshColor(mesh, ((_link$arrowStyle = link.arrowStyle) == null ? void 0 : _link$arrowStyle.color) || _this4.config.arrowStyle.color); + setMeshColor(outlineMesh, ((_link$arrowStyle2 = link.arrowStyle) == null ? void 0 : _link$arrowStyle2.outlineColor) || _this4.config.arrowStyle.outlineColor); + _this4.arrowsGroup.add(mesh); + + _this4.arrowsGroup.add(outlineMesh); } else { var _data; @@ -1230,31 +1238,12 @@ ; _proto.__positionArrows = function __positionArrows() { - var isBottom = this.config.arrowPosition === 'bottom'; this.arrowsGroup.position.copy(this.psv.prop.direction).multiplyScalar(0.5); var s = this.config.arrowStyle.scale; - var f = s[1] + (s[0] - s[1]) * photoSphereViewer.CONSTANTS.EASINGS.linear(this.psv.getZoomLevel() / 100); - this.arrowsGroup.position.y += isBottom ? -1.5 : 1.5; - this.arrowsGroup.scale.set(f, f, f); // slightly rotates each arrow to make the center ones standing out - - var position = this.psv.getPosition(); - - if (isBottom ? position.latitude < Math.PI / 8 : position.latitude > -Math.PI / 8) { - this.arrowsGroup.children.filter(function (o) { - return o.type === 'Mesh'; - }).forEach(function (arrow) { - var d = Math.abs(photoSphereViewer.utils.getShortestArc(arrow.userData.longitude, position.longitude)); - var x = photoSphereViewer.CONSTANTS.EASINGS.inOutSine(Math.max(0, Math.PI / 4 - d) / (Math.PI / 4)) / 3; // magic ! - - arrow.rotation.x = isBottom ? -x : x; - }); - } else { - this.arrowsGroup.children.filter(function (o) { - return o.type === 'Mesh'; - }).forEach(function (arrow) { - arrow.rotation.x = 0; - }); - } + var f = s[1] + (s[0] - s[1]) * (this.psv.getZoomLevel() / 100); + var y = 2.5 - this.psv.getZoomLevel() / 100 * 1.5; + this.arrowsGroup.position.y += this.config.arrowPosition === 'bottom' ? -y : y; + this.arrowsGroup.scale.set(f, f, f); } /** * @summary Manage the preload of the linked panoramas diff --git a/dist/plugins/virtual-tour.js.map b/dist/plugins/virtual-tour.js.map index a75232d8d..998e79b16 100644 --- a/dist/plugins/virtual-tour.js.map +++ b/dist/plugins/virtual-tour.js.map @@ -1 +1 @@ -{"version":3,"file":"virtual-tour.js","sources":["../../src/plugins/virtual-tour/AbstractDatasource.js","../../src/plugins/virtual-tour/utils.js","../../src/plugins/virtual-tour/ClientSideDatasource.js","../../src/plugins/virtual-tour/constants.js","../../src/plugins/virtual-tour/NodesListButton.js","../../src/plugins/virtual-tour/ServerSideDatasource.js","../../src/plugins/virtual-tour/index.js"],"sourcesContent":["import { PSVError } from 'photo-sphere-viewer';\n\n/**\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @package\n */\nexport class AbstractDatasource {\n\n /**\n * @type {Record}\n */\n nodes = {};\n\n /**\n * @param {PSV.plugins.VirtualTourPlugin} plugin\n */\n constructor(plugin) {\n this.plugin = plugin;\n }\n\n destroy() {\n delete this.plugin;\n }\n\n /**\n * @summary Loads a node\n * @param {string} nodeId\n * @return {Promise}\n */\n loadNode(nodeId) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadNode not implemented');\n }\n\n /**\n * @summary Loades nodes linked to another node\n * @param {string} nodeId\n * @return {Promise}\n */\n loadLinkedNodes(nodeId) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadLinkedNodes not implemented');\n }\n\n}\n","import { PSVError, utils } from 'photo-sphere-viewer';\n\n/**\n * @summary Checks the configuration of a node\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {boolean} isGps\n * @private\n */\nexport function checkNode(node, isGps) {\n if (!node.id) {\n throw new PSVError('No id given for node');\n }\n if (!node.panorama) {\n throw new PSVError(`No panorama provided for node ${node.id}`);\n }\n if (isGps && !(node.position?.length >= 2)) {\n throw new PSVError(`No position provided for node ${node.id}`);\n }\n}\n\n/**\n * @summary Checks the configuration of a link\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} link\n * @param {boolean} isGps\n * @private\n */\nexport function checkLink(node, link, isGps) {\n if (!link.nodeId) {\n throw new PSVError(`Link of node ${node.id} has no target id`);\n }\n if (!isGps && !utils.isExtendedPosition(link)) {\n throw new PSVError(`No position provided for link ${link.nodeId} of node ${node.id}`);\n }\n}\n\n/**\n * @summary Changes the color of a mesh\n * @param {external:THREE.Mesh} mesh\n * @param {*} color\n * @private\n */\nexport function setMeshColor(mesh, color) {\n mesh.material.color.set(color);\n mesh.material.emissive.set(color);\n}\n\n/**\n * @summary Returns the distance between two GPS points\n * @param {number[]} p1\n * @param {number[]} p2\n * @return {number}\n * @private\n */\nexport function distance(p1, p2) {\n return utils.greatArcDistance(p1, p2) * 6371e3;\n}\n\n/**\n * @summary Returns the bearing between two GPS points\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @param {number[]} p1\n * @param {number[]} p2\n * @return {number}\n * @private\n */\nexport function bearing(p1, p2) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const y = Math.sin(λ2 - λ1) * Math.cos(φ2);\n const x = Math.cos(φ1) * Math.sin(φ2) - Math.sin(φ1) * Math.cos(φ2) * Math.cos(λ2 - λ1);\n return Math.atan2(y, x);\n}\n","import { PSVError, utils } from 'photo-sphere-viewer';\nimport { AbstractDatasource } from './AbstractDatasource';\nimport { checkLink, checkNode } from './utils';\n\n/**\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @package\n */\nexport class ClientSideDatasource extends AbstractDatasource {\n\n loadNode(nodeId) {\n if (this.nodes[nodeId]) {\n return Promise.resolve(this.nodes[nodeId]);\n }\n else {\n return Promise.reject(new PSVError(`Node ${nodeId} not found`));\n }\n }\n\n loadLinkedNodes(nodeId) {\n if (!this.nodes[nodeId]) {\n return Promise.reject(new PSVError(`Node ${nodeId} not found`));\n }\n else {\n return Promise.resolve();\n }\n }\n\n setNodes(rawNodes) {\n if (!rawNodes?.length) {\n throw new PSVError('No nodes provided');\n }\n\n const nodes = {};\n const linkedNodes = {};\n\n rawNodes.forEach((node) => {\n checkNode(node, this.plugin.isGps());\n\n if (nodes[node.id]) {\n throw new PSVError(`Duplicate node ${node.id}`);\n }\n if (!node.links) {\n utils.logWarn(`Node ${node.id} has no links`);\n nodes.links = [];\n }\n\n nodes[node.id] = node;\n });\n\n rawNodes.forEach((node) => {\n node.links.forEach((link) => {\n checkLink(node, link, this.plugin.isGps());\n\n if (!nodes[link.nodeId]) {\n throw new PSVError(`Target node ${link.nodeId} of node ${node.id} does not exists`);\n }\n\n // copy essential data\n link.position = link.position || nodes[link.nodeId].position;\n link.name = link.name || nodes[link.nodeId].name;\n\n linkedNodes[link.nodeId] = true;\n });\n });\n\n rawNodes.forEach((node) => {\n if (!linkedNodes[node.id]) {\n utils.logWarn(`Node ${node.id} is never linked to`);\n }\n });\n\n this.nodes = nodes;\n }\n\n}\n","import * as THREE from 'three';\nimport arrowGeometryJson from './arrow.json';\nimport arrowIconSvg from './arrow.svg';\nimport nodesList from './nodes-list.svg';\n\n/**\n * @summary In client mode all the nodes are provided in the config or with the `setNodes` method\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_CLIENT = 'client';\n\n/**\n * @summary In server mode the nodes are fetched asynchronously\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_SERVER = 'server';\n\n/**\n * @summary In manual mode each link is positionned manually on the panorama\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_MANUAL = 'manual';\n\n/**\n * @summary In GPS mode each node is globally positionned and the links are automatically computed\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_GPS = 'gps';\n\n/**\n * @summaru In markers mode the links are represented using markers\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_MARKERS = 'markers';\n\n/**\n * @summaru In 3D mode the links are represented using 3d arrows\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_3D = '3d';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event node-changed\n * @memberof PSV.plugins.VirtualTourPlugin\n * @summary Triggered when the current node changes\n * @param {string} nodeId\n */\n NODE_CHANGED: 'node-changed',\n /**\n * @event filter:render-nodes-list\n * @memberof PSV.plugins.VirtualTourPlugin\n * @summary Used to alter the list of nodes displayed on the side-panel\n * @param {PSV.plugins.VirtualTourPlugin.Node[]} nodes\n * @returns {PSV.plugins.VirtualTourPlugin.Node[]}\n */\n RENDER_NODES_LIST: 'render-nodes-list',\n};\n\n/**\n * @summary Property name added to markers\n * @type {string}\n * @constant\n * @private\n */\nexport const LINK_DATA = 'tourLink';\n\n/**\n * @summary Default style of the link marker\n * @type {PSV.plugins.MarkersPlugin.Properties}\n * @constant\n * @private\n */\nexport const DEFAULT_MARKER = {\n html : arrowIconSvg,\n width : 80,\n height : 80,\n scale : [0.5, 2],\n anchor : 'top center',\n className: 'psv-virtual-tour__marker',\n style : {\n color: 'rgba(0, 208, 255, 0.8)',\n },\n};\n\n/**\n * @summary Default style of the link arrow\n * @type {PSV.plugins.VirtualTourPlugin.ArrowStyle}\n * @constant\n * @private\n */\nexport const DEFAULT_ARROW = {\n color : 0x0055aa,\n hoverColor: 0xaa5500,\n opacity : 0.8,\n scale : [0.5, 2],\n};\n\n/**\n * @type {external:THREE.BufferedGeometry}\n * @constant\n * @private\n */\nexport const ARROW_GEOM = (() => {\n const loader = new THREE.ObjectLoader();\n const geom = loader.parseGeometries([arrowGeometryJson])[arrowGeometryJson.uuid];\n geom.scale(0.01, 0.015, 0.015);\n geom.computeBoundingBox();\n const b = geom.boundingBox;\n geom.translate(-(b.max.x - b.min.y) / 2, -(b.max.y - b.min.y) / 2, -(b.max.z - b.min.z) / 2);\n geom.rotateX(Math.PI);\n return geom;\n})();\n\n/**\n * @summary Panel identifier for nodes list\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL_NODES_LIST = 'virtualTourNodesList';\n\n/**\n * @summary Nodes list template\n * @param {PSV.plugins.VirtualTourPlugin.Node[]} nodes\n * @param {string} title\n * @param {string} currentNodeId\n * @returns {string}\n * @constant\n * @private\n */\nexport const NODES_LIST_TEMPLATE = (nodes, title, currentNodeId) => `\n
\n

${nodesList} ${title}

\n
    \n ${nodes.map(node => `\n
  • \n ${node.thumbnail ? `` : ''}\n ${node.caption || node.name}\n
  • \n `).join('')}\n
\n
\n`;\n","import { AbstractButton, CONSTANTS } from '../..';\nimport { ID_PANEL_NODES_LIST } from './constants';\nimport nodesList from './nodes-list.svg';\n\n/**\n * @summary Navigation bar markers list button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class NodesListButton extends AbstractButton {\n\n static id = 'nodesList';\n static icon = nodesList;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-nodes-list-button', true);\n\n /**\n * @type {PSV.plugins.VirtualTourPlugin}\n */\n this.plugin = this.psv.getPlugin('virtual-tour');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return this.plugin?.config.listButton;\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 CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === ID_PANEL_NODES_LIST); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles nodes list\n */\n onClick() {\n this.plugin.toggleNodesList();\n }\n\n}\n","import { PSVError, utils } from 'photo-sphere-viewer';\nimport { AbstractDatasource } from './AbstractDatasource';\nimport { checkLink, checkNode } from './utils';\n\n/**\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @package\n */\nexport class ServerSideDatasource extends AbstractDatasource {\n\n constructor(plugin) {\n super(plugin);\n\n if (!plugin.config.getNode) {\n throw new PSVError('Missing getNode() option.');\n }\n\n this.nodeResolver = plugin.config.getNode;\n this.linksResolver = plugin.config.getLinks;\n }\n\n loadNode(nodeId) {\n if (this.nodes[nodeId]) {\n return Promise.resolve(this.nodes[nodeId]);\n }\n else {\n return Promise.resolve(this.nodeResolver(nodeId))\n .then((node) => {\n checkNode(node, this.plugin.isGps());\n this.nodes[nodeId] = node;\n return node;\n });\n }\n }\n\n loadLinkedNodes(nodeId) {\n if (!this.nodes[nodeId]) {\n return Promise.reject(new PSVError(`Node ${nodeId} not found`));\n }\n else if (this.nodes[nodeId].links) {\n return Promise.resolve();\n }\n else {\n if (!this.linksResolver) {\n this.nodes[nodeId].links = [];\n return Promise.resolve();\n }\n\n utils.logWarn(`getLinks() option is deprecated, instead make getNode() also return the node' links.`);\n\n return Promise.resolve(this.linksResolver(nodeId))\n .then(links => links || [])\n .then((links) => {\n const node = this.nodes[nodeId];\n\n links.forEach((link) => {\n checkLink(node, link, this.plugin.isGps());\n\n // copy essential data\n if (this.nodes[link.nodeId]) {\n link.position = link.position || this.nodes[link.nodeId].position;\n link.name = link.name || this.nodes[link.nodeId].name;\n }\n\n if (this.plugin.isGps() && !link.position) {\n throw new PSVError(`No GPS position provided for link ${link.nodeId} of node ${node.id}`);\n }\n });\n\n // store links\n node.links = links;\n });\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { ClientSideDatasource } from './ClientSideDatasource';\nimport {\n ARROW_GEOM,\n DEFAULT_ARROW,\n DEFAULT_MARKER,\n EVENTS,\n ID_PANEL_NODES_LIST,\n LINK_DATA,\n MODE_3D,\n MODE_CLIENT,\n MODE_GPS,\n MODE_MANUAL,\n MODE_MARKERS,\n MODE_SERVER,\n NODES_LIST_TEMPLATE\n} from './constants';\nimport { NodesListButton } from './NodesListButton';\nimport { ServerSideDatasource } from './ServerSideDatasource';\nimport './style.scss';\nimport { bearing, distance, setMeshColor } from './utils';\n\n\n/**\n * @callback GetNode\n * @summary Function to load a node\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @param {string} nodeId\n * @returns {PSV.plugins.VirtualTourPlugin.Node|Promise}\n */\n\n/**\n * @callback GetLinks\n * @summary Function to load the links of a node\n * @deprecated `getNode` must directly return the links of each node\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @param {string} nodeId\n * @returns {PSV.plugins.VirtualTourPlugin.NodeLink[]|Promise}\n */\n\n/**\n * @callback Preload\n * @summary Function to determine if a link must be preloaded\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} link\n * @returns {boolean}\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.Node\n * @summary Definition of a single node in the tour\n * @property {string} id - unique identifier of the node\n * @property {*} panorama\n * @property {PSV.plugins.VirtualTourPlugin.NodeLink[]} [links] - links to other nodes\n * @property {number[]} [position] - GPS position (longitude, latitude, optional altitude)\n * @property {PSV.PanoData | PSV.PanoDataProvider} [panoData] - data used for this panorama\n * @property {PSV.SphereCorrection} [sphereCorrection] - sphere correction to apply to this panorama\n * @property {string} [name] - short name of the node\n * @property {string} [caption] - caption visible in the navbar\n * @property {string} [thumbnail] - thumbnail for the nodes list in the side panel\n * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers] - additional markers to use on this node\n */\n\n/**\n * @typedef {PSV.ExtendedPosition} PSV.plugins.VirtualTourPlugin.NodeLink\n * @summary Definition of a link between two nodes\n * @property {string} nodeId - identifier of the target node\n * @property {string} [name] - override the name of the node (tooltip)\n * @property {number[]} [position] - override the GPS position of the node\n * @property {PSV.plugins.MarkersPlugin.Properties} [markerStyle] - override global marker style\n * @property {PSV.plugins.VirtualTourPlugin.ArrowStyle} [arrowStyle] - override global arrow style\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.ArrowStyle\n * @summary Style of the arrow in 3D mode\n * @property {string} [color=#0055aa]\n * @property {string} [hoverColor=#aa5500]\n * @property {number} [opacity=0.8]\n * @property {number[]} [scale=[0.5,2]]\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.Options\n * @property {'client'|'server'} [dataMode='client'] - configure data mode\n * @property {'manual'|'gps'} [positionMode='manual'] - configure positioning mode\n * @property {'markers'|'3d'} [renderMode='3d'] - configure rendering mode of links\n * @property {PSV.plugins.VirtualTourPlugin.Node[]} [nodes] - initial nodes\n * @property {PSV.plugins.VirtualTourPlugin.GetNode} [getNode]\n * @property {PSV.plugins.VirtualTourPlugin.GetLinks} [getLinks] - Deprecated: `getNode` must directly return the links of each node\n * @property {string} [startNodeId] - id of the initial node, if not defined the first node will be used\n * @property {boolean|PSV.plugins.VirtualTourPlugin.Preload} [preload=false] - preload linked panoramas\n * @property {boolean|string|number} [rotateSpeed='20rpm'] - speed of rotation when clicking on a link, if 'false' the viewer won't rotate at all\n * @property {boolean} [listButton] - adds a button to show the list of nodes, defaults to `true` only in client data mode\n * @property {boolean} [linksOnCompass] - if the Compass plugin is enabled, displays the links on the compass, defaults to `true` on in markers render mode\n * @property {PSV.plugins.MarkersPlugin.Properties} [markerStyle] - global marker style\n * @property {PSV.plugins.VirtualTourPlugin.ArrowStyle} [arrowStyle] - global arrow style\n * @property {number} [markerLatOffset=-0.1] - (GPS & Markers mode) latitude offset applied to link markers, to compensate for viewer height\n * @property {'top'|'bottom'} [arrowPosition='bottom'] - (3D mode) arrows vertical position\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.NodeChangedData\n * @summary Data associated to the \"node-changed\" event\n * @type {PSV.plugins.VirtualTourPlugin.Node} [fromNode] - The previous node\n * @type {PSV.plugins.VirtualTourPlugin.NodeLink} [fromLink] - The link that was clicked in the previous node\n * @type {PSV.Position} [fromLinkPosition] - The position of the link on the previous node\n */\n\n// add markers buttons\nDEFAULTS.lang[NodesListButton.id] = 'Locations';\nDEFAULTS.lang.loading = 'Loading...';\nregisterButton(NodesListButton, 'caption:left');\n\n\nexport { EVENTS, MODE_3D, MODE_CLIENT, MODE_GPS, MODE_MANUAL, MODE_MARKERS, MODE_SERVER } from './constants';\n\n\n/**\n * @summary Create virtual tours by linking multiple panoramas\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class VirtualTourPlugin extends AbstractPlugin {\n\n static id = 'virtual-tour';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.VirtualTourPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @property {PSV.plugins.VirtualTourPlugin.Node} currentNode\n * @property {PSV.Tooltip} currentTooltip\n * @property {string} loadingNode\n * @property {function} stopObserver\n * @private\n */\n this.prop = {\n currentNode : null,\n currentTooltip: null,\n loadingNode : null,\n stopObserver : null,\n };\n\n /**\n * @type {Record}\n * @private\n */\n this.preload = {};\n\n /**\n * @member {PSV.plugins.VirtualTourPlugin.Options}\n * @private\n */\n this.config = {\n dataMode : MODE_CLIENT,\n positionMode : MODE_MANUAL,\n renderMode : MODE_3D,\n preload : false,\n rotateSpeed : '20rpm',\n markerLatOffset: -0.1,\n arrowPosition : 'bottom',\n linksOnCompass : options?.renderMode === MODE_MARKERS,\n listButton : options?.dataMode !== MODE_SERVER,\n ...options,\n markerStyle : {\n ...DEFAULT_MARKER,\n ...options?.markerStyle,\n },\n arrowStyle : {\n ...DEFAULT_ARROW,\n ...options?.arrowStyle,\n },\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n\n /**\n * @type {PSV.plugins.CompassPlugin}\n * @private\n */\n this.compass = null;\n\n /**\n * @type {PSV.plugins.VirtualTourPlugin.AbstractDatasource}\n */\n this.datasource = null;\n\n /**\n * @type {external:THREE.Group}\n * @private\n */\n this.arrowsGroup = null;\n\n if (this.is3D()) {\n this.arrowsGroup = new THREE.Group();\n\n const localLight = new THREE.PointLight(0xffffff, 1, 0);\n localLight.position.set(2, 0, 0);\n this.arrowsGroup.add(localLight);\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\n if (!this.is3D() && !this.markers) {\n throw new PSVError('Tour plugin requires the Markers plugin in markers mode');\n }\n\n this.datasource = this.isServerSide() ? new ServerSideDatasource(this) : new ClientSideDatasource(this);\n\n if (this.is3D()) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.__positionArrows();\n this.psv.renderer.scene.add(this.arrowsGroup);\n\n const ambientLight = new THREE.AmbientLight(0xffffff, 1);\n this.psv.renderer.scene.add(ambientLight);\n\n this.psv.needsUpdate();\n });\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n this.prop.stopObserver = this.psv.observeObjects(LINK_DATA, this);\n }\n else {\n this.markers.on('select-marker', this);\n }\n\n if (this.isServerSide()) {\n if (this.config.startNodeId) {\n this.setCurrentNode(this.config.startNodeId);\n }\n }\n else if (this.config.nodes) {\n this.setNodes(this.config.nodes, this.config.startNodeId);\n delete this.config.nodes;\n }\n }\n\n /**\n * @package\n */\n destroy() {\n if (this.markers) {\n this.markers.off('select-marker', this);\n }\n if (this.arrowsGroup) {\n this.psv.renderer.scene.remove(this.arrowsGroup);\n }\n\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n this.prop.stopObserver?.();\n\n this.datasource.destroy();\n\n delete this.preload;\n delete this.datasource;\n delete this.markers;\n delete this.compass;\n delete this.arrowsGroup;\n\n super.destroy();\n }\n\n handleEvent(e) {\n let link;\n switch (e.type) {\n case 'select-marker':\n link = e.args[0].data?.[LINK_DATA];\n if (link) {\n this.setCurrentNode(link.nodeId, link);\n }\n break;\n\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n if (this.arrowsGroup) {\n this.__positionArrows();\n }\n break;\n\n case CONSTANTS.EVENTS.CLICK:\n link = e.args[0].objects.find(o => o.userData[LINK_DATA])?.userData[LINK_DATA];\n if (link) {\n this.setCurrentNode(link.nodeId, link);\n }\n break;\n\n case CONSTANTS.OBJECT_EVENTS.ENTER_OBJECT:\n this.__onEnterObject(e.detail.object, e.detail.viewerPoint);\n break;\n case CONSTANTS.OBJECT_EVENTS.HOVER_OBJECT:\n this.__onHoverObject(e.detail.object, e.detail.viewerPoint);\n break;\n case CONSTANTS.OBJECT_EVENTS.LEAVE_OBJECT:\n this.__onLeaveObject(e.detail.object);\n break;\n\n default:\n }\n }\n\n /**\n * @summary Tests if running in server mode\n * @return {boolean}\n */\n isServerSide() {\n return this.config.dataMode === MODE_SERVER;\n }\n\n /**\n * @summary Tests if running in GPS mode\n * @return {boolean}\n */\n isGps() {\n return this.config.positionMode === MODE_GPS;\n }\n\n /**\n * @summary Tests if running in 3D mode\n * @return {boolean}\n */\n is3D() {\n return this.config.renderMode === MODE_3D;\n }\n\n /**\n * @summary Sets the nodes (client mode only)\n * @param {PSV.plugins.VirtualTourPlugin.Node[]} nodes\n * @param {string} [startNodeId]\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setNodes(nodes, startNodeId) {\n if (this.isServerSide()) {\n throw new PSVError('Cannot set nodes in server side mode');\n }\n\n this.datasource.setNodes(nodes);\n\n if (!startNodeId) {\n startNodeId = nodes[0].id;\n }\n else if (!this.datasource.nodes[startNodeId]) {\n startNodeId = nodes[0].id;\n utils.logWarn(`startNodeId not found is provided nodes, resetted to ${startNodeId}`);\n }\n\n this.setCurrentNode(startNodeId);\n }\n\n /**\n * @summary Changes the current node\n * @param {string} nodeId\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} [fromLink]\n * @returns {Promise} resolves false if the loading was aborted by another call\n */\n setCurrentNode(nodeId, fromLink = null) {\n if (nodeId === this.prop.currentNode?.id) {\n return Promise.resolve(true);\n }\n\n this.psv.hideError();\n\n this.prop.loadingNode = nodeId;\n\n const fromNode = this.prop.currentNode;\n const fromLinkPosition = fromNode && fromLink ? this.__getLinkPosition(fromNode, fromLink) : null;\n\n return Promise.all([\n // if this node is already preloading, wait for it\n Promise.resolve(this.preload[nodeId])\n .then(() => {\n if (this.prop.loadingNode !== nodeId) {\n return Promise.reject(utils.getAbortError());\n }\n\n this.psv.textureLoader.abortLoading();\n return this.datasource.loadNode(nodeId);\n }),\n Promise.resolve(fromLinkPosition ? this.config.rotateSpeed : false)\n .then((speed) => {\n if (!speed) {\n return Promise.resolve();\n }\n else {\n return this.psv.animate({ ...fromLinkPosition, speed });\n }\n })\n .then(() => {\n this.psv.loader.show();\n }),\n ])\n .then(([node]) => {\n if (this.prop.loadingNode !== nodeId) {\n return Promise.reject(utils.getAbortError());\n }\n\n this.psv.navbar.setCaption(`${this.psv.config.lang.loading}`);\n\n this.prop.currentNode = node;\n\n if (this.prop.currentTooltip) {\n this.prop.currentTooltip.hide();\n this.prop.currentTooltip = null;\n }\n\n if (this.is3D()) {\n this.arrowsGroup.remove(...this.arrowsGroup.children.filter(o => o.type === 'Mesh'));\n }\n\n this.markers?.clearMarkers();\n this.compass?.clearHotspots();\n\n return Promise.all([\n this.psv.setPanorama(node.panorama, {\n panoData : node.panoData,\n sphereCorrection: node.sphereCorrection,\n })\n .catch((err) => {\n // the error is already displayed by the core\n return Promise.reject(utils.isAbortError(err) ? err : null);\n }),\n this.datasource.loadLinkedNodes(nodeId),\n ]);\n })\n .then(() => {\n if (this.prop.loadingNode !== nodeId) {\n return Promise.reject(utils.getAbortError());\n }\n\n const node = this.prop.currentNode;\n\n if (node.markers) {\n if (this.markers) {\n this.markers.setMarkers(node.markers);\n }\n else {\n utils.logWarn(`Node ${node.id} markers ignored because the plugin is not loaded.`);\n }\n }\n\n this.__renderLinks(node);\n this.__preload(node);\n\n this.psv.navbar.setCaption(node.caption || this.psv.config.caption);\n\n /**\n * @event node-changed\n * @memberof PSV.plugins.VirtualTourPlugin\n * @summary Triggered when the current node is changed\n * @param {string} nodeId\n * @param {PSV.plugins.VirtualTourPlugin.NodeChangedData} data\n */\n this.trigger(EVENTS.NODE_CHANGED, nodeId, {\n fromNode,\n fromLink,\n fromLinkPosition,\n });\n\n this.prop.loadingNode = null;\n\n return true;\n })\n .catch((err) => {\n if (utils.isAbortError(err)) {\n return Promise.resolve(false);\n }\n else if (err) {\n this.psv.showError(this.psv.config.lang.loadError);\n }\n\n this.psv.loader.hide();\n this.psv.navbar.setCaption('');\n\n this.prop.loadingNode = null;\n\n return Promise.reject(err);\n });\n }\n\n /**\n * @summary Adds the links for the node\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @private\n */\n __renderLinks(node) {\n const positions = [];\n\n node.links.forEach((link) => {\n const position = this.__getLinkPosition(node, link);\n positions.push(position);\n\n if (this.is3D()) {\n const arrow = ARROW_GEOM.clone();\n const mat = new THREE.MeshLambertMaterial({\n transparent: true,\n opacity : link.arrowStyle?.opacity || this.config.arrowStyle.opacity,\n });\n const mesh = new THREE.Mesh(arrow, mat);\n\n setMeshColor(mesh, link.arrowStyle?.color || this.config.arrowStyle.color);\n\n mesh.userData = { [LINK_DATA]: link, longitude: position.longitude };\n mesh.rotation.order = 'YXZ';\n mesh.rotateY(-position.longitude);\n this.psv.dataHelper\n .sphericalCoordsToVector3({ longitude: position.longitude, latitude: 0 }, mesh.position)\n .multiplyScalar(1 / CONSTANTS.SPHERE_RADIUS);\n\n this.arrowsGroup.add(mesh);\n }\n else {\n if (this.isGps()) {\n position.latitude += this.config.markerLatOffset;\n }\n\n this.markers.addMarker({\n ...this.config.markerStyle,\n ...link.markerStyle,\n id : `tour-link-${link.nodeId}`,\n tooltip : link.name,\n hideList: true,\n data : { [LINK_DATA]: link },\n ...position,\n }, false);\n }\n });\n\n if (this.is3D()) {\n this.__positionArrows();\n }\n else {\n this.markers.renderMarkers();\n }\n\n if (this.config.linksOnCompass && this.compass) {\n this.compass.setHotspots(positions);\n }\n }\n\n /**\n * @summary Computes the marker position for a link\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} link\n * @return {PSV.Position}\n * @private\n */\n __getLinkPosition(node, link) {\n if (this.isGps()) {\n const p1 = [THREE.Math.degToRad(node.position[0]), THREE.Math.degToRad(node.position[1])];\n const p2 = [THREE.Math.degToRad(link.position[0]), THREE.Math.degToRad(link.position[1])];\n const h1 = node.position[2] !== undefined ? node.position[2] : link.position[2] || 0;\n const h2 = link.position[2] !== undefined ? link.position[2] : node.position[2] || 0;\n\n let latitude = 0;\n if (h1 !== h2) {\n latitude = Math.atan((h2 - h1) / distance(p1, p2));\n }\n\n const longitude = bearing(p1, p2);\n\n return { longitude, latitude };\n }\n else {\n return this.psv.dataHelper.cleanPosition(link);\n }\n }\n\n /**\n * @private\n */\n __onEnterObject(mesh, viewerPoint) {\n const link = mesh.userData[LINK_DATA];\n\n setMeshColor(mesh, link.arrowStyle?.hoverColor || this.config.arrowStyle.hoverColor);\n\n if (link.name) {\n this.prop.currentTooltip = this.psv.tooltip.create({\n left : viewerPoint.x,\n top : viewerPoint.y,\n content: link.name,\n });\n }\n\n this.psv.needsUpdate();\n }\n\n\n /**\n * @private\n */\n __onHoverObject(mesh, viewerPoint) {\n if (this.prop.currentTooltip) {\n this.prop.currentTooltip.move({\n left: viewerPoint.x,\n top : viewerPoint.y,\n });\n }\n }\n\n\n /**\n * @private\n */\n __onLeaveObject(mesh) {\n const link = mesh.userData[LINK_DATA];\n\n setMeshColor(mesh, link.arrowStyle?.color || this.config.arrowStyle.color);\n\n if (this.prop.currentTooltip) {\n this.prop.currentTooltip.hide();\n this.prop.currentTooltip = null;\n }\n\n this.psv.needsUpdate();\n }\n\n /**\n * @summary Updates to position of the group of arrows\n * @private\n */\n __positionArrows() {\n const isBottom = this.config.arrowPosition === 'bottom';\n\n this.arrowsGroup.position.copy(this.psv.prop.direction).multiplyScalar(0.5);\n const s = this.config.arrowStyle.scale;\n const f = s[1] + (s[0] - s[1]) * CONSTANTS.EASINGS.linear(this.psv.getZoomLevel() / 100);\n this.arrowsGroup.position.y += isBottom ? -1.5 : 1.5;\n this.arrowsGroup.scale.set(f, f, f);\n\n // slightly rotates each arrow to make the center ones standing out\n const position = this.psv.getPosition();\n if (isBottom ? (position.latitude < Math.PI / 8) : (position.latitude > -Math.PI / 8)) {\n this.arrowsGroup.children\n .filter(o => o.type === 'Mesh')\n .forEach((arrow) => {\n const d = Math.abs(utils.getShortestArc(arrow.userData.longitude, position.longitude));\n const x = CONSTANTS.EASINGS.inOutSine(Math.max(0, Math.PI / 4 - d) / (Math.PI / 4)) / 3; // magic !\n arrow.rotation.x = isBottom ? -x : x;\n });\n }\n else {\n this.arrowsGroup.children\n .filter(o => o.type === 'Mesh')\n .forEach((arrow) => {\n arrow.rotation.x = 0;\n });\n }\n }\n\n /**\n * @summary Manage the preload of the linked panoramas\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @private\n */\n __preload(node) {\n if (!this.config.preload) {\n return;\n }\n\n this.preload[node.id] = true;\n\n this.prop.currentNode.links\n .filter(link => !this.preload[link.nodeId])\n .filter((link) => {\n if (typeof this.config.preload === 'function') {\n return this.config.preload(this.prop.currentNode, link);\n }\n else {\n return true;\n }\n })\n .forEach((link) => {\n this.preload[link.nodeId] = this.datasource.loadNode(link.nodeId)\n .then((linkNode) => {\n return this.psv.textureLoader.preloadPanorama(linkNode.panorama);\n })\n .then(() => {\n this.preload[link.nodeId] = true;\n })\n .catch(() => {\n delete this.preload[link.nodeId];\n });\n });\n }\n\n /**\n * @summary Toggles the visibility of the list of nodes\n */\n toggleNodesList() {\n if (this.psv.panel.prop.contentId === ID_PANEL_NODES_LIST) {\n this.hideNodesList();\n }\n else {\n this.showNodesList();\n }\n }\n\n /**\n * @summary Opens side panel with the list of nodes\n */\n showNodesList() {\n const nodes = this.change(EVENTS.RENDER_NODES_LIST, Object.values(this.datasource.nodes));\n\n this.psv.panel.show({\n id : ID_PANEL_NODES_LIST,\n content : NODES_LIST_TEMPLATE(\n nodes,\n this.psv.config.lang[NodesListButton.id],\n this.prop.currentNode?.id\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const nodeId = li ? li.dataset.nodeId : undefined;\n\n if (nodeId) {\n this.setCurrentNode(nodeId);\n this.hideNodesList();\n }\n },\n });\n }\n\n /**\n * @summary Closes side panel if it contains the list of nodes\n */\n hideNodesList() {\n this.psv.panel.hide(ID_PANEL_NODES_LIST);\n }\n\n}\n"],"names":["AbstractDatasource","plugin","nodes","destroy","loadNode","nodeId","PSVError","loadLinkedNodes","checkNode","node","isGps","id","panorama","position","length","checkLink","link","utils","isExtendedPosition","setMeshColor","mesh","color","material","set","emissive","distance","p1","p2","greatArcDistance","bearing","λ1","φ1","λ2","φ2","y","Math","sin","cos","x","atan2","ClientSideDatasource","Promise","resolve","reject","setNodes","rawNodes","linkedNodes","forEach","links","logWarn","name","MODE_CLIENT","MODE_SERVER","MODE_MANUAL","MODE_GPS","MODE_MARKERS","MODE_3D","EVENTS","NODE_CHANGED","RENDER_NODES_LIST","LINK_DATA","DEFAULT_MARKER","html","arrowIconSvg","width","height","scale","anchor","className","style","DEFAULT_ARROW","hoverColor","opacity","ARROW_GEOM","loader","THREE","ObjectLoader","geom","parseGeometries","arrowGeometryJson","uuid","computeBoundingBox","b","boundingBox","translate","max","min","z","rotateX","PI","ID_PANEL_NODES_LIST","NODES_LIST_TEMPLATE","title","currentNodeId","nodesList","map","thumbnail","caption","join","NodesListButton","navbar","psv","getPlugin","on","CONSTANTS","OPEN_PANEL","CLOSE_PANEL","off","isSupported","config","listButton","handleEvent","e","type","toggleActive","args","onClick","toggleNodesList","AbstractButton","icon","ServerSideDatasource","getNode","nodeResolver","linksResolver","getLinks","then","DEFAULTS","lang","loading","registerButton","VirtualTourPlugin","options","prop","currentNode","currentTooltip","loadingNode","stopObserver","preload","dataMode","positionMode","renderMode","rotateSpeed","markerLatOffset","arrowPosition","linksOnCompass","markerStyle","arrowStyle","markers","compass","datasource","arrowsGroup","is3D","Group","localLight","PointLight","add","init","isServerSide","once","READY","__positionArrows","renderer","scene","ambientLight","AmbientLight","needsUpdate","POSITION_UPDATED","ZOOM_UPDATED","CLICK","observeObjects","startNodeId","setCurrentNode","remove","data","objects","find","o","userData","OBJECT_EVENTS","ENTER_OBJECT","__onEnterObject","detail","object","viewerPoint","HOVER_OBJECT","__onHoverObject","LEAVE_OBJECT","__onLeaveObject","fromLink","hideError","fromNode","fromLinkPosition","__getLinkPosition","all","getAbortError","textureLoader","abortLoading","speed","animate","show","setCaption","hide","children","filter","clearMarkers","clearHotspots","setPanorama","panoData","sphereCorrection","catch","err","isAbortError","setMarkers","__renderLinks","__preload","trigger","showError","loadError","positions","push","arrow","clone","mat","MeshLambertMaterial","transparent","Mesh","longitude","rotation","order","rotateY","dataHelper","sphericalCoordsToVector3","latitude","multiplyScalar","SPHERE_RADIUS","addMarker","tooltip","hideList","renderMarkers","setHotspots","degToRad","h1","undefined","h2","atan","cleanPosition","create","left","top","content","move","isBottom","copy","direction","s","f","EASINGS","linear","getZoomLevel","getPosition","d","abs","getShortestArc","inOutSine","linkNode","preloadPanorama","panel","contentId","hideNodesList","showNodesList","change","Object","values","noMargin","clickHandler","li","target","getClosest","dataset","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;;MACaA,kBAAb;EAEE;EACF;EACA;;EAGE;EACF;EACA;EACE,8BAAYC,MAAZ,EAAoB;EAAA,SALpBC,KAKoB,GALZ,EAKY;EAClB,SAAKD,MAAL,GAAcA,MAAd;EACD;;EAZH;;EAAA,SAcEE,OAdF,GAcE,mBAAU;EACR,WAAO,KAAKF,MAAZ;EACD;EAED;EACF;EACA;EACA;EACA;EAtBA;;EAAA,SAuBEG,QAvBF,GAuBE,kBAASC,MAAT,EAAiB;EAAE;EACjB,UAAM,IAAIC,0BAAJ,CAAa,0BAAb,CAAN;EACD;EAED;EACF;EACA;EACA;EACA;EA/BA;;EAAA,SAgCEC,eAhCF,GAgCE,yBAAgBF,MAAhB,EAAwB;EAAE;EACxB,UAAM,IAAIC,0BAAJ,CAAa,iCAAb,CAAN;EACD,GAlCH;;EAAA;EAAA;;ECJA;EACA;EACA;EACA;EACA;EACA;;EACO,SAASE,SAAT,CAAmBC,IAAnB,EAAyBC,KAAzB,EAAgC;EAAA;;EACrC,MAAI,CAACD,IAAI,CAACE,EAAV,EAAc;EACZ,UAAM,IAAIL,0BAAJ,CAAa,sBAAb,CAAN;EACD;;EACD,MAAI,CAACG,IAAI,CAACG,QAAV,EAAoB;EAClB,UAAM,IAAIN,0BAAJ,oCAA8CG,IAAI,CAACE,EAAnD,CAAN;EACD;;EACD,MAAID,KAAK,IAAI,EAAE,mBAAAD,IAAI,CAACI,QAAL,oCAAeC,MAAf,KAAyB,CAA3B,CAAb,EAA4C;EAC1C,UAAM,IAAIR,0BAAJ,oCAA8CG,IAAI,CAACE,EAAnD,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CAACkC,IAAL,GAAYlC,IAAI,CAACkC,IAAL,IAAa,MAAI,CAAChD,KAAL,CAAWc,IAAI,CAACX,MAAhB,EAAwB6C,IAAjD;EACD;;EAED,cAAI,MAAI,CAACjD,MAAL,CAAYS,KAAZ,MAAuB,CAACM,IAAI,CAACH,QAAjC,EAA2C;EACzC,kBAAM,IAAIP,0BAAJ,wCAAkDU,IAAI,CAACX,MAAvD,iBAAyEI,IAAI,CAACE,EAA9E,CAAN;EACD;EACF,SAZD,EAHe;;EAkBfF,QAAAA,IAAI,CAACuC,KAAL,GAAaA,KAAb;EACD,OArBI,CAAP;EAsBD;EACF,GAjEH;;EAAA;EAAA,EAA0ChD,kBAA1C;;ECgBA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EAEA;;AACA8H,4BAAQ,CAACC,IAAT,CAAc5B,eAAe,CAACxF,EAA9B,IAAoC,WAApC;AACAmH,4BAAQ,CAACC,IAAT,CAAcC,OAAd,GAAwB,YAAxB;AACAC,kCAAc,CAAC9B,eAAD,EAAkB,cAAlB,CAAd;EAMA;EACA;EACA;EACA;EACA;;MACa+B,iBAAb;EAAA;;EAIE;EACF;EACA;EACA;EACE,6BAAY7B,GAAZ,EAAiB8B,OAAjB,EAA0B;EAAA;;EACxB,uCAAM9B,GAAN;EAEA;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;;EACI,UAAK+B,IAAL,GAAY;EACVC,MAA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qK,KAAT,CAAenE,IAAf,CAAoB;EAClB5L,MAAAA,EAAE,EAAY+E,mBADI;EAElB+J,MAAAA,OAAO,EAAO9J,mBAAmB,CAC/BzF,KAD+B,EAE/B,KAAKmG,GAAL,CAASQ,MAAT,CAAgBkB,IAAhB,CAAqB5B,eAAe,CAACxF,EAArC,CAF+B,4BAG/B,KAAKyH,IAAL,CAAUC,WAHqB,qBAG/B,uBAAuB1H,EAHQ,CAFf;EAOlBsQ,MAAAA,QAAQ,EAAM,IAPI;EAQlBC,MAAAA,YAAY,EAAE,sBAAClK,CAAD,EAAO;EACnB,YAAMmK,EAAE,GAAGnK,CAAC,CAACoK,MAAF,GAAWnQ,uBAAK,CAACoQ,UAAN,CAAiBrK,CAAC,CAACoK,MAAnB,EAA2B,IAA3B,CAAX,GAA8ClC,SAAzD;EACA,YAAM7O,MAAM,GAAG8Q,EAAE,GAAGA,EAAE,CAACG,OAAH,CAAWjR,MAAd,GAAuB6O,SAAxC;;EAEA,YAAI7O,MAAJ,EAAY;EACV,UAAA,MAAI,CAACsK,cAAL,CAAoBtK,MAApB;;EACA,UAAA,MAAI,CAACuQ,aAAL;EACD;EACF;EAhBiB,KAApB;EAkBD;EAED;EACF;EACA;EAhnBA;;EAAA,SAinBEA,aAjnBF,GAinBE,yBAAgB;EACd,SAAKvK,GAAL,CAASqK,KAAT,CAAejE,IAAf,CAAoB/G,mBAApB;EACD,GAnnBH;;EAAA;EAAA,EAAuC6L,gCAAvC;EAAarJ,kBAEJvH,KAAK;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"virtual-tour.js","sources":["../../src/plugins/virtual-tour/AbstractDatasource.js","../../src/plugins/virtual-tour/utils.js","../../src/plugins/virtual-tour/ClientSideDatasource.js","../../src/plugins/virtual-tour/constants.js","../../src/plugins/virtual-tour/NodesListButton.js","../../src/plugins/virtual-tour/ServerSideDatasource.js","../../src/plugins/virtual-tour/index.js"],"sourcesContent":["import { PSVError } from 'photo-sphere-viewer';\n\n/**\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @package\n */\nexport class AbstractDatasource {\n\n /**\n * @type {Record}\n */\n nodes = {};\n\n /**\n * @param {PSV.plugins.VirtualTourPlugin} plugin\n */\n constructor(plugin) {\n this.plugin = plugin;\n }\n\n destroy() {\n delete this.plugin;\n }\n\n /**\n * @summary Loads a node\n * @param {string} nodeId\n * @return {Promise}\n */\n loadNode(nodeId) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadNode not implemented');\n }\n\n /**\n * @summary Loades nodes linked to another node\n * @param {string} nodeId\n * @return {Promise}\n */\n loadLinkedNodes(nodeId) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadLinkedNodes not implemented');\n }\n\n}\n","import { PSVError, utils } from 'photo-sphere-viewer';\n\n/**\n * @summary Checks the configuration of a node\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {boolean} isGps\n * @private\n */\nexport function checkNode(node, isGps) {\n if (!node.id) {\n throw new PSVError('No id given for node');\n }\n if (!node.panorama) {\n throw new PSVError(`No panorama provided for node ${node.id}`);\n }\n if (isGps && !(node.position?.length >= 2)) {\n throw new PSVError(`No position provided for node ${node.id}`);\n }\n}\n\n/**\n * @summary Checks the configuration of a link\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} link\n * @param {boolean} isGps\n * @private\n */\nexport function checkLink(node, link, isGps) {\n if (!link.nodeId) {\n throw new PSVError(`Link of node ${node.id} has no target id`);\n }\n if (!isGps && !utils.isExtendedPosition(link)) {\n throw new PSVError(`No position provided for link ${link.nodeId} of node ${node.id}`);\n }\n}\n\n/**\n * @summary Changes the color of a mesh\n * @param {external:THREE.Mesh} mesh\n * @param {*} color\n * @private\n */\nexport function setMeshColor(mesh, color) {\n mesh.material.color.set(color);\n}\n\n/**\n * @summary Returns the distance between two GPS points\n * @param {number[]} p1\n * @param {number[]} p2\n * @return {number}\n * @private\n */\nexport function distance(p1, p2) {\n return utils.greatArcDistance(p1, p2) * 6371e3;\n}\n\n/**\n * @summary Returns the bearing between two GPS points\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @param {number[]} p1\n * @param {number[]} p2\n * @return {number}\n * @private\n */\nexport function bearing(p1, p2) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const y = Math.sin(λ2 - λ1) * Math.cos(φ2);\n const x = Math.cos(φ1) * Math.sin(φ2) - Math.sin(φ1) * Math.cos(φ2) * Math.cos(λ2 - λ1);\n return Math.atan2(y, x);\n}\n","import { PSVError, utils } from 'photo-sphere-viewer';\nimport { AbstractDatasource } from './AbstractDatasource';\nimport { checkLink, checkNode } from './utils';\n\n/**\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @package\n */\nexport class ClientSideDatasource extends AbstractDatasource {\n\n loadNode(nodeId) {\n if (this.nodes[nodeId]) {\n return Promise.resolve(this.nodes[nodeId]);\n }\n else {\n return Promise.reject(new PSVError(`Node ${nodeId} not found`));\n }\n }\n\n loadLinkedNodes(nodeId) {\n if (!this.nodes[nodeId]) {\n return Promise.reject(new PSVError(`Node ${nodeId} not found`));\n }\n else {\n return Promise.resolve();\n }\n }\n\n setNodes(rawNodes) {\n if (!rawNodes?.length) {\n throw new PSVError('No nodes provided');\n }\n\n const nodes = {};\n const linkedNodes = {};\n\n rawNodes.forEach((node) => {\n checkNode(node, this.plugin.isGps());\n\n if (nodes[node.id]) {\n throw new PSVError(`Duplicate node ${node.id}`);\n }\n if (!node.links) {\n utils.logWarn(`Node ${node.id} has no links`);\n nodes.links = [];\n }\n\n nodes[node.id] = node;\n });\n\n rawNodes.forEach((node) => {\n node.links.forEach((link) => {\n checkLink(node, link, this.plugin.isGps());\n\n if (!nodes[link.nodeId]) {\n throw new PSVError(`Target node ${link.nodeId} of node ${node.id} does not exists`);\n }\n\n // copy essential data\n link.position = link.position || nodes[link.nodeId].position;\n link.name = link.name || nodes[link.nodeId].name;\n\n linkedNodes[link.nodeId] = true;\n });\n });\n\n rawNodes.forEach((node) => {\n if (!linkedNodes[node.id]) {\n utils.logWarn(`Node ${node.id} is never linked to`);\n }\n });\n\n this.nodes = nodes;\n }\n\n}\n","import * as THREE from 'three';\nimport arrowGeometryJson from './arrow.json';\nimport arrowIconSvg from './arrow.svg';\nimport arrowOutlineGeometryJson from './arrow_outline.json';\nimport nodesList from './nodes-list.svg';\n\n/**\n * @summary In client mode all the nodes are provided in the config or with the `setNodes` method\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_CLIENT = 'client';\n\n/**\n * @summary In server mode the nodes are fetched asynchronously\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_SERVER = 'server';\n\n/**\n * @summary In manual mode each link is positionned manually on the panorama\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_MANUAL = 'manual';\n\n/**\n * @summary In GPS mode each node is globally positionned and the links are automatically computed\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_GPS = 'gps';\n\n/**\n * @summaru In markers mode the links are represented using markers\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_MARKERS = 'markers';\n\n/**\n * @summaru In 3D mode the links are represented using 3d arrows\n * @type {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const MODE_3D = '3d';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.VirtualTourPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event node-changed\n * @memberof PSV.plugins.VirtualTourPlugin\n * @summary Triggered when the current node changes\n * @param {string} nodeId\n */\n NODE_CHANGED : 'node-changed',\n /**\n * @event filter:render-nodes-list\n * @memberof PSV.plugins.VirtualTourPlugin\n * @summary Used to alter the list of nodes displayed on the side-panel\n * @param {PSV.plugins.VirtualTourPlugin.Node[]} nodes\n * @returns {PSV.plugins.VirtualTourPlugin.Node[]}\n */\n RENDER_NODES_LIST: 'render-nodes-list',\n};\n\n/**\n * @summary Property name added to markers\n * @type {string}\n * @constant\n * @private\n */\nexport const LINK_DATA = 'tourLink';\n\n/**\n * @summary Default style of the link marker\n * @type {PSV.plugins.MarkersPlugin.Properties}\n * @constant\n * @private\n */\nexport const DEFAULT_MARKER = {\n html : arrowIconSvg,\n width : 80,\n height : 80,\n scale : [0.5, 2],\n anchor : 'top center',\n className: 'psv-virtual-tour__marker',\n style : {\n color: 'rgba(0, 208, 255, 0.8)',\n },\n};\n\n/**\n * @summary Default style of the link arrow\n * @type {PSV.plugins.VirtualTourPlugin.ArrowStyle}\n * @constant\n * @private\n */\nexport const DEFAULT_ARROW = {\n color : 0xaaaaaa,\n hoverColor : 0xaa5500,\n outlineColor: 0x000000,\n scale : [0.5, 2],\n};\n\n/**\n * @type {external:THREE.BufferedGeometry}\n * @constant\n * @private\n */\nexport const { ARROW_GEOM, ARROW_OUTLINE_GEOM } = (() => {\n const loader = new THREE.ObjectLoader();\n const geometries = loader.parseGeometries([arrowGeometryJson, arrowOutlineGeometryJson]);\n const arrow = geometries[arrowGeometryJson.uuid];\n const arrowOutline = geometries[arrowOutlineGeometryJson.uuid];\n const scale = 0.015;\n const rot = Math.PI / 2;\n arrow.scale(scale, scale, scale);\n arrow.rotateX(rot);\n arrowOutline.scale(scale, scale, scale);\n arrowOutline.rotateX(rot);\n return { ARROW_GEOM: arrow, ARROW_OUTLINE_GEOM: arrowOutline };\n})();\n\n/**\n * @summary Panel identifier for nodes list\n * @type {string}\n * @constant\n * @private\n */\nexport const ID_PANEL_NODES_LIST = 'virtualTourNodesList';\n\n/**\n * @summary Nodes list template\n * @param {PSV.plugins.VirtualTourPlugin.Node[]} nodes\n * @param {string} title\n * @param {string} currentNodeId\n * @returns {string}\n * @constant\n * @private\n */\nexport const NODES_LIST_TEMPLATE = (nodes, title, currentNodeId) => `\n
\n

${nodesList} ${title}

\n
    \n ${nodes.map(node => `\n
  • \n ${node.thumbnail ? `` : ''}\n ${node.caption || node.name}\n
  • \n `).join('')}\n
\n
\n`;\n","import { AbstractButton, CONSTANTS } from '../..';\nimport { ID_PANEL_NODES_LIST } from './constants';\nimport nodesList from './nodes-list.svg';\n\n/**\n * @summary Navigation bar markers list button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class NodesListButton extends AbstractButton {\n\n static id = 'nodesList';\n static icon = nodesList;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-nodes-list-button', true);\n\n /**\n * @type {PSV.plugins.VirtualTourPlugin}\n */\n this.plugin = this.psv.getPlugin('virtual-tour');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin && !this.plugin.isServerSide();\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 CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === ID_PANEL_NODES_LIST); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles nodes list\n */\n onClick() {\n this.plugin.toggleNodesList();\n }\n\n}\n","import { PSVError, utils } from 'photo-sphere-viewer';\nimport { AbstractDatasource } from './AbstractDatasource';\nimport { checkLink, checkNode } from './utils';\n\n/**\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @package\n */\nexport class ServerSideDatasource extends AbstractDatasource {\n\n constructor(plugin) {\n super(plugin);\n\n if (!plugin.config.getNode) {\n throw new PSVError('Missing getNode() option.');\n }\n\n this.nodeResolver = plugin.config.getNode;\n this.linksResolver = plugin.config.getLinks;\n }\n\n loadNode(nodeId) {\n if (this.nodes[nodeId]) {\n return Promise.resolve(this.nodes[nodeId]);\n }\n else {\n return Promise.resolve(this.nodeResolver(nodeId))\n .then((node) => {\n checkNode(node, this.plugin.isGps());\n this.nodes[nodeId] = node;\n return node;\n });\n }\n }\n\n loadLinkedNodes(nodeId) {\n if (!this.nodes[nodeId]) {\n return Promise.reject(new PSVError(`Node ${nodeId} not found`));\n }\n else if (this.nodes[nodeId].links) {\n return Promise.resolve();\n }\n else {\n if (!this.linksResolver) {\n this.nodes[nodeId].links = [];\n return Promise.resolve();\n }\n\n utils.logWarn(`getLinks() option is deprecated, instead make getNode() also return the node' links.`);\n\n return Promise.resolve(this.linksResolver(nodeId))\n .then(links => links || [])\n .then((links) => {\n const node = this.nodes[nodeId];\n\n links.forEach((link) => {\n checkLink(node, link, this.plugin.isGps());\n\n // copy essential data\n if (this.nodes[link.nodeId]) {\n link.position = link.position || this.nodes[link.nodeId].position;\n link.name = link.name || this.nodes[link.nodeId].name;\n }\n\n if (this.plugin.isGps() && !link.position) {\n throw new PSVError(`No GPS position provided for link ${link.nodeId} of node ${node.id}`);\n }\n });\n\n // store links\n node.links = links;\n });\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { ClientSideDatasource } from './ClientSideDatasource';\nimport {\n ARROW_GEOM,\n ARROW_OUTLINE_GEOM,\n DEFAULT_ARROW,\n DEFAULT_MARKER,\n EVENTS,\n ID_PANEL_NODES_LIST,\n LINK_DATA,\n MODE_3D,\n MODE_CLIENT,\n MODE_GPS,\n MODE_MANUAL,\n MODE_MARKERS,\n MODE_SERVER,\n NODES_LIST_TEMPLATE\n} from './constants';\nimport { NodesListButton } from './NodesListButton';\nimport { ServerSideDatasource } from './ServerSideDatasource';\nimport './style.scss';\nimport { bearing, distance, setMeshColor } from './utils';\n\n\n/**\n * @callback GetNode\n * @summary Function to load a node\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @param {string} nodeId\n * @returns {PSV.plugins.VirtualTourPlugin.Node|Promise}\n */\n\n/**\n * @callback GetLinks\n * @summary Function to load the links of a node\n * @deprecated `getNode` must directly return the links of each node\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @param {string} nodeId\n * @returns {PSV.plugins.VirtualTourPlugin.NodeLink[]|Promise}\n */\n\n/**\n * @callback Preload\n * @summary Function to determine if a link must be preloaded\n * @memberOf PSV.plugins.VirtualTourPlugin\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} link\n * @returns {boolean}\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.Node\n * @summary Definition of a single node in the tour\n * @property {string} id - unique identifier of the node\n * @property {*} panorama\n * @property {PSV.plugins.VirtualTourPlugin.NodeLink[]} [links] - links to other nodes\n * @property {number[]} [position] - GPS position (longitude, latitude, optional altitude)\n * @property {PSV.PanoData | PSV.PanoDataProvider} [panoData] - data used for this panorama\n * @property {PSV.SphereCorrection} [sphereCorrection] - sphere correction to apply to this panorama\n * @property {string} [name] - short name of the node\n * @property {string} [caption] - caption visible in the navbar\n * @property {string} [thumbnail] - thumbnail for the nodes list in the side panel\n * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers] - additional markers to use on this node\n */\n\n/**\n * @typedef {PSV.ExtendedPosition} PSV.plugins.VirtualTourPlugin.NodeLink\n * @summary Definition of a link between two nodes\n * @property {string} nodeId - identifier of the target node\n * @property {string} [name] - override the name of the node (tooltip)\n * @property {number[]} [position] - override the GPS position of the node\n * @property {PSV.plugins.MarkersPlugin.Properties} [markerStyle] - override global marker style\n * @property {PSV.plugins.VirtualTourPlugin.ArrowStyle} [arrowStyle] - override global arrow style\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.ArrowStyle\n * @summary Style of the arrow in 3D mode\n * @property {string} [color=0xaaaaaa]\n * @property {string} [hoverColor=0xaa5500]\n * @property {number} [outlineColor=0x000000]\n * @property {number[]} [scale=[0.5,2]]\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.Options\n * @property {'client'|'server'} [dataMode='client'] - configure data mode\n * @property {'manual'|'gps'} [positionMode='manual'] - configure positioning mode\n * @property {'markers'|'3d'} [renderMode='3d'] - configure rendering mode of links\n * @property {PSV.plugins.VirtualTourPlugin.Node[]} [nodes] - initial nodes\n * @property {PSV.plugins.VirtualTourPlugin.GetNode} [getNode]\n * @property {PSV.plugins.VirtualTourPlugin.GetLinks} [getLinks] - Deprecated: `getNode` must directly return the links of each node\n * @property {string} [startNodeId] - id of the initial node, if not defined the first node will be used\n * @property {boolean|PSV.plugins.VirtualTourPlugin.Preload} [preload=false] - preload linked panoramas\n * @property {boolean|string|number} [rotateSpeed='20rpm'] - speed of rotation when clicking on a link, if 'false' the viewer won't rotate at all\n * @property {boolean|number} [transition=1500] - duration of the transition between nodes\n * @property {boolean} [linksOnCompass] - if the Compass plugin is enabled, displays the links on the compass, defaults to `true` on in markers render mode\n * @property {PSV.plugins.MarkersPlugin.Properties} [markerStyle] - global marker style\n * @property {PSV.plugins.VirtualTourPlugin.ArrowStyle} [arrowStyle] - global arrow style\n * @property {number} [markerLatOffset=-0.1] - (GPS & Markers mode) latitude offset applied to link markers, to compensate for viewer height\n * @property {'top'|'bottom'} [arrowPosition='bottom'] - (3D mode) arrows vertical position\n */\n\n/**\n * @typedef {Object} PSV.plugins.VirtualTourPlugin.NodeChangedData\n * @summary Data associated to the \"node-changed\" event\n * @type {PSV.plugins.VirtualTourPlugin.Node} [fromNode] - The previous node\n * @type {PSV.plugins.VirtualTourPlugin.NodeLink} [fromLink] - The link that was clicked in the previous node\n * @type {PSV.Position} [fromLinkPosition] - The position of the link on the previous node\n */\n\n// add markers buttons\nDEFAULTS.lang[NodesListButton.id] = 'Locations';\nregisterButton(NodesListButton, 'caption:left');\n\n\nexport { EVENTS, MODE_3D, MODE_CLIENT, MODE_GPS, MODE_MANUAL, MODE_MARKERS, MODE_SERVER } from './constants';\n\n\n/**\n * @summary Create virtual tours by linking multiple panoramas\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class VirtualTourPlugin extends AbstractPlugin {\n\n static id = 'virtual-tour';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.VirtualTourPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @property {PSV.plugins.VirtualTourPlugin.Node} currentNode\n * @property {PSV.Tooltip} currentTooltip\n * @property {string} loadingNode\n * @property {function} stopObserver\n * @private\n */\n this.prop = {\n currentNode : null,\n currentTooltip: null,\n loadingNode : null,\n stopObserver : null,\n };\n\n /**\n * @type {Record}\n * @private\n */\n this.preload = {};\n\n /**\n * @member {PSV.plugins.VirtualTourPlugin.Options}\n * @private\n */\n this.config = {\n dataMode : MODE_CLIENT,\n positionMode : MODE_MANUAL,\n renderMode : MODE_3D,\n preload : false,\n rotateSpeed : '20rpm',\n transition : CONSTANTS.DEFAULT_TRANSITION,\n markerLatOffset: -0.1,\n arrowPosition : 'bottom',\n linksOnCompass : options?.renderMode === MODE_MARKERS,\n ...options,\n markerStyle : {\n ...DEFAULT_MARKER,\n ...options?.markerStyle,\n },\n arrowStyle : {\n ...DEFAULT_ARROW,\n ...options?.arrowStyle,\n },\n };\n\n if (options?.listButton === false) {\n utils.logWarn('VirtualTourPlugin: listButton option is deprecated. '\n + 'Please define the global navbar options according to your needs.');\n }\n if (options?.listButton === true && this.config.dataMode === MODE_SERVER) {\n utils.logWarn('VirtualTourPlugin: the list button is not supported in server mode.');\n }\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n\n /**\n * @type {PSV.plugins.CompassPlugin}\n * @private\n */\n this.compass = null;\n\n /**\n * @type {PSV.plugins.VirtualTourPlugin.AbstractDatasource}\n */\n this.datasource = null;\n\n /**\n * @type {external:THREE.Group}\n * @private\n */\n this.arrowsGroup = null;\n\n if (this.is3D()) {\n this.arrowsGroup = new THREE.Group();\n\n const localLight = new THREE.PointLight(0xffffff, 1, 0);\n localLight.position.set(0, this.config.arrowPosition === 'bottom' ? 2 : -2, 0);\n this.arrowsGroup.add(localLight);\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\n if (!this.is3D() && !this.markers) {\n throw new PSVError('Tour plugin requires the Markers plugin in markers mode');\n }\n\n this.datasource = this.isServerSide() ? new ServerSideDatasource(this) : new ClientSideDatasource(this);\n\n if (this.is3D()) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.__positionArrows();\n this.psv.renderer.scene.add(this.arrowsGroup);\n\n const ambientLight = new THREE.AmbientLight(0xffffff, 1);\n this.psv.renderer.scene.add(ambientLight);\n\n this.psv.needsUpdate();\n });\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n this.prop.stopObserver = this.psv.observeObjects(LINK_DATA, this);\n }\n else {\n this.markers.on('select-marker', this);\n }\n\n if (this.isServerSide()) {\n if (this.config.startNodeId) {\n this.setCurrentNode(this.config.startNodeId);\n }\n }\n else if (this.config.nodes) {\n this.setNodes(this.config.nodes, this.config.startNodeId);\n delete this.config.nodes;\n }\n }\n\n /**\n * @package\n */\n destroy() {\n if (this.markers) {\n this.markers.off('select-marker', this);\n }\n if (this.arrowsGroup) {\n this.psv.renderer.scene.remove(this.arrowsGroup);\n }\n\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n this.prop.stopObserver?.();\n\n this.datasource.destroy();\n\n delete this.preload;\n delete this.datasource;\n delete this.markers;\n delete this.compass;\n delete this.arrowsGroup;\n\n super.destroy();\n }\n\n handleEvent(e) {\n let link;\n switch (e.type) {\n case 'select-marker':\n link = e.args[0].data?.[LINK_DATA];\n if (link) {\n this.setCurrentNode(link.nodeId, link);\n }\n break;\n\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n if (this.arrowsGroup) {\n this.__positionArrows();\n }\n break;\n\n case CONSTANTS.EVENTS.CLICK:\n link = e.args[0].objects.find(o => o.userData[LINK_DATA])?.userData[LINK_DATA];\n if (link) {\n this.setCurrentNode(link.nodeId, link);\n }\n break;\n\n case CONSTANTS.OBJECT_EVENTS.ENTER_OBJECT:\n this.__onEnterObject(e.detail.object, e.detail.viewerPoint);\n break;\n case CONSTANTS.OBJECT_EVENTS.HOVER_OBJECT:\n this.__onHoverObject(e.detail.object, e.detail.viewerPoint);\n break;\n case CONSTANTS.OBJECT_EVENTS.LEAVE_OBJECT:\n this.__onLeaveObject(e.detail.object);\n break;\n\n default:\n }\n }\n\n /**\n * @summary Tests if running in server mode\n * @return {boolean}\n */\n isServerSide() {\n return this.config.dataMode === MODE_SERVER;\n }\n\n /**\n * @summary Tests if running in GPS mode\n * @return {boolean}\n */\n isGps() {\n return this.config.positionMode === MODE_GPS;\n }\n\n /**\n * @summary Tests if running in 3D mode\n * @return {boolean}\n */\n is3D() {\n return this.config.renderMode === MODE_3D;\n }\n\n /**\n * @summary Sets the nodes (client mode only)\n * @param {PSV.plugins.VirtualTourPlugin.Node[]} nodes\n * @param {string} [startNodeId]\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setNodes(nodes, startNodeId) {\n if (this.isServerSide()) {\n throw new PSVError('Cannot set nodes in server side mode');\n }\n\n this.datasource.setNodes(nodes);\n\n if (!startNodeId) {\n startNodeId = nodes[0].id;\n }\n else if (!this.datasource.nodes[startNodeId]) {\n startNodeId = nodes[0].id;\n utils.logWarn(`startNodeId not found is provided nodes, resetted to ${startNodeId}`);\n }\n\n this.setCurrentNode(startNodeId);\n }\n\n /**\n * @summary Changes the current node\n * @param {string} nodeId\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} [fromLink]\n * @returns {Promise} resolves false if the loading was aborted by another call\n */\n setCurrentNode(nodeId, fromLink = null) {\n if (nodeId === this.prop.currentNode?.id) {\n return Promise.resolve(true);\n }\n\n this.psv.hideError();\n\n this.prop.loadingNode = nodeId;\n\n const fromNode = this.prop.currentNode;\n const fromLinkPosition = fromNode && fromLink ? this.__getLinkPosition(fromNode, fromLink) : null;\n\n return Promise.all([\n // if this node is already preloading, wait for it\n Promise.resolve(this.preload[nodeId])\n .then(() => {\n if (this.prop.loadingNode !== nodeId) {\n throw utils.getAbortError();\n }\n\n return this.datasource.loadNode(nodeId);\n }),\n Promise.resolve(fromLinkPosition ? this.config.rotateSpeed : false)\n .then((speed) => { // eslint-disable-line consistent-return\n if (speed) {\n return this.psv.animate({ ...fromLinkPosition, speed });\n }\n })\n .then(() => {\n this.psv.loader.show();\n }),\n ])\n .then(([node]) => {\n if (this.prop.loadingNode !== nodeId) {\n throw utils.getAbortError();\n }\n\n this.prop.currentNode = node;\n\n if (this.prop.currentTooltip) {\n this.prop.currentTooltip.hide();\n this.prop.currentTooltip = null;\n }\n\n if (this.is3D()) {\n this.arrowsGroup.remove(...this.arrowsGroup.children.filter(o => o.type === 'Mesh'));\n }\n\n this.markers?.clearMarkers();\n this.compass?.clearHotspots();\n\n return Promise.all([\n this.psv.setPanorama(node.panorama, {\n transition : this.config.transition,\n caption : node.caption,\n panoData : node.panoData,\n sphereCorrection: node.sphereCorrection,\n })\n .then((completed) => {\n if (!completed) {\n throw utils.getAbortError();\n }\n }),\n this.datasource.loadLinkedNodes(nodeId),\n ]);\n })\n .then(() => {\n if (this.prop.loadingNode !== nodeId) {\n throw utils.getAbortError();\n }\n\n const node = this.prop.currentNode;\n\n if (node.markers) {\n if (this.markers) {\n this.markers.setMarkers(node.markers);\n }\n else {\n utils.logWarn(`Node ${node.id} markers ignored because the plugin is not loaded.`);\n }\n }\n\n this.__renderLinks(node);\n this.__preload(node);\n\n /**\n * @event node-changed\n * @memberof PSV.plugins.VirtualTourPlugin\n * @summary Triggered when the current node is changed\n * @param {string} nodeId\n * @param {PSV.plugins.VirtualTourPlugin.NodeChangedData} data\n */\n this.trigger(EVENTS.NODE_CHANGED, nodeId, {\n fromNode,\n fromLink,\n fromLinkPosition,\n });\n\n this.prop.loadingNode = null;\n\n return true;\n })\n .catch((err) => {\n if (utils.isAbortError(err)) {\n return false;\n }\n\n this.psv.showError(this.psv.config.lang.loadError);\n\n this.psv.loader.hide();\n this.psv.navbar.setCaption('');\n\n this.prop.loadingNode = null;\n\n throw err;\n });\n }\n\n /**\n * @summary Adds the links for the node\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @private\n */\n __renderLinks(node) {\n const positions = [];\n\n node.links.forEach((link) => {\n const position = this.__getLinkPosition(node, link);\n positions.push(position);\n\n if (this.is3D()) {\n const mesh = new THREE.Mesh(ARROW_GEOM, new THREE.MeshLambertMaterial());\n mesh.userData = { [LINK_DATA]: link, longitude: position.longitude };\n mesh.rotation.order = 'YXZ';\n mesh.rotateY(-position.longitude);\n this.psv.dataHelper\n .sphericalCoordsToVector3({ longitude: position.longitude, latitude: 0 }, mesh.position)\n .multiplyScalar(1 / CONSTANTS.SPHERE_RADIUS);\n\n const outlineMesh = new THREE.Mesh(ARROW_OUTLINE_GEOM, new THREE.MeshBasicMaterial({ side: THREE.BackSide }));\n outlineMesh.position.copy(mesh.position);\n outlineMesh.rotation.copy(mesh.rotation);\n\n setMeshColor(mesh, link.arrowStyle?.color || this.config.arrowStyle.color);\n setMeshColor(outlineMesh, link.arrowStyle?.outlineColor || this.config.arrowStyle.outlineColor);\n\n this.arrowsGroup.add(mesh);\n this.arrowsGroup.add(outlineMesh);\n }\n else {\n if (this.isGps()) {\n position.latitude += this.config.markerLatOffset;\n }\n\n this.markers.addMarker({\n ...this.config.markerStyle,\n ...link.markerStyle,\n id : `tour-link-${link.nodeId}`,\n tooltip : link.name,\n hideList: true,\n data : { [LINK_DATA]: link },\n ...position,\n }, false);\n }\n });\n\n if (this.is3D()) {\n this.__positionArrows();\n }\n else {\n this.markers.renderMarkers();\n }\n\n if (this.config.linksOnCompass && this.compass) {\n this.compass.setHotspots(positions);\n }\n }\n\n /**\n * @summary Computes the marker position for a link\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @param {PSV.plugins.VirtualTourPlugin.NodeLink} link\n * @return {PSV.Position}\n * @private\n */\n __getLinkPosition(node, link) {\n if (this.isGps()) {\n const p1 = [THREE.Math.degToRad(node.position[0]), THREE.Math.degToRad(node.position[1])];\n const p2 = [THREE.Math.degToRad(link.position[0]), THREE.Math.degToRad(link.position[1])];\n const h1 = node.position[2] !== undefined ? node.position[2] : link.position[2] || 0;\n const h2 = link.position[2] !== undefined ? link.position[2] : node.position[2] || 0;\n\n let latitude = 0;\n if (h1 !== h2) {\n latitude = Math.atan((h2 - h1) / distance(p1, p2));\n }\n\n const longitude = bearing(p1, p2);\n\n return { longitude, latitude };\n }\n else {\n return this.psv.dataHelper.cleanPosition(link);\n }\n }\n\n /**\n * @private\n */\n __onEnterObject(mesh, viewerPoint) {\n const link = mesh.userData[LINK_DATA];\n\n setMeshColor(mesh, link.arrowStyle?.hoverColor || this.config.arrowStyle.hoverColor);\n\n if (link.name) {\n this.prop.currentTooltip = this.psv.tooltip.create({\n left : viewerPoint.x,\n top : viewerPoint.y,\n content: link.name,\n });\n }\n\n this.psv.needsUpdate();\n }\n\n\n /**\n * @private\n */\n __onHoverObject(mesh, viewerPoint) {\n if (this.prop.currentTooltip) {\n this.prop.currentTooltip.move({\n left: viewerPoint.x,\n top : viewerPoint.y,\n });\n }\n }\n\n\n /**\n * @private\n */\n __onLeaveObject(mesh) {\n const link = mesh.userData[LINK_DATA];\n\n setMeshColor(mesh, link.arrowStyle?.color || this.config.arrowStyle.color);\n\n if (this.prop.currentTooltip) {\n this.prop.currentTooltip.hide();\n this.prop.currentTooltip = null;\n }\n\n this.psv.needsUpdate();\n }\n\n /**\n * @summary Updates to position of the group of arrows\n * @private\n */\n __positionArrows() {\n this.arrowsGroup.position.copy(this.psv.prop.direction).multiplyScalar(0.5);\n const s = this.config.arrowStyle.scale;\n const f = s[1] + (s[0] - s[1]) * (this.psv.getZoomLevel() / 100);\n const y = 2.5 - (this.psv.getZoomLevel() / 100) * 1.5;\n this.arrowsGroup.position.y += this.config.arrowPosition === 'bottom' ? -y : y;\n this.arrowsGroup.scale.set(f, f, f);\n }\n\n /**\n * @summary Manage the preload of the linked panoramas\n * @param {PSV.plugins.VirtualTourPlugin.Node} node\n * @private\n */\n __preload(node) {\n if (!this.config.preload) {\n return;\n }\n\n this.preload[node.id] = true;\n\n this.prop.currentNode.links\n .filter(link => !this.preload[link.nodeId])\n .filter((link) => {\n if (typeof this.config.preload === 'function') {\n return this.config.preload(this.prop.currentNode, link);\n }\n else {\n return true;\n }\n })\n .forEach((link) => {\n this.preload[link.nodeId] = this.datasource.loadNode(link.nodeId)\n .then((linkNode) => {\n return this.psv.textureLoader.preloadPanorama(linkNode.panorama);\n })\n .then(() => {\n this.preload[link.nodeId] = true;\n })\n .catch(() => {\n delete this.preload[link.nodeId];\n });\n });\n }\n\n /**\n * @summary Toggles the visibility of the list of nodes\n */\n toggleNodesList() {\n if (this.psv.panel.prop.contentId === ID_PANEL_NODES_LIST) {\n this.hideNodesList();\n }\n else {\n this.showNodesList();\n }\n }\n\n /**\n * @summary Opens side panel with the list of nodes\n */\n showNodesList() {\n const nodes = this.change(EVENTS.RENDER_NODES_LIST, Object.values(this.datasource.nodes));\n\n this.psv.panel.show({\n id : ID_PANEL_NODES_LIST,\n content : NODES_LIST_TEMPLATE(\n nodes,\n this.psv.config.lang[NodesListButton.id],\n this.prop.currentNode?.id\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const nodeId = li ? li.dataset.nodeId : undefined;\n\n if (nodeId) {\n this.setCurrentNode(nodeId);\n this.hideNodesList();\n }\n },\n });\n }\n\n /**\n * @summary Closes side panel if it contains the list of nodes\n */\n hideNodesList() {\n this.psv.panel.hide(ID_PANEL_NODES_LIST);\n }\n\n}\n"],"names":["AbstractDatasource","plugin","nodes","destroy","loadNode","nodeId","PSVError","loadLinkedNodes","checkNode","node","isGps","id","panorama","position","length","checkLink","link","utils","isExtendedPosition","setMeshColor","mesh","color","material","set","distance","p1","p2","greatArcDistance","bearing","λ1","φ1","λ2","φ2","y","Math","sin","cos","x","atan2","ClientSideDatasource","Promise","resolve","reject","setNodes","rawNodes","linkedNodes","forEach","links","logWarn","name","MODE_CLIENT","MODE_SERVER","MODE_MANUAL","MODE_GPS","MODE_MARKERS","MODE_3D","EVENTS","NODE_CHANGED","RENDER_NODES_LIST","LINK_DATA","DEFAULT_MARKER","html","arrowIconSvg","width","height","scale","anchor","className","style","DEFAULT_ARROW","hoverColor","outlineColor","loader","THREE","ObjectLoader","geometries","parseGeometries","arrowGeometryJson","arrowOutlineGeometryJson","arrow","uuid","arrowOutline","rot","PI","rotateX","ARROW_GEOM","ARROW_OUTLINE_GEOM","ID_PANEL_NODES_LIST","NODES_LIST_TEMPLATE","title","currentNodeId","nodesList","map","thumbnail","caption","join","NodesListButton","navbar","psv","getPlugin","on","CONSTANTS","OPEN_PANEL","CLOSE_PANEL","off","isSupported","isServerSide","handleEvent","e","type","toggleActive","args","onClick","toggleNodesList","AbstractButton","icon","ServerSideDatasource","config","getNode","nodeResolver","linksResolver","getLinks","then","DEFAULTS","lang","registerButton","VirtualTourPlugin","options","prop","currentNode","currentTooltip","loadingNode","stopObserver","preload","dataMode","positionMode","renderMode","rotateSpeed","transition","DEFAULT_TRANSITION","markerLatOffset","arrowPosition","linksOnCompass","markerStyle","arrowStyle","listButton","markers","compass","datasource","arrowsGroup","is3D","Group","localLight","PointLight","add","init","once","READY","__positionArrows","renderer","scene","ambientLight","AmbientLight","needsUpdate","POSITION_UPDATED","ZOOM_UPDATED","CLICK","observeObjects","startNodeId","setCurrentNode","remove","data","objects","find","o","userData","OBJECT_EVENTS","ENTER_OBJECT","__onEnterObject","detail","object","viewerPoint","HOVER_OBJECT","__onHoverObject","LEAVE_OBJECT","__onLeaveObject","fromLink","hideError","fromNode","fromLinkPosition","__getLinkPosition","all","getAbortError","speed","animate","show","hide","children","filter","clearMarkers","clearHotspots","setPanorama","panoData","sphereCorrection","completed","setMarkers","__renderLinks","__preload","trigger","catch","err","isAbortError","showError","loadError","setCaption","positions","push","Mesh","MeshLambertMaterial","longitude","rotation","order","rotateY","dataHelper","sphericalCoordsToVector3","latitude","multiplyScalar","SPHERE_RADIUS","outlineMesh","MeshBasicMaterial","side","BackSide","copy","addMarker","tooltip","hideList","renderMarkers","setHotspots","degToRad","h1","undefined","h2","atan","cleanPosition","create","left","top","content","move","direction","s","f","getZoomLevel","linkNode","textureLoader","preloadPanorama","panel","contentId","hideNodesList","showNodesList","change","Object","values","noMargin","clickHandler","li","target","getClosest","dataset","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;;MACaA,kBAAb;EAEE;EACF;EACA;;EAGE;EACF;EACA;EACE,8BAAYC,MAAZ,EAAoB;EAAA,SALpBC,KAKoB,GALZ,EAKY;EAClB,SAAKD,MAAL,GAAcA,MAAd;EACD;;EAZH;;EAAA,SAcEE,OAdF,GAcE,mBAAU;EACR,WAAO,KAAKF,MAAZ;EACD;EAED;EACF;EACA;EACA;EACA;EAtBA;;EAAA,SAuBEG,QAvBF,GAuBE,kBAASC,MAAT,EAAiB;EAAE;EACjB,UAAM,IAAIC,0BAAJ,CAAa,0BAAb,CAAN;EACD;EAED;EACF;EACA;EACA;EACA;EA/BA;;EAAA,SAgCEC,eAhCF,GAgCE,y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WvQ,MAAd,GAAuB2O,SAAxC;;EAEA,YAAI3O,MAAJ,EAAY;EACV,UAAA,MAAI,CAACoK,cAAL,CAAoBpK,MAApB;;EACA,UAAA,MAAI,CAAC6P,aAAL;EACD;EACF;EAhBiB,KAApB;EAkBD;EAED;EACF;EACA;EA9lBA;;EAAA,SA+lBEA,aA/lBF,GA+lBE,yBAAgB;EACd,SAAKhK,GAAL,CAAS8J,KAAT,CAAe5D,IAAf,CAAoB7G,mBAApB;EACD,GAjmBH;;EAAA;EAAA,EAAuCsL,gCAAvC;EAAa/I,kBAEJnH,KAAK;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/visible-range.js b/dist/plugins/visible-range.js index 7b8c8ccf4..b696f0033 100644 --- a/dist/plugins/visible-range.js +++ b/dist/plugins/visible-range.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.5.1 +* Photo Sphere Viewer 4.5.2 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/docs/.vuepress/components/Playground.vue b/docs/.vuepress/components/Playground.vue index 12c259e82..ae14e945e 100644 --- a/docs/.vuepress/components/Playground.vue +++ b/docs/.vuepress/components/Playground.vue @@ -297,16 +297,24 @@
- + - + + +
@@ -342,14 +350,14 @@
-
+
-
+
-
+
+ + + + front + horizontal + vertical-left + vertical-tight + + +
+ +
@@ -376,14 +396,14 @@
-
+
-
+
@@ -483,7 +503,6 @@ export default { data: () => ({ - psv : null, markers : null, file : null, imageData : null, @@ -493,7 +512,7 @@ roll: 0 }, options : { - ...omit(cloneDeep(DEFAULTS), ['panorama', 'panoData', 'container', 'plugins', 'navbar', 'loadingImg']), + ...omit(cloneDeep(DEFAULTS), ['panorama', 'panoData', 'sphereCorrection', 'container', 'plugins', 'navbar', 'loadingImg']), }, panoData : { fullWidth : null, @@ -548,6 +567,7 @@ polylineRad: null, width : null, height : null, + orientation: null, anchor : null, listContent: null, content : null, @@ -576,6 +596,7 @@ this.CLIPBOARD_AVAILABLE = false; // SSR rendering dissallow "window" usage here this.PIN_RED_URL = 'https://photo-sphere-viewer.js.org/assets/pin-red.png'; this.PIN_BLUE_URL = 'https://photo-sphere-viewer.js.org/assets/pin-blue.png'; + this.TARGET_URL = 'https://photo-sphere-viewer.js.org/assets/target.png'; this.FONT_SIZES = range(10, 31).map(i => `${i}px`); this.FONT_SIZES_2 = range(10, 31, 5).map(i => `${i}px`); }, @@ -585,43 +606,18 @@ this.oldOptions = cloneDeep(this.options); - this.applyOptions = debounce(() => { - try { - if (this.options.defaultZoomLvl !== this.oldOptions.defaultZoomLvl) { - this.psv.zoom(this.options.defaultZoomLvl); - } - else if (this.options.defaultLong !== this.oldOptions.defaultLong || this.options.defaultLat !== this.oldOptions.defaultLat) { - this.psv.rotate({ - longitude: this.options.defaultLong, - latitude : this.options.defaultLat, - }); - } - else { - Object.keys(this.options) - .some(optName => { - if (!isEqual(this.options[optName], this.oldOptions[optName])) { - this.psv.setOption(optName, this.options[optName]); - return true; - } - }); - } - } catch (e) { - // ignore parsing errors - } - this.oldOptions = cloneDeep(this.options); - }, 200); + this._applyOptions = debounce(() => this.applyOptions(), 200); this.psv = new Viewer({ container : 'viewer', loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif', plugins : [ - [MarkersPlugin, { - hideButton: false, - listButton: false, - }], + [MarkersPlugin, {}], ], }); + this.applyNavbar(); + this.markers = this.psv.getPlugin(MarkersPlugin); this.psv.on('click', (e, data) => this.onClick(data)); @@ -638,7 +634,7 @@ options : { deep: true, handler() { - this.applyOptions(); + this._applyOptions(); }, }, sphereCorrection: { @@ -654,7 +650,7 @@ navbar : { deep: true, handler() { - this.psv.setOption('navbar', this.navbar.filter(i => i.enabled).map(i => i.code)); + this.applyNavbar(); }, }, markerForm : { @@ -726,10 +722,41 @@ } }, + applyOptions() { + try { + if (this.options.defaultZoomLvl !== this.oldOptions.defaultZoomLvl) { + this.psv.zoom(this.options.defaultZoomLvl); + } + else if (this.options.defaultLong !== this.oldOptions.defaultLong || this.options.defaultLat !== this.oldOptions.defaultLat) { + this.psv.rotate({ + longitude: this.options.defaultLong, + latitude : this.options.defaultLat, + }); + } + else { + Object.keys(this.options) + .some(optName => { + if (!isEqual(this.options[optName], this.oldOptions[optName])) { + this.psv.setOption(optName, this.options[optName]); + return true; + } + }); + } + } catch (e) { + // ignore parsing errors + } + this.oldOptions = cloneDeep(this.options); + }, + + applyNavbar() { + this.psv.setOption('navbar', this.navbar.filter(i => i.enabled).map(i => i.code)); + }, + newMarker(type) { this.cancelMarker(); this.markerForm.id = 'marker-' + Math.random().toString(36).slice(2); this.markerForm.type = type; + this.markerForm.orientation = 'front'; this.markerForm.anchor = 'center center'; this.markerForm.tooltip.position = 'top center'; @@ -741,10 +768,9 @@ this.markerForm.anchor = 'bottom center'; break; case 'imageLayer': - this.markerForm.imageLayer = this.PIN_RED_URL; - this.markerForm.width = 48; - this.markerForm.height = 48; - this.markerForm.anchor = 'bottom center'; + this.markerForm.imageLayer = this.TARGET_URL; + this.markerForm.width = 120; + this.markerForm.height = 120; break; case 'html': this.markerForm.html = 'Test content'; @@ -954,6 +980,12 @@ if (marker.config.height) { m.height = marker.config.height; } + if (marker.config.anchor !== 'center center') { + m.anchor = marker.config.anchor; + } + if (marker.config.orientation !== 'front') { + m.orientation = marker.config.orientation; + } if (marker.config.tooltip.content) { m.tooltip = marker.config.tooltip; } diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index eae85b53a..b80af97e9 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -40,15 +40,14 @@ module.exports = { 'methods', 'events', 'navbar', - 'cropped-panorama', - 'migration-v3', + 'style', { title : 'Adapters', path : '/guide/adapters/', collapsable: false, children : [ 'adapters/equirectangular', - 'adapters/tiles', + 'adapters/equirectangular-tiles', 'adapters/cubemap', ['adapters/cubemap-tiles', 'Cubemap tiles (NEW)'], ], diff --git a/docs/.vuepress/public/_redirects b/docs/.vuepress/public/_redirects new file mode 100644 index 000000000..24a31a601 --- /dev/null +++ b/docs/.vuepress/public/_redirects @@ -0,0 +1,2 @@ +/guide/adapters/tiles.html /guide/adapters/equirectangular-tiles.html +/guide/cropped-panorama.html /guide/adapters/equirectangular.html#cropped-panorama diff --git a/docs/guide/README.md b/docs/guide/README.md index 19bbbdcdf..4e0ea739e 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -92,7 +92,7 @@ const viewer = new Viewer({ The `panorama` must be an [equirectangular projection](https://en.wikipedia.org/wiki/Equirectangular_projection) of your photo. Other modes are supported through [adapters](./adapters/). ::: tip Cropped panoramas -If your image is not covering a full 360°×180° sphere, it will be deformed. You can fix it by providing [cropping data](./cropped-panorama.md). +If your image is not covering a full 360°×180° sphere, it will be deformed. You can fix it by providing [cropping data](./adapters/equirectangular.md#cropped-panorama). ::: ::: tip Caching diff --git a/docs/guide/adapters/README.md b/docs/guide/adapters/README.md index 0a01f8c8e..8c1585944 100644 --- a/docs/guide/adapters/README.md +++ b/docs/guide/adapters/README.md @@ -4,7 +4,7 @@ Adapters are small pieces of code responsible to load the panorama texture(s) in The supported adapters are: - [equirectangular](equirectangular.md): the default adapter, used to load full or partial equirectangular panoramas -- [equirectangular tiles](tiles.md): used to load tiled equirectangular panoramas +- [equirectangular tiles](equirectangular-tiles.md): used to load tiled equirectangular panoramas - [cubemap](cubemap.md): used to load cubemaps projections (six textures) - [cubemap tiles](cubemap-tiles.md): used to load tiled cubemap panoramas diff --git a/docs/guide/adapters/tiles.md b/docs/guide/adapters/equirectangular-tiles.md similarity index 100% rename from docs/guide/adapters/tiles.md rename to docs/guide/adapters/equirectangular-tiles.md diff --git a/docs/guide/adapters/equirectangular.md b/docs/guide/adapters/equirectangular.md index 59882f50b..6e3f78830 100644 --- a/docs/guide/adapters/equirectangular.md +++ b/docs/guide/adapters/equirectangular.md @@ -15,10 +15,6 @@ new PhotoSphereViewer.Viewer({ }); ``` -::: tip Cropped panoramas -If your image is not covering a full 360°×180° sphere, it will be deformed. You can fix it by providing [cropping data](../cropped-panorama.md). -::: - ## Configuration @@ -29,3 +25,100 @@ If your image is not covering a full 360°×180° sphere, it will be deformed. Y The number of faces of the sphere geometry used to display the panorama, higher values can reduce deformations on straight lines at the cost of performances. _Note: the actual number of faces is `resolution² / 2`._ + + +## Cropped panorama + +**Photo Sphere Viewer** supports cropped panorama given the appropriate configuration is provided. Cropped panoramas are not covering the whole 360°×180° sphere area but only a smaller portion. For example you might have a image covering 360° horizontally but only 90° vertically, or a semi sphere (180°×180°) + +These incomplete panoramas are handled in two ways by Photo Sphere viewer: + - Read XMP metadata directly from the file with `useXmpData` option (this is the default) + - Provide the `panoData` configuration object/function + +Use the [Playground](#playground) at the bottom of this page to find the best values for your panorama. + +### Theory + +In both case the data contains six important values: + - Full panorama width + - Full panorama height + - Cropped area width + - Cropped area height + - Cropped area left + - Cropped area right + +The `Full panorama width` / `Full panorama height` ratio must always be 2:1. `Cropped area width` and `Cropped area height` are the actual size of your image. `Cropped area left` and `Cropped area right` are used to define the cropped area position. + +The data can also contains angular values: + - Pose Heading + - Pose Pitch + - Pose Roll + +![XMP_pano_pixels](/assets/XMP_pano_pixels.png) + +More information on [Google documentation](https://developers.google.com/streetview/spherical-metadata). + + +### Provide cropping data + +#### With XMP + +If you created your panorama with a mobile phone or dedicated 360° camera, it should already contain the correct XMP data. Otherwise you can inject it yourself with tools like [exiftool](https://sno.phy.queensu.ca/~phil/exiftool/). + +The XMP payload is as follow: + +```xml + + + + + equirectangular + 6000 + 3000 + 4000 + 2000 + 1000 + 500 + 0 + 0 + 0 + + + + +``` + +To write the XMP data to an image file, paste it in a text file and use this command: + +```bash +exiftool -tagsfromfile data.xmp -all:all panorama.jpg +``` + +#### Manually + +You can also directly pass the values to Photo Sphere Viewer with the `panoData` parameter. + +```js +const viewer = new PhotoSphereViewer.Viewer({ + container: 'viewer', + panorama: 'path/to/panorama.jpg', + panoData: { + fullWidth: 6000, + fullHeight: 3000, + croppedWidth: 4000, + croppedHeight: 2000, + croppedX: 1000, + croppedY: 500, + poseHeading: 0, // 0 to 360 + posePitch: 0, // -90 to 90 + poseRoll: 0, // -180 to 180 + } +}); +``` + + +### Playground + +Use this demo to find the best values for your image. + + diff --git a/docs/guide/config.md b/docs/guide/config.md index 2990a99d9..f6cd5b590 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -43,6 +43,12 @@ List of enabled [plugins](../plugins/README.md). A text displayed in the navbar. If the navbar is disabled it will be shown anyway but with no button. HTML is allowed. +#### `downloadUrl` +- type: `string` +- default: `=panorama` for equirectangular panoramas + +Define the file which will be downloaded with the `download` button. This is particularly useful for adapters that use multiple files, like the CubemapAdapter or the EquirectangularTilesAdapter. + #### `size` - type: `{ width: integer, height: integer }` @@ -201,7 +207,7 @@ Speed multiplicator for panorama zooms. Used for mouse wheel, touch pinch and na - type: `boolean` - default `true` -Read real image size from XMP data, must be kept `true` if the panorama has been cropped after shot. +Read real image size from XMP data, must be kept `true` if the panorama has been cropped after shot. This is used for [cropped panorama](./adapters/equirectangular.md#cropped-panorama). #### `panoData` - type: `object | function` diff --git a/docs/guide/cropped-panorama.md b/docs/guide/cropped-panorama.md deleted file mode 100644 index e1fb5089c..000000000 --- a/docs/guide/cropped-panorama.md +++ /dev/null @@ -1,97 +0,0 @@ -# Cropped panorama - -[[toc]] - -**Photo Sphere Viewer** supports cropped panorama given the appropriate configuration is provided. Cropped panoramas are not covering the whole 360°×180° sphere area but only a smaller portion. For example you might have a image covering 360° horizontally but only 90° vertically, or a semi sphere (180°×180°) - -These incomplete panoramas are handled in two ways by Photo Sphere viewer: - - Read XMP metadata directly from the file - - Provide the `panoData` configuration object - -Use the [Playground](#playground) at the bottom of this page to find the best values for your panorama. - -## Theory - -In both case the data contains six important values: - - Full panorama width - - Full panorama height - - Cropped area width - - Cropped area height - - Cropped area left - - Cropped area right - -The `Full panorama width` / `Full panorama height` ratio must always be 2:1. `Cropped area width` and `Cropped area height` are the actual size of your image. `Cropped area left` and `Cropped area right` are used to define the cropped area position. - -The data can also contains angular values: - - Pose Heading - - Pose Pitch - - Pose Roll - -![XMP_pano_pixels](/assets/XMP_pano_pixels.png) - -More information on [Google documentation](https://developers.google.com/streetview/spherical-metadata). - - -## Provide cropping data - -### With XMP - -If you created your panorama with a mobile phone or dedicated 360° camera, it should already contain the correct XMP data. Otherwise you can inject it yourself with tools like [exiftool](https://sno.phy.queensu.ca/~phil/exiftool/). - -The XMP payload is as follow: - -```xml - - - - - equirectangular - 6000 - 3000 - 4000 - 2000 - 1000 - 500 - 0 - 0 - 0 - - - - -``` - -To write the XMP data to an image file, paste it in a text file and use this command: - -```bash -exiftool -tagsfromfile data.xmp -all:all panorama.jpg -``` - -### Manually - -You can also directly pass the values to Photo Sphere Viewer with the `panoData` parameter. - -```js -var viewer = new PhotoSphereViewer.Viewer({ - container: 'viewer', - panorama: 'path/to/panorama.jpg', - panoData: { - fullWidth: 6000, - fullHeight: 3000, - croppedWidth: 4000, - croppedHeight: 2000, - croppedX: 1000, - croppedY: 500, - poseHeading: 0, // 0 to 360 - posePitch: 0, // -90 to 90 - poseRoll: 0, // -180 to 180 - } -}); -``` - - -## Playground - -Use this demo to find the best values for your image. - - diff --git a/docs/guide/methods.md b/docs/guide/methods.md index e3ee1642a..50a909ba6 100644 --- a/docs/guide/methods.md +++ b/docs/guide/methods.md @@ -89,7 +89,7 @@ viewer.setOptions({ ### `setPanorama(panorama, options): Promise` -Change the panorama image with an optional transition animation (enabled by default). You can also set the new `sphereCorrection` and `panoData` if needed. +Change the panorama image with an optional transition animation (enabled by default). See all options on the . ```js viewer.setPanorama('image.jpg') diff --git a/docs/guide/style.md b/docs/guide/style.md new file mode 100644 index 000000000..a7ae941bf --- /dev/null +++ b/docs/guide/style.md @@ -0,0 +1,127 @@ +# Style + +Photo Sphere Viewer comes with a default darkish theme. You can customize it by building yourself the stylesheet from the SCSS source and some variables overrides. + +```scss +// overrides +$psv-loader-color: rgba(0, 0, 0, 0.5); +$psv-loader-width: 100px; +.... + +// main stylesheet +@import '~photo-sphere-viewer/src/styles/index.scss'; + +// plugins stylesheets +@import '~photo-sphere-viewer/src/plugins/markers/style.scss'; +@import '~photo-sphere-viewer/src/plugins/virtual-tour/style.scss'; +.... +``` + +## Global + +| variable | default | description | +|---|---|---| +| $psv-main-background | radial-gradient(...) | Background of the viewer, visible when no panorama is set. | + +## Loader + +| variable | default | description | +|---|---|---| +| $psv-loader-color | rgba(61, 61, 61, .7) | Color of the loader bar | +| $psv-loader-width | 150px | Size of the loader | +| $psv-loader-tickness | 10px | Thickness of the loader bar | +| $psv-loader-font | 14px sans-serif | Font of the loading text | + +## Navbar + +| variable | default | description | +|---|---|---| +| $psv-navbar-height | 40px | Height of the navbar | +| $psv-navbar-background | rgba(61, 61, 61, .5) | Background color of the navbar | +| $psv-caption-font | 16px sans-serif | Font of the caption | +| $psv-caption-color | rgba(255, 255, 255, .7) | Text color of the caption | + +#### Buttons + +| variable | default | description | +|---|---|---| +| $psv-buttons-height | 20px | Inner height of the buttons | +| $psv-buttons-color | rgba(255, 255, 255, .7 | Icon color of the buttons | +| $psv-buttons-background | transparent | Background color of the buttons | +| $psv-buttons-active-background | rgba(255, 255, 255, .2) | Background color of the buttons when active | +| $psv-buttons-disabled-opacity | .5 | Opacity of disabled buttons | +| $psv-buttons-hover-scale | 1.2 | Scale applied to buttons on mouse hover | +| $psv-buttons-hover-scale-delay | .2s | Duration of the scale animation | + +#### Zoom range + +| variable | default | description | +|---|---|---| +| $psv-zoom-range-width | 80px | Size of the zoom range | +| $psv-zoom-range-tickness | 1px | Tickness of the zoom range | +| $psv-zoom-disk-diameter | 7px | Size of the zoom handle | +| $psv-zoom-range-media-min-width | 600px | Hides the zoom range on small screens | + + +## Tooltip + +| variable | default | description | +|---|---|---| +| $psv-tooltip-background-color | rgba(61, 61, 61, .8) | Background color of tooltips | +| $psv-tooltip-radius | 4px | Border radius of the tooltips | +| $psv-tooltip-padding | .5em 1em | Content padding of the tooltips | +| $psv-tooltip-arrow-size | 7px | Tooltips' arrow size | +| $psv-tooltip-max-width | 200px | Maximum width of the tooltips' content | +| $psv-tooltip-text-color | rgb(255, 255, 255) | Text color of the tooltips | +| $psv-tooltip-font | 14px sans-serif | Font of the tooltips | +| $psv-tooltip-text-shadow | 0 1px #000 | Shadow applied to the tooltips' text | +| $psv-tooltip-shadow-color | rgba(90, 90, 90, .7) | Color of the tooltips' shadow | +| $psv-tooltip-shadow-offset | 3px | Size of the tooltips' shadow | +| $psv-tooltip-animate-offset | 5px | Distance travelled on show animation | +| $psv-tooltip-animate-delay | 0.1s | Duration of the show animation | + +## Panel + +| variable | default | description | +|---|---|---| +| $psv-panel-background | rgba(10, 10, 10, .7) | Background of the panel | +| $psv-panel-width | 400px | Default width of the panel | +| $psv-panel-padding | 1em | Content padding of the panel | +| $psv-panel-text-color | rgb(220, 220, 220) | Default text color of the panel | +| $psv-panel-font | 16px sans-serif | Default font of the panel | + +#### Menu + +| variable | default | description | +|---|---|---| +| $psv-panel-title-font | 24px sans-serif | Font of the menu title | +| $psv-panel-title-icon-size | 24px | Size of the menu title icon | +| $psv-panel-title-margin | 24px | Margin of the menu title | +| $psv-panel-menu-item-height | 20px | Height of an item in the menu | +| $psv-panel-menu-item-padding | .5em 1em | Padding of an item in the menu | +| $psv-panel-menu-odd-background | rgba(255, 255, 255, .1) | Background color of odd items in the menu | +| $psv-panel-menu-even-background | transparent | Background color of even items in the menu | + +## Notification + +| variable | default | description | +|---|---|---| +| $psv-notification-position-from | -$psv-navbar-height | Position of the notification when hidden | +| $psv-notification-position-to | $psv-navbar-height * 2 | Position of the notification when visible | +| $psv-notification-animate-delay | 0.2s | Duration of the show animation | +| $psv-notification-background-color | $psv-tooltip-background-color | Background color of the notification | +| $psv-notification-radius | $psv-tooltip-radius | Border radius of the notification | +| $psv-notification-padding | $psv-tooltip-padding | Content padding of the notification | +| $psv-notification-font | $psv-tooltip-font | Font of the notification | +| $psv-notification-text-color | $psv-tooltip-text-color | Text color of the notification | + +## Overlay + +| variable | default | description | +|---|---|---| +| $psv-overlay-color | black | Text color of the overlay | +| $psv-overlay-opacity | .8 | Opacity of the overlay | +| $psv-overlay-font-family | sans-serif | Default font of the overlay | +| $psv-overlay-text-size | 30px | Main text size in the overlay | +| $psv-overlay-subtext-size | 20px | Secondary text size in the overlay | +| $psv-overlay-image-size | (portrait: 50vw,
landscape: 25vw) | Image/Icon size, depending on screen orientation | diff --git a/docs/plugins/plugin-gyroscope.md b/docs/plugins/plugin-gyroscope.md index 5528b2ef0..012da1fec 100644 --- a/docs/plugins/plugin-gyroscope.md +++ b/docs/plugins/plugin-gyroscope.md @@ -23,10 +23,6 @@ const viewer = new PhotoSphereViewer.Viewer({ There are known inconsistencies of orientation data accross devices. If the panorama is not displayed in the expected orientation, this plugin is not faulty. ::: -::: tip Custom navbar -The button is added to the default navbar configuration. If you use a [custom navbar](../guide/navbar.md) you will need to manually add the `'gyroscope'` button to the list. -::: - ## Configuration @@ -52,3 +48,11 @@ lang: { ``` _Note: this option is not part of the plugin but is merged with the main [`lang`](../guide/config.md#lang) object._ + + +## Buttons + +This plugin adds buttons to the default navbar: +- `gyroscope` allows to toggle the gyroscope control + +If you use a [custom navbar](../guide/navbar.md) you will need to manually add the buttons to the list. diff --git a/docs/plugins/plugin-markers.md b/docs/plugins/plugin-markers.md index 78d91aef4..ab922fe6f 100644 --- a/docs/plugins/plugin-markers.md +++ b/docs/plugins/plugin-markers.md @@ -25,7 +25,7 @@ Markers can be added at startup with the `markers` option or after load with the const viewer = new PhotoSphereViewer.Viewer({ plugins: [ [PhotoSphereViewer.MarkersPlugin, { - markers: [ + markers: [ { id: 'new-marker', longitude: '45deg', @@ -33,7 +33,7 @@ const viewer = new PhotoSphereViewer.Viewer({ image: 'assets/pin-red.png', }, ], - }], + }], ], }); @@ -100,7 +100,7 @@ One of these options is required. ``` ::: tip What is the difference between "image" and "imageLayer" ? -Both allows to display an image but the difference is in the rendering technique. +Both allows to display an image but the difference is in the rendering technique. And `image` marker is rendered flat above the viewer but and `imageLayer` is rendered inside the panorama itself, this allows for more natural movements and scaling. ::: @@ -120,20 +120,26 @@ Unique identifier of the marker. #### `x` & `y` or `latitude` & `longitude` (required for all but polygons/polylines) - type: `integer` or `double` -Position of the marker in **texture coordinates** (pixels) or **spherical coordinates** (radians). +Position of the marker in **texture coordinates** (pixels) or **spherical coordinates** (radians). _(This option is ignored for polygons and polylines)._ #### `width` & `height` (required for images, recommended for html) - type: `integer` -Size of the marker in pixels. +Size of the marker in pixels. _(This option is ignored for polygons and polylines)._ +#### `orientation` (only for `imageLayer`) +- type: `'front' | 'horizontal' | 'vertical-left' | 'vertical-right'` +- default: `'front'` + +Applies a perspective on the image to make it look like placed on the floor or on a wall. + #### `scale` - type: `double[] | { zoom: double[], longitude: [] }` - default: no scalling -Configures the scale of the marker depending on the zoom level and/or the longitude offset. This aims to give a natural feeling to the size of the marker as the users zooms and moves. +Configures the scale of the marker depending on the zoom level and/or the longitude offset. This aims to give a natural feeling to the size of the marker as the users zooms and moves. _(This option is ignored for polygons, polylines and imageLayer)._ Scales depending on zoom level, the array contains `[scale at minimum zoom, scale at maximum zoom]` : @@ -163,17 +169,23 @@ scale: { } ``` +#### `opacity` +- type: `number` +- default: `1` + +Opacity of the marker. (Works for `imageLayer` too). + #### `className` - type: `string` -CSS class(es) added to the marker element. -_(This option is ignored for imageLayer markers)._ +CSS class(es) added to the marker element. +_(This option is ignored for `imageLayer` markers)._ #### `style` - type: `object` -CSS properties to set on the marker (background, border, etc.). -_(This option is ignored for imageLayer markers)._ +CSS properties to set on the marker (background, border, etc.). +_(This option is ignored for `imageLayer` markers)._ ```js style: { @@ -185,7 +197,7 @@ style: { #### `svgStyle` - type: `object` -SVG properties to set on the marker (fill, stroke, etc.). +SVG properties to set on the marker (fill, stroke, etc.). _(Only for polygons, polylines and svg markers)._ ```js @@ -219,7 +231,7 @@ And use it in your marker : `fill: 'url(#image)'`. - type: `string` - default: `'center center'` -Defines where the marker is placed toward its defined position. Any CSS position is valid like `bottom center` or `20% 80%`. +Defines where the marker is placed toward its defined position. Any CSS position is valid like `bottom center` or `20% 80%`. _(This option is ignored for polygons and polylines)._ #### `visible` @@ -246,7 +258,7 @@ tooltip: { // tooltip with custom position #### `listContent` - type: `string` -The name that appears in the list of markers. If not provided, the tooltip content will be used. +The name that appears in the list of markers. If not provided, the tooltip content will be used. #### `content` - type: `string` @@ -279,26 +291,6 @@ lang: { _Note: this option is not part of the plugin but is merged with the main [`lang`](../guide/config.md#lang) object._ -#### `hideButton` -- type: `boolean` -- default: `true` - -Adds a navbar button to hide/show all the markers. - -::: tip Custom navbar -The button is added to the default navbar configuration. If you use a [custom navbar](../guide/navbar.md) you will need to manually add the `'markers'` button to the list. -::: - -#### `listButton` -- type: `boolean` -- default: `true` - -Adds a navbar button to display the list of all markers. - -::: tip Custom navbar -The button is added to the default navbar configuration. If you use a [custom navbar](../guide/navbar.md) you will need to manually add the `'markersList'` button to the list. -::: - #### `clickEventOnMarker` - type: `boolean` - default: `false` @@ -381,3 +373,12 @@ Triggered when the user clicks on a marker. The `data` object indicates if the m #### `unselect-marker(marker)` Triggered when a marker was selected and the user clicks elsewhere. + + +## Buttons + +This plugin adds buttons to the default navbar: +- `markers` allows to hide/show all markers +- `markersList` allows to open a list of all markers on the left panel + +If you use a [custom navbar](../guide/navbar.md) you will need to manually add the buttons to the list. diff --git a/docs/plugins/plugin-resolution.md b/docs/plugins/plugin-resolution.md index 599097ac9..9a596327e 100644 --- a/docs/plugins/plugin-resolution.md +++ b/docs/plugins/plugin-resolution.md @@ -52,6 +52,12 @@ The following example provides two resolutions for the panorama, "small" is load List of available resolutions. Each resolution consist of an object with the properties `id`, `label` and `panorama`. Cubemaps are supported. +#### `showBadge` +- type: `boolean` +- default: `true` + +Show the resolution id as a badge on the settings button. + #### `lang` - type: `object` - default: @@ -62,3 +68,16 @@ lang: { ``` _Note: this option is not part of the plugin but is merged with the main [`lang`](../guide/config.md#lang) object._ + + +## Events + +#### `resolution-changed(id)` + +Triggered when the resolution is changed. + +```js +resolutionPlugin.on('resolution-changed', (e, id) => { + console.log(`Current resolution: ${id}`); +}); +``` diff --git a/docs/plugins/plugin-settings.md b/docs/plugins/plugin-settings.md index a46956f65..d0e60c78d 100644 --- a/docs/plugins/plugin-settings.md +++ b/docs/plugins/plugin-settings.md @@ -21,10 +21,6 @@ const viewer = new PhotoSphereViewer.Viewer({ }); ``` -::: tip Custom navbar -The button is added to the default navbar configuration. If you use a [custom navbar](../guide/navbar.md) you will need to manually add the `'settings'` button to the list. -::: - ## Example @@ -61,8 +57,8 @@ settings.addSetting({ label : 'Options setting', type : 'options', options: () => ([ - { id: 'option-a', label: 'Option A' }, - { id: 'option-b', label: 'Option B' }, + { id: 'A', label: 'Option A' }, + { id: 'B', label: 'Option B' }, ]), current: () => currentOption, apply : (option) => currentOption = option, @@ -70,6 +66,18 @@ settings.addSetting({ ``` +## Button badge + +A setting can also have a `badge` function, which return value will be used as a badge on the settings button itself. **Only one setting can declare a badge.** + +```js +settings.addSetting({ + ..., + badge: () => currentOption, +}); +``` + + ## Configuration #### `lang` @@ -82,3 +90,24 @@ lang: { ``` _Note: this option is not part of the plugin but is merged with the main [`lang`](../guide/config.md#lang) object._ + + +## Events + +#### `setting-changed(id, value)` + +Triggered when the resolution is changed. + +```js +settingsPlugin.on('resolution-changed', (e, id, value) => { + console.log(`${id}: ${value}`); +}); +``` + + +## Buttons + +This plugin adds buttons to the default navbar: +- `settings` allows to open the settings panel + +If you use a [custom navbar](../guide/navbar.md) you will need to manually add the buttons to the list. diff --git a/docs/plugins/plugin-stereo.md b/docs/plugins/plugin-stereo.md index 5b6ea303f..5735f3430 100644 --- a/docs/plugins/plugin-stereo.md +++ b/docs/plugins/plugin-stereo.md @@ -22,10 +22,6 @@ const viewer = new PhotoSphereViewer.Viewer({ }); ``` -::: tip Custom navbar -The button is added to the default navbar configuration. If you use a [custom navbar](../guide/navbar.md) you will need to manually add the `'stereo'` button to the list. -::: - ## Configuration @@ -41,3 +37,11 @@ lang: { ``` _Note: this option is not part of the plugin but is merged with the main [`lang`](../guide/config.md#lang) object._ + + +## Buttons + +This plugin adds buttons to the default navbar: +- `stereo` allows to start the stereo view + +If you use a [custom navbar](../guide/navbar.md) you will need to manually add the buttons to the list. diff --git a/docs/plugins/plugin-virtual-tour.md b/docs/plugins/plugin-virtual-tour.md index 999906c71..8168fde13 100644 --- a/docs/plugins/plugin-virtual-tour.md +++ b/docs/plugins/plugin-virtual-tour.md @@ -176,7 +176,7 @@ Overrides the global style of the marker used to display the link. See global co - default: ```js lang: { - nodesList: Locations', + nodesList: 'Locations', } ``` @@ -227,15 +227,11 @@ Enable the preloading of linked nodes, can be a function that returns true or fa When a link is clicked, adds a panorama rotation to face it before actually changing the node. If `false` the viewer won't rotate at all and keep the current orientation. -#### `listButton` -- type: `boolean` -- default: `true` id client data mode - -Adds a navbar button to display the list of all nodes. +#### `transition` +- type: `boolean | number` +- default: `1500` -::: tip Custom navbar -The button is added to the default navbar configuration. If you use a [custom navbar](../guide/navbar.md) you will need to manually add the `'nodesList'` button to the list. -::: +Duration of the transition between nodes. #### `linksOnCompass` - type: `boolean` @@ -281,10 +277,10 @@ Style of the arrow used to display links. Default value is: ```js { - color : 0x0055aa, - hoverColor: 0xaa5500, - opacity : 0.8, - scale : [0.5, 2], + color : 0xaaaaaa, + hoverColor : 0xaa5500, + outlineColor: 0x000000, + scale : [0.5, 2], } ``` @@ -328,3 +324,11 @@ virtualTourPlugin.on('node-changed', (e, nodeId, data) => { } }); ``` + + +## Buttons + +This plugin adds buttons to the default navbar: +- `nodesList` allows to open a list of all nodes on the left panel (client mode only) + +If you use a [custom navbar](../guide/navbar.md) you will need to manually add the buttons to the list. diff --git a/docs/plugins/plugin-visible-range.md b/docs/plugins/plugin-visible-range.md index d6550310e..c9e9438ef 100644 --- a/docs/plugins/plugin-visible-range.md +++ b/docs/plugins/plugin-visible-range.md @@ -29,7 +29,7 @@ visibleRangePlugin.setLongitudeRange(['0deg', '180deg']); visibleRangePlugin.setLatitudeRange(null); ``` -Alternatively, if `usePanoData` is set to `true`, the visible range is limited to the [cropped panorama data](../guide/cropped-panorama.md#provide-cropping-data) provided to the viewer. +Alternatively, if `usePanoData` is set to `true`, the visible range is limited to the [cropped panorama data](../guide/adapters/equirectangular.md#cropped-panorama) provided to the viewer. ## Example diff --git a/example/assets/target.png b/example/assets/target.png new file mode 100644 index 000000000..5cc17283b Binary files /dev/null and b/example/assets/target.png differ diff --git a/example/cubemap.html b/example/cubemap.html index 6b0b63ae2..9e80acaa8 100644 --- a/example/cubemap.html +++ b/example/cubemap.html @@ -15,10 +15,8 @@ - - diff --git a/example/equirectangular.html b/example/equirectangular.html index ea3a8338c..87b3d28e3 100644 --- a/example/equirectangular.html +++ b/example/equirectangular.html @@ -14,10 +14,7 @@ - - - diff --git a/example/index.html b/example/index.html new file mode 100644 index 000000000..8dad0acee --- /dev/null +++ b/example/index.html @@ -0,0 +1,68 @@ + + + + + + PhotoSphereViewer - Demos + + + + + + +
+
+
+ + PhotoSphereViewer - Demos +
+
+ +
+
+ +
+ +
+
+
+
Misc
+
+ +
+
+
+
+ + + diff --git a/example/plugin-gyroscope-stereo.html b/example/plugin-gyroscope-stereo.html new file mode 100644 index 000000000..3d30f7c38 --- /dev/null +++ b/example/plugin-gyroscope-stereo.html @@ -0,0 +1,38 @@ + + + + + + PhotoSphereViewer - gyroscope & stereo demo + + + + + + +
+ + + + + + + + + + + diff --git a/example/plugin-markers-cubemap.html b/example/plugin-markers-cubemap.html new file mode 100644 index 000000000..e21e4e7b2 --- /dev/null +++ b/example/plugin-markers-cubemap.html @@ -0,0 +1,106 @@ + + + + + + PhotoSphereViewer - markers demo (cubemap) + + + + + + + +
+ + + + + + + + + + diff --git a/example/plugin-markers.html b/example/plugin-markers.html index 6a76d8d0d..bfcb88d14 100644 --- a/example/plugin-markers.html +++ b/example/plugin-markers.html @@ -106,9 +106,7 @@

Header Level 3

PhotoSphereViewer.GyroscopePlugin, PhotoSphereViewer.StereoPlugin, [PhotoSphereViewer.MarkersPlugin, { - hideButton: true, - listButton: true, - markers : (() => { + markers: (() => { const a = []; // add markers all hover the sphere @@ -273,6 +271,18 @@

Header Level 3

tooltip : 'Image embedded in the scene', }); + a.push({ + id : 'imageLayerOrient', + imageLayer : 'assets/target.png', + width : 120, + height : 120, + latitude : -0.2, + longitude : 0.27, + opacity : 0.8, + orientation: 'horizontal', + tooltip : 'Image embedded in the scene with "horizontal" orientation', + }); + // SVG markers a.push({ id : 'svg-demo', diff --git a/example/plugin-resolution.html b/example/plugin-resolution.html index b0599153d..269fea61c 100644 --- a/example/plugin-resolution.html +++ b/example/plugin-resolution.html @@ -28,14 +28,15 @@ plugins : [ PhotoSphereViewer.SettingsPlugin, [PhotoSphereViewer.ResolutionPlugin, { + showBadge : true, resolutions: [ { - id : 'small', + id : 'SD', label : 'Small', panorama: 'sphere_small.jpg', }, { - id : 'normal', + id : 'HD', label : 'Normal', panorama: 'sphere.jpg', }, diff --git a/example/plugin-settings.html b/example/plugin-settings.html new file mode 100644 index 000000000..21497c73a --- /dev/null +++ b/example/plugin-settings.html @@ -0,0 +1,63 @@ + + + + + + PhotoSphereViewer - settings demo + + + + + + + +
+ + + + + + + + + diff --git a/example/plugin-virtual-tour.html b/example/plugin-virtual-tour.html index e86aeef60..a5af814ec 100644 --- a/example/plugin-virtual-tour.html +++ b/example/plugin-virtual-tour.html @@ -128,8 +128,9 @@ [PhotoSphereViewer.VirtualTourPlugin, { positionMode : PhotoSphereViewer.VirtualTourPlugin.MODE_GPS, renderMode : PhotoSphereViewer.VirtualTourPlugin.MODE_3D, - startNodeId : nodes[0].id, + startNodeId : nodes[1].id, preload : true, + // transition : false, // rotateSpeed : false, arrowPosition: 'bottom', @@ -139,7 +140,7 @@ // server mode (mock) // dataMode: PhotoSphereViewer.VirtualTourPlugin.MODE_SERVER, - getNode : (nodeId) => { + getNode: (nodeId) => { console.log('GET node ' + nodeId); return Promise.resolve({ ...nodesById[nodeId], diff --git a/example/plugin-visible-range.html b/example/plugin-visible-range.html index 366901b5d..4208f711a 100644 --- a/example/plugin-visible-range.html +++ b/example/plugin-visible-range.html @@ -6,7 +6,6 @@ PhotoSphereViewer - visible range demo - diff --git a/package.json b/package.json index 212fa2ca7..f85177846 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "photo-sphere-viewer", - "version": "4.5.1", + "version": "4.5.2", "description": "A JavaScript library to display Photo Sphere panoramas", "homepage": "https://photo-sphere-viewer.js.org", "main": "dist/photo-sphere-viewer.js", @@ -33,7 +33,7 @@ "url": "git://github.com/mistic100/Photo-Sphere-Viewer.git" }, "dependencies": { - "three": "^0.137.0", + "three": "^0.138.0", "uevent": "^2.1.1" }, "devDependencies": { @@ -47,12 +47,12 @@ "@pixi/jsdoc-template": "^2.5.1", "@rollup/plugin-babel": "^5.3.0", "@rollup/plugin-json": "^4.1.0", - "@rollup/plugin-replace": "^3.0.0", + "@rollup/plugin-replace": "^4.0.0", "@vuepress/plugin-active-header-links": "^1.8.2", "@vuepress/plugin-back-to-top": "^1.8.2", "@vuepress/plugin-google-analytics": "^1.8.2", "autoprefixer": "^10.3.3", - "axios": "^0.25.0", + "axios": "^0.26.0", "cpx2": "^4.1.2", "date-fns": "^2.23.0", "eslint": "^8.2.0", diff --git a/src/Animation.js b/src/Animation.js index 4bca0398c..c61ced057 100644 --- a/src/Animation.js +++ b/src/Animation.js @@ -1,5 +1,5 @@ import { EASINGS } from './data/constants'; -import { each } from './utils'; +import { each, logWarn } from './utils'; /** * @callback OnTick @@ -13,16 +13,20 @@ import { each } from './utils'; * @summary Interpolation helper for animations * @memberOf PSV * @description - * Implements the Promise API with an additional "cancel" and "finally" methods. - * The promise is resolved when the animation is complete and rejected if the animation is cancelled. + * Implements the Promise API with an additional "cancel" method. + * The promise is resolved with `true` when the animation is completed and `false` if the animation is cancelled. * @example - * new Animation({ + * const anim = new Animation({ * properties: { * width: {start: 100, end: 200} * }, * duration: 5000, * onTick: (properties) => element.style.width = `${properties.width}px`; - * }) + * }); + * + * anim.then((completed) => ...); + * + * anim.cancel() */ export class Animation { @@ -37,31 +41,29 @@ export class Animation { * @param {PSV.Animation.OnTick} options.onTick - called on each frame */ constructor(options) { - this.__cancelled = false; - this.__resolved = false; - - this.__promise = new Promise((resolve, reject) => { - this.__resolve = resolve; - this.__reject = reject; - }); + this.__callbacks = []; if (options) { if (!options.easing || typeof options.easing === 'string') { options.easing = EASINGS[options.easing || 'linear']; } + this.__start = null; this.options = options; if (options.delay) { this.__delayTimeout = setTimeout(() => { this.__delayTimeout = null; - window.requestAnimationFrame(t => this.__run(t)); + this.__animationFrame = window.requestAnimationFrame(t => this.__run(t)); }, options.delay); } else { - window.requestAnimationFrame(t => this.__run(t)); + this.__animationFrame = window.requestAnimationFrame(t => this.__run(t)); } } + else { + this.__resolved = true; + } } /** @@ -70,11 +72,6 @@ export class Animation { * @private */ __run(timestamp) { - // the animation has been cancelled - if (this.__cancelled) { - return; - } - // first iteration if (this.__start === null) { this.__start = timestamp; @@ -91,10 +88,9 @@ export class Animation { current[name] = prop.start + (prop.end - prop.start) * this.options.easing(progress); } }); - this.options.onTick(current, progress); - window.requestAnimationFrame(t => this.__run(t)); + this.__animationFrame = window.requestAnimationFrame(t => this.__run(t)); } else { // call onTick one last time with final values @@ -103,52 +99,43 @@ export class Animation { current[name] = prop.end; } }); - this.options.onTick(current, 1.0); - window.requestAnimationFrame(() => { + this.__animationFrame = window.requestAnimationFrame(() => { this.__resolved = true; - this.__resolve(); + this.__resolve(true); }); } } /** - * @summary Animation chaining - * @param {Function} [onFulfilled] - Called when the animation is complete, can return a new animation - * @param {Function} [onRejected] - Called when the animation is cancelled - * @returns {PSV.Animation} + * @private */ - then(onFulfilled = null, onRejected = null) { - const p = new Animation(); - - // Allow cancellation to climb up the promise chain - p.__promise.then(null, () => this.cancel()); - - this.__promise.then( - () => p.__resolve(onFulfilled ? onFulfilled() : undefined), - () => p.__reject(onRejected ? onRejected() : undefined) - ); - - return p; + __resolve(value) { + this.__callbacks.forEach(cb => cb(value)); + this.__callbacks.length = 0; } /** - * @summary Alias to `.then(null, onRejected)` - * @param {Function} onRejected - Called when the animation has been cancelled - * @returns {PSV.Animation} + * @summary Promise chaining + * @param {Function} [onFulfilled] - Called when the animation is complete (true) or cancelled (false) + * @param {Function} [onRejected] - deprecated + * @returns {PSV.Promise} */ - catch(onRejected) { - return this.then(undefined, onRejected); - } + then(onFulfilled = null, onRejected = null) { + if (onRejected) { + logWarn('Animation#then does not accept a rejection handler anymore'); + } - /** - * @summary Alias to `.then(onFinally, onFinally)` - * @param {Function} onFinally - Called when the animation is either complete or cancelled - * @returns {PSV.Animation} - */ - finally(onFinally) { - return this.then(onFinally, onFinally); + if (this.__resolved || this.__cancelled) { + return Promise.resolve(this.__resolved) + .then(onFulfilled); + } + + return new Promise((resolve) => { + this.__callbacks.push(resolve); + }) + .then(onFulfilled); } /** @@ -157,27 +144,40 @@ export class Animation { cancel() { if (!this.__cancelled && !this.__resolved) { this.__cancelled = true; - this.__reject(); + this.__resolve(false); if (this.__delayTimeout) { - window.cancelAnimationFrame(this.__delayTimeout); + window.clearTimeout(this.__delayTimeout); this.__delayTimeout = null; } + if (this.__animationFrame) { + window.cancelAnimationFrame(this.__animationFrame); + this.__animationFrame = null; + } } } /** - * @summary Returns a resolved animation promise - * @returns {PSV.Animation} + * @deprecated not supported anymore + */ + catch() { + logWarn('Animation#catch is not supported anymore'); + return this.then(); + } + + /** + * @deprecated not supported anymore + */ + finally(onFinally) { + logWarn('Animation#finally is not supported anymore'); + return this.then(onFinally); + } + + /** + * @deprecated not supported anymore */ static resolve() { - const p = Promise.resolve(); - p.cancel = () => { - }; - p.finally = (onFinally) => { - return p.then(onFinally, onFinally); - }; - return p; + logWarn('Animation.resolve is not supported anymore'); } } diff --git a/src/Viewer.js b/src/Viewer.js index 04066b8b5..f8fc5bf10 100644 --- a/src/Viewer.js +++ b/src/Viewer.js @@ -7,7 +7,7 @@ import { Notification } from './components/Notification'; import { Overlay } from './components/Overlay'; import { Panel } from './components/Panel'; import { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config'; -import { CHANGE_EVENTS, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants'; +import { CHANGE_EVENTS, DEFAULT_TRANSITION, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants'; import { SYSTEM } from './data/system'; import errorIcon from './icons/error.svg'; import { AbstractPlugin } from './plugins/AbstractPlugin'; @@ -451,9 +451,8 @@ export class Viewer extends EventEmitter { * @returns {Promise} resolves false if the loading was aborted by another call */ setPanorama(path, options = {}) { - if (this.prop.loadingPromise !== null) { - this.textureLoader.abortLoading(); - } + this.textureLoader.abortLoading(); + this.prop.transitionAnimation?.cancel(); // apply default parameters on first load if (!this.prop.ready) { @@ -466,11 +465,14 @@ export class Viewer extends EventEmitter { } if (options.transition === undefined || options.transition === true) { - options.transition = 1500; + options.transition = DEFAULT_TRANSITION; } if (options.showLoader === undefined) { options.showLoader = true; } + if (options.caption === undefined) { + options.caption = this.config.caption; + } const positionProvided = isExtendedPosition(options); const zoomProvided = 'zoom' in options; @@ -482,27 +484,29 @@ export class Viewer extends EventEmitter { this.hideError(); this.config.panorama = path; + this.config.caption = options.caption; const done = (err) => { this.loader.hide(); - this.renderer.show(); this.prop.loadingPromise = null; if (isAbortError(err)) { - console.warn(err); return false; } else if (err) { + this.navbar.setCaption(''); this.showError(this.config.lang.loadError); console.error(err); - return Promise.reject(err); + throw err; } else { + this.navbar.setCaption(this.config.caption); return true; } }; + this.navbar.setCaption(`${this.config.loadingTxt || ''}`); if (options.showLoader || !this.prop.ready) { this.loader.show(); } @@ -511,14 +515,16 @@ export class Viewer extends EventEmitter { .then((textureData) => { // check if another panorama was requested if (textureData.panorama !== this.config.panorama) { - return Promise.reject(getAbortError()); + this.adapter.disposeTexture(textureData); + throw getAbortError(); } return textureData; }); - if (!options.transition || !this.prop.ready || !this.adapter.constructor.supportsTransition) { + if (!options.transition || !this.prop.ready || !this.adapter.supportsTransition(this.config.panorama)) { this.prop.loadingPromise = loadingPromise .then((textureData) => { + this.renderer.show(); this.renderer.setTexture(textureData); this.renderer.setPanoramaPose(textureData.panoData); this.renderer.setSphereCorrection(options.sphereCorrection); @@ -537,7 +543,14 @@ export class Viewer extends EventEmitter { .then((textureData) => { this.loader.hide(); - return this.renderer.transition(textureData, options); + this.prop.transitionAnimation = this.renderer.transition(textureData, options); + return this.prop.transitionAnimation + .then((completed) => { + this.prop.transitionAnimation = null; + if (!completed) { + throw getAbortError(); + } + }); }) .then(done, done); } @@ -773,7 +786,7 @@ export class Viewer extends EventEmitter { this.zoom(options.zoom); } - return Animation.resolve(); + return new Animation(); } this.prop.animationPromise = new Animation({ @@ -801,7 +814,7 @@ export class Viewer extends EventEmitter { stopAnimation() { if (this.prop.animationPromise) { return new Promise((resolve) => { - this.prop.animationPromise.finally(resolve); + this.prop.animationPromise.then(resolve); this.prop.animationPromise.cancel(); this.prop.animationPromise = null; }); diff --git a/src/adapters/AbstractAdapter.js b/src/adapters/AbstractAdapter.js index 66715bf4e..93bfc06a8 100644 --- a/src/adapters/AbstractAdapter.js +++ b/src/adapters/AbstractAdapter.js @@ -20,20 +20,12 @@ export class AbstractAdapter { static id = null; /** - * @summary Indicates if the adapter supports transitions between panoramas - * @member {boolean} - * @readonly - * @static - */ - static supportsTransition = false; - - /** - * @summary Indicates if the adapter supports preload + * @summary Indicates if the adapter supports panorama download natively * @type {boolean} * @readonly * @static */ - static supportsPreload = false; + static supportsDownload = false; /** * @param {PSV.Viewer} psv @@ -54,6 +46,24 @@ export class AbstractAdapter { delete this.psv; } + /** + * @summary Indicates if the adapter supports transitions between panoramas + * @param {*} panorama + * @return {boolean} + */ + supportsTransition(panorama) { // eslint-disable-line no-unused-vars + return false; + } + + /** + * @summary Indicates if the adapter supports preload of a panorama + * @param {*} panorama + * @return {boolean} + */ + supportsPreload(panorama) { // eslint-disable-line no-unused-vars + return false; + } + /** * @abstract * @summary Loads the panorama texture(s) @@ -80,8 +90,9 @@ export class AbstractAdapter { * @summary Applies the texture to the mesh * @param {external:THREE.Mesh} mesh * @param {PSV.TextureData} textureData + * @param {boolean} [transition=false] */ - setTexture(mesh, textureData) { // eslint-disable-line no-unused-vars + setTexture(mesh, textureData, transition = false) { // eslint-disable-line no-unused-vars throw new PSVError('setTexture not implemented'); } @@ -95,4 +106,13 @@ export class AbstractAdapter { throw new PSVError('setTextureOpacity not implemented'); } + /** + * @abstract + * @summary Clear a loaded texture from memory + * @param {PSV.TextureData} textureData + */ + disposeTexture(textureData) { // eslint-disable-line no-unused-vars + throw new PSVError('disposeTexture not implemented'); + } + } diff --git a/src/adapters/cubemap-tiles/index.js b/src/adapters/cubemap-tiles/index.js index d31321199..37a78472e 100644 --- a/src/adapters/cubemap-tiles/index.js +++ b/src/adapters/cubemap-tiles/index.js @@ -52,6 +52,10 @@ const NB_VERTICES_BY_PLANE = NB_VERTICES_BY_FACE * CUBE_SEGMENTS * CUBE_SEGMENTS const NB_VERTICES = 6 * NB_VERTICES_BY_PLANE; const NB_GROUPS_BY_FACE = CUBE_SEGMENTS * CUBE_SEGMENTS; +const ATTR_UV = 'uv'; +const ATTR_ORIGINAL_UV = 'originaluv'; +const ATTR_POSITION = 'position'; + function tileId(tile) { return `${tile.face}:${tile.col}x${tile.row}`; } @@ -67,8 +71,7 @@ const vertexPosition = new THREE.Vector3(); export class CubemapTilesAdapter extends CubemapAdapter { static id = 'cubemap-tiles'; - static supportsTransition = false; - static supportsPreload = false; + static supportsDownload = false; /** * @param {PSV.Viewer} psv @@ -88,12 +91,6 @@ export class CubemapTilesAdapter extends CubemapAdapter { ...options, }; - /** - * @member {external:THREE.MeshBasicMaterial[]} - * @private - */ - this.materials = []; - /** * @member {PSV.adapters.Queue} * @private @@ -106,7 +103,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { * @property {int} facesByTile - number of mesh faces by tile * @property {Record} tiles - loaded tiles * @property {external:THREE.BoxGeometry} geom - * @property {*} originalUvs + * @property {external:THREE.MeshBasicMaterial[]} materials * @property {external:THREE.MeshBasicMaterial} errorMaterial * @private */ @@ -115,7 +112,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { facesByTile : 0, tiles : {}, geom : null, - originalUvs : null, + materials : [], errorMaterial: null, }; @@ -135,6 +132,9 @@ export class CubemapTilesAdapter extends CubemapAdapter { this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this); } + /** + * @override + */ destroy() { this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this); this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this); @@ -147,12 +147,14 @@ export class CubemapTilesAdapter extends CubemapAdapter { delete this.queue; delete this.loader; delete this.prop.geom; - delete this.prop.originalUvs; delete this.prop.errorMaterial; super.destroy(); } + /** + * @private + */ handleEvent(e) { /* eslint-disable */ switch (e.type) { @@ -172,11 +174,25 @@ export class CubemapTilesAdapter extends CubemapAdapter { this.queue.clear(); this.prop.tiles = {}; - this.materials.forEach((mat) => { + this.prop.materials.forEach((mat) => { mat?.map?.dispose(); mat?.dispose(); }); - this.materials.length = 0; + this.prop.materials.length = 0; + } + + /** + * @override + */ + supportsTransition(panorama) { + return !!panorama.baseUrl; + } + + /** + * @override + */ + supportsPreload(panorama) { + return !!panorama.baseUrl; } /** @@ -195,13 +211,6 @@ export class CubemapTilesAdapter extends CubemapAdapter { return Promise.reject(new PSVError('Panorama nbTiles must be power of 2.')); } - this.prop.tileSize = panorama.faceSize / panorama.nbTiles; - this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles; - - if (this.prop.geom) { - this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone()); - } - if (panorama.baseUrl) { return super.loadTexture(panorama.baseUrl) .then(textureData => ({ @@ -228,48 +237,70 @@ export class CubemapTilesAdapter extends CubemapAdapter { geometry.addGroup(i, NB_VERTICES_BY_FACE, k++); } - this.prop.geom = geometry; - this.prop.originalUvs = geometry.getAttribute('uv').clone(); + geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone()); - return new THREE.Mesh(geometry, this.materials); + return new THREE.Mesh(geometry, []); } /** * @summary Applies the base texture and starts the loading of tiles * @override */ - setTexture(mesh, textureData) { + setTexture(mesh, textureData, transition) { + const { panorama, texture } = textureData; + + if (transition) { + this.__setTexture(mesh, texture); + return; + } + this.__cleanup(); + this.__setTexture(mesh, texture); - if (textureData.texture) { - for (let i = 0; i < 6; i++) { - const texture = textureData.texture[i]; + this.prop.materials = mesh.material; + this.prop.geom = mesh.geometry; + this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone()); - if (this.config.flipTopBottom && (i === 2 || i === 3)) { - texture.center = new THREE.Vector2(0.5, 0.5); - texture.rotation = Math.PI; - } + this.prop.tileSize = panorama.faceSize / panorama.nbTiles; + this.prop.facesByTile = CUBE_SEGMENTS / panorama.nbTiles; + + // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); - const material = new THREE.MeshBasicMaterial({ map: texture }); + setTimeout(() => this.__refresh(true)); + } - for (let j = 0; j < NB_GROUPS_BY_FACE; j++) { - this.materials.push(material); + /** + * @private + */ + __setTexture(mesh, texture) { + for (let i = 0; i < 6; i++) { + let material; + if (texture) { + if (this.config.flipTopBottom && (i === 2 || i === 3)) { + texture[i].center = new THREE.Vector2(0.5, 0.5); + texture[i].rotation = Math.PI; } + + material = new THREE.MeshBasicMaterial({ map: texture[i] }); + } + else { + material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true }); } - } - else { - const material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true }); - for (let i = 0; i < 6; i++) { - for (let j = 0; j < NB_GROUPS_BY_FACE; j++) { - this.materials.push(material); - } + for (let j = 0; j < NB_GROUPS_BY_FACE; j++) { + mesh.material.push(material); } } + } - // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); - - setTimeout(() => this.__refresh(true)); + /** + * @override + */ + setTextureOpacity(mesh, opacity) { + for (let i = 0; i < 6; i++) { + mesh.material[i * NB_GROUPS_BY_FACE].opacity = opacity; + mesh.material[i * NB_GROUPS_BY_FACE].transparent = opacity < 1; + } } /** @@ -288,7 +319,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); - const verticesPosition = this.prop.geom.getAttribute('position'); + const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); const tilesToLoad = []; for (let face = 0; face < 6; face++) { @@ -439,7 +470,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { * @private */ __swapMaterial(face, col, row, material) { - const uvs = this.prop.geom.getAttribute('uv'); + const uvs = this.prop.geom.getAttribute(ATTR_UV); for (let c = 0; c < this.prop.facesByTile; c++) { for (let r = 0; r < this.prop.facesByTile; r++) { @@ -452,7 +483,7 @@ export class CubemapTilesAdapter extends CubemapAdapter { // swap material const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex; - this.materials[matIndex] = material; + this.prop.materials[matIndex] = material; // define new uvs let top = 1 - r / this.prop.facesByTile; diff --git a/src/adapters/cubemap/index.js b/src/adapters/cubemap/index.js index 6b12f529b..c5228c000 100644 --- a/src/adapters/cubemap/index.js +++ b/src/adapters/cubemap/index.js @@ -32,8 +32,7 @@ export const CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front']; export class CubemapAdapter extends AbstractAdapter { static id = 'cubemap'; - static supportsTransition = true; - static supportsPreload = true; + static supportsDownload = false; /** * @param {PSV.Viewer} psv @@ -52,6 +51,20 @@ export class CubemapAdapter extends AbstractAdapter { }; } + /** + * @override + */ + supportsTransition() { + return true; + } + + /** + * @override + */ + supportsPreload() { + return true; + } + /** * @override * @param {string[] | PSV.adapters.CubemapAdapter.Cubemap} panorama @@ -156,15 +169,12 @@ export class CubemapAdapter extends AbstractAdapter { const { texture } = textureData; for (let i = 0; i < 6; i++) { - if (mesh.material[i].map) { - mesh.material[i].map.dispose(); - } - if (this.config.flipTopBottom && (i === 2 || i === 3)) { texture[i].center = new THREE.Vector2(0.5, 0.5); texture[i].rotation = Math.PI; } + mesh.material[i].map?.dispose(); mesh.material[i].map = texture[i]; } } @@ -179,4 +189,11 @@ export class CubemapAdapter extends AbstractAdapter { } } + /** + * @override + */ + disposeTexture(textureData) { + textureData.texture?.forEach(texture => texture.dispose()); + } + } diff --git a/src/adapters/equirectangular-tiles/index.js b/src/adapters/equirectangular-tiles/index.js index e4460216f..bb169d42b 100644 --- a/src/adapters/equirectangular-tiles/index.js +++ b/src/adapters/equirectangular-tiles/index.js @@ -1,5 +1,5 @@ import * as THREE from 'three'; -import { AbstractAdapter, CONSTANTS, PSVError, utils } from '../..'; +import { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..'; import { Queue } from '../tiles-shared/Queue'; import { Task } from '../tiles-shared/Task'; import { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils'; @@ -36,7 +36,7 @@ import { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils'; * @private * @property {int} col * @property {int} row - * @property {int} angle + * @property {float} angle */ /* the faces of the top and bottom rows are made of a single triangle (3 vertices) @@ -71,6 +71,10 @@ import { buildErrorMaterial, createBaseTexture } from '../tiles-shared/utils'; * ⋁ */ +const ATTR_UV = 'uv'; +const ATTR_ORIGINAL_UV = 'originaluv'; +const ATTR_POSITION = 'position'; + function tileId(tile) { return `${tile.col}x${tile.row}`; } @@ -84,11 +88,10 @@ const vertexPosition = new THREE.Vector3(); * @summary Adapter for tiled panoramas * @memberof PSV.adapters */ -export class EquirectangularTilesAdapter extends AbstractAdapter { +export class EquirectangularTilesAdapter extends EquirectangularAdapter { static id = 'equirectangular-tiles'; - static supportsTransition = false; - static supportsPreload = false; + static supportsDownload = false; /** * @param {PSV.Viewer} psv @@ -97,6 +100,8 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { constructor(psv, options) { super(psv); + this.psv.config.useXmpData = false; + /** * @member {PSV.adapters.EquirectangularTilesAdapter.Options} * @private @@ -120,12 +125,6 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { + (this.SPHERE_HORIZONTAL_SEGMENTS - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE; this.NB_GROUPS = this.SPHERE_SEGMENTS * this.SPHERE_HORIZONTAL_SEGMENTS; - /** - * @member {external:THREE.MeshBasicMaterial[]} - * @private - */ - this.materials = []; - /** * @member {PSV.adapters.Queue} * @private @@ -140,7 +139,7 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { * @property {int} facesByRow - number of mesh faces by row * @property {Record} tiles - loaded tiles * @property {external:THREE.SphereGeometry} geom - * @property {*} originalUvs + * @property {external:THREE.MeshBasicMaterial[]} materials * @property {external:THREE.MeshBasicMaterial} errorMaterial * @private */ @@ -151,7 +150,7 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { facesByRow : 0, tiles : {}, geom : null, - originalUvs : null, + materials : [], errorMaterial: null, }; @@ -171,6 +170,9 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this); } + /** + * @override + */ destroy() { this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this); this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this); @@ -183,12 +185,14 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { delete this.queue; delete this.loader; delete this.prop.geom; - delete this.prop.originalUvs; delete this.prop.errorMaterial; super.destroy(); } + /** + * @private + */ handleEvent(e) { /* eslint-disable */ switch (e.type) { @@ -208,11 +212,25 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { this.queue.clear(); this.prop.tiles = {}; - this.materials.forEach((mat) => { + this.prop.materials.forEach((mat) => { mat?.map?.dispose(); mat?.dispose(); }); - this.materials.length = 0; + this.prop.materials.length = 0; + } + + /** + * @override + */ + supportsTransition(panorama) { + return !!panorama.baseUrl; + } + + /** + * @override + */ + supportsPreload(panorama) { + return !!panorama.baseUrl; } /** @@ -234,15 +252,6 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.')); } - this.prop.colSize = panorama.width / panorama.cols; - this.prop.rowSize = panorama.width / 2 / panorama.rows; - this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols; - this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows; - - if (this.prop.geom) { - this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone()); - } - const panoData = { fullWidth : panorama.width, fullHeight : panorama.width / 2, @@ -253,11 +262,12 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { }; if (panorama.baseUrl) { - return this.psv.textureLoader.loadImage(panorama.baseUrl, p => this.psv.loader.setProgress(p)) - .then((img) => { - const texture = this.__createBaseTexture(img); - return { panorama, texture, panoData }; - }); + return super.loadTexture(panorama.baseUrl) + .then(textureData => ({ + panorama: panorama, + texture : textureData.texture, + panoData: panoData, + })); } else { return Promise.resolve({ panorama, panoData }); @@ -288,34 +298,63 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++); } - this.prop.geom = geometry; - this.prop.originalUvs = geometry.getAttribute('uv').clone(); + geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone()); - return new THREE.Mesh(geometry, this.materials); + return new THREE.Mesh(geometry, []); } /** * @summary Applies the base texture and starts the loading of tiles * @override */ - setTexture(mesh, textureData) { + setTexture(mesh, textureData, transition) { + const { panorama, texture } = textureData; + + if (transition) { + this.__setTexture(mesh, texture); + return; + } + this.__cleanup(); + this.__setTexture(mesh, texture); + + this.prop.materials = mesh.material; + this.prop.geom = mesh.geometry; + this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone()); + + this.prop.colSize = panorama.width / panorama.cols; + this.prop.rowSize = panorama.width / 2 / panorama.rows; + this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols; + this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows; + + // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); + setTimeout(() => this.__refresh(true)); + } + + /** + * @private + */ + __setTexture(mesh, texture) { let material; - if (textureData.texture) { - material = new THREE.MeshBasicMaterial({ map: textureData.texture }); + if (texture) { + material = new THREE.MeshBasicMaterial({ map: texture }); } else { material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true }); } for (let i = 0; i < this.NB_GROUPS; i++) { - this.materials.push(material); + mesh.material.push(material); } + } - // this.psv.renderer.scene.add(createWireFrame(this.prop.geom)); - - setTimeout(() => this.__refresh(true)); + /** + * @override + */ + setTextureOpacity(mesh, opacity) { + mesh.material[0].opacity = opacity; + mesh.material[0].transparent = opacity < 1; } /** @@ -335,7 +374,7 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse); frustum.setFromProjectionMatrix(projScreenMatrix); - const verticesPosition = this.prop.geom.getAttribute('position'); + const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION); const tilesToLoad = []; for (let col = 0; col < panorama.cols; col++) { @@ -563,7 +602,7 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { * @private */ __swapMaterial(col, row, material) { - const uvs = this.prop.geom.getAttribute('uv'); + const uvs = this.prop.geom.getAttribute(ATTR_UV); for (let c = 0; c < this.prop.facesByCol; c++) { for (let r = 0; r < this.prop.facesByRow; r++) { @@ -591,7 +630,7 @@ export class EquirectangularTilesAdapter extends AbstractAdapter { // swap material const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex; - this.materials[matIndex] = material; + this.prop.materials[matIndex] = material; // define new uvs const top = 1 - r / this.prop.facesByRow; diff --git a/src/adapters/equirectangular/index.js b/src/adapters/equirectangular/index.js index 6bf95d1e0..56795194e 100644 --- a/src/adapters/equirectangular/index.js +++ b/src/adapters/equirectangular/index.js @@ -19,8 +19,7 @@ import { AbstractAdapter } from '../AbstractAdapter'; export class EquirectangularAdapter extends AbstractAdapter { static id = 'equirectangular'; - static supportsTransition = true; - static supportsPreload = true; + static supportsDownload = true; /** * @param {PSV.Viewer} psv @@ -46,6 +45,20 @@ export class EquirectangularAdapter extends AbstractAdapter { this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2; } + /** + * @override + */ + supportsTransition() { + return true; + } + + /** + * @override + */ + supportsPreload() { + return true; + } + /** * @override * @param {string} panorama @@ -88,7 +101,7 @@ export class EquirectangularAdapter extends AbstractAdapter { logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image. panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`); } - if (panoData.fullWidth !== panoData.fullHeight * 2) { + if ((newPanoData || xmpPanoData) && panoData.fullWidth !== panoData.fullHeight * 2) { logWarn('Invalid panoData, fullWidth should be twice fullHeight'); } @@ -206,10 +219,7 @@ export class EquirectangularAdapter extends AbstractAdapter { setTexture(mesh, textureData) { const { texture } = textureData; - if (mesh.material.map) { - mesh.material.map.dispose(); - } - + mesh.material.map?.dispose(); mesh.material.map = texture; } @@ -221,4 +231,11 @@ export class EquirectangularAdapter extends AbstractAdapter { mesh.material.transparent = opacity < 1; } + /** + * @override + */ + disposeTexture(textureData) { + textureData.texture?.dispose(); + } + } diff --git a/src/buttons/DownloadButton.js b/src/buttons/DownloadButton.js index 53c015898..9d1a098aa 100644 --- a/src/buttons/DownloadButton.js +++ b/src/buttons/DownloadButton.js @@ -18,14 +18,21 @@ export class DownloadButton extends AbstractButton { super(navbar, 'psv-button--hover-scale psv-download-button', true); } + /** + * @override + */ + isSupported() { + return this.psv.adapter.constructor.supportsDownload || !!this.psv.config.downloadUrl; + } + /** * @override * @description Asks the browser to download the panorama source file */ onClick() { const link = document.createElement('a'); - link.href = this.psv.config.panorama; - link.download = this.psv.config.panorama; + link.href = this.psv.config.downloadUrl || this.psv.config.panorama; + link.download = link.href.split('/').pop(); this.psv.container.appendChild(link); link.click(); diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 889a88e61..9095791ca 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -142,16 +142,10 @@ export class Navbar extends AbstractComponent { /** * @summary Sets the bar caption * @param {string} html - * @throws {PSV.PSVError} when the caption element is not present */ setCaption(html) { const caption = this.getButton('caption', false); - - if (!caption) { - throw new PSVError('Cannot set caption, the navbar caption container is not initialized.'); - } - - caption.setCaption(html); + caption?.setCaption(html); } /** diff --git a/src/data/config.js b/src/data/config.js index 3fe4b54ea..3337b533a 100644 --- a/src/data/config.js +++ b/src/data/config.js @@ -17,6 +17,7 @@ export const DEFAULTS = { adapter : null, plugins : [], caption : null, + downloadUrl : null, loadingImg : null, loadingTxt : 'Loading...', size : null, diff --git a/src/data/constants.js b/src/data/constants.js index 35a904fab..cd5006ba3 100644 --- a/src/data/constants.js +++ b/src/data/constants.js @@ -2,6 +2,14 @@ * @namespace PSV.constants */ +/** + * @summary Default duration of the transition between panoramas + * @memberOf PSV.constants + * @type {number} + * @constant + */ +export const DEFAULT_TRANSITION = 1500; + /** * @summary Number of pixels bellow which a mouse move will be considered as a click * @memberOf PSV.constants @@ -66,6 +74,14 @@ export const SPHERE_RADIUS = 10; */ export const VIEWER_DATA = 'photoSphereViewer'; +/** + * @summary Property added the the main Mesh object + * @memberOf PSV.constants + * @type {string} + * @constant + */ +export const MESH_USER_DATA = 'psvSphere'; + /** * @summary Available actions * @memberOf PSV.constants diff --git a/src/index.js b/src/index.js index 08bdf288a..d8e73c3cf 100644 --- a/src/index.js +++ b/src/index.js @@ -107,6 +107,7 @@ export { /** * @typedef {PSV.ExtendedPosition} PSV.PanoramaOptions * @summary Object defining panorama and animation options + * @property {string} [caption] - new navbar caption * @property {boolean|number} [transition=1500] - duration of the transition between all and new panorama * @property {boolean} [showLoader=true] - show the loader while loading the new panorama * @property {number} [zoom] - new zoom level between 0 and 100 diff --git a/src/plugins/markers/Marker.js b/src/plugins/markers/Marker.js index 7b35714af..492951ac0 100644 --- a/src/plugins/markers/Marker.js +++ b/src/plugins/markers/Marker.js @@ -395,6 +395,7 @@ export class Marker { } // apply style + this.$el.style.opacity = this.config.opacity ?? 1; if (this.config.style) { utils.deepmerge(this.$el.style, this.config.style); } @@ -627,7 +628,7 @@ export class Marker { // compute x/y/z positions this.props.positions3D = this.props.def.map((coord) => { - return this.psv.dataHelper.sphericalCoordsToVector3({ longitude: coord[0], latitude: coord[1] }); + return this.psv.dataHelper.sphericalCoordsToVector3({ longitude: coord[0], latitude : coord[1] }); }); } @@ -653,7 +654,11 @@ export class Marker { switch (this.type) { case MARKER_TYPES.imageLayer: if (!this.$el) { - const material = new THREE.MeshBasicMaterial({ transparent: true }); + const material = new THREE.MeshBasicMaterial({ + transparent: true, + opacity : this.config.opacity ?? 1, + depthTest : false, + }); const geometry = new THREE.PlaneGeometry(1, 1); const mesh = new THREE.Mesh(geometry, material); mesh.userData = { [MARKER_DATA]: this }; @@ -676,7 +681,10 @@ export class Marker { if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') { this.loader.setRequestHeader(this.psv.config.requestHeaders(this.config.imageLayer)); } - this.$el.children[0].material.map = this.loader.load(this.config.imageLayer, () => this.psv.needsUpdate()); + this.$el.children[0].material.map = this.loader.load(this.config.imageLayer, (texture) => { + texture.anisotropy = 4; + this.psv.needsUpdate(); + }); this.props.def = this.config.imageLayer; } @@ -687,7 +695,25 @@ export class Marker { ); this.$el.position.copy(this.props.positions3D[0]); - this.$el.lookAt(0, 0, 0); + + switch (this.config.orientation) { + case 'horizontal': + this.$el.lookAt(0, this.$el.position.y, 0); + this.$el.rotateX(this.props.position.latitude < 0 ? -Math.PI / 2 : Math.PI / 2); + break; + case 'vertical-left': + this.$el.lookAt(0, 0, 0); + this.$el.rotateY(-Math.PI * 0.4); + break; + case 'vertical-right': + this.$el.lookAt(0, 0, 0); + this.$el.rotateY(Math.PI * 0.4); + break; + default: + this.$el.lookAt(0, 0, 0); + break; + } + // 100 is magic number that gives a coherent size at default zoom level this.$el.scale.set(this.config.width / 100 * SYSTEM.pixelRatio, this.config.height / 100 * SYSTEM.pixelRatio, 1); break; diff --git a/src/plugins/markers/MarkersButton.js b/src/plugins/markers/MarkersButton.js index 806697e47..3d6408c10 100644 --- a/src/plugins/markers/MarkersButton.js +++ b/src/plugins/markers/MarkersButton.js @@ -49,7 +49,7 @@ export class MarkersButton extends AbstractButton { * @override */ isSupported() { - return this.plugin?.config.hideButton; + return !!this.plugin; } /** diff --git a/src/plugins/markers/MarkersListButton.js b/src/plugins/markers/MarkersListButton.js index dba807e2e..71ff661e3 100644 --- a/src/plugins/markers/MarkersListButton.js +++ b/src/plugins/markers/MarkersListButton.js @@ -45,7 +45,7 @@ export class MarkersListButton extends AbstractButton { * @override */ isSupported() { - return this.plugin?.config.listButton; + return !!this.plugin; } /** diff --git a/src/plugins/markers/index.js b/src/plugins/markers/index.js index eb72b561a..d07661206 100644 --- a/src/plugins/markers/index.js +++ b/src/plugins/markers/index.js @@ -16,8 +16,6 @@ import './style.scss'; /** * @typedef {Object} PSV.plugins.MarkersPlugin.Options - * @property {boolean} [hideButton=true] - adds a button to show/hide the markers - * @property {boolean} [listButton=true] - adds a button to show the list of markers * @property {boolean} [clickEventOnMarker=false] If a `click` event is triggered on the viewer additionally to the `select-marker` event. * @property {PSV.plugins.MarkersPlugin.Properties[]} [markers] */ @@ -85,12 +83,15 @@ export class MarkersPlugin extends AbstractPlugin { * @type {PSV.plugins.MarkersPlugin.Options} */ this.config = { - hideButton : true, - listButton : true, clickEventOnMarker: false, ...options, }; + if (options?.listButton === false || options?.hideButton === false) { + utils.logWarn('MarkersPlugin: listButton and hideButton options are deprecated. ' + + 'Please define the global navbar options according to your needs.'); + } + /** * @member {HTMLElement} * @readonly @@ -939,12 +940,8 @@ export class MarkersPlugin extends AbstractPlugin { } } else { - if (this.config.hideButton) { - markersButton?.show(); - } - if (this.config.listButton) { - markersListButton?.show(); - } + markersButton?.show(); + markersListButton?.show(); if (this.psv.panel.isVisible(ID_PANEL_MARKERS_LIST)) { this.showMarkersList(); diff --git a/src/plugins/resolution/index.js b/src/plugins/resolution/index.js index 205871da0..36bad4567 100644 --- a/src/plugins/resolution/index.js +++ b/src/plugins/resolution/index.js @@ -13,6 +13,7 @@ import { deepEqual } from './utils'; /** * @typedef {Object} PSV.plugins.ResolutionPlugin.Options * @property {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions - list of available resolutions + * @property {boolean} [showBadge=true] - show the resolution id as a badge on the settings button */ @@ -76,6 +77,7 @@ export class ResolutionPlugin extends AbstractPlugin { * @type {PSV.plugins.ResolutionPlugin.Options} */ this.config = { + showBadge: true, ...options, }; } @@ -99,6 +101,7 @@ export class ResolutionPlugin extends AbstractPlugin { current: () => this.prop.resolution, options: () => this.__getSettingsOptions(), apply : resolution => this.setResolution(resolution), + badge : !this.config.showBadge ? null : () => this.prop.resolution, }); this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this); @@ -177,6 +180,7 @@ export class ResolutionPlugin extends AbstractPlugin { const resolution = this.resolutions.find(r => deepEqual(this.psv.config.panorama, r.panorama)); if (this.prop.resolution !== resolution?.id) { this.prop.resolution = resolution?.id; + this.settings?.updateBadge(); this.trigger(EVENTS.RESOLUTION_CHANGED, this.prop.resolution); } } diff --git a/src/plugins/settings/SettingsButton.js b/src/plugins/settings/SettingsButton.js index 0f6f0c605..a8fe16115 100644 --- a/src/plugins/settings/SettingsButton.js +++ b/src/plugins/settings/SettingsButton.js @@ -25,6 +25,16 @@ export class SettingsButton extends AbstractButton { */ this.plugin = this.psv.getPlugin('settings'); + /** + * @member {HTMLElement} + * @private + * @readonly + */ + this.badge = document.createElement('div'); + this.badge.className = 'psv-settings-badge'; + this.badge.style.display = 'none'; + this.container.appendChild(this.badge); + if (this.plugin) { this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this); this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this); @@ -74,4 +84,13 @@ export class SettingsButton extends AbstractButton { this.plugin.toggleSettings(); } + /** + * @summary Changes the badge value + * @param {string} value + */ + setBadge(value) { + this.badge.innerText = value; + this.badge.style.display = value ? '' : 'none'; + } + } diff --git a/src/plugins/settings/constants.js b/src/plugins/settings/constants.js index 87fe9f7f2..c54dafeea 100644 --- a/src/plugins/settings/constants.js +++ b/src/plugins/settings/constants.js @@ -4,6 +4,24 @@ import icon from './settings.svg'; import switchOff from './switch-off.svg'; import switchOn from './switch-on.svg'; +/** + * @summary Available events + * @enum {string} + * @memberof PSV.plugins.ResolutionPlugin + * @constant + */ +export const EVENTS = { + /** + * @event setting-changed + * @memberof PSV.plugins.SettingsPlugin + * @summary Triggered when a setting is changed + * @param {string} settingId + * @param {any} value + */ + SETTING_CHANGED: 'setting-changed', +}; + + /** * @summary Panel identifier for settings content * @type {string} diff --git a/src/plugins/settings/index.js b/src/plugins/settings/index.js index 437308aa6..64a63a962 100644 --- a/src/plugins/settings/index.js +++ b/src/plugins/settings/index.js @@ -1,5 +1,12 @@ import { AbstractPlugin, DEFAULTS, PSVError, registerButton, utils } from '../..'; -import { ID_PANEL, SETTING_DATA, SETTING_OPTIONS_TEMPLATE, SETTINGS_TEMPLATE, SETTINGS_TEMPLATE_ } from './constants'; +import { + EVENTS, + ID_PANEL, + SETTING_DATA, + SETTING_OPTIONS_TEMPLATE, + SETTINGS_TEMPLATE, + SETTINGS_TEMPLATE_ +} from './constants'; import { SettingsButton } from './SettingsButton'; import './style.scss'; @@ -10,6 +17,7 @@ import './style.scss'; * @property {string} id - identifier of the setting * @property {string} label - label of the setting * @property {'options' | 'toggle'} type - type of the setting + * @property {function} [badge] - function which returns the value of the button badge */ /** @@ -42,6 +50,9 @@ DEFAULTS.lang[SettingsButton.id] = 'Settings'; registerButton(SettingsButton, 'fullscreen:left'); +export { EVENTS } from './constants'; + + /** * @summary Adds a button to access various settings. * @extends PSV.plugins.AbstractPlugin @@ -69,6 +80,9 @@ export class SettingsPlugin extends AbstractPlugin { */ init() { super.init(); + + // buttons are initialized just after plugins + setTimeout(() => this.updateBadge()); } /** @@ -95,11 +109,17 @@ export class SettingsPlugin extends AbstractPlugin { throw new PSVError('Unsupported setting type'); } + if (setting.badge && this.settings.some(s => s.badge)) { + utils.logWarn('More than one setting with a badge are declared, the result is unpredictable.'); + } + this.settings.push(setting); if (this.psv.panel.prop.contentId === ID_PANEL) { this.showSettings(); } + + this.updateBadge(); } /** @@ -122,6 +142,8 @@ export class SettingsPlugin extends AbstractPlugin { if (this.psv.panel.prop.contentId === ID_PANEL) { this.showSettings(); } + + this.updateBadge(); } } @@ -170,7 +192,9 @@ export class SettingsPlugin extends AbstractPlugin { switch (setting.type) { case 'toggle': setting.toggle(); + this.trigger(EVENTS.SETTING_CHANGED, setting.id, setting.active()); this.showSettings(); + this.updateBadge(); break; case 'options': @@ -213,10 +237,20 @@ export class SettingsPlugin extends AbstractPlugin { } else { setting.apply(optionId); + this.trigger(EVENTS.SETTING_CHANGED, setting.id, setting.current()); this.hideSettings(); + this.updateBadge(); } }, }); } + /** + * @summary Updates the badge in the button + */ + updateBadge() { + const value = this.settings.find(s => s.badge)?.badge(); + this.psv.navbar.getButton(SettingsButton.id, false)?.setBadge(value); + } + } diff --git a/src/plugins/settings/style.scss b/src/plugins/settings/style.scss index 4d5dd31d5..9e07518df 100644 --- a/src/plugins/settings/style.scss +++ b/src/plugins/settings/style.scss @@ -1,5 +1,9 @@ @import '../../styles/vars'; +$psv-settings-badge-font: 10px / .9 monospace !default; +$psv-settings-badge-background: #111 !default; +$psv-settings-badge-text-color: white !default; + .psv-settings-item { &-label { flex: 1; @@ -38,3 +42,14 @@ } } } + +.psv-settings-badge { + position: absolute; + top: 10%; + right: 10%; + border-radius: .2em; + padding: .2em; + background: $psv-settings-badge-background; + color: $psv-settings-badge-text-color; + font: $psv-settings-badge-font; +} diff --git a/src/plugins/virtual-tour/NodesListButton.js b/src/plugins/virtual-tour/NodesListButton.js index 3584d93b1..1a8c2939a 100644 --- a/src/plugins/virtual-tour/NodesListButton.js +++ b/src/plugins/virtual-tour/NodesListButton.js @@ -43,7 +43,7 @@ export class NodesListButton extends AbstractButton { * @override */ isSupported() { - return this.plugin?.config.listButton; + return !!this.plugin && !this.plugin.isServerSide(); } /** diff --git a/src/plugins/virtual-tour/arrow.STL b/src/plugins/virtual-tour/arrow.STL deleted file mode 100644 index df4515c23..000000000 Binary files a/src/plugins/virtual-tour/arrow.STL and /dev/null differ diff --git a/src/plugins/virtual-tour/arrow.json b/src/plugins/virtual-tour/arrow.json index 99d051024..c7bca61ed 100644 --- a/src/plugins/virtual-tour/arrow.json +++ b/src/plugins/virtual-tour/arrow.json @@ -4,26 +4,26 @@ "type": "BufferGeometry", "generator": "BufferGeometry.toJSON" }, - "uuid": "B5839B4F-7D11-4EC3-B454-059BC0185A1B", + "uuid": "8B1A6E5B-A7CC-4471-9CA0-BD64D80ABB79", "type": "BufferGeometry", "data": { "attributes": { "position": { "itemSize": 3, "type": "Float32Array", - "array": [50,0,25,50,20,25,0,10,50,50,0,25,100,10,50,50,20,25,50,10,0,0,10,50,50,20,25,100,10,50,50,10,0,50,20,25,50,0,25,0,10,50,50,10,0,50,10,0,100,10,50,50,0,25], + "array": [-25,-15,-2.5,0,0,-2.5,0,-5,-2.5,0,-5,-2.5,0,0,-2.5,25,-15,-2.5,0,-5,-2.5,25,-15,-2.5,25,-20,-2.5,0,-5,-2.5,-25,-20,-2.5,-25,-15,-2.5,25,-15,2.5,25,-20,2.5,25,-15,-2.5,25,-15,-2.5,25,-20,2.5,25,-20,-2.5,25,-20,2.5,0,-5,2.5,25,-20,-2.5,25,-20,-2.5,0,-5,2.5,0,-5,-2.5,0,-5,2.5,-25,-20,2.5,0,-5,-2.5,0,-5,-2.5,-25,-20,2.5,-25,-20,-2.5,-25,-20,2.5,-25,-15,2.5,-25,-20,-2.5,-25,-20,-2.5,-25,-15,2.5,-25,-15,-2.5,-25,-15,2.5,0,0,2.5,-25,-15,-2.5,-25,-15,-2.5,0,0,2.5,0,0,-2.5,0,0,2.5,25,-15,2.5,0,0,-2.5,0,0,-2.5,25,-15,2.5,25,-15,-2.5,25,-20,2.5,25,-15,2.5,0,-5,2.5,0,-5,2.5,25,-15,2.5,0,0,2.5,0,-5,2.5,0,0,2.5,-25,-15,2.5,-25,-15,2.5,-25,-20,2.5,0,-5,2.5], "normalized": false }, "normal": { "itemSize": 3, "type": "Float32Array", - "array": [0.447214,0,0.894427,0.447214,0,0.894427,0.447214,0,0.894427,-0.447214,0,0.894427,-0.447214,0,0.894427,-0.447214,0,0.894427,-0.348155,0.870388,-0.348155,-0.348155,0.870388,-0.348155,-0.348155,0.870388,-0.348155,0.348155,0.870388,-0.348155,0.348155,0.870388,-0.348155,0.348155,0.870388,-0.348155,-0.348155,-0.870388,-0.348155,-0.348155,-0.870388,-0.348155,-0.348155,-0.870388,-0.348155,0.348155,-0.870388,-0.348155,0.348155,-0.870388,-0.348155,0.348155,-0.870388,-0.348155], + "array": [0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1], "normalized": false } }, "boundingSphere": { - "center": [50,10,25], - "radius": 55.901699 + "center": [0,-10,0], + "radius": 27.041634 } } } diff --git a/src/plugins/virtual-tour/arrow_outline.json b/src/plugins/virtual-tour/arrow_outline.json new file mode 100644 index 000000000..4d1fc8215 --- /dev/null +++ b/src/plugins/virtual-tour/arrow_outline.json @@ -0,0 +1,29 @@ +{ + "metadata": { + "version": 4.5, + "type": "BufferGeometry", + "generator": "BufferGeometry.toJSON" + }, + "uuid": "B12A1453-6E56-40AC-840B-BA7DF5DB9E2A", + "type": "BufferGeometry", + "data": { + "attributes": { + "position": { + "itemSize": 3, + "type": "Float32Array", + "array": [-26,-21.766189,-3.5,-26,-14.433809,-3.5,0,-6.166190,-3.5,0,-6.166190,-3.5,-26,-14.433809,-3.5,0,1.166190,-3.5,0,-6.166190,-3.5,0,1.166190,-3.5,26,-14.433810,-3.5,26,-14.433810,-3.5,26,-21.766191,-3.5,0,-6.166190,-3.5,-26,-14.433809,3.5,0,1.166190,3.5,-26,-14.433809,-3.5,-26,-14.433809,-3.5,0,1.166190,3.5,0,1.166190,-3.5,0,1.166190,3.5,26,-14.433810,3.5,0,1.166190,-3.5,0,1.166190,-3.5,26,-14.433810,3.5,26,-14.433810,-3.5,26,-14.433810,3.5,26,-21.766191,3.5,26,-14.433810,-3.5,26,-14.433810,-3.5,26,-21.766191,3.5,26,-21.766191,-3.5,26,-21.766191,3.5,0,-6.166190,3.5,26,-21.766191,-3.5,26,-21.766191,-3.5,0,-6.166190,3.5,0,-6.166190,-3.5,0,-6.166190,3.5,-26,-21.766189,3.5,0,-6.166190,-3.5,0,-6.166190,-3.5,-26,-21.766189,3.5,-26,-21.766189,-3.5,-26,-21.766189,3.5,-26,-14.433809,3.5,-26,-21.766189,-3.5,-26,-21.766189,-3.5,-26,-14.433809,3.5,-26,-14.433809,-3.5,-26,-21.766189,3.5,0,-6.166190,3.5,-26,-14.433809,3.5,-26,-14.433809,3.5,0,-6.166190,3.5,0,1.166190,3.5,0,1.166190,3.5,0,-6.166190,3.5,26,-14.433810,3.5,26,-14.433810,3.5,0,-6.166190,3.5,26,-21.766191,3.5], + "normalized": false + }, + "normal": { + "itemSize": 3, + "type": "Float32Array", + "array": [0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,-0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,0.514495,0.857492,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,-0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,0.514495,-0.857492,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1,0,0,1], + "normalized": false + } + }, + "boundingSphere": { + "center": [0,-10.300000,0], + "radius": 28.630814 + } + } +} diff --git a/src/plugins/virtual-tour/constants.js b/src/plugins/virtual-tour/constants.js index 5c2454d93..0bb2900a2 100644 --- a/src/plugins/virtual-tour/constants.js +++ b/src/plugins/virtual-tour/constants.js @@ -1,6 +1,7 @@ import * as THREE from 'three'; import arrowGeometryJson from './arrow.json'; import arrowIconSvg from './arrow.svg'; +import arrowOutlineGeometryJson from './arrow_outline.json'; import nodesList from './nodes-list.svg'; /** @@ -64,7 +65,7 @@ export const EVENTS = { * @summary Triggered when the current node changes * @param {string} nodeId */ - NODE_CHANGED: 'node-changed', + NODE_CHANGED : 'node-changed', /** * @event filter:render-nodes-list * @memberof PSV.plugins.VirtualTourPlugin @@ -108,10 +109,10 @@ export const DEFAULT_MARKER = { * @private */ export const DEFAULT_ARROW = { - color : 0x0055aa, - hoverColor: 0xaa5500, - opacity : 0.8, - scale : [0.5, 2], + color : 0xaaaaaa, + hoverColor : 0xaa5500, + outlineColor: 0x000000, + scale : [0.5, 2], }; /** @@ -119,15 +120,18 @@ export const DEFAULT_ARROW = { * @constant * @private */ -export const ARROW_GEOM = (() => { +export const { ARROW_GEOM, ARROW_OUTLINE_GEOM } = (() => { const loader = new THREE.ObjectLoader(); - const geom = loader.parseGeometries([arrowGeometryJson])[arrowGeometryJson.uuid]; - geom.scale(0.01, 0.015, 0.015); - geom.computeBoundingBox(); - const b = geom.boundingBox; - geom.translate(-(b.max.x - b.min.y) / 2, -(b.max.y - b.min.y) / 2, -(b.max.z - b.min.z) / 2); - geom.rotateX(Math.PI); - return geom; + const geometries = loader.parseGeometries([arrowGeometryJson, arrowOutlineGeometryJson]); + const arrow = geometries[arrowGeometryJson.uuid]; + const arrowOutline = geometries[arrowOutlineGeometryJson.uuid]; + const scale = 0.015; + const rot = Math.PI / 2; + arrow.scale(scale, scale, scale); + arrow.rotateX(rot); + arrowOutline.scale(scale, scale, scale); + arrowOutline.rotateX(rot); + return { ARROW_GEOM: arrow, ARROW_OUTLINE_GEOM: arrowOutline }; })(); /** diff --git a/src/plugins/virtual-tour/index.js b/src/plugins/virtual-tour/index.js index 23595d3de..053c34a71 100644 --- a/src/plugins/virtual-tour/index.js +++ b/src/plugins/virtual-tour/index.js @@ -3,6 +3,7 @@ import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } import { ClientSideDatasource } from './ClientSideDatasource'; import { ARROW_GEOM, + ARROW_OUTLINE_GEOM, DEFAULT_ARROW, DEFAULT_MARKER, EVENTS, @@ -76,9 +77,9 @@ import { bearing, distance, setMeshColor } from './utils'; /** * @typedef {Object} PSV.plugins.VirtualTourPlugin.ArrowStyle * @summary Style of the arrow in 3D mode - * @property {string} [color=#0055aa] - * @property {string} [hoverColor=#aa5500] - * @property {number} [opacity=0.8] + * @property {string} [color=0xaaaaaa] + * @property {string} [hoverColor=0xaa5500] + * @property {number} [outlineColor=0x000000] * @property {number[]} [scale=[0.5,2]] */ @@ -93,7 +94,7 @@ import { bearing, distance, setMeshColor } from './utils'; * @property {string} [startNodeId] - id of the initial node, if not defined the first node will be used * @property {boolean|PSV.plugins.VirtualTourPlugin.Preload} [preload=false] - preload linked panoramas * @property {boolean|string|number} [rotateSpeed='20rpm'] - speed of rotation when clicking on a link, if 'false' the viewer won't rotate at all - * @property {boolean} [listButton] - adds a button to show the list of nodes, defaults to `true` only in client data mode + * @property {boolean|number} [transition=1500] - duration of the transition between nodes * @property {boolean} [linksOnCompass] - if the Compass plugin is enabled, displays the links on the compass, defaults to `true` on in markers render mode * @property {PSV.plugins.MarkersPlugin.Properties} [markerStyle] - global marker style * @property {PSV.plugins.VirtualTourPlugin.ArrowStyle} [arrowStyle] - global arrow style @@ -111,7 +112,6 @@ import { bearing, distance, setMeshColor } from './utils'; // add markers buttons DEFAULTS.lang[NodesListButton.id] = 'Locations'; -DEFAULTS.lang.loading = 'Loading...'; registerButton(NodesListButton, 'caption:left'); @@ -165,10 +165,10 @@ export class VirtualTourPlugin extends AbstractPlugin { renderMode : MODE_3D, preload : false, rotateSpeed : '20rpm', + transition : CONSTANTS.DEFAULT_TRANSITION, markerLatOffset: -0.1, arrowPosition : 'bottom', linksOnCompass : options?.renderMode === MODE_MARKERS, - listButton : options?.dataMode !== MODE_SERVER, ...options, markerStyle : { ...DEFAULT_MARKER, @@ -180,6 +180,14 @@ export class VirtualTourPlugin extends AbstractPlugin { }, }; + if (options?.listButton === false) { + utils.logWarn('VirtualTourPlugin: listButton option is deprecated. ' + + 'Please define the global navbar options according to your needs.'); + } + if (options?.listButton === true && this.config.dataMode === MODE_SERVER) { + utils.logWarn('VirtualTourPlugin: the list button is not supported in server mode.'); + } + /** * @type {PSV.plugins.MarkersPlugin} * @private @@ -207,7 +215,7 @@ export class VirtualTourPlugin extends AbstractPlugin { this.arrowsGroup = new THREE.Group(); const localLight = new THREE.PointLight(0xffffff, 1, 0); - localLight.position.set(2, 0, 0); + localLight.position.set(0, this.config.arrowPosition === 'bottom' ? 2 : -2, 0); this.arrowsGroup.add(localLight); } } @@ -394,18 +402,14 @@ export class VirtualTourPlugin extends AbstractPlugin { Promise.resolve(this.preload[nodeId]) .then(() => { if (this.prop.loadingNode !== nodeId) { - return Promise.reject(utils.getAbortError()); + throw utils.getAbortError(); } - this.psv.textureLoader.abortLoading(); return this.datasource.loadNode(nodeId); }), Promise.resolve(fromLinkPosition ? this.config.rotateSpeed : false) - .then((speed) => { - if (!speed) { - return Promise.resolve(); - } - else { + .then((speed) => { // eslint-disable-line consistent-return + if (speed) { return this.psv.animate({ ...fromLinkPosition, speed }); } }) @@ -415,11 +419,9 @@ export class VirtualTourPlugin extends AbstractPlugin { ]) .then(([node]) => { if (this.prop.loadingNode !== nodeId) { - return Promise.reject(utils.getAbortError()); + throw utils.getAbortError(); } - this.psv.navbar.setCaption(`${this.psv.config.lang.loading}`); - this.prop.currentNode = node; if (this.prop.currentTooltip) { @@ -436,19 +438,22 @@ export class VirtualTourPlugin extends AbstractPlugin { return Promise.all([ this.psv.setPanorama(node.panorama, { + transition : this.config.transition, + caption : node.caption, panoData : node.panoData, sphereCorrection: node.sphereCorrection, }) - .catch((err) => { - // the error is already displayed by the core - return Promise.reject(utils.isAbortError(err) ? err : null); + .then((completed) => { + if (!completed) { + throw utils.getAbortError(); + } }), this.datasource.loadLinkedNodes(nodeId), ]); }) .then(() => { if (this.prop.loadingNode !== nodeId) { - return Promise.reject(utils.getAbortError()); + throw utils.getAbortError(); } const node = this.prop.currentNode; @@ -465,8 +470,6 @@ export class VirtualTourPlugin extends AbstractPlugin { this.__renderLinks(node); this.__preload(node); - this.psv.navbar.setCaption(node.caption || this.psv.config.caption); - /** * @event node-changed * @memberof PSV.plugins.VirtualTourPlugin @@ -486,18 +489,17 @@ export class VirtualTourPlugin extends AbstractPlugin { }) .catch((err) => { if (utils.isAbortError(err)) { - return Promise.resolve(false); - } - else if (err) { - this.psv.showError(this.psv.config.lang.loadError); + return false; } + this.psv.showError(this.psv.config.lang.loadError); + this.psv.loader.hide(); this.psv.navbar.setCaption(''); this.prop.loadingNode = null; - return Promise.reject(err); + throw err; }); } @@ -514,15 +516,7 @@ export class VirtualTourPlugin extends AbstractPlugin { positions.push(position); if (this.is3D()) { - const arrow = ARROW_GEOM.clone(); - const mat = new THREE.MeshLambertMaterial({ - transparent: true, - opacity : link.arrowStyle?.opacity || this.config.arrowStyle.opacity, - }); - const mesh = new THREE.Mesh(arrow, mat); - - setMeshColor(mesh, link.arrowStyle?.color || this.config.arrowStyle.color); - + const mesh = new THREE.Mesh(ARROW_GEOM, new THREE.MeshLambertMaterial()); mesh.userData = { [LINK_DATA]: link, longitude: position.longitude }; mesh.rotation.order = 'YXZ'; mesh.rotateY(-position.longitude); @@ -530,7 +524,15 @@ export class VirtualTourPlugin extends AbstractPlugin { .sphericalCoordsToVector3({ longitude: position.longitude, latitude: 0 }, mesh.position) .multiplyScalar(1 / CONSTANTS.SPHERE_RADIUS); + const outlineMesh = new THREE.Mesh(ARROW_OUTLINE_GEOM, new THREE.MeshBasicMaterial({ side: THREE.BackSide })); + outlineMesh.position.copy(mesh.position); + outlineMesh.rotation.copy(mesh.rotation); + + setMeshColor(mesh, link.arrowStyle?.color || this.config.arrowStyle.color); + setMeshColor(outlineMesh, link.arrowStyle?.outlineColor || this.config.arrowStyle.outlineColor); + this.arrowsGroup.add(mesh); + this.arrowsGroup.add(outlineMesh); } else { if (this.isGps()) { @@ -643,32 +645,12 @@ export class VirtualTourPlugin extends AbstractPlugin { * @private */ __positionArrows() { - const isBottom = this.config.arrowPosition === 'bottom'; - this.arrowsGroup.position.copy(this.psv.prop.direction).multiplyScalar(0.5); const s = this.config.arrowStyle.scale; - const f = s[1] + (s[0] - s[1]) * CONSTANTS.EASINGS.linear(this.psv.getZoomLevel() / 100); - this.arrowsGroup.position.y += isBottom ? -1.5 : 1.5; + const f = s[1] + (s[0] - s[1]) * (this.psv.getZoomLevel() / 100); + const y = 2.5 - (this.psv.getZoomLevel() / 100) * 1.5; + this.arrowsGroup.position.y += this.config.arrowPosition === 'bottom' ? -y : y; this.arrowsGroup.scale.set(f, f, f); - - // slightly rotates each arrow to make the center ones standing out - const position = this.psv.getPosition(); - if (isBottom ? (position.latitude < Math.PI / 8) : (position.latitude > -Math.PI / 8)) { - this.arrowsGroup.children - .filter(o => o.type === 'Mesh') - .forEach((arrow) => { - const d = Math.abs(utils.getShortestArc(arrow.userData.longitude, position.longitude)); - const x = CONSTANTS.EASINGS.inOutSine(Math.max(0, Math.PI / 4 - d) / (Math.PI / 4)) / 3; // magic ! - arrow.rotation.x = isBottom ? -x : x; - }); - } - else { - this.arrowsGroup.children - .filter(o => o.type === 'Mesh') - .forEach((arrow) => { - arrow.rotation.x = 0; - }); - } } /** diff --git a/src/plugins/virtual-tour/src/arrow.stl b/src/plugins/virtual-tour/src/arrow.stl new file mode 100644 index 000000000..ded24e9c7 Binary files /dev/null and b/src/plugins/virtual-tour/src/arrow.stl differ diff --git a/src/plugins/virtual-tour/src/arrow_outline.stl b/src/plugins/virtual-tour/src/arrow_outline.stl new file mode 100644 index 000000000..c88efeddf Binary files /dev/null and b/src/plugins/virtual-tour/src/arrow_outline.stl differ diff --git a/src/plugins/virtual-tour/utils.js b/src/plugins/virtual-tour/utils.js index d8015a71e..0aa83aa87 100644 --- a/src/plugins/virtual-tour/utils.js +++ b/src/plugins/virtual-tour/utils.js @@ -42,7 +42,6 @@ export function checkLink(node, link, isGps) { */ export function setMeshColor(mesh, color) { mesh.material.color.set(color); - mesh.material.emissive.set(color); } /** diff --git a/src/services/DataHelper.js b/src/services/DataHelper.js index 8f5d7aaad..a07e75858 100644 --- a/src/services/DataHelper.js +++ b/src/services/DataHelper.js @@ -1,5 +1,5 @@ import * as THREE from 'three'; -import { SPHERE_RADIUS } from '../data/constants'; +import { MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants'; import { PSVError } from '../PSVError'; import { applyEulerInverse, parseAngle, parseSpeed } from '../utils'; import { AbstractService } from './AbstractService'; @@ -166,7 +166,7 @@ export class DataHelper extends AbstractService { * @returns {external:THREE.Vector3} */ viewerCoordsToVector3(viewerPoint) { - const sphereIntersect = this.getIntersections(viewerPoint).filter(i => i.object.userData.psvSphere); + const sphereIntersect = this.getIntersections(viewerPoint).filter(i => i.object.userData[MESH_USER_DATA]); if (sphereIntersect) { return sphereIntersect.point; diff --git a/src/services/EventsHandler.js b/src/services/EventsHandler.js index bac8b3611..9b2dffd00 100644 --- a/src/services/EventsHandler.js +++ b/src/services/EventsHandler.js @@ -640,8 +640,10 @@ export class EventsHandler extends AbstractService { onTick : (properties) => { this.__move(properties, false); }, - }) - .finally(() => { + }); + + this.prop.animationPromise + .then(() => { this.state.moving = false; }); } diff --git a/src/services/Renderer.js b/src/services/Renderer.js index 9e2f266a9..65baa2281 100644 --- a/src/services/Renderer.js +++ b/src/services/Renderer.js @@ -1,6 +1,6 @@ import * as THREE from 'three'; import { Animation } from '../Animation'; -import { EVENTS, SPHERE_RADIUS } from '../data/constants'; +import { EVENTS, MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants'; import { SYSTEM } from '../data/system'; import { each, isExtendedPosition } from '../utils'; import { AbstractService } from './AbstractService'; @@ -23,8 +23,7 @@ export class Renderer extends AbstractService { * @readonly * @protected */ - this.renderer = new THREE.WebGLRenderer({ alpha: true }); - this.renderer.context.disable(this.renderer.context.DEPTH_TEST); + this.renderer = new THREE.WebGLRenderer({ alpha: true, antialias: true }); this.renderer.setPixelRatio(SYSTEM.pixelRatio); this.renderer.domElement.className = 'psv-canvas'; @@ -48,7 +47,7 @@ export class Renderer extends AbstractService { * @protected */ this.mesh = this.psv.adapter.createMesh(); - this.mesh.userData = { psvSphere: true }; + this.mesh.userData = { [MESH_USER_DATA]: true }; /** * @member {external:THREE.Group} @@ -293,10 +292,10 @@ export class Renderer extends AbstractService { const positionProvided = isExtendedPosition(options); const zoomProvided = 'zoom' in options; + // create temp group and new mesh, half size to be in "front" of the first one const group = new THREE.Group(); - const mesh = this.psv.adapter.createMesh(0.5); - this.psv.adapter.setTexture(mesh, textureData); + this.psv.adapter.setTexture(mesh, textureData, true); this.psv.adapter.setTextureOpacity(mesh, 0); this.setPanoramaPose(textureData.panoData, mesh); this.setSphereCorrection(options.sphereCorrection, group); @@ -317,9 +316,8 @@ export class Renderer extends AbstractService { group.add(mesh); this.scene.add(group); - this.psv.needsUpdate(); - return new Animation({ + const animation = new Animation({ properties: { opacity: { start: 0.0, end: 1.0 }, zoom : zoomProvided ? { start: this.psv.getZoomLevel(), end: options.zoom } : undefined, @@ -336,23 +334,32 @@ export class Renderer extends AbstractService { this.psv.needsUpdate(); }, - }) - .then(() => { - // remove temp sphere and transfer the texture to the main sphere - this.setTexture(textureData); - this.psv.adapter.setTextureOpacity(this.mesh, 1); - this.setPanoramaPose(textureData.panoData); - this.setSphereCorrection(options.sphereCorrection); + }); + + animation + .then((completed) => { + if (completed) { + // remove temp sphere and transfer the texture to the main mesh + this.setTexture(textureData); + this.psv.adapter.setTextureOpacity(this.mesh, 1); + this.setPanoramaPose(textureData.panoData); + this.setSphereCorrection(options.sphereCorrection); + + // actually rotate the camera + if (positionProvided) { + this.psv.rotate(options); + } + } + else { + this.psv.adapter.disposeTexture(textureData); + } this.scene.remove(group); mesh.geometry.dispose(); mesh.geometry = null; - - // actually rotate the camera - if (positionProvided) { - this.psv.rotate(options); - } }); + + return animation; } /** diff --git a/src/services/TextureLoader.js b/src/services/TextureLoader.js index 018eed57d..52515b87b 100644 --- a/src/services/TextureLoader.js +++ b/src/services/TextureLoader.js @@ -121,7 +121,7 @@ export class TextureLoader extends AbstractService { * @returns {Promise} */ preloadPanorama(panorama) { - if (this.psv.adapter.constructor.supportsPreload) { + if (this.psv.adapter.supportsPreload(panorama)) { return this.psv.adapter.loadTexture(panorama); } else { diff --git a/src/styles/_vars.scss b/src/styles/_vars.scss index 021306e31..25e2aadab 100644 --- a/src/styles/_vars.scss +++ b/src/styles/_vars.scss @@ -18,7 +18,7 @@ $psv-caption-font: 16px sans-serif !default; $psv-caption-color: rgba(255, 255, 255, .7) !default; $psv-buttons-height: 20px !default; -$psv-buttons-padding: 10px !default; +$psv-buttons-padding: (($psv-navbar-height - $psv-buttons-height) * .5) !default; $psv-buttons-background: transparent !default; $psv-buttons-active-background: rgba(255, 255, 255, .2) !default; $psv-buttons-color: rgba(255, 255, 255, .7) !default; @@ -30,7 +30,6 @@ $psv-buttons-hover-scale-delay: 200ms !default; $psv-zoom-range-width: 80px !default; $psv-zoom-range-tickness: 1px !default; $psv-zoom-disk-diameter: 7px !default; -$psv-zoom-buttons-width: 16px !default; $psv-zoom-range-media-min-width: 600px !default; @@ -54,7 +53,7 @@ $psv-tooltip-shadow-offset: 3px !default; // the shadow is always at the opposit // *** PANEL *** $psv-panel-background: rgba(10, 10, 10, .7) !default; $psv-panel-text-color: rgb(220, 220, 220) !default; - +$psv-panel-font: 16px sans-serif !default; $psv-panel-width: 400px !default; $psv-panel-padding: 1em !default; @@ -66,8 +65,6 @@ $psv-panel-close-button-width: 24px !default; $psv-panel-close-button-background: $psv-panel-resizer-background !default; $psv-panel-close-button-color: #fff !default; -$psv-panel-font: 16px sans-serif !default; - $psv-panel-title-font: 24px sans-serif !default; $psv-panel-title-icon-size: 24px !default; $psv-panel-title-margin: 24px !default; @@ -80,7 +77,8 @@ $psv-panel-menu-even-background: transparent !default; // *** NOTIFICATION *** -$psv-notification-bottom: (from: - $psv-navbar-height, to: $psv-navbar-height * 2) !default; +$psv-notification-position-from: -$psv-navbar-height !default; +$psv-notification-position-to: $psv-navbar-height * 2 !default; $psv-notification-animate-delay: 200ms !default; $psv-notification-background-color: $psv-tooltip-background-color !default; $psv-notification-radius: $psv-tooltip-radius !default; diff --git a/src/styles/notification.scss b/src/styles/notification.scss index 55b255ebe..83f9e7658 100644 --- a/src/styles/notification.scss +++ b/src/styles/notification.scss @@ -4,7 +4,7 @@ .psv-notification { position: absolute; z-index: $psv-notification-zindex; - bottom: map.get($psv-notification-bottom, from); + bottom: $psv-notification-position-from; display: flex; justify-content: center; box-sizing: border-box; @@ -26,6 +26,6 @@ &--visible { opacity: 100; - bottom: map.get($psv-notification-bottom, to); + bottom: $psv-notification-position-to; } } diff --git a/src/styles/panel.scss b/src/styles/panel.scss index 2a4291fec..2f5465f53 100644 --- a/src/styles/panel.scss +++ b/src/styles/panel.scss @@ -36,7 +36,7 @@ margin-left: $psv-panel-resizer-width; .psv--has-navbar & { - height: calc(100% - #{$psv-buttons-height + 2 * $psv-buttons-padding}); + height: calc(100% - #{$psv-navbar-height}); } &-close-button { diff --git a/tests/types/index.ts b/tests/types/index.ts index dee222e4e..baf21e933 100644 --- a/tests/types/index.ts +++ b/tests/types/index.ts @@ -1,6 +1,9 @@ -import { CONSTANTS, Viewer } from 'photo-sphere-viewer'; -import { EquirectangularTilesAdapter, EquirectangularTilesPanorama } from 'photo-sphere-viewer/dist/adapters/equirectangular-tiles'; -import { MarkersPlugin, MarkersPluginOptions, EVENTS as MAKER_EVENTS } from 'photo-sphere-viewer/dist/plugins/markers'; +import { Animation, CONSTANTS, Viewer } from 'photo-sphere-viewer'; +import { + EquirectangularTilesAdapter, + EquirectangularTilesPanorama +} from 'photo-sphere-viewer/dist/adapters/equirectangular-tiles'; +import { EVENTS as MAKER_EVENTS, MarkersPlugin, MarkersPluginOptions } from 'photo-sphere-viewer/dist/plugins/markers'; import { CustomPlugin } from './CustomPlugin'; const viewer = new Viewer({ @@ -75,3 +78,15 @@ customPlugin.doSomething(); const customPluginAgain = viewer.getPlugin('custom'); customPluginAgain.doSomething(); + +const anim = new Animation({ + duration: 1000, + properties: { + foo: {start: 0, end: 1}, + }, + onTick: (properties) => { + console.log(properties.foo); + } +}); + +anim.then(completed => console.log(completed)); diff --git a/types/Animation.d.ts b/types/Animation.d.ts index af6f5cff0..1a9a97fd5 100644 --- a/types/Animation.d.ts +++ b/types/Animation.d.ts @@ -1,35 +1,43 @@ -export type AnimationOptions = { - properties: { [K: string]: { start: number, end: number } }; +export type AnimationOptions = { + properties: { [key in keyof T]: { start: number, end: number } }; duration: number; delay?: number; easing?: string | ((progress: number) => number); - onTick: (properties: { [K: string]: number }, progress: number) => void; + onTick: (properties: { [key in keyof T]: number }, progress: number) => void; }; /** * @summary Interpolation helper for animations * @description - * Implements the Promise API with an additional "cancel" and "finally" methods. + * Implements the Promise API with an additional "cancel" method. * The promise is resolved when the animation is complete and rejected if the animation is cancelled. */ -export class Animation implements Promise { +export class Animation implements PromiseLike { - constructor(options: AnimationOptions); + constructor(options: AnimationOptions); - // @ts-ignore - then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + then(onFulfilled?: ((completed: boolean) => TResult | PromiseLike) | undefined | null): PromiseLike; - // @ts-ignore - catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + cancel(); - // @ts-ignore - finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + /** + * @deprecated does not accept a rejection handler anymore + */ + then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; - cancel(); + /** + * @deprecated not supported anymore + */ + catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + /** + * @deprecated not supported anymore + */ + finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; /** - * @summary Returns a resolved animation promise + * @deprecated not supported anymore */ - static resolve(): Animation; + static resolve(): Animation; } diff --git a/types/Viewer.d.ts b/types/Viewer.d.ts index 270e46a8f..9fb400e46 100644 --- a/types/Viewer.d.ts +++ b/types/Viewer.d.ts @@ -33,6 +33,7 @@ export type ViewerOptions = { panorama?: any; adapter?: AdapterConstructor | [AdapterConstructor, any]; caption?: string; + downloadUrl?: string; loadingImg?: string; loadingTxt?: string; size?: Size; @@ -78,7 +79,7 @@ export type ViewerProps = { hFov: number; aspect: number; autorotateEnabled: boolean; - animationPromise: Animation; + animationPromise: Animation; loadingPromise: Promise; startTimeout: any; size: Size; @@ -235,7 +236,7 @@ export class Viewer extends EventEmitter { /** * @summary Rotates and zooms the view with a smooth animation */ - animate(options: AnimateOptions): Animation; + animate(options: AnimateOptions): Animation; /** * @summary Stops the ongoing animation diff --git a/types/adapters/AbstractAdapter.d.ts b/types/adapters/AbstractAdapter.d.ts index cdc1ed3df..3742cbf69 100644 --- a/types/adapters/AbstractAdapter.d.ts +++ b/types/adapters/AbstractAdapter.d.ts @@ -14,14 +14,9 @@ export abstract class AbstractAdapter { static id: string; /** - * @summary Indicates if the adapter supports transitions between panoramas - */ - static supportsTransition: boolean; - - /** - * @summary Indicates if the adapter supports preload + * @summary Indicates if the adapter supports panorama download natively */ - static supportsPreload: boolean; + static supportsDownload: boolean; constructor(parent: Viewer); @@ -30,6 +25,16 @@ export abstract class AbstractAdapter { */ destroy(); + /** + * @summary Indicates if the adapter supports transitions between panoramas + */ + supportsTransition(panorama: T): boolean; + + /** + * @summary Indicates if the adapter supports preload of a panorama + */ + supportsPreload(panorama: T): boolean; + /** * @summary Loads the panorama texture(s) */ @@ -44,13 +49,18 @@ export abstract class AbstractAdapter { /** * @summary Applies the texture to the mesh */ - setTexture(mesh: Mesh, textureData: TextureData); + setTexture(mesh: Mesh, textureData: TextureData, transition?: boolean); /** * @summary Changes the opacity of the mesh */ setTextureOpacity(mesh: Mesh, opacity: number); + /** + * @abstract + */ + disposeTexture(textureData: TextureData); + } export type AdapterConstructor> = new (psv: Viewer, options?: any) => T; diff --git a/types/models.d.ts b/types/models.d.ts index 0ab07a259..8a35526b2 100644 --- a/types/models.d.ts +++ b/types/models.d.ts @@ -75,9 +75,10 @@ export type PanoDataProvider = (image: HTMLImageElement) => PanoData; * Object defining panorama and animation options */ export type PanoramaOptions = (ExtendedPosition | {}) & { - zoom?: number; + caption?: string; transition?: boolean | number; showLoader?: boolean; + zoom?: number; sphereCorrection?: SphereCorrection; panoData?: PanoData | PanoDataProvider; }; diff --git a/types/plugins/markers/index.d.ts b/types/plugins/markers/index.d.ts index 29f2559d8..c8b2009f7 100644 --- a/types/plugins/markers/index.d.ts +++ b/types/plugins/markers/index.d.ts @@ -35,7 +35,9 @@ export type MarkerProperties = Partial & { id: string; width?: number; height?: number; + orientation?: 'front' | 'horizontal' | 'vertical-left' | 'vertical-right'; scale?: number | [number, number] | { zoom?: [number, number], longitude?: [number, number] }; + opacity?: number; className?: string; style?: Record; svgStyle?: Record; @@ -207,7 +209,7 @@ export class MarkersPlugin extends AbstractPlugin { /** * @summary Rotate the view to face the marker */ - gotoMarker(markerId: string, speed: string | number): Animation; + gotoMarker(markerId: string, speed: string | number): Animation; /** * @summary Hides a marker diff --git a/types/plugins/resolution/index.d.ts b/types/plugins/resolution/index.d.ts index 8bf38042a..5ce31703d 100644 --- a/types/plugins/resolution/index.d.ts +++ b/types/plugins/resolution/index.d.ts @@ -9,6 +9,11 @@ export type Resolution = { export type ResolutionPluginOptions = { resolutions: Resolution[]; + showBadge?: boolean; +}; + +export const EVENTS: { + RESOLUTION_CHANGED: 'resolution-changed', }; /** @@ -16,10 +21,6 @@ export type ResolutionPluginOptions = { */ export class ResolutionPlugin extends AbstractPlugin { - static EVENTS: { - RESOLUTION_CHANGED: 'resolution-changed', - }; - constructor(psv: Viewer, options: ResolutionPluginOptions); /** diff --git a/types/plugins/settings/index.d.ts b/types/plugins/settings/index.d.ts index 9fbea11a4..3ff505a8e 100644 --- a/types/plugins/settings/index.d.ts +++ b/types/plugins/settings/index.d.ts @@ -1,3 +1,4 @@ +import { Event } from 'uevent'; import { AbstractPlugin, Viewer } from '../..'; /** @@ -6,6 +7,7 @@ import { AbstractPlugin, Viewer } from '../..'; export type BaseSetting = { id: string; label: string; + badge?: () => string; }; /** @@ -37,6 +39,10 @@ export type SettingOption = { export type Setting = OptionsSetting | ToggleSetting; +export const EVENTS: { + SETTING_CHANGED: 'setting-changed', +}; + /** * @summary Adds a button to access various settings. */ @@ -70,4 +76,9 @@ export class SettingsPlugin extends AbstractPlugin { */ showSettings(); + /** + * @summary Triggered when a setting is changed + */ + on(e: 'setting-changed', cb: (e: Event, settingId: string, value: any) => void): this; + } diff --git a/types/plugins/virtual-tour/index.d.ts b/types/plugins/virtual-tour/index.d.ts index 22ce336ee..74ad3e747 100644 --- a/types/plugins/virtual-tour/index.d.ts +++ b/types/plugins/virtual-tour/index.d.ts @@ -34,6 +34,10 @@ export type VirtualTourNodeLink = { export type VirtualTourArrowStyle = { color?: string; hoverColor?: string; + outlineColor?: number; + /** + * @deprecated + */ opacity?: number; scale?: [number, number]; }; @@ -60,6 +64,7 @@ export type VirtualTourPluginPluginOptions = { startNodeId?: string; preload?: boolean | ((node: VirtualTourNode, link: VirtualTourNodeLink) => boolean); rotateSpeed?: boolean | string | number; + transition?: boolean | number; markerStyle?: MarkerProperties; arrowStyle?: VirtualTourArrowStyle; markerLatOffset?: number;