diff --git a/.github/dependabot.yml b/.github/dependabot.yml index feb4f86ab..241f7cff2 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,10 +1,8 @@ version: 2 updates: -- package-ecosystem: npm - directory: "/" - schedule: - interval: daily - time: "04:00" - open-pull-requests-limit: 10 - assignees: - - mistic100 + - package-ecosystem: npm + directory: "/" + schedule: + interval: daily + assignees: + - mistic100 diff --git a/.github/stale.yml b/.github/stale.yml deleted file mode 100644 index d8c6a18a6..000000000 --- a/.github/stale.yml +++ /dev/null @@ -1,10 +0,0 @@ -daysUntilStale: 7 -daysUntilClose: 7 -onlyLabels: - - invalid - - "info requested" -staleLabel: wontfix -markComment: > - This issue has been automatically marked as wontfix because not enough - information was provided. It will be closed if no further activity occurs. -closeComment: false diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9077557c2..039663894 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,6 +1,12 @@ name: CI -on: [push, pull_request] +on: + push: + branches-ignore: + - master + pull_request: + branches: + - dev jobs: build: diff --git a/.github/workflows/close-milestone.yml b/.github/workflows/close-milestone.yml index 5f56c2fe0..33cd4de6b 100644 --- a/.github/workflows/close-milestone.yml +++ b/.github/workflows/close-milestone.yml @@ -10,6 +10,8 @@ permissions: jobs: comment: + if: github.repository == 'mistic100/Photo-Sphere-Viewer' + runs-on: ubuntu-latest steps: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 542d357a7..2ffa5e63d 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -7,12 +7,13 @@ on: jobs: publish: + if: github.repository == 'mistic100/Photo-Sphere-Viewer' + runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: publish - uses: pascalgn/npm-publish-action@master + - uses: pascalgn/npm-publish-action@master with: tag_name: "%s" tag_message: "%s" diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 000000000..17772d35e --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,26 @@ +name: stale + +on: + schedule: + - cron: '0 5 * * *' + workflow_dispatch: {} + +permissions: + issues: write + pull-requests: write + +jobs: + stale: + if: github.repository == 'mistic100/Photo-Sphere-Viewer' + + runs-on: ubuntu-latest + + steps: + - uses: actions/stale@v5 + with: + any-of-labels: 'invalid,info requested' + stale-issue-label: wontfix + days-before-stale: 7 + days-before-close: 7 + stale-issue-message: | + This issue has been automatically marked as wontfix because not enough information was provided. It will be closed if no further activity occurs. diff --git a/CODE-OF-CONDUCT.md b/CODE-OF-CONDUCT.md new file mode 100644 index 000000000..24fc95948 --- /dev/null +++ b/CODE-OF-CONDUCT.md @@ -0,0 +1,128 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, religion, or sexual identity +and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the + overall community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or + advances of any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email + address, without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at +contact@git.strangeplanet.fr. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series +of actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or +permanent ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within +the community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.0, available at +https://www.contributor-covenant.org/version/2/0/code_of_conduct.html. + +Community Impact Guidelines were inspired by [Mozilla's code of conduct +enforcement ladder](https://github.com/mozilla/diversity). + +[homepage]: https://www.contributor-covenant.org + +For answers to common questions about this code of conduct, see the FAQ at +https://www.contributor-covenant.org/faq. Translations are available at +https://www.contributor-covenant.org/translations. diff --git a/dist/adapters/cubemap-tiles.js b/dist/adapters/cubemap-tiles.js index 5e9a5920c..c52e1beef 100644 --- a/dist/adapters/cubemap-tiles.js +++ b/dist/adapters/cubemap-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer'), require('photo-sphere-viewer/dist/adapters/cubemap')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer', 'photo-sphere-viewer/dist/adapters/cubemap'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.CubemapTilesAdapter = {}), global.THREE, global.PhotoSphereViewer, global.PhotoSphereViewer.CubemapAdapter)); -})(this, (function (exports, THREE, photoSphereViewer, cubemap) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer, cubemap) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -201,8 +201,8 @@ ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText('⚠', canvas.width / 2, canvas.height / 2); - var texture = new THREE.CanvasTexture(canvas); - return new THREE.MeshBasicMaterial({ + var texture = new three.CanvasTexture(canvas); + return new three.MeshBasicMaterial({ map: texture }); } @@ -287,9 +287,9 @@ return tile.face + ":" + tile.col + "x" + tile.row; } - var frustum = new THREE.Frustum(); - var projScreenMatrix = new THREE.Matrix4(); - var vertexPosition = new THREE.Vector3(); + var frustum = new three.Frustum(); + var projScreenMatrix = new three.Matrix4(); + var vertexPosition = new three.Vector3(); /** * @summary Adapter for tiled cubemaps * @memberof PSV.adapters @@ -347,7 +347,7 @@ * @private */ - _this.loader = new THREE.ImageLoader(); + _this.loader = new three.ImageLoader(); if (_this.psv.config.withCredentials) { _this.loader.setWithCredentials(true); @@ -453,7 +453,7 @@ return Promise.reject(new photoSphereViewer.PSVError("Panorama nbTiles must not be greater than " + CUBE_SEGMENTS + ".")); } - if (!photoSphereViewer.utils.isPowerOfTwo(panorama.nbTiles)) { + if (!three.MathUtils.isPowerOfTwo(panorama.nbTiles)) { return Promise.reject(new photoSphereViewer.PSVError('Panorama nbTiles must be power of 2.')); } @@ -481,7 +481,7 @@ } var cubeSize = photoSphereViewer.CONSTANTS.SPHERE_RADIUS * 2 * scale; - var geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_SEGMENTS, CUBE_SEGMENTS, CUBE_SEGMENTS).scale(1, 1, -1).toNonIndexed(); + var geometry = new three.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_SEGMENTS, CUBE_SEGMENTS, CUBE_SEGMENTS).scale(1, 1, -1).toNonIndexed(); geometry.clearGroups(); for (var i = 0, k = 0; i < NB_VERTICES; i += NB_VERTICES_BY_FACE) { @@ -489,7 +489,7 @@ } geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone()); - return new THREE.Mesh(geometry, []); + return new three.Mesh(geometry, []); } /** * @summary Applies the base texture and starts the loading of tiles @@ -534,15 +534,15 @@ if (texture) { if (this.config.flipTopBottom && (i === 2 || i === 3)) { - texture[i].center = new THREE.Vector2(0.5, 0.5); + texture[i].center = new three.Vector2(0.5, 0.5); texture[i].rotation = Math.PI; } - material = new THREE.MeshBasicMaterial({ + material = new three.MeshBasicMaterial({ map: texture[i] }); } else { - material = new THREE.MeshBasicMaterial({ + material = new three.MeshBasicMaterial({ opacity: 0, transparent: true }); @@ -704,7 +704,7 @@ _this5.loader.load(url, resolve, undefined, reject); }).then(function (image) { if (!task.isCancelled()) { - var material = new THREE.MeshBasicMaterial({ + var material = new three.MeshBasicMaterial({ map: photoSphereViewer.utils.createTexture(image) }); diff --git a/dist/adapters/cubemap-tiles.js.map b/dist/adapters/cubemap-tiles.js.map index 79740c179..8582b14ca 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/shared/Task.js","../../src/adapters/shared/Queue.js","../../src/adapters/shared/tiles-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 '../shared/Queue';\nimport { Task } from '../shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../shared/tiles-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 * @extends PSV.adapters.AbstractAdapter\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 if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let 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;EACA,IAAaA,IAAb,gBAAA,YAAA;EAWE;EACF;EACA;EACA;EACA;EACE,EAAA,SAAA,IAAA,CAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;MAC5B,IAAKF,CAAAA,EAAL,GAAUA,EAAV,CAAA;MACA,IAAKC,CAAAA,QAAL,GAAgBA,QAAhB,CAAA;MACA,IAAKC,CAAAA,EAAL,GAAUA,EAAV,CAAA;EACA,IAAA,IAAA,CAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B,CAAA;EACD,GAAA;;EArBH,EAAA,IAAA,MAAA,GAAA,IAAA,CAAA,SAAA,CAAA;;IAAA,MAuBEC,CAAAA,KAvBF,GA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uC,CAAA,CAAA;EA+B/C,OAAA;EACF,KAAA;;MAEDF,GAAG,CAACF,WAAJ,GAAkB,IAAlB,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EACA;EACA;EACA;EA/bA,GAAA;;EAAA,EAAA,MAAA,CAgcEkB,sBAhcF,GAgcE,SAAuB3K,sBAAAA,CAAAA,GAAvB,EAA4B;EAC1B,IAAA,IAAIA,GAAG,CAACnB,KAAJ,KAAcmB,GAAG,CAAClB,MAAtB,EAA8B;QAC5B6B,uBAAK,CAACiK,OAAN,CAAc,wDAAd,CAAA,CAAA;EACD,KAAA;;MAED,OAAO7K,iBAAiB,CAACC,GAAD,EAAM,IAAA,CAAKqC,MAAL,CAAYG,QAAlB,EAA4B,UAAAqI,CAAC,EAAA;EAAA,MAAA,OAAIA,CAAJ,CAAA;EAAA,KAA7B,CAAxB,CAAA;KArcJ,CAAA;;EAAA,EAAA,OAAA,mBAAA,CAAA;EAAA,CAAA,CAAyChK,sBAAzC,EAAA;EAAaqB,oBAEJ1F,KAAK;EAFD0F,oBAGJ4I,mBAAmB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"cubemap-tiles.js","sources":["../../src/adapters/shared/Task.js","../../src/adapters/shared/Queue.js","../../src/adapters/shared/tiles-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 { CanvasTexture, LineSegments, Mesh, MeshBasicMaterial, SphereGeometry, WireframeGeometry } 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 CanvasTexture(canvas);\n return new 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 WireframeGeometry(geometry);\n const line = new 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 SphereGeometry(0.1);\n const material = new MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import {\n BoxGeometry,\n Frustum,\n ImageLoader,\n MathUtils,\n Matrix4,\n Mesh,\n MeshBasicMaterial,\n Vector2,\n Vector3\n} from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { CUBE_HASHMAP, CubemapAdapter } from '../cubemap';\nimport { Queue } from '../shared/Queue';\nimport { Task } from '../shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../shared/tiles-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 Frustum();\nconst projScreenMatrix = new Matrix4();\nconst vertexPosition = new Vector3();\n\n/**\n * @summary Adapter for tiled cubemaps\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\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 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 (!MathUtils.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 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 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 Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n material = new MeshBasicMaterial({ map: texture[i] });\n }\n else {\n material = new 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 if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let 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 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","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","MathUtils","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;EACA,IAAaA,IAAb,gBAAA,YAAA;EAWE;EACF;EACA;EACA;EACA;EACE,EAAA,SAAA,IAAA,CAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;MAC5B,IAAKF,CAAAA,EAAL,GAAUA,EAAV,CAAA;MACA,IAAKC,CAAAA,QAAL,GAAgBA,QAAhB,CAAA;MACA,IAAKC,CAAAA,EAAL,GAAUA,EAAV,CAAA;EACA,IAAA,IAAA,CAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B,CAAA;EACD,GAAA;;EArBH,EAAA,IAAA,MAAA,GAAA,IAAA,CAAA,SAAA,CAAA;;IAAA,MAuBEC,CAAAA,KAvBF,GAuBE,SAAQ,KAAA,GAAA;EAAA,IAAA,IAAA,KAAA,GAAA,IAAA,CAAA;;EACN,IAAA,IAAA,CAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B,CAAA;EACA,IAAA,OAAO,KAAKL,EAAL,CAAQ,IAAR,CACJM,CAAAA,IADI,CACC,YAAM;EACV,MAAA,KAAI,CAACL,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYK,IAA1B,CAAA;EACD,KAHI,EAGF,YAAM;EACP,MAAA,KAAI,CAACN,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYM,KAA1B,CAAA;EACD,KALI,CAAP,CAAA;KAzBJ,CAAA;;IAAA,MAiCEC,CAAAA,MAjCF,GAiCE,SAAS,MAAA,GAAA;EACP,IAAA,IAAA,CAAKR,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYQ,SAA1B,CAAA;KAlCJ,CAAA;;IAAA,MAqCEC,CAA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5315b9b 100644 --- a/dist/adapters/cubemap-video.js +++ b/dist/adapters/cubemap-video.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.CubemapVideoAdapter = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -149,7 +149,7 @@ var video = this.__createVideo(panorama.source); return this.__videoLoadPromise(video).then(function () { - var texture = new THREE.VideoTexture(video); + var texture = new three.VideoTexture(video); return { panorama: panorama, texture: texture @@ -357,7 +357,7 @@ } var cubeSize = photoSphereViewer.CONSTANTS.SPHERE_RADIUS * 2 * scale; - var geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize).scale(1, 1, -1).toNonIndexed(); + var geometry = new three.BoxGeometry(cubeSize, cubeSize, cubeSize).scale(1, 1, -1).toNonIndexed(); geometry.clearGroups(); var uvs = geometry.getAttribute('uv'); /* @@ -427,7 +427,7 @@ uvs.setXY(34, c, B); uvs.setXY(35, c, A); // shamelessly copied from https://github.com/videojs/videojs-vr - var material = new THREE.ShaderMaterial({ + var material = new three.ShaderMaterial({ uniforms: { mapped: { value: null @@ -436,16 +436,16 @@ value: 1 }, faceWH: { - value: new THREE.Vector2(1 / 3, 1 / 2) + value: new three.Vector2(1 / 3, 1 / 2) }, vidWH: { - value: new THREE.Vector2(1, 1) + value: new three.Vector2(1, 1) } }, vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.);\n}", - fragmentShader: "\nvarying vec2 vUv;\nuniform sampler2D mapped;\nuniform vec2 faceWH;\nuniform vec2 vidWH;\nuniform float contCorrect;\nconst float PI = 3.1415926535897932384626433832795;\nvoid main() {\n vec2 corner = vUv - mod(vUv, faceWH) + vec2(0, contCorrect / vidWH.y);\n vec2 faceWHadj = faceWH - vec2(0, contCorrect * 2. / vidWH.y);\n vec2 p = (vUv - corner) / faceWHadj - .5;\n vec2 q = " + (this.config.equiangular ? '2. / PI * atan(2. * p) + .5' : 'p + .5') + ";\n vec2 eUv = corner + q * faceWHadj;\n gl_FragColor = texture2D(mapped, eUv);\n}" + fragmentShader: "\nvarying vec2 vUv;\nuniform sampler2D mapped;\nuniform vec2 faceWH;\nuniform vec2 vidWH;\nuniform float contCorrect;\n\nconst float PI = 3.1415926535897932384626433832795;\n\nvoid main() {\n vec2 corner = vUv - mod(vUv, faceWH) + vec2(0, contCorrect / vidWH.y);\n vec2 faceWHadj = faceWH - vec2(0, contCorrect * 2. / vidWH.y);\n vec2 p = (vUv - corner) / faceWHadj - .5;\n vec2 q = " + (this.config.equiangular ? '2. / PI * atan(2. * p) + .5' : 'p + .5') + ";\n vec2 eUv = corner + q * faceWHadj;\n gl_FragColor = texture2D(mapped, eUv);\n}" }); - return new THREE.Mesh(geometry, material); + return new three.Mesh(geometry, material); } /** * @override diff --git a/dist/adapters/cubemap-video.js.map b/dist/adapters/cubemap-video.js.map index 23dc002fd..e893fded8 100644 --- a/dist/adapters/cubemap-video.js.map +++ b/dist/adapters/cubemap-video.js.map @@ -1 +1 @@ -{"version":3,"file":"cubemap-video.js","sources":["../../src/adapters/shared/AbstractVideoAdapter.js","../../src/adapters/cubemap-video/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError } from '../..';\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n */\n\n/**\n * @summary Base video adapters class\n * @memberof PSV.adapters\n * @abstract\n * @private\n */\nexport class AbstractVideoAdapter extends AbstractAdapter {\n\n static supportsTransition = false;\n static supportsPreload = false;\n static supportsDownload = false;\n\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.AbstractVideoAdapter.Options}\n * @private\n */\n this.config = {\n autoplay: false,\n muted : options?.autoplay ?? false,\n ...options,\n };\n\n /**\n * @member {HTMLVideoElement}\n * @private\n */\n this.video = null;\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.__removeVideo();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n if (this.video) {\n this.psv.needsUpdate();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {PSV.adapters.AbstractVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.source) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n\n if (!this.psv.getPlugin('video')) {\n return Promise.reject(new PSVError('Video adapters require VideoPlugin to be loaded too.'));\n }\n\n const video = this.__createVideo(panorama.source);\n\n return this.__videoLoadPromise(video)\n .then(() => {\n const texture = new THREE.VideoTexture(video);\n return { panorama, texture };\n });\n }\n\n /**\n * @override\n */\n __switchVideo(texture) {\n let currentTime;\n let duration;\n let paused = !this.config.autoplay;\n let muted = this.config.muted;\n let volume = 1;\n if (this.video) {\n ({ currentTime, duration, paused, muted, volume } = this.video);\n }\n\n this.__removeVideo();\n this.video = texture.image;\n\n // keep current time when switching resolution\n if (this.video.duration === duration) {\n this.video.currentTime = currentTime;\n }\n\n // keep volume\n this.video.muted = muted;\n this.video.volume = volume;\n\n // play\n if (!paused) {\n this.video.play();\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n if (textureData.texture) {\n const video = textureData.texture.image;\n video.pause();\n this.psv.container.removeChild(video);\n }\n textureData.texture?.dispose();\n }\n\n /**\n * @summary Removes the current video element\n * @private\n */\n __removeVideo() {\n if (this.video) {\n this.video.pause();\n this.psv.container.removeChild(this.video);\n delete this.video;\n }\n }\n\n /**\n * @summary Creates a new video element\n * @memberOf PSV.adapters\n * @param {string} src\n * @return {HTMLVideoElement}\n * @private\n */\n __createVideo(src) {\n const video = document.createElement('video');\n video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous';\n video.loop = true;\n video.playsinline = true;\n video.style.display = 'none';\n video.muted = this.config.muted;\n video.src = src;\n video.preload = 'metadata';\n\n this.psv.container.appendChild(video);\n\n return video;\n }\n\n /**\n * @private\n */\n __videoLoadPromise(video) {\n const self = this;\n\n return new Promise((resolve, reject) => {\n video.addEventListener('loadedmetadata', function onLoaded() {\n if (this.video && video.duration === this.video.duration) {\n resolve(self.__videoBufferPromise(video, this.video.currentTime));\n }\n else {\n resolve();\n }\n video.removeEventListener('loadedmetadata', onLoaded);\n });\n\n video.addEventListener('error', function onError(err) {\n reject(err);\n video.removeEventListener('error', onError);\n });\n });\n }\n\n /**\n * @private\n */\n __videoBufferPromise(video, currentTime) {\n return new Promise((resolve) => {\n function onBuffer() {\n const buffer = video.buffered;\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= video.currentTime && buffer.end(i) >= video.currentTime) {\n video.pause();\n video.removeEventListener('buffer', onBuffer);\n video.removeEventListener('progress', onBuffer);\n resolve();\n break;\n }\n }\n }\n\n // try to reduce the switching time by preloading in advance\n // FIXME find a better way ?\n video.currentTime = Math.min(currentTime + 2000, video.duration.currentTime);\n video.muted = true;\n\n video.addEventListener('buffer', onBuffer);\n video.addEventListener('progress', onBuffer);\n\n video.play();\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { CONSTANTS } from '../..';\nimport { AbstractVideoAdapter } from '../shared/AbstractVideoAdapter';\n\n/**\n * @typedef {Object} PSV.adapters.CubemapVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n * @property {number} [equiangular=true] - if the video is an equiangular cubemap (EAC)\n */\n\n\n/**\n * @summary Adapter for cubemap videos\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class CubemapVideoAdapter extends AbstractVideoAdapter {\n\n static id = 'cubemap-video';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapVideoAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv, {\n equiangular: true,\n ...options,\n });\n }\n\n /**\n * @override\n * @param {PSV.adapters.CubemapVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n return super.loadTexture(panorama);\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 .toNonIndexed();\n\n geometry.clearGroups();\n\n const uvs = geometry.getAttribute('uv');\n\n /*\n Structure of a frame\n\n 1 +---------+---------+---------+\n | | | |\n | Left | Front | Right |\n | | | |\n 1/2 +---------+---------+---------+\n | | | |\n | Bottom | Back | Top |\n | | | |\n 0 +---------+---------+---------+\n 0 1/3 2/3 1\n\n Bottom, Back and Top are rotated 90° clockwise\n */\n\n // columns\n const a = 0;\n const b = 1 / 3;\n const c = 2 / 3;\n const d = 1;\n\n // lines\n const A = 1;\n const B = 1 / 2;\n const C = 0;\n\n // left\n uvs.setXY(0, a, A);\n uvs.setXY(1, a, B);\n uvs.setXY(2, b, A);\n uvs.setXY(3, a, B);\n uvs.setXY(4, b, B);\n uvs.setXY(5, b, A);\n\n // right\n uvs.setXY(6, c, A);\n uvs.setXY(7, c, B);\n uvs.setXY(8, d, A);\n uvs.setXY(9, c, B);\n uvs.setXY(10, d, B);\n uvs.setXY(11, d, A);\n\n // top\n uvs.setXY(12, d, B);\n uvs.setXY(13, c, B);\n uvs.setXY(14, d, C);\n uvs.setXY(15, c, B);\n uvs.setXY(16, c, C);\n uvs.setXY(17, d, C);\n\n // bottom\n uvs.setXY(18, b, B);\n uvs.setXY(19, a, B);\n uvs.setXY(20, b, C);\n uvs.setXY(21, a, B);\n uvs.setXY(22, a, C);\n uvs.setXY(23, b, C);\n\n // back\n uvs.setXY(24, c, B);\n uvs.setXY(25, b, B);\n uvs.setXY(26, c, C);\n uvs.setXY(27, b, B);\n uvs.setXY(28, b, C);\n uvs.setXY(29, c, C);\n\n // front\n uvs.setXY(30, b, A);\n uvs.setXY(31, b, B);\n uvs.setXY(32, c, A);\n uvs.setXY(33, b, B);\n uvs.setXY(34, c, B);\n uvs.setXY(35, c, A);\n\n // shamelessly copied from https://github.com/videojs/videojs-vr\n const material = new THREE.ShaderMaterial({\n uniforms : {\n mapped : { value: null },\n contCorrect: { value: 1 },\n faceWH : { value: new THREE.Vector2(1 / 3, 1 / 2) },\n vidWH : { value: new THREE.Vector2(1, 1) },\n },\n vertexShader : `\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.);\n}`,\n fragmentShader: `\nvarying vec2 vUv;\nuniform sampler2D mapped;\nuniform vec2 faceWH;\nuniform vec2 vidWH;\nuniform float contCorrect;\nconst float PI = 3.1415926535897932384626433832795;\nvoid main() {\n vec2 corner = vUv - mod(vUv, faceWH) + vec2(0, contCorrect / vidWH.y);\n vec2 faceWHadj = faceWH - vec2(0, contCorrect * 2. / vidWH.y);\n vec2 p = (vUv - corner) / faceWHadj - .5;\n vec2 q = ${this.config.equiangular ? '2. / PI * atan(2. * p) + .5' : 'p + .5'};\n vec2 eUv = corner + q * faceWHadj;\n gl_FragColor = texture2D(mapped, eUv);\n}`,\n });\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.uniforms.mapped.value?.dispose();\n mesh.material.uniforms.mapped.value = texture;\n mesh.material.uniforms.vidWH.value.set(texture.image.videoWidth, texture.image.videoHeight);\n\n this.__switchVideo(textureData.texture);\n }\n\n}\n"],"names":["AbstractVideoAdapter","psv","options","config","autoplay","muted","video","on","CONSTANTS","EVENTS","BEFORE_RENDER","destroy","off","__removeVideo","handleEvent","e","type","needsUpdate","loadTexture","panorama","source","Promise","reject","PSVError","getPlugin","__createVideo","__videoLoadPromise","then","texture","THREE","VideoTexture","__switchVideo","currentTime","duration","paused","volume","image","play","disposeTexture","textureData","pause","container","removeChild","dispose","src","document","createElement","crossOrigin","withCredentials","loop","playsinline","style","display","preload","appendChild","self","resolve","addEventListener","onLoaded","__videoBufferPromise","removeEventListener","onError","err","onBuffer","buffer","buffered","i","l","length","start","end","Math","min","AbstractAdapter","supportsTransition","supportsPreload","supportsDownload","CubemapVideoAdapter","equiangular","createMesh","scale","cubeSize","SPHERE_RADIUS","geometry","BoxGeometry","toNonIndexed","clearGroups","uvs","getAttribute","a","b","c","d","A","B","C","setXY","material","ShaderMaterial","uniforms","mapped","value","contCorrect","faceWH","Vector2","vidWH","vertexShader","fragmentShader","Mesh","setTexture","mesh","set","videoWidth","videoHeight","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;E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C,KAA9B,GAAsCzE,OAAtC,CAAA;MACAkF,IAAI,CAACb,QAAL,CAAcE,QAAd,CAAuBM,KAAvB,CAA6BJ,KAA7B,CAAmCU,GAAnC,CAAuCnF,OAAO,CAACQ,KAAR,CAAc4E,UAArD,EAAiEpF,OAAO,CAACQ,KAAR,CAAc6E,WAA/E,CAAA,CAAA;;EAEA,IAAA,IAAA,CAAKlF,aAAL,CAAmBQ,WAAW,CAACX,OAA/B,CAAA,CAAA;KA7JJ,CAAA;;EAAA,EAAA,OAAA,mBAAA,CAAA;EAAA,CAAA,CAAyC5B,oBAAzC,EAAA;EAAa6E,oBAEJqC,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"cubemap-video.js","sources":["../../src/adapters/shared/AbstractVideoAdapter.js","../../src/adapters/cubemap-video/index.js"],"sourcesContent":["import { VideoTexture } from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError } from '../..';\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n */\n\n/**\n * @summary Base video adapters class\n * @memberof PSV.adapters\n * @abstract\n * @private\n */\nexport class AbstractVideoAdapter extends AbstractAdapter {\n\n static supportsTransition = false;\n static supportsPreload = false;\n static supportsDownload = false;\n\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.AbstractVideoAdapter.Options}\n * @private\n */\n this.config = {\n autoplay: false,\n muted : options?.autoplay ?? false,\n ...options,\n };\n\n /**\n * @member {HTMLVideoElement}\n * @private\n */\n this.video = null;\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.__removeVideo();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n if (this.video) {\n this.psv.needsUpdate();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {PSV.adapters.AbstractVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.source) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n\n if (!this.psv.getPlugin('video')) {\n return Promise.reject(new PSVError('Video adapters require VideoPlugin to be loaded too.'));\n }\n\n const video = this.__createVideo(panorama.source);\n\n return this.__videoLoadPromise(video)\n .then(() => {\n const texture = new VideoTexture(video);\n return { panorama, texture };\n });\n }\n\n /**\n * @override\n */\n __switchVideo(texture) {\n let currentTime;\n let duration;\n let paused = !this.config.autoplay;\n let muted = this.config.muted;\n let volume = 1;\n if (this.video) {\n ({ currentTime, duration, paused, muted, volume } = this.video);\n }\n\n this.__removeVideo();\n this.video = texture.image;\n\n // keep current time when switching resolution\n if (this.video.duration === duration) {\n this.video.currentTime = currentTime;\n }\n\n // keep volume\n this.video.muted = muted;\n this.video.volume = volume;\n\n // play\n if (!paused) {\n this.video.play();\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n if (textureData.texture) {\n const video = textureData.texture.image;\n video.pause();\n this.psv.container.removeChild(video);\n }\n textureData.texture?.dispose();\n }\n\n /**\n * @summary Removes the current video element\n * @private\n */\n __removeVideo() {\n if (this.video) {\n this.video.pause();\n this.psv.container.removeChild(this.video);\n delete this.video;\n }\n }\n\n /**\n * @summary Creates a new video element\n * @memberOf PSV.adapters\n * @param {string} src\n * @return {HTMLVideoElement}\n * @private\n */\n __createVideo(src) {\n const video = document.createElement('video');\n video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous';\n video.loop = true;\n video.playsinline = true;\n video.style.display = 'none';\n video.muted = this.config.muted;\n video.src = src;\n video.preload = 'metadata';\n\n this.psv.container.appendChild(video);\n\n return video;\n }\n\n /**\n * @private\n */\n __videoLoadPromise(video) {\n const self = this;\n\n return new Promise((resolve, reject) => {\n video.addEventListener('loadedmetadata', function onLoaded() {\n if (this.video && video.duration === this.video.duration) {\n resolve(self.__videoBufferPromise(video, this.video.currentTime));\n }\n else {\n resolve();\n }\n video.removeEventListener('loadedmetadata', onLoaded);\n });\n\n video.addEventListener('error', function onError(err) {\n reject(err);\n video.removeEventListener('error', onError);\n });\n });\n }\n\n /**\n * @private\n */\n __videoBufferPromise(video, currentTime) {\n return new Promise((resolve) => {\n function onBuffer() {\n const buffer = video.buffered;\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= video.currentTime && buffer.end(i) >= video.currentTime) {\n video.pause();\n video.removeEventListener('buffer', onBuffer);\n video.removeEventListener('progress', onBuffer);\n resolve();\n break;\n }\n }\n }\n\n // try to reduce the switching time by preloading in advance\n // FIXME find a better way ?\n video.currentTime = Math.min(currentTime + 2000, video.duration.currentTime);\n video.muted = true;\n\n video.addEventListener('buffer', onBuffer);\n video.addEventListener('progress', onBuffer);\n\n video.play();\n });\n }\n\n}\n","import { BoxGeometry, Mesh, ShaderMaterial, Vector2 } from 'three';\nimport { CONSTANTS } from '../..';\nimport { AbstractVideoAdapter } from '../shared/AbstractVideoAdapter';\n\n/**\n * @typedef {Object} PSV.adapters.CubemapVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.CubemapVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n * @property {number} [equiangular=true] - if the video is an equiangular cubemap (EAC)\n */\n\n\n/**\n * @summary Adapter for cubemap videos\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class CubemapVideoAdapter extends AbstractVideoAdapter {\n\n static id = 'cubemap-video';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.CubemapVideoAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv, {\n equiangular: true,\n ...options,\n });\n }\n\n /**\n * @override\n * @param {PSV.adapters.CubemapVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n return super.loadTexture(panorama);\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale;\n const geometry = new BoxGeometry(cubeSize, cubeSize, cubeSize)\n .scale(1, 1, -1)\n .toNonIndexed();\n\n geometry.clearGroups();\n\n const uvs = geometry.getAttribute('uv');\n\n /*\n Structure of a frame\n\n 1 +---------+---------+---------+\n | | | |\n | Left | Front | Right |\n | | | |\n 1/2 +---------+---------+---------+\n | | | |\n | Bottom | Back | Top |\n | | | |\n 0 +---------+---------+---------+\n 0 1/3 2/3 1\n\n Bottom, Back and Top are rotated 90° clockwise\n */\n\n // columns\n const a = 0;\n const b = 1 / 3;\n const c = 2 / 3;\n const d = 1;\n\n // lines\n const A = 1;\n const B = 1 / 2;\n const C = 0;\n\n // left\n uvs.setXY(0, a, A);\n uvs.setXY(1, a, B);\n uvs.setXY(2, b, A);\n uvs.setXY(3, a, B);\n uvs.setXY(4, b, B);\n uvs.setXY(5, b, A);\n\n // right\n uvs.setXY(6, c, A);\n uvs.setXY(7, c, B);\n uvs.setXY(8, d, A);\n uvs.setXY(9, c, B);\n uvs.setXY(10, d, B);\n uvs.setXY(11, d, A);\n\n // top\n uvs.setXY(12, d, B);\n uvs.setXY(13, c, B);\n uvs.setXY(14, d, C);\n uvs.setXY(15, c, B);\n uvs.setXY(16, c, C);\n uvs.setXY(17, d, C);\n\n // bottom\n uvs.setXY(18, b, B);\n uvs.setXY(19, a, B);\n uvs.setXY(20, b, C);\n uvs.setXY(21, a, B);\n uvs.setXY(22, a, C);\n uvs.setXY(23, b, C);\n\n // back\n uvs.setXY(24, c, B);\n uvs.setXY(25, b, B);\n uvs.setXY(26, c, C);\n uvs.setXY(27, b, B);\n uvs.setXY(28, b, C);\n uvs.setXY(29, c, C);\n\n // front\n uvs.setXY(30, b, A);\n uvs.setXY(31, b, B);\n uvs.setXY(32, c, A);\n uvs.setXY(33, b, B);\n uvs.setXY(34, c, B);\n uvs.setXY(35, c, A);\n\n // shamelessly copied from https://github.com/videojs/videojs-vr\n const material = new ShaderMaterial({\n uniforms : {\n mapped : { value: null },\n contCorrect: { value: 1 },\n faceWH : { value: new Vector2(1 / 3, 1 / 2) },\n vidWH : { value: new Vector2(1, 1) },\n },\n vertexShader : `\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.);\n}`,\n fragmentShader: `\nvarying vec2 vUv;\nuniform sampler2D mapped;\nuniform vec2 faceWH;\nuniform vec2 vidWH;\nuniform float contCorrect;\n\nconst float PI = 3.1415926535897932384626433832795;\n\nvoid main() {\n vec2 corner = vUv - mod(vUv, faceWH) + vec2(0, contCorrect / vidWH.y);\n vec2 faceWHadj = faceWH - vec2(0, contCorrect * 2. / vidWH.y);\n vec2 p = (vUv - corner) / faceWHadj - .5;\n vec2 q = ${this.config.equiangular ? '2. / PI * atan(2. * p) + .5' : 'p + .5'};\n vec2 eUv = corner + q * faceWHadj;\n gl_FragColor = texture2D(mapped, eUv);\n}`,\n });\n\n return new Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n const { texture } = textureData;\n\n mesh.material.uniforms.mapped.value?.dispose();\n mesh.material.uniforms.mapped.value = texture;\n mesh.material.uniforms.vidWH.value.set(texture.image.videoWidth, texture.image.videoHeight);\n\n this.__switchVideo(textureData.texture);\n }\n\n}\n"],"names":["AbstractVideoAdapter","psv","options","config","autoplay","muted","video","on","CONSTANTS","EVENTS","BEFORE_RENDER","destroy","off","__removeVideo","handleEvent","e","type","needsUpdate","loadTexture","panorama","source","Promise","reject","PSVError","getPlugin","__createVideo","__videoLoadPromise","then","texture","VideoTexture","__switchVideo","currentTime","duration","paused","volume","image","play","disposeTexture","textureData","pause","container","removeChild","dispose","src","document","createElement","crossOrigin","withCredentials","loop","playsinline","style","display","preload","appendChild","self","resolve","addEventListener","onLoaded","__videoBufferPromise","removeEventListener","onError","err","onBuffer","buffer","buffered","i","l","length","start","end","Math","min","AbstractAdapter","supportsTransition","supportsPreload","supportsDownload","CubemapVideoAdapter","equiangular","createMesh","scale","cubeSize","SPHERE_RADIUS","geometry","BoxGeometry","toNonIndexed","clearGroups","uvs","getAttribute","a","b","c","d","A","B","C","setXY","material","ShaderMaterial","uniforms","mapped","value","contCorrect","faceWH","Vector2","vidWH","vertexShader","fragmentShader","Mesh","setTexture","mesh","set","videoWidth","videoHeight","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EACA,IAAaA,oBAAb,gBAAA,UAAA,gBAAA,EAAA;EAAA,EAAA,cAAA,CAAA,oBAAA,EAAA,gBAAA,CAAA,CAAA;;IAME,SAAYC,oBAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,iBAAA,CAAA;;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,gBAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GAAA,QAAA,CAAA;EACEC,MAAAA,QAAQ,EAAE,KADZ;EAEEC,MAAAA,KAAK,uBAAKH,OAAL,IAAA,IAAA,GAAA,KAAA,CAAA,GAAKA,OAAO,CAAEE,QAAd,KAA0B,IAAA,GAAA,iBAAA,GAAA,KAAA;EAFjC,KAAA,EAGKF,OAHL,CAAA,CAAA;EAMA;EACJ;EACA;EACA;;MACI,KAAKI,CAAAA,KAAL,GAAa,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,UAAJ,CAASzB,QAAT,EAAmBc,QAAnB,CAAP,CAAA;EACD,GAAA;EAED;EACF;EACA;EAvJA,GAAA;;EAAA,EAAA,MAAA,CAwJEY,UAxJF,GAwJE,SAAA,UAAA,CAAWC,IAAX,EAAiBvE,WAAjB,EAA8B;EAAA,IAAA,IAAA,qBAAA,CAAA;;EAC5B,IAAA,IAAQV,OAAR,GAAoBU,WAApB,CAAQV,OAAR,CAAA;MAEA,CAAAiF,qBAAAA,GAAAA,IAAI,CAACb,QAAL,CAAcE,QAAd,CAAuBC,MAAvB,CAA8BC,KAA9B,KAAA,IAAA,GAAA,KAAA,CAAA,GAAA,qBAAA,CAAqC1D,OAArC,EAAA,CAAA;MACAmE,IAAI,CAACb,QAAL,CAAcE,QAAd,CAAuBC,MAAvB,CAA8BC,KAA9B,GAAsCxE,OAAtC,CAAA;MACAiF,IAAI,CAACb,QAAL,CAAcE,QAAd,CAAuBM,KAAvB,CAA6BJ,KAA7B,CAAmCU,GAAnC,CAAuClF,OAAO,CAACO,KAAR,CAAc4E,UAArD,EAAiEnF,OAAO,CAACO,KAAR,CAAc6E,WAA/E,CAAA,CAAA;;EAEA,IAAA,IAAA,CAAKlF,aAAL,CAAmBQ,WAAW,CAACV,OAA/B,CAAA,CAAA;KA/JJ,CAAA;;EAAA,EAAA,OAAA,mBAAA,CAAA;EAAA,CAAA,CAAyC5B,oBAAzC,EAAA;EAAa4E,oBAEJqC,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/cubemap.js b/dist/adapters/cubemap.js index c708e2c7a..62e952f21 100644 --- a/dist/adapters/cubemap.js +++ b/dist/adapters/cubemap.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.CubemapAdapter = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -208,14 +208,14 @@ } var cubeSize = photoSphereViewer.CONSTANTS.SPHERE_RADIUS * 2 * scale; - var geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize).scale(1, 1, -1); + var geometry = new three.BoxGeometry(cubeSize, cubeSize, cubeSize).scale(1, 1, -1); var materials = []; for (var i = 0; i < 6; i++) { - materials.push(new THREE.MeshBasicMaterial()); + materials.push(photoSphereViewer.AbstractAdapter.createOverlayMaterial()); } - return new THREE.Mesh(geometry, materials); + return new three.Mesh(geometry, materials); } /** * @override @@ -226,15 +226,30 @@ var texture = textureData.texture; for (var i = 0; i < 6; i++) { - 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].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]; + this.__setUniform(mesh, i, photoSphereViewer.AbstractAdapter.OVERLAY_UNIFORMS.panorama, texture[i]); + } + + this.setOverlay(mesh, null); + } + /** + * @override + */ + ; + + _proto.setOverlay = function setOverlay(mesh, textureData, opacity) { + for (var i = 0; i < 6; i++) { + this.__setUniform(mesh, i, photoSphereViewer.AbstractAdapter.OVERLAY_UNIFORMS.overlayOpacity, opacity); + + if (!textureData) { + this.__setUniform(mesh, i, photoSphereViewer.AbstractAdapter.OVERLAY_UNIFORMS.overlay, new three.Texture()); + } else { + this.__setUniform(mesh, i, photoSphereViewer.AbstractAdapter.OVERLAY_UNIFORMS.overlay, textureData.texture[i]); + } } } /** @@ -244,7 +259,8 @@ _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { for (var i = 0; i < 6; i++) { - mesh.material[i].opacity = opacity; + this.__setUniform(mesh, i, photoSphereViewer.AbstractAdapter.OVERLAY_UNIFORMS.globalOpacity, opacity); + mesh.material[i].transparent = opacity < 1; } } @@ -259,12 +275,29 @@ (_textureData$texture = textureData.texture) == null ? void 0 : _textureData$texture.forEach(function (texture) { return texture.dispose(); }); + } + /** + * @param {external:THREE.Mesh} mesh + * @param {number} index + * @param {string} uniform + * @param {*} value + * @private + */ + ; + + _proto.__setUniform = function __setUniform(mesh, index, uniform, value) { + if (mesh.material[index].uniforms[uniform].value instanceof three.Texture) { + mesh.material[index].uniforms[uniform].value.dispose(); + } + + mesh.material[index].uniforms[uniform].value = value; }; return CubemapAdapter; }(photoSphereViewer.AbstractAdapter); CubemapAdapter.id = 'cubemap'; CubemapAdapter.supportsDownload = false; + CubemapAdapter.supportsOverlay = true; 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 d58b29d5f..503f649cd 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 * @extends PSV.adapters.AbstractAdapter\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":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EAGA;EACA;;AACaA,MAAAA,UAAU,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,EAAnB;AACMC,MAAAA,YAAY,GAAG,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,QAAzB,EAAmC,MAAnC,EAA2C,OAA3C,EAArB;EAGP;EACA;EACA;EACA;EACA;;AACA,MAAaC,cAAb,gBAAA,UAAA,gBAAA,EAAA;EAAA,EAAA,cAAA,CAAA,cAAA,EAAA,gBAAA,CAAA,CAAA;;EAKE;EACF;EACA;EACA;IACE,SAAYC,cAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,gBAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GAAA,QAAA,CAAA;EACEC,MAAAA,aAAa,EAAE,KAAA;EADjB,KAAA,EAEKF,OA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AArB,CAA6B,UAAAiB,OAAO,EAAA;QAAA,OAAIA,OAAO,CAACmC,OAAR,EAAJ,CAAA;OAApC,CAAA,CAAA;KApKJ,CAAA;;EAAA,EAAA,OAAA,cAAA,CAAA;EAAA,CAAA,CAAoCK,iCAApC,EAAA;EAAa5E,eAEJ6E,KAAK;EAFD7E,eAGJ8E,mBAAmB;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"cubemap.js","sources":["../../src/adapters/cubemap/index.js"],"sourcesContent":["import { BoxGeometry, Mesh, Texture, Vector2 } 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 * @extends PSV.adapters.AbstractAdapter\n */\nexport class CubemapAdapter extends AbstractAdapter {\n\n static id = 'cubemap';\n static supportsDownload = false;\n static supportsOverlay = 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 */\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 BoxGeometry(cubeSize, cubeSize, cubeSize)\n .scale(1, 1, -1);\n\n const materials = [];\n for (let i = 0; i < 6; i++) {\n materials.push(AbstractAdapter.createOverlayMaterial());\n }\n\n return new 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 Vector2(0.5, 0.5);\n texture[i].rotation = Math.PI;\n }\n\n this.__setUniform(mesh, i, AbstractAdapter.OVERLAY_UNIFORMS.panorama, texture[i]);\n }\n\n this.setOverlay(mesh, null);\n }\n\n /**\n * @override\n */\n setOverlay(mesh, textureData, opacity) {\n for (let i = 0; i < 6; i++) {\n this.__setUniform(mesh, i, AbstractAdapter.OVERLAY_UNIFORMS.overlayOpacity, opacity);\n if (!textureData) {\n this.__setUniform(mesh, i, AbstractAdapter.OVERLAY_UNIFORMS.overlay, new Texture());\n }\n else {\n this.__setUniform(mesh, i, AbstractAdapter.OVERLAY_UNIFORMS.overlay, textureData.texture[i]);\n }\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n this.__setUniform(mesh, i, AbstractAdapter.OVERLAY_UNIFORMS.globalOpacity, 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 * @param {external:THREE.Mesh} mesh\n * @param {number} index\n * @param {string} uniform\n * @param {*} value\n * @private\n */\n __setUniform(mesh, index, uniform, value) {\n if (mesh.material[index].uniforms[uniform].value instanceof Texture) {\n mesh.material[index].uniforms[uniform].value.dispose();\n }\n mesh.material[index].uniforms[uniform].value = value;\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","BoxGeometry","materials","AbstractAdapter","createOverlayMaterial","Mesh","setTexture","mesh","textureData","center","Vector2","rotation","Math","PI","__setUniform","OVERLAY_UNIFORMS","setOverlay","opacity","overlayOpacity","overlay","Texture","setTextureOpacity","globalOpacity","material","transparent","disposeTexture","dispose","index","uniform","value","uniforms","id","supportsDownload","supportsOverlay"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EAGA;EACA;;AACaA,MAAAA,UAAU,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,EAAnB;AACMC,MAAAA,YAAY,GAAG,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,QAAzB,EAAmC,MAAnC,EAA2C,OAA3C,EAArB;EAGP;EACA;EACA;EACA;EACA;;AACA,MAAaC,cAAb,gBAAA,UAAA,gBAAA,EAAA;EAAA,EAAA,cAAA,CAAA,cAAA,EAAA,gBAAA,CAAA,CAAA;;EAME;EACF;EACA;EACA;IACE,SAAYC,cAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,gBAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GAAA,QAAA,CAAA;EACEC,MAAAA,aAA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,CAACgB,QAAL,CAAcI,KAAd,CAAA,CAAqBG,QAArB,CAA8BF,OAA9B,CAAA,CAAuCC,KAAvC,CAA6CH,OAA7C,EAAA,CAAA;EACD,KAAA;;MACDnB,IAAI,CAACgB,QAAL,CAAcI,KAAd,CAAA,CAAqBG,QAArB,CAA8BF,OAA9B,CAAA,CAAuCC,KAAvC,GAA+CA,KAA/C,CAAA;KAnMJ,CAAA;;EAAA,EAAA,OAAA,cAAA,CAAA;EAAA,CAAA,CAAoC1B,iCAApC,EAAA;EAAa1D,eAEJsF,KAAK;EAFDtF,eAGJuF,mBAAmB;EAHfvF,eAIJwF,kBAAkB;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/equirectangular-tiles.js b/dist/adapters/equirectangular-tiles.js index 8a651b8bd..e87448600 100644 --- a/dist/adapters/equirectangular-tiles.js +++ b/dist/adapters/equirectangular-tiles.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.EquirectangularTilesAdapter = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -201,8 +201,8 @@ ctx.textAlign = 'center'; ctx.textBaseline = 'middle'; ctx.fillText('⚠', canvas.width / 2, canvas.height / 2); - var texture = new THREE.CanvasTexture(canvas); - return new THREE.MeshBasicMaterial({ + var texture = new three.CanvasTexture(canvas); + return new three.MeshBasicMaterial({ map: texture }); } @@ -310,9 +310,9 @@ return tile.col + "x" + tile.row; } - var frustum = new THREE.Frustum(); - var projScreenMatrix = new THREE.Matrix4(); - var vertexPosition = new THREE.Vector3(); + var frustum = new three.Frustum(); + var projScreenMatrix = new three.Matrix4(); + var vertexPosition = new three.Vector3(); /** * @summary Adapter for tiled panoramas * @memberof PSV.adapters @@ -342,7 +342,7 @@ baseBlur: true }, options); - if (!photoSphereViewer.utils.isPowerOfTwo(_this.config.resolution)) { + if (!three.MathUtils.isPowerOfTwo(_this.config.resolution)) { throw new photoSphereViewer.PSVError('EquirectangularAdapter resolution must be power of two'); } @@ -386,7 +386,7 @@ * @private */ - _this.loader = new THREE.ImageLoader(); + _this.loader = new three.ImageLoader(); if (_this.psv.config.withCredentials) { _this.loader.setWithCredentials(true); @@ -496,7 +496,7 @@ return Promise.reject(new photoSphereViewer.PSVError("Panorama rows must not be greater than " + this.SPHERE_HORIZONTAL_SEGMENTS + ".")); } - if (!photoSphereViewer.utils.isPowerOfTwo(panorama.cols) || !photoSphereViewer.utils.isPowerOfTwo(panorama.rows)) { + if (!three.MathUtils.isPowerOfTwo(panorama.cols) || !three.MathUtils.isPowerOfTwo(panorama.rows)) { return Promise.reject(new photoSphereViewer.PSVError('Panorama cols and rows must be powers of 2.')); } @@ -537,7 +537,7 @@ scale = 1; } - var geometry = new THREE.SphereGeometry(photoSphereViewer.CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2).scale(-1, 1, 1).toNonIndexed(); + var geometry = new three.SphereGeometry(photoSphereViewer.CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2).scale(-1, 1, 1).toNonIndexed(); geometry.clearGroups(); var i = 0; var k = 0; // first row @@ -557,7 +557,7 @@ } geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone()); - return new THREE.Mesh(geometry, []); + return new three.Mesh(geometry, []); } /** * @summary Applies the base texture and starts the loading of tiles @@ -602,11 +602,11 @@ var material; if (texture) { - material = new THREE.MeshBasicMaterial({ + material = new three.MeshBasicMaterial({ map: texture }); } else { - material = new THREE.MeshBasicMaterial({ + material = new three.MeshBasicMaterial({ opacity: 0, transparent: true }); @@ -827,7 +827,7 @@ _this5.loader.load(url, resolve, undefined, reject); }).then(function (image) { if (!task.isCancelled()) { - var material = new THREE.MeshBasicMaterial({ + var material = new three.MeshBasicMaterial({ map: photoSphereViewer.utils.createTexture(image) }); diff --git a/dist/adapters/equirectangular-tiles.js.map b/dist/adapters/equirectangular-tiles.js.map index 2780cff86..b52c68dae 100644 --- a/dist/adapters/equirectangular-tiles.js.map +++ b/dist/adapters/equirectangular-tiles.js.map @@ -1 +1 @@ -{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/shared/Task.js","../../src/adapters/shared/Queue.js","../../src/adapters/shared/tiles-utils.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { SYSTEM, utils } from '../..';\n\n/**\n * @summary Generates an material for errored tiles\n * @memberOf PSV.adapters\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\nexport function buildErrorMaterial(width, height) {\n const canvas = document.createElement('canvas');\n canvas.width = width;\n canvas.height = height;\n\n const ctx = canvas.getContext('2d');\n\n ctx.fillStyle = '#333';\n ctx.fillRect(0, 0, canvas.width, canvas.height);\n ctx.font = `${canvas.width / 5}px serif`;\n ctx.fillStyle = '#a22';\n ctx.textAlign = 'center';\n ctx.textBaseline = 'middle';\n ctx.fillText('⚠', canvas.width / 2, canvas.height / 2);\n\n const texture = new THREE.CanvasTexture(canvas);\n return new THREE.MeshBasicMaterial({ map: texture });\n}\n\n/**\n * @summary Create the texture for the base image\n * @memberOf PSV.adapters\n * @param {HTMLImageElement} img\n * @param {boolean} blur\n * @param {function} getHeight\n * @return {external:THREE.Texture}\n * @private\n */\nexport function createBaseTexture(img, blur, getHeight) {\n if (blur || img.width > SYSTEM.maxTextureWidth) {\n const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width);\n\n const buffer = document.createElement('canvas');\n buffer.width = img.width * ratio;\n buffer.height = getHeight(img.width);\n\n const ctx = buffer.getContext('2d');\n if (blur) {\n ctx.filter = 'blur(1px)';\n }\n ctx.drawImage(img, 0, 0, buffer.width, buffer.height);\n\n return utils.createTexture(buffer);\n }\n\n return utils.createTexture(img);\n}\n\n/**\n * @summary Creates a wireframe geometry, for debug\n * @memberOf PSV.adapters\n * @param {THREE.BufferGeometry} geometry\n * @return {THREE.Object3D}\n * @private\n */\nexport function createWireFrame(geometry) {\n const wireframe = new THREE.WireframeGeometry(geometry);\n const line = new THREE.LineSegments(wireframe);\n line.material.depthTest = false;\n line.material.opacity = 0.25;\n line.material.transparent = true;\n return line;\n}\n\n/**\n * @summary Creates a small red sphere, for debug\n * @memberOf PSV.adapters\n * @return {THREE.Object3D}\n * @private\n */\nexport function createDot(x, y, z) {\n const geom = new THREE.SphereGeometry(0.1);\n const material = new THREE.MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new THREE.Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..';\nimport { Queue } from '../shared/Queue';\nimport { Task } from '../shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../shared/tiles-utils';\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {PSV.PanoData | PSV.PanoDataProvider} [basePanoData] - panoData configuration associated to low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n/* the faces of the top and bottom rows are made of a single triangle (3 vertices)\n * all other faces are made of two triangles (6 vertices)\n * bellow is the indexing of each face vertices\n *\n * first row faces:\n * ⋀\n * /0\\\n * / \\\n * / \\\n * /1 2\\\n * ¯¯¯¯¯¯¯¯¯\n *\n * other rows faces:\n * _________\n * |\\1 0|\n * |3\\ |\n * | \\ |\n * | \\ |\n * | \\ |\n * | \\2|\n * |4 5\\|\n * ¯¯¯¯¯¯¯¯¯\n *\n * last row faces:\n * _________\n * \\1 0/\n * \\ /\n * \\ /\n * \\2/\n * ⋁\n */\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nconst frustum = new THREE.Frustum();\nconst projScreenMatrix = new THREE.Matrix4();\nconst vertexPosition = new THREE.Vector3();\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularTilesAdapter extends EquirectangularAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n this.psv.config.useXmpData = false;\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n resolution : 64,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n this.NB_VERTICES_BY_FACE = 6;\n this.NB_VERTICES_BY_SMALL_FACE = 3;\n this.NB_VERTICES = 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.SPHERE_HORIZONTAL_SEGMENTS - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n this.NB_GROUPS = this.SPHERE_SEGMENTS * this.SPHERE_HORIZONTAL_SEGMENTS;\n\n /**\n * @member {PSV.adapters.Queue}\n * @private\n */\n this.queue = new Queue();\n\n /**\n * @type {Object}\n * @property {int} colSize - size in pixels of a column\n * @property {int} rowSize - size in pixels of a row\n * @property {int} facesByCol - number of mesh faces by column\n * @property {int} facesByRow - number of mesh faces by row\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.SphereGeometry} geom\n * @property {external:THREE.MeshBasicMaterial[]} materials\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n colSize : 0,\n rowSize : 0,\n facesByCol : 0,\n facesByRow : 0,\n tiles : {},\n geom : null,\n materials : [],\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.prop.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.prop.materials.length = 0;\n }\n\n /**\n * @override\n */\n supportsTransition(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n */\n supportsPreload(panorama) {\n return !!panorama.baseUrl;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.cols > this.SPHERE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama cols must not be greater than ${this.SPHERE_SEGMENTS}.`));\n }\n if (panorama.rows > this.SPHERE_HORIZONTAL_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama rows must not be greater than ${this.SPHERE_HORIZONTAL_SEGMENTS}.`));\n }\n if (!utils.isPowerOfTwo(panorama.cols) || !utils.isPowerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.width / 2,\n croppedWidth : panorama.width,\n croppedHeight: panorama.width / 2,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl, panorama.basePanoData)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n panoData: panoData,\n }));\n }\n else {\n return Promise.resolve({ panorama, panoData });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1)\n .toNonIndexed();\n\n geometry.clearGroups();\n let i = 0;\n let k = 0;\n // first row\n for (; i < this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n // second to before last rows\n for (; i < this.NB_VERTICES - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_FACE, k++);\n }\n // last row\n for (; i < this.NB_VERTICES; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new THREE.Mesh(geometry, []);\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData, transition) {\n const { panorama, texture } = textureData;\n\n if (transition) {\n this.__setTexture(mesh, texture);\n return;\n }\n\n this.__cleanup();\n this.__setTexture(mesh, texture);\n\n this.prop.materials = mesh.material;\n this.prop.geom = mesh.geometry;\n this.prop.geom.setAttribute(ATTR_UV, this.prop.geom.getAttribute(ATTR_ORIGINAL_UV).clone());\n\n this.prop.colSize = panorama.width / panorama.cols;\n this.prop.rowSize = panorama.width / 2 / panorama.rows;\n this.prop.facesByCol = this.SPHERE_SEGMENTS / panorama.cols;\n this.prop.facesByRow = this.SPHERE_HORIZONTAL_SEGMENTS / panorama.rows;\n\n // this.psv.renderer.scene.add(createWireFrame(this.prop.geom));\n\n setTimeout(() => this.__refresh(true));\n }\n\n /**\n * @private\n */\n __setTexture(mesh, texture) {\n let material;\n if (texture) {\n material = new THREE.MeshBasicMaterial({ map: texture });\n }\n else {\n material = new THREE.MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let i = 0; i < this.NB_GROUPS; i++) {\n mesh.material.push(material);\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material[0].opacity = opacity;\n mesh.material[0].transparent = opacity < 1;\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @param {boolean} [init=false] Indicates initial call\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let col = 0; col < panorama.cols; col++) {\n for (let row = 0; row < panorama.rows; row++) {\n // for each tile, find the vertices corresponding to the four corners (three for first and last rows)\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n\n const verticesIndex = [];\n\n if (row === 0) {\n // bottom-left\n const v0 = this.prop.facesByRow === 1\n ? col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.prop.facesByRow - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 4;\n\n // bottom-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE + 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top (all vertices are equal)\n const v2 = 0;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // bottom-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else if (row === panorama.rows - 1) {\n // top-left\n const v0 = this.prop.facesByRow === 1\n ? -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE - 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n // bottom (all vertices are equal)\n const v2 = this.NB_VERTICES - 1;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else {\n // top-left\n const v0 = -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // bottom-left\n const v1 = v0 + (this.prop.facesByRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE + 3;\n\n // bottom-right\n const v2 = v1 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v3 = v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v3 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // center-center\n const v8 = v6 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v8);\n }\n }\n }\n\n // if (init && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n let angle = vertexPosition.angleTo(this.psv.prop.direction);\n if (row === 0 || row === panorama.rows - 1) {\n angle *= 2; // lower priority to top and bottom tiles\n }\n tilesToLoad.push({ col, row, angle });\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n const url = panorama.tileUrl(tile.col, tile.row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({ map: utils.createTexture(image) });\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n if (!this.prop.errorMaterial) {\n this.prop.errorMaterial = buildErrorMaterial(this.prop.colSize, this.prop.rowSize);\n }\n this.__swapMaterial(tile.col, tile.row, this.prop.errorMaterial);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(col, row, material) {\n const uvs = this.prop.geom.getAttribute(ATTR_UV);\n\n for (let c = 0; c < this.prop.facesByCol; c++) {\n for (let r = 0; r < this.prop.facesByRow; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByCol + c;\n const faceRow = row * this.prop.facesByRow + r;\n const isFirstRow = faceRow === 0;\n const isLastRow = faceRow === (this.SPHERE_HORIZONTAL_SEGMENTS - 1);\n\n // first vertex for this face (3 or 6 vertices in total)\n let firstVertex;\n if (isFirstRow) {\n firstVertex = faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else if (isLastRow) {\n firstVertex = this.NB_VERTICES\n - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + faceCol * this.NB_VERTICES_BY_SMALL_FACE;\n }\n else {\n firstVertex = this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (faceRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + faceCol * this.NB_VERTICES_BY_FACE;\n }\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.prop.materials[matIndex] = material;\n\n // define new uvs\n const top = 1 - r / this.prop.facesByRow;\n const bottom = 1 - (r + 1) / this.prop.facesByRow;\n const left = c / this.prop.facesByCol;\n const right = (c + 1) / this.prop.facesByCol;\n\n if (isFirstRow) {\n uvs.setXY(firstVertex, (left + right) / 2, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, bottom);\n }\n else if (isLastRow) {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, (left + right) / 2, bottom);\n }\n else {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, right, bottom);\n uvs.setXY(firstVertex + 3, left, top);\n uvs.setXY(firstVertex + 4, left, bottom);\n uvs.setXY(firstVertex + 5, right, bottom);\n }\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Create the texture for the base image\n * @param {HTMLImageElement} img\n * @return {external:THREE.Texture}\n * @private\n */\n __createBaseTexture(img) {\n if (img.width !== img.height * 2) {\n utils.logWarn('Invalid base image, the width should be twice the height');\n }\n\n return createBaseTexture(img, this.config.baseBlur, w => w / 2);\n }\n\n}\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","DISABLED","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","disableAllTasks","keys","length","nextTask","filter","sort","a","b","pop","buildErrorMaterial","width","height","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","texture","THREE","CanvasTexture","MeshBasicMaterial","map","createBaseTexture","img","blur","getHeight","SYSTEM","maxTextureWidth","ratio","Math","min","getMaxCanvasWidth","buffer","drawImage","utils","createTexture","ATTR_UV","ATTR_ORIGINAL_UV","ATTR_POSITION","tileId","tile","col","row","frustum","Frustum","projScreenMatrix","Matrix4","vertexPosition","Vector3","EquirectangularTilesAdapter","psv","options","config","useXmpData","resolution","showErrorTile","baseBlur","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","cols","rows","tileUrl","Promise","reject","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","basePanoData","textureData","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","opacity","transparent","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v4","v6","v7","v3","v5","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","rotation","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createBaseTexture","logWarn","w","EquirectangularAdapter","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA,IAAaA,IAAb,gBAAA,YAAA;EAWE;EACF;EACA;EACA;EACA;EACE,EAAA,SA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;QAAA,OAAIA,CAAC,GAAG,CAAR,CAAA;EAAA,KAA7B,CAAxB,CAAA;KAhlBJ,CAAA;;EAAA,EAAA,OAAA,2BAAA,CAAA;EAAA,CAAA,CAAiDC,wCAAjD,EAAA;EAAa9J,4BAEJlF,KAAK;EAFDkF,4BAGJ+J,mBAAmB;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/shared/Task.js","../../src/adapters/shared/Queue.js","../../src/adapters/shared/tiles-utils.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters\n * @private\n */\nexport class Task {\n\n static STATUS = {\n DISABLED : -1,\n PENDING : 0,\n RUNNING : 1,\n CANCELLED: 2,\n DONE : 3,\n ERROR : 4,\n };\n\n /**\n * @param {string} id\n * @param {number} priority\n * @param {function(Task): Promise} fn\n */\n constructor(id, priority, fn) {\n this.id = id;\n this.priority = priority;\n this.fn = fn;\n this.status = Task.STATUS.PENDING;\n }\n\n start() {\n this.status = Task.STATUS.RUNNING;\n return this.fn(this)\n .then(() => {\n this.status = Task.STATUS.DONE;\n }, () => {\n this.status = Task.STATUS.ERROR;\n });\n }\n\n cancel() {\n this.status = Task.STATUS.CANCELLED;\n }\n\n isCancelled() {\n return this.status === Task.STATUS.CANCELLED;\n }\n\n}\n","import { Task } from './Task';\n\n/**\n * @summary Loading queue\n * @memberOf PSV.adapters\n * @private\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency = 4) {\n this.concurency = concurency;\n this.runningTasks = {};\n this.tasks = {};\n }\n\n enqueue(task) {\n this.tasks[task.id] = task;\n }\n\n clear() {\n Object.values(this.tasks).forEach(task => task.cancel());\n this.tasks = {};\n this.runningTasks = {};\n }\n\n setPriority(taskId, priority) {\n const task = this.tasks[taskId];\n if (task) {\n task.priority = priority;\n if (task.status === Task.STATUS.DISABLED) {\n task.status = Task.STATUS.PENDING;\n }\n }\n }\n\n disableAllTasks() {\n Object.values(this.tasks).forEach((task) => {\n task.status = Task.STATUS.DISABLED;\n });\n }\n\n start() {\n if (Object.keys(this.runningTasks).length >= this.concurency) {\n return;\n }\n\n const nextTask = Object.values(this.tasks)\n .filter(task => task.status === Task.STATUS.PENDING)\n .sort((a, b) => b.priority - a.priority)\n .pop();\n\n if (nextTask) {\n this.runningTasks[nextTask.id] = true;\n\n nextTask.start()\n .then(() => {\n if (!nextTask.isCancelled()) {\n delete this.tasks[nextTask.id];\n delete this.runningTasks[nextTask.id];\n this.start();\n }\n });\n\n this.start(); // start tasks until max concurrency is reached\n }\n }\n\n}\n","import { CanvasTexture, LineSegments, Mesh, MeshBasicMaterial, SphereGeometry, WireframeGeometry } 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 CanvasTexture(canvas);\n return new 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 WireframeGeometry(geometry);\n const line = new 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 SphereGeometry(0.1);\n const material = new MeshBasicMaterial({ color: 0xff0000 });\n const mesh = new Mesh(geom, material);\n mesh.position.set(x, y, z);\n return mesh;\n}\n","import { Frustum, ImageLoader, MathUtils, Matrix4, Mesh, MeshBasicMaterial, SphereGeometry, Vector3 } from 'three';\nimport { CONSTANTS, EquirectangularAdapter, PSVError, utils } from '../..';\nimport { Queue } from '../shared/Queue';\nimport { Task } from '../shared/Task';\nimport { buildErrorMaterial, createBaseTexture } from '../shared/tiles-utils';\n\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {PSV.PanoData | PSV.PanoDataProvider} [basePanoData] - panoData configuration associated to low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {float} angle\n */\n\n/* the faces of the top and bottom rows are made of a single triangle (3 vertices)\n * all other faces are made of two triangles (6 vertices)\n * bellow is the indexing of each face vertices\n *\n * first row faces:\n * ⋀\n * /0\\\n * / \\\n * / \\\n * /1 2\\\n * ¯¯¯¯¯¯¯¯¯\n *\n * other rows faces:\n * _________\n * |\\1 0|\n * |3\\ |\n * | \\ |\n * | \\ |\n * | \\ |\n * | \\2|\n * |4 5\\|\n * ¯¯¯¯¯¯¯¯¯\n *\n * last row faces:\n * _________\n * \\1 0/\n * \\ /\n * \\ /\n * \\2/\n * ⋁\n */\n\nconst ATTR_UV = 'uv';\nconst ATTR_ORIGINAL_UV = 'originaluv';\nconst ATTR_POSITION = 'position';\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nconst frustum = new Frustum();\nconst projScreenMatrix = new Matrix4();\nconst vertexPosition = new Vector3();\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularTilesAdapter extends EquirectangularAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n this.psv.config.useXmpData = false;\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n resolution : 64,\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n if (!MathUtils.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 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 (!MathUtils.isPowerOfTwo(panorama.cols) || !MathUtils.isPowerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.width / 2,\n croppedWidth : panorama.width,\n croppedHeight: panorama.width / 2,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n if (panorama.baseUrl) {\n return super.loadTexture(panorama.baseUrl, panorama.basePanoData)\n .then(textureData => ({\n panorama: panorama,\n texture : textureData.texture,\n panoData: panoData,\n }));\n }\n else {\n return Promise.resolve({ panorama, panoData });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1)\n .toNonIndexed();\n\n geometry.clearGroups();\n let i = 0;\n let k = 0;\n // first row\n for (; i < this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n // second to before last rows\n for (; i < this.NB_VERTICES - this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE; i += this.NB_VERTICES_BY_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_FACE, k++);\n }\n // last row\n for (; i < this.NB_VERTICES; i += this.NB_VERTICES_BY_SMALL_FACE) {\n geometry.addGroup(i, this.NB_VERTICES_BY_SMALL_FACE, k++);\n }\n\n geometry.setAttribute(ATTR_ORIGINAL_UV, geometry.getAttribute(ATTR_UV).clone());\n\n return new 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 MeshBasicMaterial({ map: texture });\n }\n else {\n material = new MeshBasicMaterial({ opacity: 0, transparent: true });\n }\n\n for (let i = 0; i < this.NB_GROUPS; i++) {\n mesh.material.push(material);\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material[0].opacity = opacity;\n mesh.material[0].transparent = opacity < 1;\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @param {boolean} [init=false] Indicates initial call\n * @private\n */\n __refresh(init = false) { // eslint-disable-line no-unused-vars\n if (!this.prop.geom) {\n return;\n }\n\n const camera = this.psv.renderer.camera;\n camera.updateMatrixWorld();\n projScreenMatrix.multiplyMatrices(camera.projectionMatrix, camera.matrixWorldInverse);\n frustum.setFromProjectionMatrix(projScreenMatrix);\n\n const panorama = this.psv.config.panorama;\n const verticesPosition = this.prop.geom.getAttribute(ATTR_POSITION);\n const tilesToLoad = [];\n\n for (let col = 0; col < panorama.cols; col++) {\n for (let row = 0; row < panorama.rows; row++) {\n // for each tile, find the vertices corresponding to the four corners (three for first and last rows)\n // if at least one vertex is visible, the tile must be loaded\n // for larger tiles we also test the four edges centers and the tile center\n\n const verticesIndex = [];\n\n if (row === 0) {\n // bottom-left\n const v0 = this.prop.facesByRow === 1\n ? col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + (this.prop.facesByRow - 2) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 4;\n\n // bottom-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE + 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top (all vertices are equal)\n const v2 = 0;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // bottom-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 - this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else if (row === panorama.rows - 1) {\n // top-left\n const v0 = this.prop.facesByRow === 1\n ? -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_SMALL_FACE + 1\n : -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v1 = this.prop.facesByRow === 1\n ? v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_SMALL_FACE - 1\n : v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n // bottom (all vertices are equal)\n const v2 = this.NB_VERTICES - 1;\n\n verticesIndex.push(v0, v1, v2);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v1 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n }\n }\n else {\n // top-left\n const v0 = -this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_SMALL_FACE\n + row * this.prop.facesByRow * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE\n + col * this.prop.facesByCol * this.NB_VERTICES_BY_FACE + 1;\n\n // bottom-left\n const v1 = v0 + (this.prop.facesByRow - 1) * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE + 3;\n\n // bottom-right\n const v2 = v1 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE + 1;\n\n // top-right\n const v3 = v0 + (this.prop.facesByCol - 1) * this.NB_VERTICES_BY_FACE - 1;\n\n verticesIndex.push(v0, v1, v2, v3);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // top-center\n const v4 = v0 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n // bottom-center\n const v5 = v1 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v4, v5);\n }\n\n if (this.prop.facesByRow >= this.SPHERE_HORIZONTAL_SEGMENTS / 4) {\n // left-center\n const v6 = v0 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n // right-center\n const v7 = v3 + this.prop.facesByRow / 2 * this.SPHERE_SEGMENTS * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v6, v7);\n\n if (this.prop.facesByCol >= this.SPHERE_SEGMENTS / 8) {\n // center-center\n const v8 = v6 + this.prop.facesByCol / 2 * this.NB_VERTICES_BY_FACE;\n\n verticesIndex.push(v8);\n }\n }\n }\n\n // if (init && col === 0 && row === 0) {\n // verticesIndex.forEach((vertexIdx) => {\n // this.psv.renderer.scene.add(createDot(\n // verticesPosition.getX(vertexIdx),\n // verticesPosition.getY(vertexIdx),\n // verticesPosition.getZ(vertexIdx)\n // ));\n // });\n // }\n\n const vertexVisible = verticesIndex.some((vertexIdx) => {\n vertexPosition.set(\n verticesPosition.getX(vertexIdx),\n verticesPosition.getY(vertexIdx),\n verticesPosition.getZ(vertexIdx)\n );\n vertexPosition.applyEuler(this.psv.renderer.meshContainer.rotation);\n return frustum.containsPoint(vertexPosition);\n });\n\n if (vertexVisible) {\n let angle = vertexPosition.angleTo(this.psv.prop.direction);\n if (row === 0 || row === panorama.rows - 1) {\n angle *= 2; // lower priority to top and bottom tiles\n }\n tilesToLoad.push({ col, row, angle });\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Loads tiles and change existing tiles priority\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles\n * @private\n */\n __loadTiles(tiles) {\n this.queue.disableAllTasks();\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, tile.angle);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, tile.angle, task => this.__loadTile(tile, task)));\n }\n });\n\n this.queue.start();\n }\n\n /**\n * @summary Loads and draw a tile\n * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile\n * @param {PSV.adapters.Task} task\n * @return {Promise}\n * @private\n */\n __loadTile(tile, task) {\n const panorama = this.psv.config.panorama;\n const url = panorama.tileUrl(tile.col, tile.row);\n\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders(url));\n }\n\n return new Promise((resolve, reject) => {\n this.loader.load(url, resolve, undefined, reject);\n })\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new 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","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","MathUtils","isPowerOfTwo","PSVError","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","NB_VERTICES_BY_FACE","NB_VERTICES_BY_SMALL_FACE","NB_VERTICES","NB_GROUPS","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","materials","errorMaterial","loader","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","dispose","handleEvent","e","type","__refresh","mat","supportsTransition","panorama","baseUrl","supportsPreload","loadTexture","cols","rows","tileUrl","Promise","reject","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","basePanoData","textureData","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","clearGroups","i","k","addGroup","setAttribute","getAttribute","clone","Mesh","setTexture","mesh","transition","__setTexture","material","setTimeout","opacity","transparent","push","setTextureOpacity","init","camera","renderer","updateMatrixWorld","multiplyMatrices","projectionMatrix","matrixWorldInverse","setFromProjectionMatrix","verticesPosition","tilesToLoad","verticesIndex","v0","v1","v2","v4","v6","v7","v3","v5","v8","vertexVisible","some","vertexIdx","set","getX","getY","getZ","applyEuler","meshContainer","rotation","containsPoint","angle","angleTo","direction","__loadTiles","__loadTile","url","load","undefined","image","__swapMaterial","needsUpdate","catch","uvs","c","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","find","g","materialIndex","top","bottom","left","right","setXY","__createBaseTexture","logWarn","w","EquirectangularAdapter","supportsDownload"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA,IAAaA,IAAb,gBAAA,YAAA;EAWE;EACF;EACA;EACA;EACA;EACE,EAAA,SAAA,IAAA,CAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;MAC5B,IAAKF,CAAAA,EAAL,GAAUA,EAAV,CAAA;MACA,IAAKC,CAAAA,QAAL,GAAgBA,QAAhB,CAAA;MACA,IAAKC,CAAAA,EAAL,GAAUA,EAAV,CAAA;EACA,IAAA,IAAA,CAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B,CAAA;EACD,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A,CAAA;YACAd,GAAG,CAACiB,KAAJ,CAAUV,WAAW,GAAG,CAAxB,EAA2BS,KAA3B,EAAkCF,MAAlC,CAAA,CAAA;EACD,SAAA;EAnD0C,OAAA,CAAA;;EAC7C,MAAA,KAAK,IAAIZ,CAAC,GAAG,CAAb,EAAgBA,CAAC,GAAG,IAAK1H,CAAAA,IAAL,CAAUI,UAA9B,EAA0CsH,CAAC,EAA3C,EAA+C;EAAA,QAAA,KAAA,CAAtCA,CAAsC,CAAA,CAAA;EAmD9C,OAAA;EACF,KAAA;;MAEDF,GAAG,CAACF,WAAJ,GAAkB,IAAlB,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EACA;EACA;EA1kBA,GAAA;;EAAA,EAAA,MAAA,CA2kBEoB,mBA3kBF,GA2kBE,SAAoBtL,mBAAAA,CAAAA,GAApB,EAAyB;MACvB,IAAIA,GAAG,CAAClB,KAAJ,KAAckB,GAAG,CAACjB,MAAJ,GAAa,CAA/B,EAAkC;QAChC4B,uBAAK,CAAC4K,OAAN,CAAc,0DAAd,CAAA,CAAA;EACD,KAAA;;MAED,OAAOxL,iBAAiB,CAACC,GAAD,EAAM,IAAA,CAAK6B,MAAL,CAAYI,QAAlB,EAA4B,UAAAuJ,CAAC,EAAA;QAAA,OAAIA,CAAC,GAAG,CAAR,CAAA;EAAA,KAA7B,CAAxB,CAAA;KAhlBJ,CAAA;;EAAA,EAAA,OAAA,2BAAA,CAAA;EAAA,CAAA,CAAiDC,wCAAjD,EAAA;EAAa/J,4BAEJjF,KAAK;EAFDiF,4BAGJgK,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/equirectangular-video.js b/dist/adapters/equirectangular-video.js index ab0a8f261..29103ec3a 100644 --- a/dist/adapters/equirectangular-video.js +++ b/dist/adapters/equirectangular-video.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.EquirectangularVideoAdapter = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -149,7 +149,7 @@ var video = this.__createVideo(panorama.source); return this.__videoLoadPromise(video).then(function () { - var texture = new THREE.VideoTexture(video); + var texture = new three.VideoTexture(video); return { panorama: panorama, texture: texture @@ -336,7 +336,7 @@ resolution: 64 }, options)) || this; - if (!photoSphereViewer.utils.isPowerOfTwo(_this.config.resolution)) { + if (!three.MathUtils.isPowerOfTwo(_this.config.resolution)) { throw new photoSphereViewer.PSVError('EquirectangularVideoAdapter resolution must be power of two'); } @@ -385,9 +385,9 @@ scale = 1; } - var geometry = new THREE.SphereGeometry(photoSphereViewer.CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2).scale(-1, 1, 1); - var material = new THREE.MeshBasicMaterial(); - return new THREE.Mesh(geometry, material); + var geometry = new three.SphereGeometry(photoSphereViewer.CONSTANTS.SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2).scale(-1, 1, 1); + var material = new three.MeshBasicMaterial(); + return new three.Mesh(geometry, material); } /** * @override diff --git a/dist/adapters/equirectangular-video.js.map b/dist/adapters/equirectangular-video.js.map index 950e01189..ce6c220b6 100644 --- a/dist/adapters/equirectangular-video.js.map +++ b/dist/adapters/equirectangular-video.js.map @@ -1 +1 @@ -{"version":3,"file":"equirectangular-video.js","sources":["../../src/adapters/shared/AbstractVideoAdapter.js","../../src/adapters/equirectangular-video/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError } from '../..';\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n */\n\n/**\n * @summary Base video adapters class\n * @memberof PSV.adapters\n * @abstract\n * @private\n */\nexport class AbstractVideoAdapter extends AbstractAdapter {\n\n static supportsTransition = false;\n static supportsPreload = false;\n static supportsDownload = false;\n\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.AbstractVideoAdapter.Options}\n * @private\n */\n this.config = {\n autoplay: false,\n muted : options?.autoplay ?? false,\n ...options,\n };\n\n /**\n * @member {HTMLVideoElement}\n * @private\n */\n this.video = null;\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.__removeVideo();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n if (this.video) {\n this.psv.needsUpdate();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {PSV.adapters.AbstractVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.source) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n\n if (!this.psv.getPlugin('video')) {\n return Promise.reject(new PSVError('Video adapters require VideoPlugin to be loaded too.'));\n }\n\n const video = this.__createVideo(panorama.source);\n\n return this.__videoLoadPromise(video)\n .then(() => {\n const texture = new THREE.VideoTexture(video);\n return { panorama, texture };\n });\n }\n\n /**\n * @override\n */\n __switchVideo(texture) {\n let currentTime;\n let duration;\n let paused = !this.config.autoplay;\n let muted = this.config.muted;\n let volume = 1;\n if (this.video) {\n ({ currentTime, duration, paused, muted, volume } = this.video);\n }\n\n this.__removeVideo();\n this.video = texture.image;\n\n // keep current time when switching resolution\n if (this.video.duration === duration) {\n this.video.currentTime = currentTime;\n }\n\n // keep volume\n this.video.muted = muted;\n this.video.volume = volume;\n\n // play\n if (!paused) {\n this.video.play();\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n if (textureData.texture) {\n const video = textureData.texture.image;\n video.pause();\n this.psv.container.removeChild(video);\n }\n textureData.texture?.dispose();\n }\n\n /**\n * @summary Removes the current video element\n * @private\n */\n __removeVideo() {\n if (this.video) {\n this.video.pause();\n this.psv.container.removeChild(this.video);\n delete this.video;\n }\n }\n\n /**\n * @summary Creates a new video element\n * @memberOf PSV.adapters\n * @param {string} src\n * @return {HTMLVideoElement}\n * @private\n */\n __createVideo(src) {\n const video = document.createElement('video');\n video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous';\n video.loop = true;\n video.playsinline = true;\n video.style.display = 'none';\n video.muted = this.config.muted;\n video.src = src;\n video.preload = 'metadata';\n\n this.psv.container.appendChild(video);\n\n return video;\n }\n\n /**\n * @private\n */\n __videoLoadPromise(video) {\n const self = this;\n\n return new Promise((resolve, reject) => {\n video.addEventListener('loadedmetadata', function onLoaded() {\n if (this.video && video.duration === this.video.duration) {\n resolve(self.__videoBufferPromise(video, this.video.currentTime));\n }\n else {\n resolve();\n }\n video.removeEventListener('loadedmetadata', onLoaded);\n });\n\n video.addEventListener('error', function onError(err) {\n reject(err);\n video.removeEventListener('error', onError);\n });\n });\n }\n\n /**\n * @private\n */\n __videoBufferPromise(video, currentTime) {\n return new Promise((resolve) => {\n function onBuffer() {\n const buffer = video.buffered;\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= video.currentTime && buffer.end(i) >= video.currentTime) {\n video.pause();\n video.removeEventListener('buffer', onBuffer);\n video.removeEventListener('progress', onBuffer);\n resolve();\n break;\n }\n }\n }\n\n // try to reduce the switching time by preloading in advance\n // FIXME find a better way ?\n video.currentTime = Math.min(currentTime + 2000, video.duration.currentTime);\n video.muted = true;\n\n video.addEventListener('buffer', onBuffer);\n video.addEventListener('progress', onBuffer);\n\n video.play();\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { AbstractVideoAdapter } from '../shared/AbstractVideoAdapter';\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular videos\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularVideoAdapter extends AbstractVideoAdapter {\n\n static id = 'equirectangular-video';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularVideoAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv, {\n resolution: 64,\n ...options,\n });\n\n if (!utils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularVideoAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n return super.loadTexture(panorama)\n .then(({ texture }) => {\n const video = texture.image;\n const panoData = {\n fullWidth : video.videoWidth,\n fullHeight : video.videoHeight,\n croppedWidth : video.videoWidth,\n croppedHeight: video.videoHeight,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new THREE.MeshBasicMaterial();\n\n return new THREE.Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n\n this.__switchVideo(textureData.texture);\n }\n\n}\n"],"names":["AbstractVideoAdapter","psv","options","config","autoplay","muted","video","on","CONSTANTS","EVENTS","BEFORE_RENDER","destroy","off","__removeVideo","handleEvent","e","type","needsUpdate","loadTexture","panorama","source","Promise","reject","PSVError","getPlugin","__createVideo","__videoLoadPromise","then","texture","THREE","VideoTexture","__switchVideo","currentTime","duration","paused","volume","image","play","disposeTexture","textureData","pause","container","removeChild","dispose","src","document","createElement","crossOrigin","withCredentials","loop","playsinline","style","display","preload","appendChild","self","resolve","addEventListener","onLoaded","__videoBufferPromise","removeEventListener","onError","err","onBuffer","buffer","buffered","i","l","length","start","end","Math","min","AbstractAdapter","supportsTransition","supportsPreload","supportsDownload","EquirectangularVideoAdapter","resolution","utils","isPowerOfTwo","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","panoData","fullWidth","videoWidth","fullHeight","videoHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","material","MeshBasicMaterial","Mesh","setTexture","mesh","map","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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W,CAJI,CAAA,CAMdJ,KANc,CAMR,CAAC,CANO,EAMJ,CANI,EAMD,CANC,CAAjB,CAAA;EAQA,IAAA,IAAMK,QAAQ,GAAG,IAAIxE,KAAK,CAACyE,iBAAV,EAAjB,CAAA;MAEA,OAAO,IAAIzE,KAAK,CAAC0E,IAAV,CAAeN,QAAf,EAAyBI,QAAzB,CAAP,CAAA;EACD,GAAA;EAED;EACF;EACA;EAlEA,GAAA;;EAAA,EAAA,MAAA,CAmEEG,UAnEF,GAmEE,SAAA,UAAA,CAAWC,IAAX,EAAiBlE,WAAjB,EAA8B;EAAA,IAAA,IAAA,kBAAA,CAAA;;EAC5B,IAAA,CAAA,kBAAA,GAAAkE,IAAI,CAACJ,QAAL,CAAcK,GAAd,wCAAmB/D,OAAnB,EAAA,CAAA;EACA8D,IAAAA,IAAI,CAACJ,QAAL,CAAcK,GAAd,GAAoBnE,WAAW,CAACX,OAAhC,CAAA;;EAEA,IAAA,IAAA,CAAKG,aAAL,CAAmBQ,WAAW,CAACX,OAA/B,CAAA,CAAA;KAvEJ,CAAA;;EAAA,EAAA,OAAA,2BAAA,CAAA;EAAA,CAAA,CAAiD5B,oBAAjD,EAAA;EAAa6E,4BAEJ8B,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"equirectangular-video.js","sources":["../../src/adapters/shared/AbstractVideoAdapter.js","../../src/adapters/equirectangular-video/index.js"],"sourcesContent":["import { VideoTexture } from 'three';\nimport { AbstractAdapter, CONSTANTS, PSVError } from '../..';\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.AbstractVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n */\n\n/**\n * @summary Base video adapters class\n * @memberof PSV.adapters\n * @abstract\n * @private\n */\nexport class AbstractVideoAdapter extends AbstractAdapter {\n\n static supportsTransition = false;\n static supportsPreload = false;\n static supportsDownload = false;\n\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.AbstractVideoAdapter.Options}\n * @private\n */\n this.config = {\n autoplay: false,\n muted : options?.autoplay ?? false,\n ...options,\n };\n\n /**\n * @member {HTMLVideoElement}\n * @private\n */\n this.video = null;\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.__removeVideo();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n if (this.video) {\n this.psv.needsUpdate();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {PSV.adapters.AbstractVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.source) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n\n if (!this.psv.getPlugin('video')) {\n return Promise.reject(new PSVError('Video adapters require VideoPlugin to be loaded too.'));\n }\n\n const video = this.__createVideo(panorama.source);\n\n return this.__videoLoadPromise(video)\n .then(() => {\n const texture = new VideoTexture(video);\n return { panorama, texture };\n });\n }\n\n /**\n * @override\n */\n __switchVideo(texture) {\n let currentTime;\n let duration;\n let paused = !this.config.autoplay;\n let muted = this.config.muted;\n let volume = 1;\n if (this.video) {\n ({ currentTime, duration, paused, muted, volume } = this.video);\n }\n\n this.__removeVideo();\n this.video = texture.image;\n\n // keep current time when switching resolution\n if (this.video.duration === duration) {\n this.video.currentTime = currentTime;\n }\n\n // keep volume\n this.video.muted = muted;\n this.video.volume = volume;\n\n // play\n if (!paused) {\n this.video.play();\n }\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n if (textureData.texture) {\n const video = textureData.texture.image;\n video.pause();\n this.psv.container.removeChild(video);\n }\n textureData.texture?.dispose();\n }\n\n /**\n * @summary Removes the current video element\n * @private\n */\n __removeVideo() {\n if (this.video) {\n this.video.pause();\n this.psv.container.removeChild(this.video);\n delete this.video;\n }\n }\n\n /**\n * @summary Creates a new video element\n * @memberOf PSV.adapters\n * @param {string} src\n * @return {HTMLVideoElement}\n * @private\n */\n __createVideo(src) {\n const video = document.createElement('video');\n video.crossOrigin = this.psv.config.withCredentials ? 'use-credentials' : 'anonymous';\n video.loop = true;\n video.playsinline = true;\n video.style.display = 'none';\n video.muted = this.config.muted;\n video.src = src;\n video.preload = 'metadata';\n\n this.psv.container.appendChild(video);\n\n return video;\n }\n\n /**\n * @private\n */\n __videoLoadPromise(video) {\n const self = this;\n\n return new Promise((resolve, reject) => {\n video.addEventListener('loadedmetadata', function onLoaded() {\n if (this.video && video.duration === this.video.duration) {\n resolve(self.__videoBufferPromise(video, this.video.currentTime));\n }\n else {\n resolve();\n }\n video.removeEventListener('loadedmetadata', onLoaded);\n });\n\n video.addEventListener('error', function onError(err) {\n reject(err);\n video.removeEventListener('error', onError);\n });\n });\n }\n\n /**\n * @private\n */\n __videoBufferPromise(video, currentTime) {\n return new Promise((resolve) => {\n function onBuffer() {\n const buffer = video.buffered;\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= video.currentTime && buffer.end(i) >= video.currentTime) {\n video.pause();\n video.removeEventListener('buffer', onBuffer);\n video.removeEventListener('progress', onBuffer);\n resolve();\n break;\n }\n }\n }\n\n // try to reduce the switching time by preloading in advance\n // FIXME find a better way ?\n video.currentTime = Math.min(currentTime + 2000, video.duration.currentTime);\n video.muted = true;\n\n video.addEventListener('buffer', onBuffer);\n video.addEventListener('progress', onBuffer);\n\n video.play();\n });\n }\n\n}\n","import { MathUtils, Mesh, MeshBasicMaterial, SphereGeometry } from 'three';\nimport { CONSTANTS, PSVError } from '../..';\nimport { AbstractVideoAdapter } from '../shared/AbstractVideoAdapter';\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Video\n * @summary Object defining a video\n * @property {string} source\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularVideoAdapter.Options\n * @property {boolean} [autoplay=false] - automatically start the video\n * @property {boolean} [muted=autoplay] - initially mute the video\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular videos\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularVideoAdapter extends AbstractVideoAdapter {\n\n static id = 'equirectangular-video';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularVideoAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv, {\n resolution: 64,\n ...options,\n });\n\n if (!MathUtils.isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularVideoAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularVideoAdapter.Video} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n return super.loadTexture(panorama)\n .then(({ texture }) => {\n const video = texture.image;\n const panoData = {\n fullWidth : video.videoWidth,\n fullHeight : video.videoHeight,\n croppedWidth : video.videoWidth,\n croppedHeight: video.videoHeight,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n };\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new SphereGeometry(\n CONSTANTS.SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new MeshBasicMaterial();\n\n return new Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n\n this.__switchVideo(textureData.texture);\n }\n\n}\n"],"names":["AbstractVideoAdapter","psv","options","config","autoplay","muted","video","on","CONSTANTS","EVENTS","BEFORE_RENDER","destroy","off","__removeVideo","handleEvent","e","type","needsUpdate","loadTexture","panorama","source","Promise","reject","PSVError","getPlugin","__createVideo","__videoLoadPromise","then","texture","VideoTexture","__switchVideo","currentTime","duration","paused","volume","image","play","disposeTexture","textureData","pause","container","removeChild","dispose","src","document","createElement","crossOrigin","withCredentials","loop","playsinline","style","display","preload","appendChild","self","resolve","addEventListener","onLoaded","__videoBufferPromise","removeEventListener","onError","err","onBuffer","buffer","buffered","i","l","length","start","end","Math","min","AbstractAdapter","supportsTransition","supportsPreload","supportsDownload","EquirectangularVideoAdapter","resolution","MathUtils","isPowerOfTwo","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","panoData","fullWidth","videoWidth","fullHeight","videoHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","material","MeshBasicMaterial","Mesh","setTexture","mesh","map","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EACA,IAAaA,oBAAb,gBAAA,UAAA,gBAAA,EAAA;EAAA,EAAA,cAAA,CAAA,oBAAA,EAAA,gBAAA,CAAA,CAAA;;IAME,SAAYC,oBAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,iBAAA,CAAA;;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,gBAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GA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,IAAI,CAACJ,QAAL,CAAcK,GAAd,GAAoBnE,WAAW,CAACV,OAAhC,CAAA;;EAEA,IAAA,IAAA,CAAKE,aAAL,CAAmBQ,WAAW,CAACV,OAA/B,CAAA,CAAA;KAvEJ,CAAA;;EAAA,EAAA,OAAA,2BAAA,CAAA;EAAA,CAAA,CAAiD5B,oBAAjD,EAAA;EAAa4E,4BAEJ8B,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/adapters/little-planet.d.ts b/dist/adapters/little-planet.d.ts new file mode 100644 index 000000000..094c04f23 --- /dev/null +++ b/dist/adapters/little-planet.d.ts @@ -0,0 +1,12 @@ +import { AbstractAdapter, Viewer } from 'photo-sphere-viewer'; + +/** + * @summary Adapter for equirectangular panoramas displayed with little planet effect + */ +declare class LittlePlanetAdapter extends AbstractAdapter { + + constructor(psv: Viewer); + +} + +export { LittlePlanetAdapter }; diff --git a/dist/adapters/little-planet.js b/dist/adapters/little-planet.js new file mode 100644 index 000000000..0d5448355 --- /dev/null +++ b/dist/adapters/little-planet.js @@ -0,0 +1,209 @@ +/*! +* Photo Sphere Viewer 4.7.1 +* @copyright 2014-2015 Jérémy Heleine +* @copyright 2015-2022 Damien "Mistic" Sorel +* @licence MIT (https://opensource.org/licenses/MIT) +*/ +(function (global, factory) { + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : + typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.LittlePlanetAdapter = {}), global.THREE, global.PhotoSphereViewer)); +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + return _setPrototypeOf(o, p); + } + + function _assertThisInitialized(self) { + if (self === void 0) { + throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); + } + + return self; + } + + photoSphereViewer.DEFAULTS.moveSpeed = 2; + var AXIS_X = new three.Vector3(1, 0, 0); + var AXIS_Y = new three.Vector3(0, 1, 0); + /** + * @summary Adapter for equirectangular panoramas displayed with little planet effect + * @memberof PSV.adapters + * @extends PSV.adapters.AbstractAdapter + */ + + var LittlePlanetAdapter = /*#__PURE__*/function (_EquirectangularAdapt) { + _inheritsLoose(LittlePlanetAdapter, _EquirectangularAdapt); + + /** + * @param {PSV.Viewer} psv + */ + function LittlePlanetAdapter(psv) { + var _this; + + _this = _EquirectangularAdapt.call(this, psv) || this; + _this.psv.prop.littlePlanet = true; + _this.prop = { + quatA: new three.Quaternion(), + quatB: new three.Quaternion(), + quatC: new three.Quaternion(), + position: { + longitude: 0, + latitude: 0 + } + }; + + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.SIZE_UPDATED, _assertThisInitialized(_this)); + + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED, _assertThisInitialized(_this)); + + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.POSITION_UPDATED, _assertThisInitialized(_this)); + + return _this; + } + /** + * @override + */ + + + var _proto = LittlePlanetAdapter.prototype; + + _proto.supportsTransition = function supportsTransition() { + return false; + } + /** + * @override + */ + ; + + _proto.supportsPreload = function supportsPreload() { + return true; + } + /** + * @private + */ + ; + + _proto.handleEvent = function handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + case photoSphereViewer.CONSTANTS.EVENTS.SIZE_UPDATED: + this.__setResolution(e.args[0]); + + break; + + case photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED: + this.__setZoom(e.args[0]); + + break; + + case photoSphereViewer.CONSTANTS.EVENTS.POSITION_UPDATED: + this.__setPosition(e.args[0]); + + break; + } + /* eslint-enable */ + + } + /** + * @param {PSV.Size} size + * @private + */ + ; + + _proto.__setResolution = function __setResolution(size) { + this.uniforms.resolution.value = size.width / size.height; + } + /** + * @param {integer} zoom + * @private + */ + ; + + _proto.__setZoom = function __setZoom(zoom) { + this.uniforms.zoom.value = three.MathUtils.mapLinear(zoom, 0, 100, 50, 2); + } + /** + * @param {PSV.Position} position + * @private + */ + ; + + _proto.__setPosition = function __setPosition(position) { + this.prop.quatA.setFromAxisAngle(AXIS_Y, this.prop.position.longitude - position.longitude); + this.prop.quatB.setFromAxisAngle(AXIS_X, -this.prop.position.latitude + position.latitude); + this.prop.quatC.multiply(this.prop.quatA).multiply(this.prop.quatB); + this.uniforms.transform.value.makeRotationFromQuaternion(this.prop.quatC); + this.prop.position = position; + } + /** + * @override + */ + ; + + _proto.createMesh = function createMesh() { + var geometry = new three.PlaneBufferGeometry(20, 10).translate(0, 0, -1); // this one was copied from https://github.com/pchen66/panolens.js + + var material = new three.ShaderMaterial({ + uniforms: { + tDiffuse: { + value: new three.Texture() + }, + resolution: { + value: 2.0 + }, + transform: { + value: new three.Matrix4() + }, + zoom: { + value: 10.0 + }, + opacity: { + value: 1.0 + } + }, + vertexShader: "\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = vec4( position, 1.0 );\n}", + fragmentShader: "\nuniform sampler2D tDiffuse;\nuniform float resolution;\nuniform mat4 transform;\nuniform float zoom;\nuniform float opacity;\n\nvarying vec2 vUv;\n\nconst float PI = 3.1415926535897932384626433832795;\n\nvoid main() {\n vec2 position = -1.0 + 2.0 * vUv;\n position *= vec2( zoom * resolution, zoom * 0.5 );\n\n float x2y2 = position.x * position.x + position.y * position.y;\n vec3 sphere_pnt = vec3( 2. * position, x2y2 - 1. ) / ( x2y2 + 1. );\n sphere_pnt = vec3( transform * vec4( sphere_pnt, 1.0 ) );\n\n vec2 sampleUV = vec2(\n (atan(sphere_pnt.y, sphere_pnt.x) / PI + 1.0) * 0.5,\n (asin(sphere_pnt.z) / PI + 0.5)\n );\n\n gl_FragColor = texture2D( tDiffuse, sampleUV );\n gl_FragColor.a *= opacity;\n}" + }); + this.uniforms = material.uniforms; + + this.__setPosition({ + longitude: this.psv.config.defaultLong, + latitude: this.psv.config.defaultLat + }); + + this.__setZoom(this.psv.config.defaultZoomLvl); + + return new three.Mesh(geometry, material); + } + /** + * @override + */ + ; + + _proto.setTexture = function setTexture(mesh, textureData) { + mesh.material.uniforms.tDiffuse.value.dispose(); + mesh.material.uniforms.tDiffuse.value = textureData.texture; + }; + + return LittlePlanetAdapter; + }(photoSphereViewer.EquirectangularAdapter); + LittlePlanetAdapter.id = 'little-planet'; + LittlePlanetAdapter.supportsDownload = true; + + exports.LittlePlanetAdapter = LittlePlanetAdapter; + + Object.defineProperty(exports, '__esModule', { value: true }); + +})); +//# sourceMappingURL=little-planet.js.map diff --git a/dist/adapters/little-planet.js.map b/dist/adapters/little-planet.js.map new file mode 100644 index 000000000..df3fa787a --- /dev/null +++ b/dist/adapters/little-planet.js.map @@ -0,0 +1 @@ +{"version":3,"file":"little-planet.js","sources":["../../src/adapters/little-planet/index.js"],"sourcesContent":["import { MathUtils, Matrix4, Mesh, PlaneBufferGeometry, Quaternion, ShaderMaterial, Texture, Vector3 } from 'three';\nimport { CONSTANTS, DEFAULTS, EquirectangularAdapter } from '../..';\n\n\nDEFAULTS.moveSpeed = 2;\n\nconst AXIS_X = new Vector3(1, 0, 0);\nconst AXIS_Y = new Vector3(0, 1, 0);\n\n\n/**\n * @summary Adapter for equirectangular panoramas displayed with little planet effect\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class LittlePlanetAdapter extends EquirectangularAdapter {\n\n static id = 'little-planet';\n static supportsDownload = true;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n this.psv.prop.littlePlanet = true;\n\n this.prop = {\n quatA : new Quaternion(),\n quatB : new Quaternion(),\n quatC : new Quaternion(),\n position: { longitude: 0, latitude: 0 },\n };\n\n this.psv.on(CONSTANTS.EVENTS.SIZE_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n }\n\n /**\n * @override\n */\n supportsTransition() {\n return false;\n }\n\n /**\n * @override\n */\n supportsPreload() {\n return true;\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.SIZE_UPDATED:\n this.__setResolution(e.args[0]);\n break;\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__setZoom(e.args[0]);\n break;\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n this.__setPosition(e.args[0]);\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @param {PSV.Size} size\n * @private\n */\n __setResolution(size) {\n this.uniforms.resolution.value = size.width / size.height;\n }\n\n /**\n * @param {integer} zoom\n * @private\n */\n __setZoom(zoom) {\n this.uniforms.zoom.value = MathUtils.mapLinear(zoom, 0, 100, 50, 2);\n }\n\n /**\n * @param {PSV.Position} position\n * @private\n */\n __setPosition(position) {\n this.prop.quatA.setFromAxisAngle(AXIS_Y, this.prop.position.longitude - position.longitude);\n this.prop.quatB.setFromAxisAngle(AXIS_X, -this.prop.position.latitude + position.latitude);\n this.prop.quatC.multiply(this.prop.quatA).multiply(this.prop.quatB);\n this.uniforms.transform.value.makeRotationFromQuaternion(this.prop.quatC);\n this.prop.position = position;\n }\n\n /**\n * @override\n */\n createMesh() {\n const geometry = new PlaneBufferGeometry(20, 10)\n .translate(0, 0, -1);\n\n // this one was copied from https://github.com/pchen66/panolens.js\n const material = new ShaderMaterial({\n uniforms: {\n tDiffuse : { value: new Texture() },\n resolution: { value: 2.0 },\n transform : { value: new Matrix4() },\n zoom : { value: 10.0 },\n opacity : { value: 1.0 },\n },\n\n vertexShader: `\nvarying vec2 vUv;\nvoid main() {\n vUv = uv;\n gl_Position = vec4( position, 1.0 );\n}`,\n\n fragmentShader: `\nuniform sampler2D tDiffuse;\nuniform float resolution;\nuniform mat4 transform;\nuniform float zoom;\nuniform float opacity;\n\nvarying vec2 vUv;\n\nconst float PI = 3.1415926535897932384626433832795;\n\nvoid main() {\n vec2 position = -1.0 + 2.0 * vUv;\n position *= vec2( zoom * resolution, zoom * 0.5 );\n\n float x2y2 = position.x * position.x + position.y * position.y;\n vec3 sphere_pnt = vec3( 2. * position, x2y2 - 1. ) / ( x2y2 + 1. );\n sphere_pnt = vec3( transform * vec4( sphere_pnt, 1.0 ) );\n\n vec2 sampleUV = vec2(\n (atan(sphere_pnt.y, sphere_pnt.x) / PI + 1.0) * 0.5,\n (asin(sphere_pnt.z) / PI + 0.5)\n );\n\n gl_FragColor = texture2D( tDiffuse, sampleUV );\n gl_FragColor.a *= opacity;\n}`,\n });\n\n this.uniforms = material.uniforms;\n\n this.__setPosition({\n longitude: this.psv.config.defaultLong,\n latitude : this.psv.config.defaultLat,\n });\n\n this.__setZoom(this.psv.config.defaultZoomLvl);\n\n return new Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.uniforms.tDiffuse.value.dispose();\n mesh.material.uniforms.tDiffuse.value = textureData.texture;\n }\n\n}\n"],"names":["DEFAULTS","moveSpeed","AXIS_X","Vector3","AXIS_Y","LittlePlanetAdapter","psv","prop","littlePlanet","quatA","Quaternion","quatB","quatC","position","longitude","latitude","on","CONSTANTS","EVENTS","SIZE_UPDATED","ZOOM_UPDATED","POSITION_UPDATED","supportsTransition","supportsPreload","handleEvent","e","type","__setResolution","args","__setZoom","__setPosition","size","uniforms","resolution","value","width","height","zoom","MathUtils","mapLinear","setFromAxisAngle","multiply","transform","makeRotationFromQuaternion","createMesh","geometry","PlaneBufferGeometry","translate","material","ShaderMaterial","tDiffuse","Texture","Matrix4","opacity","vertexShader","fragmentShader","config","defaultLong","defaultLat","defaultZoomLvl","Mesh","setTexture","mesh","textureData","disp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P,CAAA;EACD,GAAA;EAED;EACF;EACA;EAzJA,GAAA;;EAAA,EAAA,MAAA,CA0JEa,UA1JF,GA0JE,SAAA,UAAA,CAAWC,IAAX,EAAiBC,WAAjB,EAA8B;MAC5BD,IAAI,CAACd,QAAL,CAAchB,QAAd,CAAuBkB,QAAvB,CAAgChB,KAAhC,CAAsC8B,OAAtC,EAAA,CAAA;MACAF,IAAI,CAACd,QAAL,CAAchB,QAAd,CAAuBkB,QAAvB,CAAgChB,KAAhC,GAAwC6B,WAAW,CAACE,OAApD,CAAA;KA5JJ,CAAA;;EAAA,EAAA,OAAA,mBAAA,CAAA;EAAA,CAAA,CAAyCC,wCAAzC,EAAA;EAAa7D,oBAEJ8D,KAAK;EAFD9D,oBAGJ+D,mBAAmB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index baf42fdc7..4cfd64d21 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @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 32a74f32b..5261897c0 100644 --- a/dist/photo-sphere-viewer.d.ts +++ b/dist/photo-sphere-viewer.d.ts @@ -270,6 +270,8 @@ type PanoramaOptions = (ExtendedPosition | {}) & { zoom?: number; sphereCorrection?: SphereCorrection; panoData?: PanoData | PanoDataProvider; + overlay?: any; + overlayOpacity?: number; }; /** @@ -305,7 +307,7 @@ type NavbarCustomButton = { title?: string; content?: string; className?: string; - onClick: () => void; + onClick: (Viewer) => void; disabled?: boolean; visible?: boolean; collapsable?: boolean; @@ -484,26 +486,6 @@ declare class Animation implements PromiseLike { cancel(); - /** - * @deprecated does not accept a rejection handler anymore - */ - then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; - - /** - * @deprecated not supported anymore - */ - catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; - - /** - * @deprecated not supported anymore - */ - finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; - - /** - * @deprecated not supported anymore - */ - static resolve(): Animation; - } declare const index_d_toggleClass: typeof toggleClass; @@ -967,6 +949,8 @@ type ViewerOptions = { container: HTMLElement | string; panorama?: any; adapter?: AdapterConstructor | [AdapterConstructor, any]; + overlay?: any; + overlayOpacity?: number; caption?: string; description?: string; downloadUrl?: string; @@ -1130,6 +1114,11 @@ declare class Viewer extends EventEmitter { */ setPanorama(panorama: any, options?: PanoramaOptions): Promise; + /** + * @summary Loads a new overlay + */ + setOverlay(path: any, opacity?: number): Promise; + /** * @summary Update options */ @@ -1352,6 +1341,11 @@ declare abstract class AbstractAdapter { */ static supportsDownload: boolean; + /** + * @summary Indicated if the adapter can display an additional transparent image above the panorama + */ + static supportsOverlay: boolean; + constructor(parent: Viewer); /** @@ -1372,7 +1366,7 @@ declare abstract class AbstractAdapter { /** * @summary Loads the panorama texture(s) */ - loadTexture(panorama: T, newPanoData?: PanoData | PanoDataProvider): Promise; + loadTexture(panorama: T, newPanoData?: PanoData | PanoDataProvider, useXmpPanoData?: boolean): Promise; /** * @summary Creates the cube mesh @@ -1395,6 +1389,11 @@ declare abstract class AbstractAdapter { */ disposeTexture(textureData: TextureData); + /** + * @summary Applies the overlay to the mesh + */ + setOverlay(mesh: Mesh, textureData: TextureData, opacity: number); + } type AdapterConstructor> = new (psv: Viewer, options?: any) => T; diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index 110a6c3eb..f823457c8 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('uevent')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'uevent'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global.PhotoSphereViewer = {}, global.THREE, global.uEvent)); -})(this, (function (exports, THREE, uevent) { 'use strict'; +})(this, (function (exports, three, uevent) { 'use strict'; /** * @summary Custom error used in the lib @@ -55,6 +55,11 @@ * @static */ + /** + * @summary Indicated if the adapter can display an additional transparent image above the panorama + * @type {boolean} + */ + /** * @param {PSV.Viewer} psv */ @@ -103,11 +108,12 @@ * @summary Loads the panorama texture(s) * @param {*} panorama * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @param {boolean} [useXmpPanoData] * @returns {Promise.} */ ; - _proto.loadTexture = function loadTexture(panorama, newPanoData) { + _proto.loadTexture = function loadTexture(panorama, newPanoData, useXmpPanoData) { // eslint-disable-line no-unused-vars throw new PSVError('loadTexture not implemented'); } @@ -160,12 +166,57 @@ _proto.disposeTexture = function disposeTexture(textureData) { // eslint-disable-line no-unused-vars throw new PSVError('disposeTexture not implemented'); + } + /** + * @abstract + * @summary Applies the overlay to the mesh + * @param {external:THREE.Mesh} mesh + * @param {PSV.TextureData} textureData + * @param {number} opacity + */ + ; + + _proto.setOverlay = function setOverlay(mesh, textureData, opacity) { + // eslint-disable-line no-unused-vars + throw new PSVError('setOverlay not implemented'); + } + /** + * @internal + */ + ; + + /** + * @internal + */ + AbstractAdapter.createOverlayMaterial = function createOverlayMaterial() { + var _uniforms; + + return new three.ShaderMaterial({ + uniforms: (_uniforms = {}, _uniforms[AbstractAdapter.OVERLAY_UNIFORMS.panorama] = { + value: new three.Texture() + }, _uniforms[AbstractAdapter.OVERLAY_UNIFORMS.overlay] = { + value: new three.Texture() + }, _uniforms[AbstractAdapter.OVERLAY_UNIFORMS.globalOpacity] = { + value: 1.0 + }, _uniforms[AbstractAdapter.OVERLAY_UNIFORMS.overlayOpacity] = { + value: 1.0 + }, _uniforms), + vertexShader: "\nvarying vec2 vUv;\n\nvoid main() {\n vUv = uv;\n gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );\n}", + fragmentShader: "\nuniform sampler2D " + AbstractAdapter.OVERLAY_UNIFORMS.panorama + ";\nuniform sampler2D " + AbstractAdapter.OVERLAY_UNIFORMS.overlay + ";\nuniform float " + AbstractAdapter.OVERLAY_UNIFORMS.globalOpacity + ";\nuniform float " + AbstractAdapter.OVERLAY_UNIFORMS.overlayOpacity + ";\n\nvarying vec2 vUv;\n\nvoid main() {\n vec4 tColor1 = texture2D( " + AbstractAdapter.OVERLAY_UNIFORMS.panorama + ", vUv );\n vec4 tColor2 = texture2D( " + AbstractAdapter.OVERLAY_UNIFORMS.overlay + ", vUv );\n gl_FragColor = vec4( \n mix( tColor1.rgb, tColor2.rgb, tColor2.a * " + AbstractAdapter.OVERLAY_UNIFORMS.overlayOpacity + " ), \n " + AbstractAdapter.OVERLAY_UNIFORMS.globalOpacity + "\n );\n}" + }); }; return AbstractAdapter; }(); AbstractAdapter.id = null; AbstractAdapter.supportsDownload = false; + AbstractAdapter.supportsOverlay = false; + AbstractAdapter.OVERLAY_UNIFORMS = { + panorama: 'panorama', + overlay: 'overlay', + globalOpacity: 'globalOpacity', + overlayOpacity: 'overlayOpacity' + }; function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { @@ -939,7 +990,7 @@ function toggleClass(element, className, active) { if (active === undefined) { element.classList.toggle(className); - } else if (active && !element.classList.contains(className)) { + } else if (active) { element.classList.add(className); } else if (!active) { element.classList.remove(className); @@ -953,11 +1004,9 @@ */ function addClasses(element, className) { - if (className) { - className.split(' ').forEach(function (name) { - toggleClass(element, name, true); - }); - } + var _element$classList; + + (_element$classList = element.classList).add.apply(_element$classList, className.split(' ')); } /** * @summary Removes one or several CSS classes to an element @@ -967,11 +1016,9 @@ */ function removeClasses(element, className) { - if (className) { - className.split(' ').forEach(function (name) { - toggleClass(element, name, false); - }); - } + var _element$classList2; + + (_element$classList2 = element.classList).remove.apply(_element$classList2, className.split(' ')); } /** * @summary Searches if an element has a particular parent at any level including itself @@ -1164,15 +1211,11 @@ } /** - * @summary Ensures that a number is in a given interval - * @memberOf PSV.utils - * @param {number} x - * @param {number} min - * @param {number} max - * @returns {number} + * @deprecated use THREE.MathUtils.clamp */ + function bound(x, min, max) { - return Math.max(min, Math.min(max, x)); + return three.MathUtils.clamp(x, min, max); } /** * @summary Ensure a value is within 0 and `max` @@ -1191,28 +1234,11 @@ return result; } /** - * @summary Checks if a value is an integer - * @memberOf PSV.utils - * @param {*} value - * @returns {boolean} - */ - - function isInteger(value) { - if (Number.isInteger) { - return Number.isInteger(value); - } - - return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value; - } - /** - * @summary Tests if a number is power of two - * @memberOf PSV.utils - * @param {number} x - * @return {boolean} + * @deprecated Use THREE.MathUtils.isPowerOfTwo */ function isPowerOfTwo(x) { - return Math.log(x) / Math.log(2) % 1 === 0; + return three.MathUtils.isPowerOfTwo(x); } /** * @summary Computes the sum of an array @@ -1712,20 +1738,15 @@ * @summary Parse a CSS-like position into an array of position keywords among top, bottom, left, right and center * @memberOf PSV.utils * @param {string | string[]} value - * @param {string} defaultValue * @param {boolean} [allowCenter=true] * @return {string[]} */ - function cleanPosition(value, defaultValue, allowCenter) { + function cleanPosition(value, allowCenter) { if (allowCenter === void 0) { allowCenter = true; } - if (!value) { - return defaultValue.split(' '); - } - if (typeof value === 'string') { var tempPos = parsePosition(value); @@ -1770,7 +1791,7 @@ case 'degrees per minute': case 'dps': case 'degrees per second': - parsed = THREE.MathUtils.degToRad(speedValue); + parsed = three.MathUtils.degToRad(speedValue); break; // Radians per minute / second @@ -1834,7 +1855,7 @@ switch (unit) { case 'deg': case 'degs': - parsed = THREE.MathUtils.degToRad(value); + parsed = three.MathUtils.degToRad(value); break; case 'rad': @@ -1855,7 +1876,7 @@ } parsed = loop(zeroCenter ? parsed + Math.PI : parsed, Math.PI * 2); - return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed; + return zeroCenter ? three.MathUtils.clamp(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed; } /** * @summary Creates a THREE texture from an image @@ -1865,13 +1886,13 @@ */ function createTexture(img) { - var texture = new THREE.Texture(img); + var texture = new three.Texture(img); texture.needsUpdate = true; - texture.minFilter = THREE.LinearFilter; + texture.minFilter = three.LinearFilter; texture.generateMipmaps = false; return texture; } - var quaternion = new THREE.Quaternion(); + var quaternion = new three.Quaternion(); /** * @summary Applies the inverse of Euler angles to a vector * @memberOf PSV.utils @@ -2014,26 +2035,13 @@ /** * @summary Promise chaining * @param {Function} [onFulfilled] - Called when the animation is complete (true) or cancelled (false) - * @param {Function} [onRejected] - deprecated * @returns {Promise} */ ; - _proto.then = function then(onFulfilled, onRejected) { + _proto.then = function then(onFulfilled) { var _this3 = this; - if (onFulfilled === void 0) { - onFulfilled = null; - } - - if (onRejected === void 0) { - onRejected = null; - } - - if (onRejected) { - logWarn('Animation#then does not accept a rejection handler anymore'); - } - if (this.__resolved || this.__cancelled) { return Promise.resolve(this.__resolved).then(onFulfilled); } @@ -2063,32 +2071,6 @@ this.__animationFrame = null; } } - } - /** - * @deprecated not supported anymore - */ - ; - - _proto.catch = function _catch() { - logWarn('Animation#catch is not supported anymore'); - return this.then(); - } - /** - * @deprecated not supported anymore - */ - ; - - _proto.finally = function _finally(onFinally) { - logWarn('Animation#finally is not supported anymore'); - return this.then(onFinally); - } - /** - * @deprecated not supported anymore - */ - ; - - Animation.resolve = function resolve() { - logWarn('Animation.resolve is not supported anymore'); }; return Animation; @@ -2217,7 +2199,7 @@ } this.mode = Dynamic.POSITION; - this.target = this.loopValue ? loop(position, this.max) : bound(position, this.min, this.max); + this.target = this.loopValue ? loop(position, this.max) : three.MathUtils.clamp(position, this.min, this.max); this.speedMult = speedMult; } /** @@ -2273,7 +2255,7 @@ ; _proto.setValue = function setValue(value) { - this.target = this.loopValue ? loop(value, this.max) : bound(value, this.min, this.max); + this.target = this.loopValue ? loop(value, this.max) : three.MathUtils.clamp(value, this.min, this.max); this.mode = Dynamic.STOP; if (this.target !== this.current) { @@ -2332,7 +2314,7 @@ if (next !== null) { - next = this.loopValue ? loop(next, this.max) : bound(next, this.min, this.max); + next = this.loopValue ? loop(next, this.max) : three.MathUtils.clamp(next, this.min, this.max); if (next !== this.current) { this.current = next; @@ -2797,7 +2779,6 @@ normalizeWheel: normalizeWheel, bound: bound, loop: loop, - isInteger: isInteger, isPowerOfTwo: isPowerOfTwo, sum: sum, distance: distance, @@ -2863,7 +2844,7 @@ resolution: 64 }, options); - if (!isPowerOfTwo(_this.config.resolution)) { + if (!three.MathUtils.isPowerOfTwo(_this.config.resolution)) { throw new PSVError('EquirectangularAdapter resolution must be power of two'); } @@ -2893,13 +2874,18 @@ * @override * @param {string} panorama * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @param {boolean} [useXmpPanoData] * @returns {Promise.} */ ; - _proto.loadTexture = function loadTexture(panorama, newPanoData) { + _proto.loadTexture = function loadTexture(panorama, newPanoData, useXmpPanoData) { var _this2 = this; + if (useXmpPanoData === void 0) { + useXmpPanoData = this.psv.config.useXmpData; + } + if (typeof panorama !== 'string') { if (Array.isArray(panorama) || typeof panorama === 'object' && !!panorama.left) { logWarn('Cubemap support now requires an additional adapter, see https://photo-sphere-viewer.js.org/guide/adapters'); @@ -2908,14 +2894,7 @@ return Promise.reject(new PSVError('Invalid panorama url, are you using the right adapter?')); } - return (!this.psv.config.useXmpData ? this.psv.textureLoader.loadImage(panorama, function (p) { - return _this2.psv.loader.setProgress(p); - }).then(function (img) { - return { - img: img, - xmpPanoData: null - }; - }) : this.__loadXMP(panorama, function (p) { + return (useXmpPanoData ? this.__loadXMP(panorama, function (p) { return _this2.psv.loader.setProgress(p); }).then(function (xmpPanoData) { return _this2.psv.textureLoader.loadImage(panorama).then(function (img) { @@ -2924,6 +2903,13 @@ xmpPanoData: xmpPanoData }; }); + }) : this.psv.textureLoader.loadImage(panorama, function (p) { + return _this2.psv.loader.setProgress(p); + }).then(function (img) { + return { + img: img, + xmpPanoData: null + }; })).then(function (_ref) { var _newPanoData, _newPanoData2, _newPanoData3, _newPanoData4, _newPanoData5, _newPanoData6, _newPanoData7, _newPanoData8, _newPanoData9; @@ -3066,9 +3052,9 @@ } // The middle of the panorama is placed at longitude=0 - var geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2).scale(-1, 1, 1); - var material = new THREE.MeshBasicMaterial(); - return new THREE.Mesh(geometry, material); + var geometry = new three.SphereGeometry(SPHERE_RADIUS * scale, this.SPHERE_SEGMENTS, this.SPHERE_HORIZONTAL_SEGMENTS, -Math.PI / 2).scale(-1, 1, 1); + var material = AbstractAdapter.createOverlayMaterial(); + return new three.Mesh(geometry, material); } /** * @override @@ -3076,10 +3062,23 @@ ; _proto.setTexture = function setTexture(mesh, textureData) { - var _mesh$material$map; + this.__setUniform(mesh, AbstractAdapter.OVERLAY_UNIFORMS.panorama, textureData.texture); - (_mesh$material$map = mesh.material.map) == null ? void 0 : _mesh$material$map.dispose(); - mesh.material.map = textureData.texture; + this.setOverlay(mesh, null); + } + /** + * @override + */ + ; + + _proto.setOverlay = function setOverlay(mesh, textureData, opacity) { + this.__setUniform(mesh, AbstractAdapter.OVERLAY_UNIFORMS.overlayOpacity, opacity); + + if (!textureData) { + this.__setUniform(mesh, AbstractAdapter.OVERLAY_UNIFORMS.overlay, new three.Texture()); + } else { + this.__setUniform(mesh, AbstractAdapter.OVERLAY_UNIFORMS.overlay, textureData.texture); + } } /** * @override @@ -3087,7 +3086,8 @@ ; _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { - mesh.material.opacity = opacity; + this.__setUniform(mesh, AbstractAdapter.OVERLAY_UNIFORMS.globalOpacity, opacity); + mesh.material.transparent = opacity < 1; } /** @@ -3099,12 +3099,28 @@ var _textureData$texture; (_textureData$texture = textureData.texture) == null ? void 0 : _textureData$texture.dispose(); + } + /** + * @param {external:THREE.Mesh} mesh + * @param {string} uniform + * @param {*} value + * @private + */ + ; + + _proto.__setUniform = function __setUniform(mesh, uniform, value) { + if (mesh.material.uniforms[uniform].value instanceof three.Texture) { + mesh.material.uniforms[uniform].value.dispose(); + } + + mesh.material.uniforms[uniform].value = value; }; return EquirectangularAdapter; }(AbstractAdapter); EquirectangularAdapter.id = 'equirectangular'; EquirectangularAdapter.supportsDownload = true; + EquirectangularAdapter.supportsOverlay = true; /** * @namespace PSV.components @@ -3691,7 +3707,7 @@ _proto.onClick = function onClick() { if (this.config.onClick) { - this.config.onClick.apply(this.psv); + this.config.onClick.call(this.psv, this.psv); } }; @@ -4918,6 +4934,8 @@ var DEFAULTS = { panorama: null, + overlay: null, + overlayOpacity: 1, container: null, adapter: null, plugins: [], @@ -5017,6 +5035,9 @@ return _adapter; }, + overlayOpacity: function overlayOpacity(_overlayOpacity) { + return three.MathUtils.clamp(_overlayOpacity, 0, 1); + }, defaultLong: function defaultLong(_defaultLong) { // defaultLat is between 0 and PI return parseAngle(_defaultLong); @@ -5033,7 +5054,7 @@ } // minFov between 1 and 179 - return bound(_minFov, 1, 179); + return three.MathUtils.clamp(_minFov, 1, 179); }, maxFov: function maxFov(_maxFov, config) { // minFov and maxFov must be ordered @@ -5042,7 +5063,7 @@ } // maxFov between 1 and 179 - return bound(_maxFov, 1, 179); + return three.MathUtils.clamp(_maxFov, 1, 179); }, lang: function lang(_lang) { if (Array.isArray(_lang.twoFingers)) { @@ -5637,7 +5658,7 @@ context.lineWidth = this.prop.tickness; context.strokeStyle = getStyle(this.loader, 'color'); context.beginPath(); - context.arc(this.canvas.width / 2, this.canvas.height / 2, this.canvas.width / 2 - this.prop.tickness / 2, -Math.PI / 2, bound(value, 0, 100) / 100 * 2 * Math.PI - Math.PI / 2); + context.arc(this.canvas.width / 2, this.canvas.height / 2, this.canvas.width / 2 - this.prop.tickness / 2, -Math.PI / 2, three.MathUtils.clamp(value, 0, 100) / 100 * 2 * Math.PI - Math.PI / 2); context.stroke(); this.psv.trigger(EVENTS.LOAD_PROGRESS, Math.round(value)); }; @@ -6391,9 +6412,9 @@ return AbstractService; }(); - var vector2 = new THREE.Vector2(); - var vector3 = new THREE.Vector3(); - var eulerZero = new THREE.Euler(0, 0, 0, 'ZXY'); + var vector2 = new three.Vector2(); + var vector3 = new three.Vector3(); + var eulerZero = new three.Euler(0, 0, 0, 'ZXY'); /** * @summary Collections of data converters for the current viewer * @extends PSV.services.AbstractService @@ -6440,7 +6461,7 @@ ; _proto.vFovToHFov = function vFovToHFov(vFov) { - return THREE.MathUtils.radToDeg(2 * Math.atan(Math.tan(THREE.MathUtils.degToRad(vFov) / 2) * this.prop.aspect)); + return three.MathUtils.radToDeg(2 * Math.atan(Math.tan(three.MathUtils.degToRad(vFov) / 2) * this.prop.aspect)); } /** * @summary Converts a speed into a duration from current position to a new position @@ -6531,7 +6552,7 @@ _proto.sphericalCoordsToVector3 = function sphericalCoordsToVector3(position, vector) { if (!vector) { - vector = new THREE.Vector3(); + vector = new three.Vector3(); } vector.x = SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude); @@ -6625,7 +6646,7 @@ } else { return { longitude: parseAngle(position.longitude), - latitude: parseAngle(position.latitude, true) + latitude: parseAngle(position.latitude, !this.prop.littlePlanet) }; } } @@ -6652,9 +6673,9 @@ _proto.cleanPanoramaPose = function cleanPanoramaPose(panoData) { return { - pan: THREE.MathUtils.degToRad((panoData == null ? void 0 : panoData.poseHeading) || 0), - tilt: THREE.MathUtils.degToRad((panoData == null ? void 0 : panoData.posePitch) || 0), - roll: THREE.MathUtils.degToRad((panoData == null ? void 0 : panoData.poseRoll) || 0) + pan: three.MathUtils.degToRad((panoData == null ? void 0 : panoData.poseHeading) || 0), + tilt: three.MathUtils.degToRad((panoData == null ? void 0 : panoData.posePitch) || 0), + roll: three.MathUtils.degToRad((panoData == null ? void 0 : panoData.poseRoll) || 0) }; }; @@ -7404,26 +7425,44 @@ _proto.__stopMoveInertia = function __stopMoveInertia(evt) { var _this8 = this; - var direction = { - x: evt.clientX - this.state.mouseHistory[0][1], - y: evt.clientY - this.state.mouseHistory[0][2] + // get direction at end of movement + var curve = new three.SplineCurve(this.state.mouseHistory.map(function (_ref) { + var x = _ref[1], + y = _ref[2]; + return new three.Vector2(x, y); + })); + var direction = curve.getTangent(1); // average speed + + var speed = this.state.mouseHistory.slice(1).reduce(function (_ref2, curr) { + var total = _ref2.total, + prev = _ref2.prev; + return { + total: total + Math.sqrt(Math.pow(curr[1] - prev[1], 2) + Math.pow(curr[2] - prev[2], 2)) / (curr[0] - [prev[0]]), + prev: curr + }; + }, { + total: 0, + prev: this.state.mouseHistory[0] + }).total / this.state.mouseHistory.length; + var current = { + clientX: evt.clientX, + clientY: evt.clientY }; - var norm = Math.sqrt(direction.x * direction.x + direction.y * direction.y); this.prop.animationPromise = new Animation({ properties: { - clientX: { - start: evt.clientX, - end: evt.clientX + direction.x - }, - clientY: { - start: evt.clientY, - end: evt.clientY + direction.y + speed: { + start: speed, + end: 0 } }, - duration: norm * INERTIA_WINDOW / 100, - easing: 'outCirc', + duration: 1000, + easing: 'outQuad', onTick: function onTick(properties) { - _this8.__move(properties, false); + // 3 is a magic number + current.clientX += properties.speed * direction.x * 3 * SYSTEM.pixelRatio; + current.clientY += properties.speed * direction.y * 3 * SYSTEM.pixelRatio; + + _this8.__move(current, false); } }); this.prop.animationPromise.then(function () { @@ -7518,8 +7557,8 @@ var x = evt.clientX; var y = evt.clientY; var rotation = { - longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * THREE.MathUtils.degToRad(this.prop.hFov), - latitude: (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.MathUtils.degToRad(this.prop.vFov) + longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * three.MathUtils.degToRad(this.prop.hFov), + latitude: (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * three.MathUtils.degToRad(this.prop.vFov) }; var currentPosition = this.psv.getPosition(); this.psv.rotate({ @@ -7590,19 +7629,29 @@ _proto.__logMouseMove = function __logMouseMove(evt) { var now = Date.now(); - this.state.mouseHistory.push([now, evt.clientX, evt.clientY]); + var last = this.state.mouseHistory.length ? this.state.mouseHistory[this.state.mouseHistory.length - 1] : [0, -1, -1]; // avoid duplicates + + if (last[1] === evt.clientX && last[2] === evt.clientY) { + last[0] = now; + } else if (now === last[0]) { + last[1] = evt.clientX; + last[2] = evt.clientY; + } else { + this.state.mouseHistory.push([now, evt.clientX, evt.clientY]); + } + var previous = null; for (var i = 0; i < this.state.mouseHistory.length;) { - if (this.state.mouseHistory[0][i] < now - INERTIA_WINDOW) { + if (this.state.mouseHistory[i][0] < now - INERTIA_WINDOW) { this.state.mouseHistory.splice(i, 1); - } else if (previous && this.state.mouseHistory[0][i] - previous > INERTIA_WINDOW / 10) { + } else if (previous && this.state.mouseHistory[i][0] - previous > INERTIA_WINDOW / 10) { this.state.mouseHistory.splice(0, i); i = 0; - previous = this.state.mouseHistory[0][i]; + previous = this.state.mouseHistory[i][0]; } else { + previous = this.state.mouseHistory[i][0]; i++; - previous = this.state.mouseHistory[0][i]; } } }; @@ -7634,7 +7683,7 @@ * @protected */ - _this.renderer = new THREE.WebGLRenderer({ + _this.renderer = new three.WebGLRenderer({ alpha: true, antialias: true }); @@ -7648,14 +7697,14 @@ * @protected */ - _this.scene = new THREE.Scene(); + _this.scene = new three.Scene(); /** * @member {external:THREE.PerspectiveCamera} * @readonly * @protected */ - _this.camera = new THREE.PerspectiveCamera(50, 16 / 9, 1, 2 * SPHERE_RADIUS); + _this.camera = new three.PerspectiveCamera(50, 16 / 9, 1, 2 * SPHERE_RADIUS); /** * @member {external:THREE.Mesh} * @readonly @@ -7670,7 +7719,7 @@ * @private */ - _this.meshContainer = new THREE.Group(); + _this.meshContainer = new three.Group(); _this.meshContainer.add(_this.mesh); @@ -7682,7 +7731,7 @@ */ - _this.raycaster = new THREE.Raycaster(); + _this.raycaster = new three.Raycaster(); /** * @member {number} * @private @@ -7901,6 +7950,18 @@ this.psv.needsUpdate(); this.psv.trigger(EVENTS.PANORAMA_LOADED, textureData); } + /** + * @summary Applies the overlay to the mesh + * @param {PSV.TextureData} textureData + * @param {number} opacity + * @package + */ + ; + + _proto.setOverlay = function setOverlay(textureData, opacity) { + this.psv.adapter.setOverlay(this.mesh, textureData, opacity); + this.psv.needsUpdate(); + } /** * @summary Apply a panorama data pose to a Mesh * @param {PSV.PanoData} [panoData] @@ -7950,7 +8011,7 @@ var positionProvided = isExtendedPosition(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 group = new three.Group(); var mesh = this.psv.adapter.createMesh(0.5); this.psv.adapter.setTexture(mesh, textureData, true); this.psv.adapter.setTextureOpacity(mesh, 0); @@ -7961,10 +8022,10 @@ var cleanPosition = this.psv.dataHelper.cleanPosition(options); var currentPosition = this.psv.getPosition(); // Longitude rotation along the vertical axis - var verticalAxis = new THREE.Vector3(0, 1, 0); + var verticalAxis = new three.Vector3(0, 1, 0); group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - currentPosition.longitude); // Latitude rotation along the camera horizontal axis - var horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new THREE.Vector3())).normalize(); + var horizontalAxis = new three.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new three.Vector3())).normalize(); group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - currentPosition.latitude); } @@ -8054,7 +8115,7 @@ } } - if (item.dispose && !(item instanceof THREE.Scene)) { + if (item.dispose && !(item instanceof three.Scene)) { item.dispose(); } @@ -8089,7 +8150,7 @@ * @private */ - _this.loader = new THREE.FileLoader(); + _this.loader = new three.FileLoader(); _this.loader.setResponseType('blob'); @@ -8402,7 +8463,7 @@ var a = this.arrow; // compute size var style = { - posClass: cleanPosition(config.position, 'top center', false), + posClass: config.position ? cleanPosition(config.position, false) : ['top', 'center'], width: this.prop.width, height: this.prop.height, top: 0, @@ -8652,7 +8713,7 @@ return TooltipRenderer; }(AbstractService); - THREE.Cache.enabled = true; + three.Cache.enabled = true; /** * @summary Main class * @memberOf PSV @@ -8695,6 +8756,7 @@ * @property {boolean} autorotateEnabled - automatic rotation is enabled * @property {PSV.Animation} animationPromise - promise of the current animation * @property {Promise} loadingPromise - promise of the setPanorama method + * @property {boolean} littlePlanet - special tweaks for LittlePlanetAdapter * @property {number} idleTime - time of the last user action * @property {object} objectsObservers * @property {PSV.Size} size - size of the container @@ -8707,13 +8769,14 @@ uiRefresh: false, needsUpdate: false, fullscreen: false, - direction: new THREE.Vector3(0, 0, SPHERE_RADIUS), + direction: new three.Vector3(0, 0, SPHERE_RADIUS), vFov: null, hFov: null, aspect: null, autorotateEnabled: false, animationPromise: null, loadingPromise: null, + littlePlanet: false, idleTime: -1, objectsObservers: {}, size: { @@ -8858,7 +8921,7 @@ }, _this.config.defaultZoomLvl, 0, 100), position: new MultiDynamic({ longitude: new Dynamic(null, _this.config.defaultLong, 0, 2 * Math.PI, true), - latitude: new Dynamic(null, _this.config.defaultLat, -Math.PI / 2, Math.PI / 2) + latitude: _this.prop.littlePlanet ? new Dynamic(null, _this.config.defaultLat, 0, Math.PI * 2, true) : new Dynamic(null, _this.config.defaultLat, -Math.PI / 2, Math.PI / 2) }, function (position) { _this.dataHelper.sphericalCoordsToVector3(position, _this.prop.direction); @@ -9103,13 +9166,11 @@ (_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)) { - options.sphereCorrection = this.config.sphereCorrection; - } - - if (!('panoData' in options)) { - options.panoData = this.config.panoData; - } + ['sphereCorrection', 'panoData', 'overlay', 'overlayOpacity'].forEach(function (opt) { + if (!(opt in options)) { + options[opt] = _this3.config[opt]; + } + }); } if (options.transition === undefined || options.transition === true) { @@ -9128,6 +9189,10 @@ options.description = this.config.description; } + if (!options.panoData && typeof this.config.panoData === 'function') { + options.panoData = this.config.panoData; + } + var positionProvided = isExtendedPosition(options); var zoomProvided = ('zoom' in options); @@ -9157,6 +9222,8 @@ } else { _this3.resetIdleTimer(); + _this3.setOverlay(options.overlay, options.overlayOpacity); + _this3.navbar.setCaption(_this3.config.caption); return true; @@ -9203,18 +9270,57 @@ _this3.loader.hide(); _this3.prop.transitionAnimation = _this3.renderer.transition(textureData, options); - return _this3.prop.transitionAnimation.then(function (completed) { - _this3.prop.transitionAnimation = null; + return _this3.prop.transitionAnimation; + }).then(function (completed) { + _this3.prop.transitionAnimation = null; - if (!completed) { - throw getAbortError(); - } - }); + if (!completed) { + throw getAbortError(); + } }).then(done, done); } return this.prop.loadingPromise; } + /** + * @summary Loads a new overlay + * @param {*} path - URL of the new overlay file + * @param {number} [opacity=1] + * @returns {Promise} + */ + ; + + _proto.setOverlay = function setOverlay(path, opacity) { + var _this4 = this; + + if (opacity === void 0) { + opacity = 1; + } + + if (!this.adapter.constructor.supportsOverlay) { + return Promise.reject(new PSVError(this.adapter.constructor.id + " adapter does not supports overlay")); + } + + if (!path) { + this.renderer.setOverlay(null, 0); + return Promise.resolve(); + } else { + return this.adapter.loadTexture(path, function (image) { + var p = _this4.prop.panoData; + var r = image.width / p.croppedWidth; + return { + fullWidth: r * p.fullWidth, + fullHeight: r * p.fullHeight, + croppedWidth: r * p.croppedWidth, + croppedHeight: r * p.croppedHeight, + croppedX: r * p.croppedX, + croppedY: r * p.croppedY + }; + }, false).then(function (textureData) { + _this4.renderer.setOverlay(textureData, opacity); + }); + } + } /** * @summary Update options * @param {PSV.Options} options @@ -9224,7 +9330,7 @@ ; _proto.setOptions = function setOptions(options) { - var _this4 = this; + var _this5 = this; var rawConfig = _extends({}, this.config, options); @@ -9243,54 +9349,60 @@ } if (CONFIG_PARSERS[key]) { - _this4.config[key] = CONFIG_PARSERS[key](value, rawConfig); + _this5.config[key] = CONFIG_PARSERS[key](value, rawConfig); } else { - _this4.config[key] = value; + _this5.config[key] = value; } switch (key) { + case 'overlay': + case 'overlayOpacity': + _this5.setOverlay(_this5.config.overlay, _this5.config.overlayOpacity); + + break; + case 'caption': case 'description': - _this4.navbar.setCaption(_this4.config.caption); + _this5.navbar.setCaption(_this5.config.caption); break; case 'size': - _this4.resize(value); + _this5.resize(value); break; case 'sphereCorrection': - _this4.renderer.setSphereCorrection(value); + _this5.renderer.setSphereCorrection(value); break; case 'navbar': case 'lang': - _this4.navbar.setButtons(_this4.config.navbar); + _this5.navbar.setButtons(_this5.config.navbar); break; case 'moveSpeed': case 'zoomSpeed': - _this4.__updateSpeeds(); + _this5.__updateSpeeds(); break; case 'minFov': case 'maxFov': - _this4.dynamics.zoom.setValue(_this4.dataHelper.fovToZoomLevel(_this4.prop.vFov)); + _this5.dynamics.zoom.setValue(_this5.dataHelper.fovToZoomLevel(_this5.prop.vFov)); - _this4.trigger(EVENTS.ZOOM_UPDATED, _this4.getZoomLevel()); + _this5.trigger(EVENTS.ZOOM_UPDATED, _this5.getZoomLevel()); break; case 'canvasBackground': - _this4.renderer.canvasContainer.style.background = _this4.config.canvasBackground; + _this5.renderer.canvasContainer.style.background = _this5.config.canvasBackground; break; case 'autorotateIdle': - _this4.resetIdleTimer(); + _this5.resetIdleTimer(); break; } @@ -9440,7 +9552,7 @@ ; _proto.animate = function animate(options) { - var _this5 = this; + var _this6 = this; this.__stopAll(); @@ -9498,18 +9610,18 @@ easing: 'inOutSine', onTick: function onTick(properties) { if (positionProvided) { - _this5.rotate(properties); + _this6.rotate(properties); } if (zoomProvided) { - _this5.zoom(properties.zoom); + _this6.zoom(properties.zoom); } } }); this.prop.animationPromise.then(function () { - _this5.prop.animationPromise = null; + _this6.prop.animationPromise = null; - _this5.resetIdleTimer(); + _this6.resetIdleTimer(); }); return this.prop.animationPromise; } @@ -9521,15 +9633,15 @@ ; _proto.stopAnimation = function stopAnimation() { - var _this6 = this; + var _this7 = this; if (this.prop.animationPromise) { return new Promise(function (resolve) { - _this6.prop.animationPromise.then(resolve); + _this7.prop.animationPromise.then(resolve); - _this6.prop.animationPromise.cancel(); + _this7.prop.animationPromise.cancel(); - _this6.prop.animationPromise = null; + _this7.prop.animationPromise = null; }); } else { return Promise.resolve(); @@ -9578,7 +9690,7 @@ ; _proto.resize = function resize(size) { - var _this7 = this; + var _this8 = this; ['width', 'height'].forEach(function (dim) { if (size && size[dim]) { @@ -9586,7 +9698,7 @@ size[dim] += 'px'; } - _this7.parent.style[dim] = size[dim]; + _this8.parent.style[dim] = size[dim]; } }); this.autoSize(); @@ -9664,13 +9776,13 @@ ; _proto.observeObjects = function observeObjects(userDataKey, listener) { - var _this8 = this; + var _this9 = this; this.prop.objectsObservers[userDataKey] = { listener: listener }; return function () { - delete _this8.prop.objectsObservers[userDataKey]; + delete _this9.prop.objectsObservers[userDataKey]; }; } /** @@ -9694,7 +9806,7 @@ _proto.__updateSpeeds = function __updateSpeeds() { this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50); - this.dynamics.position.setSpeed(THREE.MathUtils.degToRad(this.config.moveSpeed * 50)); + this.dynamics.position.setSpeed(three.MathUtils.degToRad(this.config.moveSpeed * 50)); }; return Viewer; diff --git a/dist/photo-sphere-viewer.js.map b/dist/photo-sphere-viewer.js.map index 218fc282b..aac07d5d6 100644 --- a/dist/photo-sphere-viewer.js.map +++ b/dist/photo-sphere-viewer.js.map @@ -1 +1 @@ -{"version":3,"file":"photo-sphere-viewer.js","sources":["../src/PSVError.js","../src/adapters/AbstractAdapter.js","../src/data/constants.js","../src/data/system.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/utils/psv.js","../src/utils/Animation.js","../src/utils/Dynamic.js","../src/utils/MultiDynamic.js","../src/utils/Slider.js","../src/utils/index.js","../src/adapters/equirectangular/index.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/buttons/DescriptionButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/utils/PressHandler.js","../src/buttons/AbstractMoveButton.js","../src/buttons/MoveDownButton.js","../src/buttons/MoveLeftButton.js","../src/buttons/MoveRightButton.js","../src/buttons/MoveUpButton.js","../src/buttons/AbstractZoomButton.js","../src/buttons/ZoomInButton.js","../src/buttons/ZoomOutButton.js","../src/buttons/ZoomRangeButton.js","../src/plugins/AbstractPlugin.js","../src/data/config.js","../src/components/NavbarCaption.js","../src/components/Navbar.js","../src/components/Loader.js","../src/components/Notification.js","../src/components/Overlay.js","../src/components/Panel.js","../src/services/AbstractService.js","../src/services/DataHelper.js","../src/services/EventsHandler.js","../src/services/Renderer.js","../src/services/TextureLoader.js","../src/components/Tooltip.js","../src/services/TooltipRenderer.js","../src/Viewer.js"],"sourcesContent":["/**\n * @summary Custom error used in the lib\n * @param {string} message\n * @constructor\n * @memberOf PSV\n */\nfunction PSVError(message) {\n this.message = message;\n\n // Use V8's native method if available, otherwise fallback\n if ('captureStackTrace' in Error) {\n Error.captureStackTrace(this, PSVError);\n }\n else {\n this.stack = (new Error()).stack;\n }\n}\n\nPSVError.prototype = Object.create(Error.prototype);\nPSVError.prototype.name = 'PSVError';\nPSVError.prototype.constructor = PSVError;\n\nexport { PSVError };\n","import { PSVError } from '../PSVError';\n\n/**\n * @namespace PSV.adapters\n */\n\n/**\n * @summary Base adapters class\n * @memberof PSV.adapters\n * @abstract\n */\nexport class AbstractAdapter {\n\n /**\n * @summary Unique identifier of the adapter\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Indicates if the adapter supports panorama download natively\n * @type {boolean}\n * @readonly\n * @static\n */\n static supportsDownload = false;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Destroys the adapter\n */\n destroy() {\n delete this.psv;\n }\n\n /**\n * @summary Indicates if the adapter supports transitions between panoramas\n * @param {*} panorama\n * @return {boolean}\n */\n supportsTransition(panorama) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n * @summary Indicates if the adapter supports preload of a panorama\n * @param {*} panorama\n * @return {boolean}\n */\n supportsPreload(panorama) { // eslint-disable-line no-unused-vars\n return false;\n }\n\n /**\n * @abstract\n * @summary Loads the panorama texture(s)\n * @param {*} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Creates the cube mesh\n * @param {number} [scale=1]\n * @returns {external:THREE.Mesh}\n */\n createMesh(scale = 1) { // eslint-disable-line no-unused-vars\n throw new PSVError('createMesh not implemented');\n }\n\n /**\n * @abstract\n * @summary Applies the texture to the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {PSV.TextureData} textureData\n * @param {boolean} [transition=false]\n */\n setTexture(mesh, textureData, transition = false) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Changes the opacity of the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {number} opacity\n */\n setTextureOpacity(mesh, opacity) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTextureOpacity not implemented');\n }\n\n /**\n * @abstract\n * @summary Clear a loaded texture from memory\n * @param {PSV.TextureData} textureData\n */\n disposeTexture(textureData) { // eslint-disable-line no-unused-vars\n throw new PSVError('disposeTexture not implemented');\n }\n\n}\n","/**\n * @namespace PSV.constants\n */\n\n/**\n * @summary Default duration of the transition between panoramas\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DEFAULT_TRANSITION = 1500;\n\n/**\n * @summary Number of pixels bellow which a mouse move will be considered as a click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const MOVE_THRESHOLD = 4;\n\n/**\n * @summary Delay in milliseconds between two clicks to consider a double click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DBLCLICK_DELAY = 300;\n\n/**\n * @summary Delay in milliseconds to emulate a long touch\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const LONGTOUCH_DELAY = 500;\n\n/**\n * @summary Delay in milliseconds to for the two fingers overlay to appear\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const TWOFINGERSOVERLAY_DELAY = 100;\n\n/**\n * @summary Duration in milliseconds of the \"ctrl zoom\" overlay\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const CTRLZOOM_TIMEOUT = 2000;\n\n/**\n * @summary Time size of the mouse position history used to compute inertia\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const INERTIA_WINDOW = 300;\n\n/**\n * @summary Radius of the THREE.SphereGeometry, Half-length of the THREE.BoxGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const SPHERE_RADIUS = 10;\n\n/**\n * @summary Property name added to viewer element\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const VIEWER_DATA = 'photoSphereViewer';\n\n/**\n * @summary Property added the the main Mesh object\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const MESH_USER_DATA = 'psvSphere';\n\n/**\n * @summary Available actions\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const ACTIONS = {\n ROTATE_LAT_UP : 'rotateLatitudeUp',\n ROTATE_LAT_DOWN : 'rotateLatitudeDown',\n ROTATE_LONG_RIGHT: 'rotateLongitudeRight',\n ROTATE_LONG_LEFT : 'rotateLongitudeLeft',\n ZOOM_IN : 'zoomIn',\n ZOOM_OUT : 'zoomOut',\n TOGGLE_AUTOROTATE: 'toggleAutorotate',\n};\n\n/**\n * @summary Available events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event autorotate\n * @memberof PSV\n * @summary Triggered when the automatic rotation is enabled/disabled\n * @param {boolean} enabled\n */\n AUTOROTATE : 'autorotate',\n /**\n * @event before-render\n * @memberof PSV\n * @summary Triggered before a render, used to modify the view\n * @param {number} timestamp - time provided by requestAnimationFrame\n * @param {number} elapsed - time elapsed from the previous frame\n */\n BEFORE_RENDER : 'before-render',\n /**\n * @event before-rotate\n * @memberOf PSV\n * @summary Triggered before a rotate operation, can be cancelled\n * @param {PSV.ExtendedPosition}\n */\n BEFORE_ROTATE : 'before-rotate',\n /**\n * @event click\n * @memberof PSV\n * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel)\n * @param {PSV.ClickData} data\n */\n CLICK : 'click',\n /**\n * @event close-panel\n * @memberof PSV\n * @summary Triggered when the panel is closed\n * @param {string} [id]\n */\n CLOSE_PANEL : 'close-panel',\n /**\n * @event config-changed\n * @memberOf PSV\n * @summary Triggered after a call to setOption/setOptions\n * @param {string[]} name of changed options\n */\n CONFIG_CHANGED : 'config-changed',\n /**\n * @event dblclick\n * @memberof PSV\n * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick`\n * @param {PSV.ClickData} data\n */\n DOUBLE_CLICK : 'dblclick',\n /**\n * @event fullscreen-updated\n * @memberof PSV\n * @summary Triggered when the fullscreen mode is enabled/disabled\n * @param {boolean} enabled\n */\n FULLSCREEN_UPDATED: 'fullscreen-updated',\n /**\n * @event hide-notification\n * @memberof PSV\n * @summary Triggered when the notification is hidden\n * @param {string} [id]\n */\n HIDE_NOTIFICATION : 'hide-notification',\n /**\n * @event hide-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is hidden\n * @param {string} [id]\n */\n HIDE_OVERLAY : 'hide-overlay',\n /**\n * @event hide-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is hidden\n * @param {*} Data associated to this tooltip\n */\n HIDE_TOOLTIP : 'hide-tooltip',\n /**\n * @event key-press\n * @memberof PSV\n * @summary Triggered when a key is pressed, can be cancelled\n * @param {string} key\n */\n KEY_PRESS : 'key-press',\n /**\n * @event load-progress\n * @memberof PSV\n * @summary Triggered when the loader value changes\n * @param {number} value from 0 to 100\n */\n LOAD_PROGRESS : 'load-progress',\n /**\n * @event open-panel\n * @memberof PSV\n * @summary Triggered when the panel is opened\n * @param {string} [id]\n */\n OPEN_PANEL : 'open-panel',\n /**\n * @event panorama-loaded\n * @memberof PSV\n * @summary Triggered when a panorama image has been loaded\n * @param {PSV.TextureData} textureData\n */\n PANORAMA_LOADED : 'panorama-loaded',\n /**\n * @event position-updated\n * @memberof PSV\n * @summary Triggered when the view longitude and/or latitude changes\n * @param {PSV.Position} position\n */\n POSITION_UPDATED : 'position-updated',\n /**\n * @event ready\n * @memberof PSV\n * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render\n */\n READY : 'ready',\n /**\n * @event render\n * @memberof PSV\n * @summary Triggered on each viewer render, **this event is triggered very often**\n */\n RENDER : 'render',\n /**\n * @event show-notification\n * @memberof PSV\n * @summary Triggered when the notification is shown\n * @param {string} [id]\n */\n SHOW_NOTIFICATION : 'show-notification',\n /**\n * @event show-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is shown\n * @param {string} [id]\n */\n SHOW_OVERLAY : 'show-overlay',\n /**\n * @event show-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is shown\n * @param {*} Data associated to this tooltip\n * @param {PSV.components.Tooltip} Instance of the tooltip\n */\n SHOW_TOOLTIP : 'show-tooltip',\n /**\n * @event size-updated\n * @memberof PSV\n * @summary Triggered when the viewer size changes\n * @param {PSV.Size} size\n */\n SIZE_UPDATED : 'size-updated',\n /**\n * @event stop-all\n * @memberof PSV\n * @summary Triggered when all current animations are stopped\n */\n STOP_ALL : 'stop-all',\n /**\n * @event zoom-updated\n * @memberof PSV\n * @summary Triggered when the zoom level changes\n * @param {number} zoomLevel\n */\n ZOOM_UPDATED : 'zoom-updated',\n};\n\n/**\n * @summary Available change events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const CHANGE_EVENTS = {\n /**\n * @event get-animate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of an animation\n */\n GET_ANIMATE_POSITION: 'get-animate-position',\n /**\n * @event get-rotate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of a rotation\n */\n GET_ROTATE_POSITION : 'get-rotate-position',\n};\n\n/**\n * @summary Special events emitted to listener using {@link Viewer#observeObjects}\n * @memberOf PSV.constants\n * @constant\n * @package\n */\nexport const OBJECT_EVENTS = {\n ENTER_OBJECT: 'enter-object',\n HOVER_OBJECT: 'hover-object',\n LEAVE_OBJECT: 'leave-object',\n};\n\n/**\n * @summary Internal identifiers for various stuff\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const IDS = {\n MENU : 'menu',\n TWO_FINGERS: 'twoFingers',\n CTRL_ZOOM : 'ctrlZoom',\n ERROR : 'error',\n DESCRIPTION: 'description',\n};\n\n/* eslint-disable */\n// @formatter:off\n/**\n * @summary Collection of easing functions\n * @memberOf PSV.constants\n * @see {@link https://gist.github.com/frederickk/6165768}\n * @type {Object}\n * @constant\n */\nexport const EASINGS = {\n linear : (t) => t,\n\n inQuad : (t) => t*t,\n outQuad : (t) => t*(2-t),\n inOutQuad : (t) => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\n inCubic : (t) => t*t*t,\n outCubic : (t) => (--t)*t*t+1,\n inOutCubic: (t) => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\n inQuart : (t) => t*t*t*t,\n outQuart : (t) => 1-(--t)*t*t*t,\n inOutQuart: (t) => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\n inQuint : (t) => t*t*t*t*t,\n outQuint : (t) => 1+(--t)*t*t*t*t,\n inOutQuint: (t) => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t,\n\n inSine : (t) => 1-Math.cos(t*(Math.PI/2)),\n outSine : (t) => Math.sin(t*(Math.PI/2)),\n inOutSine : (t) => .5-.5*Math.cos(Math.PI*t),\n\n inExpo : (t) => Math.pow(2, 10*(t-1)),\n outExpo : (t) => 1-Math.pow(2, -10*t),\n inOutExpo : (t) => (t=t*2-1)<0 ? .5*Math.pow(2, 10*t) : 1-.5*Math.pow(2, -10*t),\n\n inCirc : (t) => 1-Math.sqrt(1-t*t),\n outCirc : (t) => Math.sqrt(1-(t-1)*(t-1)),\n inOutCirc : (t) => (t*=2)<1 ? .5-.5*Math.sqrt(1-t*t) : .5+.5*Math.sqrt(1-(t-=2)*t)\n};\n// @formatter:on\n/* eslint-enable */\n\n/**\n * @summary Subset of key codes\n * @memberOf PSV.constants\n * @type {Object}\n * @constant\n */\nexport const KEY_CODES = {\n Enter : 'Enter',\n Control : 'Control',\n Escape : 'Escape',\n Space : ' ',\n PageUp : 'PageUp',\n PageDown : 'PageDown',\n ArrowLeft : 'ArrowLeft',\n ArrowUp : 'ArrowUp',\n ArrowRight: 'ArrowRight',\n ArrowDown : 'ArrowDown',\n Delete : 'Delete',\n Plus : '+',\n Minus : '-',\n};\n","import { PSVError } from '../PSVError';\nimport { VIEWER_DATA } from './constants';\n\nconst LOCALSTORAGE_TOUCH_SUPPORT = `${VIEWER_DATA}_touchSupport`;\n\n/**\n * @summary General information about the system\n * @constant\n * @memberOf PSV\n * @property {boolean} loaded - Indicates if the system data has been loaded\n * @property {Function} load - Loads the system if not already loaded\n * @property {number} pixelRatio\n * @property {boolean} isWebGLSupported\n * @property {number} maxCanvasWidth\n * @property {string} mouseWheelEvent\n * @property {string} fullscreenEvent\n * @property {Function} getMaxCanvasWidth - Returns the max width of a canvas allowed by the browser\n * @property {{initial: boolean, promise: Promise}} isTouchEnabled\n */\nexport const SYSTEM = {\n loaded : false,\n pixelRatio : 1,\n isWebGLSupported: false,\n isTouchEnabled : null,\n maxTextureWidth : 0,\n mouseWheelEvent : null,\n fullscreenEvent : null,\n};\n\n/**\n * @summary Loads the system if not already loaded\n */\nSYSTEM.load = () => {\n if (!SYSTEM.loaded) {\n const ctx = getWebGLCtx();\n\n SYSTEM.loaded = true;\n SYSTEM.pixelRatio = window.devicePixelRatio || 1;\n SYSTEM.isWebGLSupported = ctx != null;\n SYSTEM.isTouchEnabled = isTouchEnabled();\n SYSTEM.maxTextureWidth = getMaxTextureWidth(ctx);\n SYSTEM.mouseWheelEvent = getMouseWheelEvent();\n SYSTEM.fullscreenEvent = getFullscreenEvent();\n }\n};\n\nlet maxCanvasWidth = null;\nSYSTEM.getMaxCanvasWidth = () => {\n if (maxCanvasWidth === null) {\n maxCanvasWidth = getMaxCanvasWidth(SYSTEM.maxTextureWidth);\n }\n return maxCanvasWidth;\n};\n\n/**\n * @summary Tries to return a canvas webgl context\n * @returns {WebGLRenderingContext}\n * @private\n */\nfunction getWebGLCtx() {\n const canvas = document.createElement('canvas');\n const names = ['webgl', 'experimental-webgl', 'moz-webgl', 'webkit-3d'];\n let context = null;\n\n if (!canvas.getContext) {\n return null;\n }\n\n if (names.some((name) => {\n try {\n context = canvas.getContext(name);\n return context !== null;\n }\n catch (e) {\n return false;\n }\n })) {\n return context;\n }\n else {\n return null;\n }\n}\n\n/**\n * @summary Detects if the user is using a touch screen\n * @returns {{initial: boolean, promise: Promise}}\n * @private\n */\nfunction isTouchEnabled() {\n let initial = ('ontouchstart' in window) || (navigator.maxTouchPoints > 0);\n if (LOCALSTORAGE_TOUCH_SUPPORT in localStorage) {\n initial = localStorage[LOCALSTORAGE_TOUCH_SUPPORT] === 'true';\n }\n\n const promise = new Promise((resolve) => {\n let clear;\n\n const listenerMouse = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = false;\n resolve(false);\n };\n\n const listenerTouch = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = true;\n resolve(true);\n };\n\n const listenerTimeout = () => {\n clear();\n localStorage[LOCALSTORAGE_TOUCH_SUPPORT] = initial;\n resolve(initial);\n };\n\n window.addEventListener('mousedown', listenerMouse, false);\n window.addEventListener('touchstart', listenerTouch, false);\n const listenerTimeoutId = setTimeout(listenerTimeout, 10000);\n\n clear = () => {\n window.removeEventListener('mousedown', listenerMouse);\n window.removeEventListener('touchstart', listenerTouch);\n clearTimeout(listenerTimeoutId);\n };\n });\n\n return { initial, promise };\n}\n\n/**\n * @summary Gets max texture width in WebGL context\n * @returns {number}\n * @private\n */\nfunction getMaxTextureWidth(ctx) {\n if (ctx !== null) {\n return ctx.getParameter(ctx.MAX_TEXTURE_SIZE);\n }\n else {\n return 0;\n }\n}\n\n/**\n * @summary Gets max canvas width supported by the browser.\n * We only test powers of 2 and height = width / 2 because that's what we need to generate WebGL textures\n * @param maxWidth\n * @return {number}\n * @private\n */\nfunction getMaxCanvasWidth(maxWidth) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = maxWidth;\n canvas.height = maxWidth / 2;\n\n while (canvas.width > 1024) {\n ctx.fillStyle = 'white';\n ctx.fillRect(0, 0, 1, 1);\n\n try {\n if (ctx.getImageData(0, 0, 1, 1).data[0] > 0) {\n return canvas.width;\n }\n }\n catch (e) {\n // continue\n }\n\n canvas.width /= 2;\n canvas.height /= 2;\n }\n\n throw new PSVError('Unable to detect system capabilities');\n}\n\n/**\n * @summary Gets the event name for mouse wheel\n * @returns {string}\n * @private\n */\nfunction getMouseWheelEvent() {\n if ('onwheel' in document.createElement('div')) { // Modern browsers support \"wheel\"\n return 'wheel';\n }\n else if (document.onmousewheel !== undefined) { // Webkit and IE support at least \"mousewheel\"\n return 'mousewheel';\n }\n else { // let's assume that remaining browsers are older Firefox\n return 'DOMMouseScroll';\n }\n}\n\n/**\n * @summary Map between fullsceen method and fullscreen event name\n * @type {Object}\n * @readonly\n * @private\n */\nconst FULLSCREEN_EVT_MAP = {\n exitFullscreen : 'fullscreenchange',\n webkitExitFullscreen: 'webkitfullscreenchange',\n mozCancelFullScreen : 'mozfullscreenchange',\n msExitFullscreen : 'MSFullscreenChange',\n};\n\n\n/**\n * @summary Gets the event name for fullscreen\n * @returns {string}\n * @private\n */\nfunction getFullscreenEvent() {\n const validExits = Object.keys(FULLSCREEN_EVT_MAP).filter(exit => exit in document);\n\n if (validExits.length) {\n return FULLSCREEN_EVT_MAP[validExits[0]];\n }\n else {\n return null;\n }\n}\n","/**\n * @summary Toggles a CSS class\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} element\n * @param {string} className\n * @param {boolean} [active] - forced state\n */\nexport function toggleClass(element, className, active) {\n if (active === undefined) {\n element.classList.toggle(className);\n }\n else if (active && !element.classList.contains(className)) {\n element.classList.add(className);\n }\n else if (!active) {\n element.classList.remove(className);\n }\n}\n\n/**\n * @summary Adds one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function addClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, true);\n });\n }\n}\n\n/**\n * @summary Removes one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function removeClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, false);\n });\n }\n}\n\n/**\n * @summary Searches if an element has a particular parent at any level including itself\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @returns {boolean}\n */\nexport function hasParent(el, parent) {\n let test = el;\n\n do {\n if (test === parent) {\n return true;\n }\n test = test.parentNode;\n } while (test);\n\n return false;\n}\n\n/**\n * @summary Gets the closest parent (can by itself)\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} el\n * @param {string} selector\n * @returns {HTMLElement}\n */\nexport function getClosest(el, selector) {\n // When el is document or window, the matches does not exist\n if (!el.matches) {\n return null;\n }\n\n let test = el;\n\n do {\n if (test.matches(selector)) {\n return test;\n }\n test = test instanceof SVGElement ? test.parentNode : test.parentElement;\n } while (test);\n\n return null;\n}\n\n/**\n * @summary Gets the position of an element in the viewer without reflow\n * @description Will gives the same result as getBoundingClientRect() as soon as there are no CSS transforms\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @return {{left: number, top: number}}\n */\nexport function getPosition(el) {\n let left = 0;\n let top = 0;\n let test = el;\n\n while (test) {\n left += (test.offsetLeft - test.scrollLeft + test.clientLeft);\n top += (test.offsetTop - test.scrollTop + test.clientTop);\n test = test.offsetParent;\n }\n\n return { left, top };\n}\n\n/**\n * @summary Detects if fullscreen is enabled\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @returns {boolean}\n */\nexport function isFullscreenEnabled(elt) {\n return (document.fullscreenElement || document.webkitFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n (elt.requestFullscreen || elt.webkitRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n (document.exitFullscreen || document.webkitExitFullscreen).call(document);\n}\n\n/**\n * @summary Gets an element style\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @param {string} prop\n * @returns {*}\n */\nexport function getStyle(elt, prop) {\n return window.getComputedStyle(elt, null)[prop];\n}\n\n/**\n * @summary Normalize mousewheel values accross browsers\n * @memberOf PSV.utils\n * @description From Facebook's Fixed Data Table\n * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js}\n * @copyright Facebook\n * @param {WheelEvent} event\n * @returns {{spinX: number, spinY: number, pixelX: number, pixelY: number}}\n */\nexport function normalizeWheel(event) {\n const PIXEL_STEP = 10;\n const LINE_HEIGHT = 40;\n const PAGE_HEIGHT = 800;\n\n let spinX = 0;\n let spinY = 0;\n let pixelX = 0;\n let pixelY = 0;\n\n // Legacy\n if ('detail' in event) {\n spinY = event.detail;\n }\n if ('wheelDelta' in event) {\n spinY = -event.wheelDelta / 120;\n }\n if ('wheelDeltaY' in event) {\n spinY = -event.wheelDeltaY / 120;\n }\n if ('wheelDeltaX' in event) {\n spinX = -event.wheelDeltaX / 120;\n }\n\n // side scrolling on FF with DOMMouseScroll\n if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {\n spinX = spinY;\n spinY = 0;\n }\n\n pixelX = spinX * PIXEL_STEP;\n pixelY = spinY * PIXEL_STEP;\n\n if ('deltaY' in event) {\n pixelY = event.deltaY;\n }\n if ('deltaX' in event) {\n pixelX = event.deltaX;\n }\n\n if ((pixelX || pixelY) && event.deltaMode) {\n // delta in LINE units\n if (event.deltaMode === 1) {\n pixelX *= LINE_HEIGHT;\n pixelY *= LINE_HEIGHT;\n }\n // delta in PAGE units\n else {\n pixelX *= PAGE_HEIGHT;\n pixelY *= PAGE_HEIGHT;\n }\n }\n\n // Fall-back if spin cannot be determined\n if (pixelX && !spinX) {\n spinX = (pixelX < 1) ? -1 : 1;\n }\n if (pixelY && !spinY) {\n spinY = (pixelY < 1) ? -1 : 1;\n }\n\n return { spinX, spinY, pixelX, pixelY };\n}\n","/**\n * @summary Ensures that a number is in a given interval\n * @memberOf PSV.utils\n * @param {number} x\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport function bound(x, min, max) {\n return Math.max(min, Math.min(max, x));\n}\n\n/**\n * @summary Ensure a value is within 0 and `max`\n * @param {number} value\n * @param {number} max\n * @return {number}\n */\nexport function loop(value, max) {\n let result = value % max;\n\n if (result < 0) {\n result += max;\n }\n\n return result;\n}\n\n/**\n * @summary Checks if a value is an integer\n * @memberOf PSV.utils\n * @param {*} value\n * @returns {boolean}\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value;\n}\n\n/**\n * @summary Tests if a number is power of two\n * @memberOf PSV.utils\n * @param {number} x\n * @return {boolean}\n */\nexport function isPowerOfTwo(x) {\n return (Math.log(x) / Math.log(2)) % 1 === 0;\n}\n\n/**\n * @summary Computes the sum of an array\n * @memberOf PSV.utils\n * @param {number[]} array\n * @returns {number}\n */\nexport function sum(array) {\n return array.reduce((a, b) => a + b, 0);\n}\n\n/**\n * @summary Computes the distance between two points\n * @memberOf PSV.utils\n * @param {PSV.Point} p1\n * @param {PSV.Point} p2\n * @returns {number}\n */\nexport function distance(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\n/**\n * @summary Compute the shortest offset between two longitudes\n * @memberOf PSV.utils\n * @param {number} from\n * @param {number} to\n * @returns {number}\n */\nexport function getShortestArc(from, to) {\n const tCandidates = [\n 0, // direct\n Math.PI * 2, // clock-wise cross zero\n -Math.PI * 2, // counter-clock-wise cross zero\n ];\n\n return tCandidates.reduce((value, candidate) => {\n const newCandidate = to - from + candidate;\n return Math.abs(newCandidate) < Math.abs(value) ? newCandidate : value;\n }, Infinity);\n}\n\n/**\n * @summary Computes the angle between the current position and a target position\n * @memberOf PSV.utils\n * @param {PSV.Position} position1\n * @param {PSV.Position} position2\n * @returns {number}\n */\nexport function getAngle(position1, position2) {\n return Math.acos(\n Math.cos(position1.latitude)\n * Math.cos(position2.latitude)\n * Math.cos(position1.longitude - position2.longitude)\n + Math.sin(position1.latitude)\n * Math.sin(position2.latitude)\n );\n}\n\n/**\n * @summary Returns the distance between two points on a sphere of radius one\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @memberOf PSV.utils\n * @param {number[]} p1\n * @param {number[]} p2\n * @returns {number}\n */\nexport function greatArcDistance(p1, p2) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const x = (λ2 - λ1) * Math.cos((φ1 + φ2) / 2);\n const y = (φ2 - φ1);\n return Math.sqrt(x * x + y * y);\n}\n","/**\n * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize}\n * @memberOf PSV.utils\n * @param {string} str\n * @returns {string}\n */\nexport function dasherize(str) {\n return str.replace(/[A-Z](?:(?=[^A-Z])|[A-Z]*(?=[A-Z][^A-Z]|$))/g, (s, i) => {\n return (i > 0 ? '-' : '') + s.toLowerCase();\n });\n}\n\n/**\n * @summary Returns a function, that, when invoked, will only be triggered at most once during a given window of time.\n * @memberOf PSV.utils\n * @copyright underscore.js - modified by Clément Prévost {@link http://stackoverflow.com/a/27078401}\n * @param {Function} func\n * @param {number} wait\n * @returns {Function}\n */\nexport function throttle(func, wait) {\n /* eslint-disable */\n let self, args, result;\n let timeout;\n let previous = 0;\n const later = function() {\n previous = Date.now();\n timeout = undefined;\n result = func.apply(self, args);\n if (!timeout) {\n self = args = null;\n }\n };\n return function() {\n const now = Date.now();\n if (!previous) {\n previous = now;\n }\n const remaining = wait - (now - previous);\n self = this;\n args = arguments;\n if (remaining <= 0 || remaining > wait) {\n if (timeout) {\n clearTimeout(timeout);\n timeout = undefined;\n }\n previous = now;\n result = func.apply(self, args);\n if (!timeout) {\n self = args = null;\n }\n }\n else if (!timeout) {\n timeout = setTimeout(later, remaining);\n }\n return result;\n };\n /* eslint-enable */\n}\n\n/**\n * @summary Test if an object is a plain object\n * @memberOf PSV.utils\n * @description Test if an object is a plain object, i.e. is constructed\n * by the built-in Object constructor and inherits directly from Object.prototype\n * or null. Some built-in objects pass the test, e.g. Math which is a plain object\n * and some host or exotic objects may pass also.\n * {@link http://stackoverflow.com/a/5878101/1207670}\n * @param {*} obj\n * @returns {boolean}\n */\nexport function isPlainObject(obj) {\n // Basic check for Type object that's not null\n if (typeof obj === 'object' && obj !== null) {\n // If Object.getPrototypeOf supported, use it\n if (typeof Object.getPrototypeOf === 'function') {\n const proto = Object.getPrototypeOf(obj);\n return proto === Object.prototype || proto === null;\n }\n\n // Otherwise, use internal class\n // This should be reliable as if getPrototypeOf not supported, is pre-ES5\n return Object.prototype.toString.call(obj) === '[object Object]';\n }\n\n // Not an object\n return false;\n}\n\n/**\n * @summary Merges the enumerable attributes of two objects\n * @memberOf PSV.utils\n * @description Replaces arrays and alters the target object.\n * @copyright Nicholas Fisher \n * @param {Object} target\n * @param {Object} src\n * @returns {Object} target\n */\nexport function deepmerge(target, src) {\n /* eslint-disable */\n let first = src;\n\n return (function merge(target, src) {\n if (Array.isArray(src)) {\n if (!target || !Array.isArray(target)) {\n target = [];\n }\n else {\n target.length = 0;\n }\n src.forEach(function(e, i) {\n target[i] = merge(null, e);\n });\n }\n else if (typeof src === 'object') {\n if (!target || Array.isArray(target)) {\n target = {};\n }\n Object.keys(src).forEach(function(key) {\n if (typeof src[key] !== 'object' || !src[key] || !isPlainObject(src[key])) {\n target[key] = src[key];\n }\n else if (src[key] != first) {\n if (!target[key]) {\n target[key] = merge(null, src[key]);\n }\n else {\n merge(target[key], src[key]);\n }\n }\n });\n }\n else {\n target = src;\n }\n\n return target;\n }(target, src));\n /* eslint-enable */\n}\n\n/**\n * @summary Deeply clones an object\n * @memberOf PSV.utils\n * @param {Object} src\n * @returns {Object}\n */\nexport function clone(src) {\n return deepmerge(null, src);\n}\n\n/**\n * @summery Test of an object is empty\n * @memberOf PSV.utils\n * @param {object} obj\n * @returns {boolean}\n */\nexport function isEmpty(obj) {\n return !obj || (Object.keys(obj).length === 0 && obj.constructor === Object);\n}\n\n/**\n * @summary Loops over enumerable properties of an object\n * @memberOf PSV.utils\n * @param {Object} object\n * @param {Function} callback\n */\nexport function each(object, callback) {\n Object.keys(object).forEach((key) => {\n callback(object[key], key);\n });\n}\n\n/**\n * @summary Returns if a valu is null or undefined\n * @memberOf PSV.utils\n * @param {*} val\n * @return {boolean}\n */\nexport function isNil(val) {\n return val === null || val === undefined;\n}\n\n/**\n * @summary Returns the first non null non undefined parameter\n * @memberOf PSV.utils\n * @param {*} values\n * @return {*}\n */\nexport function firstNonNull(...values) {\n for (const val of values) {\n if (!isNil(val)) {\n return val;\n }\n }\n\n return undefined;\n}\n\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\n","import * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound, loop } from './math';\n\n/**\n * @summary Returns the plugin constructor from the imported object\n * For retrocompatibility with previous default exports\n * @memberOf PSV.utils\n * @package\n */\nexport function pluginInterop(plugin, target) {\n if (plugin) {\n for (const [, p] of [['_', plugin], ...Object.entries(plugin)]) {\n if (p.prototype instanceof target) {\n return p;\n }\n }\n }\n return null;\n}\n\n/**\n * @summary Builds an Error with name 'AbortError'\n * @memberOf PSV.utils\n * @return {Error}\n */\nexport function getAbortError() {\n const error = new Error('Loading was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/**\n * @summary Tests if an Error has name 'AbortError'\n * @memberOf PSV.utils\n * @param {Error} err\n * @return {boolean}\n */\nexport function isAbortError(err) {\n return err?.name === 'AbortError';\n}\n\n/**\n * @summary Displays a warning in the console\n * @memberOf PSV.utils\n * @param {string} message\n */\nexport function logWarn(message) {\n console.warn(`PhotoSphereViewer: ${message}`);\n}\n\n/**\n * @summary Checks if an object is a {PSV.ExtendedPosition}, ie has x/y or longitude/latitude\n * @memberOf PSV.utils\n * @param {object} object\n * @returns {boolean}\n */\nexport function isExtendedPosition(object) {\n return [['x', 'y'], ['longitude', 'latitude']].some(([key1, key2]) => {\n return object[key1] !== undefined && object[key2] !== undefined;\n });\n}\n\n/**\n * @summary Returns the value of a given attribute in the panorama metadata\n * @memberOf PSV.utils\n * @param {string} data\n * @param {string} attr\n * @returns (number)\n */\nexport function getXMPValue(data, attr) {\n // XMP data are stored in children\n let result = data.match('(.*)');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n // XMP data are stored in attributes\n result = data.match('GPano:' + attr + '=\"(.*?)\"');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n return null;\n}\n\n/**\n * @readonly\n * @private\n * @type {{top: string, left: string, bottom: string, center: string, right: string}}\n */\nconst CSS_POSITIONS = {\n top : '0%',\n bottom: '100%',\n left : '0%',\n right : '100%',\n center: '50%',\n};\n\n/**\n * @summary Translate CSS values like \"top center\" or \"10% 50%\" as top and left positions\n * @memberOf PSV.utils\n * @description The implementation is as close as possible to the \"background-position\" specification\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}\n * @param {string|PSV.Point} value\n * @returns {PSV.Point}\n */\nexport function parsePosition(value) {\n if (!value) {\n return { x: 0.5, y: 0.5 };\n }\n\n if (typeof value === 'object') {\n return value;\n }\n\n let tokens = value.toLocaleLowerCase().split(' ').slice(0, 2);\n\n if (tokens.length === 1) {\n if (CSS_POSITIONS[tokens[0]] !== undefined) {\n tokens = [tokens[0], 'center'];\n }\n else {\n tokens = [tokens[0], tokens[0]];\n }\n }\n\n const xFirst = tokens[1] !== 'left' && tokens[1] !== 'right' && tokens[0] !== 'top' && tokens[0] !== 'bottom';\n\n tokens = tokens.map(token => CSS_POSITIONS[token] || token);\n\n if (!xFirst) {\n tokens.reverse();\n }\n\n const parsed = tokens.join(' ').match(/^([0-9.]+)% ([0-9.]+)%$/);\n\n if (parsed) {\n return {\n x: parseFloat(parsed[1]) / 100,\n y: parseFloat(parsed[2]) / 100,\n };\n }\n else {\n return { x: 0.5, y: 0.5 };\n }\n}\n\n/**\n * @readonly\n * @private\n */\nconst LEFT_MAP = { 0: 'left', 0.5: 'center', 1: 'right' };\n/**\n * @readonly\n * @private\n */\nconst TOP_MAP = { 0: 'top', 0.5: 'center', 1: 'bottom' };\n\n/**\n * @summary Parse a CSS-like position into an array of position keywords among top, bottom, left, right and center\n * @memberOf PSV.utils\n * @param {string | string[]} value\n * @param {string} defaultValue\n * @param {boolean} [allowCenter=true]\n * @return {string[]}\n */\nexport function cleanPosition(value, defaultValue, allowCenter = true) {\n if (!value) {\n return defaultValue.split(' ');\n }\n\n if (typeof value === 'string') {\n const tempPos = parsePosition(value);\n\n if (!(tempPos.x in LEFT_MAP) || !(tempPos.y in TOP_MAP)) {\n throw new PSVError(`Unable to parse position \"${value}\"`);\n }\n\n value = [TOP_MAP[tempPos.y], LEFT_MAP[tempPos.x]];\n }\n\n if (!allowCenter && value[0] === 'center' && value[1] === 'center') {\n throw new PSVError('Unable to parse position \"center center\"');\n }\n\n return value;\n}\n\n/**\n * @summary Parses an speed\n * @memberOf PSV.utils\n * @param {string|number} speed - The speed, in radians/degrees/revolutions per second/minute\n * @returns {number} radians per second\n * @throws {PSV.PSVError} when the speed cannot be parsed\n */\nexport function parseSpeed(speed) {\n let parsed;\n\n if (typeof speed === 'string') {\n const speedStr = speed.toString().trim();\n\n // Speed extraction\n let speedValue = parseFloat(speedStr.replace(/^(-?[0-9]+(?:\\.[0-9]*)?).*$/, '$1'));\n const speedUnit = speedStr.replace(/^-?[0-9]+(?:\\.[0-9]*)?(.*)$/, '$1').trim();\n\n // \"per minute\" -> \"per second\"\n if (speedUnit.match(/(pm|per minute)$/)) {\n speedValue /= 60;\n }\n\n // Which unit?\n switch (speedUnit) {\n // Degrees per minute / second\n case 'dpm':\n case 'degrees per minute':\n case 'dps':\n case 'degrees per second':\n parsed = THREE.MathUtils.degToRad(speedValue);\n break;\n\n // Radians per minute / second\n case 'rdpm':\n case 'radians per minute':\n case 'rdps':\n case 'radians per second':\n parsed = speedValue;\n break;\n\n // Revolutions per minute / second\n case 'rpm':\n case 'revolutions per minute':\n case 'rps':\n case 'revolutions per second':\n parsed = speedValue * Math.PI * 2;\n break;\n\n // Unknown unit\n default:\n throw new PSVError('Unknown speed unit \"' + speedUnit + '\"');\n }\n }\n else {\n parsed = speed;\n }\n\n return parsed;\n}\n\n/**\n * @summary Parses an angle value in radians or degrees and returns a normalized value in radians\n * @memberOf PSV.utils\n * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg\n * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi\n * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi\n * @returns {number}\n * @throws {PSV.PSVError} when the angle cannot be parsed\n */\nexport function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) {\n let parsed;\n\n if (typeof angle === 'string') {\n const match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\\.[0-9]*)?)(.*)$/);\n\n if (!match) {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n const value = parseFloat(match[1]);\n const unit = match[2];\n\n if (unit) {\n switch (unit) {\n case 'deg':\n case 'degs':\n parsed = THREE.MathUtils.degToRad(value);\n break;\n case 'rad':\n case 'rads':\n parsed = value;\n break;\n default:\n throw new PSVError('Unknown angle unit \"' + unit + '\"');\n }\n }\n else {\n parsed = value;\n }\n }\n else if (typeof angle === 'number' && !isNaN(angle)) {\n parsed = angle;\n }\n else {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n parsed = loop(zeroCenter ? parsed + Math.PI : parsed, Math.PI * 2);\n\n return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed;\n}\n\n/**\n * @summary Creates a THREE texture from an image\n * @memberOf PSV.utils\n * @param {HTMLImageElement | HTMLCanvasElement} img\n * @return {external:THREE.Texture}\n */\nexport function createTexture(img) {\n const texture = new THREE.Texture(img);\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n return texture;\n}\n\nconst quaternion = new THREE.Quaternion();\n\n/**\n * @summary Applies the inverse of Euler angles to a vector\n * @memberOf PSV.utils\n * @param {external:THREE.Vector3} vector\n * @param {external:THREE.Euler} euler\n */\nexport function applyEulerInverse(vector, euler) {\n quaternion.setFromEuler(euler).invert();\n vector.applyQuaternion(quaternion);\n}\n","import { EASINGS } from '../data/constants';\nimport { each } from './misc';\nimport { logWarn } from './psv';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.utils.Animation\n * @param {Object.} properties - current values\n * @param {float} progress - 0 to 1\n */\n\n/**\n * @summary Interpolation helper for animations\n * @memberOf PSV.utils\n * @description\n * Implements the Promise API with an additional \"cancel\" method.\n * The promise is resolved with `true` when the animation is completed and `false` if the animation is cancelled.\n * @example\n * const anim = new Animation({\n * properties: {\n * width: {start: 100, end: 200}\n * },\n * duration: 5000,\n * onTick: (properties) => element.style.width = `${properties.width}px`;\n * });\n *\n * anim.then((completed) => ...);\n *\n * anim.cancel()\n */\nexport class Animation {\n\n /**\n * @param {Object} options\n * @param {Object.} options.properties\n * @param {number} options.properties[].start\n * @param {number} options.properties[].end\n * @param {number} options.duration\n * @param {number} [options.delay=0]\n * @param {string} [options.easing='linear']\n * @param {PSV.utils.Animation.OnTick} options.onTick - called on each frame\n */\n constructor(options) {\n this.__callbacks = [];\n\n if (options) {\n if (!options.easing || typeof options.easing === 'string') {\n options.easing = EASINGS[options.easing || 'linear'];\n }\n\n this.__start = null;\n this.options = options;\n\n if (options.delay) {\n this.__delayTimeout = setTimeout(() => {\n this.__delayTimeout = null;\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }, options.delay);\n }\n else {\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }\n }\n else {\n this.__resolved = true;\n }\n }\n\n /**\n * @summary Main loop for the animation\n * @param {number} timestamp\n * @private\n */\n __run(timestamp) {\n // first iteration\n if (this.__start === null) {\n this.__start = timestamp;\n }\n\n // compute progress\n const progress = (timestamp - this.__start) / this.options.duration;\n const current = {};\n\n if (progress < 1.0) {\n // interpolate properties\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.start + (prop.end - prop.start) * this.options.easing(progress);\n }\n });\n this.options.onTick(current, progress);\n\n this.__animationFrame = window.requestAnimationFrame(t => this.__run(t));\n }\n else {\n // call onTick one last time with final values\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.end;\n }\n });\n this.options.onTick(current, 1.0);\n\n this.__animationFrame = window.requestAnimationFrame(() => {\n this.__resolved = true;\n this.__resolve(true);\n });\n }\n }\n\n /**\n * @private\n */\n __resolve(value) {\n this.__callbacks.forEach(cb => cb(value));\n this.__callbacks.length = 0;\n }\n\n /**\n * @summary Promise chaining\n * @param {Function} [onFulfilled] - Called when the animation is complete (true) or cancelled (false)\n * @param {Function} [onRejected] - deprecated\n * @returns {Promise}\n */\n then(onFulfilled = null, onRejected = null) {\n if (onRejected) {\n logWarn('Animation#then does not accept a rejection handler anymore');\n }\n\n if (this.__resolved || this.__cancelled) {\n return Promise.resolve(this.__resolved)\n .then(onFulfilled);\n }\n\n return new Promise((resolve) => {\n this.__callbacks.push(resolve);\n })\n .then(onFulfilled);\n }\n\n /**\n * @summary Cancels the animation\n */\n cancel() {\n if (!this.__cancelled && !this.__resolved) {\n this.__cancelled = true;\n this.__resolve(false);\n\n if (this.__delayTimeout) {\n window.clearTimeout(this.__delayTimeout);\n this.__delayTimeout = null;\n }\n if (this.__animationFrame) {\n window.cancelAnimationFrame(this.__animationFrame);\n this.__animationFrame = null;\n }\n }\n }\n\n /**\n * @deprecated not supported anymore\n */\n catch() {\n logWarn('Animation#catch is not supported anymore');\n return this.then();\n }\n\n /**\n * @deprecated not supported anymore\n */\n finally(onFinally) {\n logWarn('Animation#finally is not supported anymore');\n return this.then(onFinally);\n }\n\n /**\n * @deprecated not supported anymore\n */\n static resolve() {\n logWarn('Animation.resolve is not supported anymore');\n }\n\n}\n","import { PSVError } from '../PSVError';\nimport { bound, loop } from './math';\n\n/**\n * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame)\n * @memberOf PSV.utils\n */\nexport class Dynamic {\n\n static STOP = 0;\n static INFINITE = 1;\n static POSITION = 2;\n\n /**\n * @param {Function} [fn] Callback function\n * @param {number} [defaultValue] Default position\n * @param {number} [min] Minimum position\n * @param {number} [max] Maximum position\n * @param {boolean} [loopValue] Loop value between min and max\n */\n constructor(fn, defaultValue = 0, min = -Infinity, max = Infinity, loopValue = false) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {number}\n * @private\n */\n this.mode = Dynamic.STOP;\n\n /**\n * @type {number}\n * @private\n */\n this.speed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.speedMult = 1;\n\n /**\n * @type {number}\n * @private\n */\n this.currentSpeed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.target = 0;\n\n /**\n * @type {number}\n * @readonly\n */\n this.current = defaultValue;\n\n /**\n * @type {number}\n * @private\n */\n this.min = min;\n\n /**\n * @type {number}\n * @private\n */\n this.max = max;\n\n /**\n * @type {boolean}\n * @private\n */\n this.loopValue = loopValue;\n\n if (loopValue && min !== 0) {\n throw new PSVError('invalid config');\n }\n\n if (this.fn) {\n this.fn(defaultValue);\n }\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n this.speed = speed;\n }\n\n /**\n * Defines the target position\n * @param {number} position\n * @param {number} [speedMult=1]\n */\n goto(position, speedMult = 1) {\n this.mode = Dynamic.POSITION;\n this.target = this.loopValue ? loop(position, this.max) : bound(position, this.min, this.max);\n this.speedMult = speedMult;\n }\n\n /**\n * Increase/decrease the target position\n * @param {number} step\n * @param {number} [speedMult=1]\n */\n step(step, speedMult = 1) {\n if (this.mode !== Dynamic.POSITION) {\n this.target = this.current;\n }\n this.goto(this.target + step, speedMult);\n }\n\n /**\n * Starts infinite movement\n * @param {boolean} [invert=false]\n * @param {number} [speedMult=1]\n */\n roll(invert = false, speedMult = 1) {\n this.mode = Dynamic.INFINITE;\n this.target = invert ? -Infinity : Infinity;\n this.speedMult = speedMult;\n }\n\n /**\n * Stops movement\n */\n stop() {\n this.mode = Dynamic.STOP;\n }\n\n /**\n * Defines the current position and immediately stops movement\n * @param {number} value\n */\n setValue(value) {\n this.target = this.loopValue ? loop(value, this.max) : bound(value, this.min, this.max);\n this.mode = Dynamic.STOP;\n if (this.target !== this.current) {\n this.current = this.target;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n return false;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n // in position mode switch to stop mode when in the decceleration window\n if (this.mode === Dynamic.POSITION) {\n // in loop mode, alter \"current\" to avoid crossing the origin\n if (this.loopValue && Math.abs(this.target - this.current) > this.max / 2) {\n this.current = this.current < this.target ? this.current + this.max : this.current - this.max;\n }\n\n const dstStop = this.currentSpeed * this.currentSpeed / (this.speed * this.speedMult * 4);\n if (Math.abs(this.target - this.current) <= dstStop) {\n this.mode = Dynamic.STOP;\n }\n }\n\n // compute speed\n let targetSpeed = this.mode === Dynamic.STOP ? 0 : this.speed * this.speedMult;\n if (this.target < this.current) {\n targetSpeed = -targetSpeed;\n }\n if (this.currentSpeed < targetSpeed) {\n this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n else if (this.currentSpeed > targetSpeed) {\n this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n\n // compute new position\n let next = null;\n if (this.current > this.target && this.currentSpeed) {\n next = Math.max(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n else if (this.current < this.target && this.currentSpeed) {\n next = Math.min(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n\n // apply value\n if (next !== null) {\n next = this.loopValue ? loop(next, this.max) : bound(next, this.min, this.max);\n if (next !== this.current) {\n this.current = next;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n }\n\n return false;\n }\n\n}\n","import { each } from './misc';\n\n/**\n * @summary Wrapper for multiple {@link PSV.utils.Dynamic} evolving together\n * @memberOf PSV.utils\n */\nexport class MultiDynamic {\n\n /**\n * @type {Object}\n * @readonly\n */\n get current() {\n const values = {};\n each(this.dynamics, (dynamic, name) => {\n values[name] = dynamic.current;\n });\n return values;\n }\n\n /**\n * @param {Record} dynamics\n * @param {Function} [fn] Callback function\n */\n constructor(dynamics, fn) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {Record}\n * @private\n * @readonly\n */\n this.dynamics = dynamics;\n\n if (this.fn) {\n this.fn(this.current);\n }\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n each(this.dynamics, (d) => {\n d.setSpeed(speed);\n });\n }\n\n /**\n * Defines the target positions\n * @param {Record} positions\n * @param {number} [speedMult=1]\n */\n goto(positions, speedMult = 1) {\n each(positions, (position, name) => {\n this.dynamics[name].goto(position, speedMult);\n });\n }\n\n /**\n * Increase/decrease the target positions\n * @param {Record} steps\n * @param {number} [speedMult=1]\n */\n step(steps, speedMult = 1) {\n each(steps, (step, name) => {\n this.dynamics[name].step(step, speedMult);\n });\n }\n\n /**\n * Starts infinite movements\n * @param {Record} rolls\n * @param {number} [speedMult=1]\n */\n roll(rolls, speedMult = 1) {\n each(rolls, (roll, name) => {\n this.dynamics[name].roll(roll, speedMult);\n });\n }\n\n /**\n * Stops movements\n */\n stop() {\n each(this.dynamics, d => d.stop());\n }\n\n /**\n * Defines the current positions and immediately stops movements\n * @param {Record} values\n */\n setValue(values) {\n let hasUpdates = false;\n each(values, (value, name) => {\n hasUpdates |= this.dynamics[name].setValue(value);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n let hasUpdates = false;\n each(this.dynamics, (dynamic) => {\n hasUpdates |= dynamic.update(elapsed);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @summary Helper to make sliders elements\n * @memberOf PSV.utils\n */\nexport class Slider extends EventEmitter {\n\n static VERTICAL = 1;\n static HORIZONTAL = 2;\n\n /**\n * @type {boolean}\n * @readonly\n */\n get vertical() {\n return this.prop.direction === Slider.VERTICAL;\n }\n\n constructor({ psv, container, direction, onUpdate }) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = container;\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n onUpdate : onUpdate,\n direction: direction,\n mousedown: false,\n mouseover: false,\n };\n\n this.container.addEventListener('click', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('mousemove', this, true);\n this.container.addEventListener('touchmove', this, true);\n window.addEventListener('mouseup', this);\n window.addEventListener('touchend', this);\n }\n\n /**\n * @protected\n */\n destroy() {\n window.removeEventListener('mouseup', this);\n window.removeEventListener('touchend', this);\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'click': e.stopPropagation(); break;\n case 'mousedown': this.__onMouseDown(e); break;\n case 'mouseenter': this.__onMouseEnter(e); break;\n case 'mouseleave': this.__onMouseLeave(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onTouchEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __onMouseDown(evt) {\n this.prop.mousedown = true;\n this.__update(evt, true);\n }\n\n /**\n * @private\n */\n __onMouseEnter(evt) {\n this.prop.mouseover = true;\n this.__update(evt, true);\n }\n\n /**\n * @private\n */\n __onTouchStart(evt) {\n this.prop.mouseover = true;\n this.prop.mousedown = true;\n this.__update(evt.changedTouches[0], true);\n }\n\n /**\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown || this.prop.mouseover) {\n evt.stopPropagation();\n this.__update(evt, true);\n }\n }\n\n /**\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown || this.prop.mouseover) {\n evt.stopPropagation();\n this.__update(evt.changedTouches[0], true);\n }\n }\n\n /**\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n this.prop.mousedown = false;\n this.__update(evt, false);\n }\n }\n\n /**\n * @private\n */\n __onMouseLeave(evt) {\n if (this.prop.mouseover) {\n this.prop.mouseover = false;\n this.__update(evt, true);\n }\n }\n\n /**\n * @private\n */\n __onTouchEnd(evt) {\n if (this.prop.mousedown) {\n this.prop.mouseover = false;\n this.prop.mousedown = false;\n this.__update(evt.changedTouches[0], false);\n }\n }\n\n /**\n * @private\n */\n __update(evt, moving) {\n const boundingClientRect = this.container.getBoundingClientRect();\n const cursor = evt[this.vertical ? 'clientY' : 'clientX'];\n const pos = boundingClientRect[this.vertical ? 'bottom' : 'left'];\n const size = boundingClientRect[this.vertical ? 'height' : 'width'];\n const val = Math.abs((pos - cursor) / size);\n\n this.prop.onUpdate({\n value : val,\n click : !moving,\n mousedown: this.prop.mousedown,\n mouseover: this.prop.mouseover,\n cursor : evt,\n });\n }\n\n}\n","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser';\nexport * from './math';\nexport * from './misc';\nexport * from './psv';\n\nexport * from './Animation';\nexport * from './Dynamic';\nexport * from './MultiDynamic';\nexport * from './Slider';\n","import * as THREE from 'three';\nimport { SPHERE_RADIUS } from '../../data/constants';\nimport { SYSTEM } from '../../data/system';\nimport { PSVError } from '../../PSVError';\nimport { createTexture, firstNonNull, getXMPValue, isPowerOfTwo, logWarn } from '../../utils';\nimport { AbstractAdapter } from '../AbstractAdapter';\n\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularAdapter.Options\n * @property {number} [resolution=64] - number of faces of the sphere geometry, higher values may decrease performances\n */\n\n\n/**\n * @summary Adapter for equirectangular panoramas\n * @memberof PSV.adapters\n * @extends PSV.adapters.AbstractAdapter\n */\nexport class EquirectangularAdapter extends AbstractAdapter {\n\n static id = 'equirectangular';\n static supportsDownload = true;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.EquirectangularAdapter.Options}\n * @private\n */\n this.config = {\n resolution: 64,\n ...options,\n };\n\n if (!isPowerOfTwo(this.config.resolution)) {\n throw new PSVError('EquirectangularAdapter resolution must be power of two');\n }\n\n this.SPHERE_SEGMENTS = this.config.resolution;\n this.SPHERE_HORIZONTAL_SEGMENTS = this.SPHERE_SEGMENTS / 2;\n }\n\n /**\n * @override\n */\n supportsTransition() {\n return true;\n }\n\n /**\n * @override\n */\n supportsPreload() {\n return true;\n }\n\n /**\n * @override\n * @param {string} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) {\n if (typeof panorama !== 'string') {\n if (Array.isArray(panorama) || typeof panorama === 'object' && !!panorama.left) {\n logWarn('Cubemap support now requires an additional adapter, see https://photo-sphere-viewer.js.org/guide/adapters');\n }\n return Promise.reject(new PSVError('Invalid panorama url, are you using the right adapter?'));\n }\n\n return (\n !this.psv.config.useXmpData\n ? this.psv.textureLoader.loadImage(panorama, p => this.psv.loader.setProgress(p))\n .then(img => ({ img: img, xmpPanoData: null }))\n : this.__loadXMP(panorama, p => this.psv.loader.setProgress(p))\n .then(xmpPanoData => this.psv.textureLoader.loadImage(panorama).then(img => ({ img, xmpPanoData })))\n )\n .then(({ img, xmpPanoData }) => {\n if (typeof newPanoData === 'function') {\n newPanoData = newPanoData(img);\n }\n\n const panoData = {\n fullWidth : firstNonNull(newPanoData?.fullWidth, xmpPanoData?.fullWidth, img.width),\n fullHeight : firstNonNull(newPanoData?.fullHeight, xmpPanoData?.fullHeight, img.height),\n croppedWidth : firstNonNull(newPanoData?.croppedWidth, xmpPanoData?.croppedWidth, img.width),\n croppedHeight: firstNonNull(newPanoData?.croppedHeight, xmpPanoData?.croppedHeight, img.height),\n croppedX : firstNonNull(newPanoData?.croppedX, xmpPanoData?.croppedX, 0),\n croppedY : firstNonNull(newPanoData?.croppedY, xmpPanoData?.croppedY, 0),\n poseHeading : firstNonNull(newPanoData?.poseHeading, xmpPanoData?.poseHeading, 0),\n posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch, 0),\n poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll, 0),\n };\n\n if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) {\n logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image.\n panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`);\n }\n if ((newPanoData || xmpPanoData) && panoData.fullWidth !== panoData.fullHeight * 2) {\n logWarn('Invalid panoData, fullWidth should be twice fullHeight');\n }\n\n const texture = this.__createEquirectangularTexture(img, panoData);\n\n return { panorama, texture, panoData };\n });\n }\n\n /**\n * @summary Loads the XMP data of an image\n * @param {string} panorama\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @private\n */\n __loadXMP(panorama, onProgress) {\n return this.psv.textureLoader.loadFile(panorama, onProgress)\n .then(blob => this.__loadBlobAsString(blob))\n .then((binary) => {\n const a = binary.indexOf('');\n const data = binary.substring(a, b);\n\n if (a !== -1 && b !== -1 && data.includes('GPano:')) {\n return {\n fullWidth : getXMPValue(data, 'FullPanoWidthPixels'),\n fullHeight : getXMPValue(data, 'FullPanoHeightPixels'),\n croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'),\n croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'),\n croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'),\n croppedY : getXMPValue(data, 'CroppedAreaTopPixels'),\n poseHeading : getXMPValue(data, 'PoseHeadingDegrees'),\n posePitch : getXMPValue(data, 'PosePitchDegrees'),\n poseRoll : getXMPValue(data, 'PoseRollDegrees'),\n };\n }\n\n return null;\n });\n }\n\n /**\n * @summmary read a Blob as string\n * @param {Blob} blob\n * @returns {Promise}\n * @private\n */\n __loadBlobAsString(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n }\n\n /**\n * @summary Creates the final texture from image and panorama data\n * @param {Image} img\n * @param {PSV.PanoData} panoData\n * @returns {external:THREE.Texture}\n * @private\n */\n __createEquirectangularTexture(img, panoData) {\n // resize image / fill cropped parts with black\n if (panoData.fullWidth > SYSTEM.maxTextureWidth\n || panoData.croppedWidth !== panoData.fullWidth\n || panoData.croppedHeight !== panoData.fullHeight\n ) {\n const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth;\n\n const resizedPanoData = { ...panoData };\n if (ratio < 1) {\n resizedPanoData.fullWidth *= ratio;\n resizedPanoData.fullHeight *= ratio;\n resizedPanoData.croppedWidth *= ratio;\n resizedPanoData.croppedHeight *= ratio;\n resizedPanoData.croppedX *= ratio;\n resizedPanoData.croppedY *= ratio;\n }\n\n const buffer = document.createElement('canvas');\n buffer.width = resizedPanoData.fullWidth;\n buffer.height = resizedPanoData.fullHeight;\n\n const ctx = buffer.getContext('2d');\n ctx.drawImage(img,\n resizedPanoData.croppedX, resizedPanoData.croppedY,\n resizedPanoData.croppedWidth, resizedPanoData.croppedHeight);\n\n return createTexture(buffer);\n }\n\n return createTexture(img);\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n // The middle of the panorama is placed at longitude=0\n const geometry = new THREE.SphereGeometry(\n SPHERE_RADIUS * scale,\n this.SPHERE_SEGMENTS,\n this.SPHERE_HORIZONTAL_SEGMENTS,\n -Math.PI / 2\n )\n .scale(-1, 1, 1);\n\n const material = new THREE.MeshBasicMaterial();\n\n return new THREE.Mesh(geometry, material);\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n mesh.material.map?.dispose();\n mesh.material.map = textureData.texture;\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material.opacity = opacity;\n mesh.material.transparent = opacity < 1;\n }\n\n /**\n * @override\n */\n disposeTexture(textureData) {\n textureData.texture?.dispose();\n }\n\n}\n","/**\n * @namespace PSV.components\n */\n\n/**\n * @summary Base component class\n * @memberof PSV.components\n * @abstract\n */\nexport class AbstractComponent {\n\n /**\n * @param {PSV.Viewer | PSV.components.AbstractComponent} parent\n * @param {string} className - CSS class added to the component's container\n */\n constructor(parent, className) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = parent.psv || parent;\n\n /**\n * @member {PSV.Viewer|PSV.components.AbstractComponent}\n * @readonly\n */\n this.parent = parent;\n this.parent.children.push(this);\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} visible - Visibility of the component\n */\n this.prop = {\n visible: true,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = className;\n this.parent.container.appendChild(this.container);\n }\n\n /**\n * @summary Destroys the component\n * @protected\n */\n destroy() {\n this.parent.container.removeChild(this.container);\n\n const childIdx = this.parent.children.indexOf(this);\n if (childIdx !== -1) {\n this.parent.children.splice(childIdx, 1);\n }\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n delete this.container;\n delete this.parent;\n delete this.psv;\n delete this.prop;\n }\n\n /**\n * @summary Refresh UI\n * @description Must be be a very lightweight operation\n * @package\n */\n refreshUi() {\n this.children.every((child) => {\n child.refreshUi();\n return this.psv.prop.uiRefresh === true;\n });\n }\n\n /**\n * @summary Displays or hides the component\n */\n toggle() {\n if (this.isVisible()) {\n this.hide();\n }\n else {\n this.show();\n }\n }\n\n /**\n * @summary Hides the component\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Displays the component\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Checks if the component is visible\n * @returns {boolean}\n */\n isVisible() {\n return this.prop.visible;\n }\n\n}\n","import { AbstractComponent } from '../components/AbstractComponent';\nimport { KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { isPlainObject, toggleClass } from '../utils';\n\n/**\n * @namespace PSV.buttons\n */\n\n/**\n * @summary Base navbar button class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.buttons\n * @abstract\n */\nexport class AbstractButton extends AbstractComponent {\n\n /**\n * @summary Unique identifier of the button\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Identifier to declare a group of buttons\n * @member {string}\n * @readonly\n * @static\n */\n static groupId = null;\n\n /**\n * @summary SVG icon name injected in the button\n * @member {string}\n * @readonly\n * @static\n */\n static icon = null;\n\n /**\n * @summary SVG icon name injected in the button when it is active\n * @member {string}\n * @readonly\n * @static\n */\n static iconActive = null;\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} [className] - Additional CSS classes\n * @param {boolean} [collapsable=false] - `true` if the button can be moved to menu when the navbar is too small\n * @param {boolean} [tabbable=true] - `true` if the button is accessible with the keyboard\n */\n constructor(navbar, className = '', collapsable = false, tabbable = true) {\n super(navbar, 'psv-button ' + className);\n\n /**\n * @override\n * @property {string} id - Unique identifier of the button\n * @property {boolean} enabled\n * @property {boolean} supported\n * @property {boolean} collapsed\n * @property {boolean} active\n * @property {number} width\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable: collapsable,\n enabled : true,\n supported : true,\n collapsed : false,\n active : false,\n width : this.container.offsetWidth,\n };\n\n if (this.constructor.icon) {\n this.__setIcon(this.constructor.icon);\n }\n\n if (this.prop.id && this.psv.config.lang[this.prop.id]) {\n this.container.title = this.psv.config.lang[this.prop.id];\n }\n\n if (tabbable) {\n this.container.tabIndex = 0;\n }\n\n this.container.addEventListener('click', (e) => {\n if (this.prop.enabled) {\n this.onClick();\n }\n e.stopPropagation();\n });\n\n this.container.addEventListener('keydown', (e) => {\n if (e.key === KEY_CODES.Enter && this.prop.enabled) {\n this.onClick();\n e.stopPropagation();\n }\n });\n }\n\n /**\n * @package\n */\n checkSupported() {\n const supportedOrObject = this.isSupported();\n if (isPlainObject(supportedOrObject)) {\n if (supportedOrObject.initial === false) {\n this.hide();\n this.prop.supported = false;\n }\n\n supportedOrObject.promise.then((supported) => {\n if (!this.prop) {\n return; // the component has been destroyed\n }\n this.prop.supported = supported;\n if (!supported) {\n this.hide();\n }\n else {\n this.show();\n }\n });\n }\n else {\n this.prop.supported = supportedOrObject;\n if (!supportedOrObject) {\n this.hide();\n }\n }\n }\n\n /**\n * @summary Checks if the button can be displayed\n * @returns {boolean|{initial: boolean, promise: Promise}}\n */\n isSupported() {\n return true;\n }\n\n /**\n * @summary Changes the active state of the button\n * @param {boolean} [active] - forced state\n */\n toggleActive(active) {\n this.prop.active = active !== undefined ? active : !this.prop.active;\n toggleClass(this.container, 'psv-button--active', this.prop.active);\n\n if (this.constructor.iconActive) {\n this.__setIcon(this.prop.active ? this.constructor.iconActive : this.constructor.icon);\n }\n }\n\n /**\n * @override\n */\n show(refresh = true) {\n if (!this.isVisible()) {\n this.prop.visible = true;\n if (!this.prop.collapsed) {\n this.container.style.display = '';\n }\n if (refresh) {\n this.psv.refreshUi(`show button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @override\n */\n hide(refresh = true) {\n if (this.isVisible()) {\n this.prop.visible = false;\n this.container.style.display = 'none';\n if (refresh) {\n this.psv.refreshUi(`hide button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @summary Disables the button\n */\n disable() {\n this.container.classList.add('psv-button--disabled');\n this.prop.enabled = false;\n }\n\n /**\n * @summary Enables the button\n */\n enable() {\n this.container.classList.remove('psv-button--disabled');\n this.prop.enabled = true;\n }\n\n /**\n * @summary Collapses the button in the navbar menu\n */\n collapse() {\n this.prop.collapsed = true;\n this.container.style.display = 'none';\n }\n\n /**\n * @summary Uncollapses the button from the navbar menu\n */\n uncollapse() {\n this.prop.collapsed = false;\n if (this.prop.visible) {\n this.container.style.display = '';\n }\n }\n\n /**\n * @summary Set the button icon\n * @param {string} icon SVG\n * @param {HTMLElement} [container] - default is the main button container\n * @private\n */\n __setIcon(icon, container = this.container) {\n if (icon) {\n container.innerHTML = icon;\n // className is read-only on SVGElement\n container.querySelector('svg').classList.add('psv-button-svg');\n }\n else {\n container.innerHTML = '';\n }\n }\n\n /**\n * @summary Action when the button is clicked\n * @private\n * @abstract\n */\n onClick() {\n throw new PSVError(`onClick not implemented for button \"${this.prop.id}\".`);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport playActive from '../icons/play-active.svg';\nimport play from '../icons/play.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar autorotate button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AutorotateButton extends AbstractButton {\n\n static id = 'autorotate';\n static icon = play;\n static iconActive = playActive;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-autorotate-button', true);\n\n this.psv.on(EVENTS.AUTOROTATE, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.AUTOROTATE, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.AUTOROTATE: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles autorotate\n */\n onClick() {\n if (this.psv.isAutorotateEnabled()) {\n this.psv.config.autorotateIdle = false;\n this.psv.resetIdleTimer();\n }\n this.psv.toggleAutorotate();\n }\n\n}\n","import { addClasses } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar custom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CustomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {PSV.NavbarCustomButton} config\n */\n constructor(navbar, config) {\n super(navbar, 'psv-custom-button', config.collapsable !== false, config.tabbable !== false);\n\n /**\n * @member {Object}\n * @readonly\n * @private\n */\n this.config = config;\n\n if (this.config.id) {\n this.prop.id = this.config.id;\n }\n else {\n this.prop.id = 'psvButton-' + Math.random().toString(36).substr(2, 9);\n }\n\n if (this.config.className) {\n addClasses(this.container, this.config.className);\n }\n\n if (this.config.title) {\n this.container.title = this.config.title;\n }\n\n if (this.config.content) {\n this.container.innerHTML = this.config.content;\n }\n\n this.prop.width = this.container.offsetWidth;\n\n if (this.config.enabled === false) {\n this.disable();\n }\n\n if (this.config.visible === false) {\n this.hide();\n }\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.config;\n\n super.destroy();\n }\n\n /**\n * @override\n * @description Calls user method\n */\n onClick() {\n if (this.config.onClick) {\n this.config.onClick.apply(this.psv);\n }\n }\n\n}\n","import { EVENTS, IDS } from '../data/constants';\nimport info from '../icons/info.svg';\nimport { AbstractButton } from './AbstractButton';\n\nconst MODE_NOTIF = 1;\nconst MODE_PANEL = 2;\n\n/**\n * @summary Navigation bar description button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DescriptionButton extends AbstractButton {\n\n static id = 'description';\n static icon = info;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-description-button');\n\n /**\n * @override\n * @property {string} mode - notification or panel\n */\n this.prop = {\n ...this.prop,\n mode: null,\n };\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n this.psv.on(EVENTS.SHOW_NOTIFICATION, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n this.psv.on(EVENTS.OPEN_PANEL, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, this);\n this.psv.off(EVENTS.SHOW_NOTIFICATION, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n this.psv.off(EVENTS.OPEN_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (!this.prop.mode) {\n return;\n }\n\n let closed = false;\n switch (e.type) {\n case EVENTS.HIDE_NOTIFICATION:\n closed = this.prop.mode === MODE_NOTIF;\n break;\n\n case EVENTS.SHOW_NOTIFICATION:\n closed = this.prop.mode === MODE_NOTIF && e.args[0] !== IDS.DESCRIPTION;\n break;\n\n case EVENTS.CLOSE_PANEL:\n closed = this.prop.mode === MODE_PANEL;\n break;\n\n case EVENTS.OPEN_PANEL:\n closed = this.prop.mode === MODE_PANEL && e.args[0] !== IDS.DESCRIPTION;\n break;\n\n default:\n }\n\n if (closed) {\n this.toggleActive(false);\n this.prop.mode = null;\n }\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n\n if (this.prop.mode) {\n this.__close();\n }\n }\n\n /**\n * This button can only be refresh from NavbarCaption\n * @override\n */\n refreshUi(refresh = false) {\n if (refresh) {\n const caption = this.psv.navbar.getButton('caption', false);\n const captionHidden = caption && !caption.isVisible();\n const hasDescription = !!this.psv.config.description;\n\n if (captionHidden || hasDescription) {\n this.show(false);\n }\n else {\n this.hide(false);\n }\n }\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.prop.mode) {\n this.__close();\n }\n else {\n this.__open();\n }\n }\n\n /**\n * @private\n */\n __close() {\n switch (this.prop.mode) {\n case MODE_NOTIF:\n this.psv.notification.hide(IDS.DESCRIPTION);\n break;\n case MODE_PANEL:\n this.psv.panel.hide(IDS.DESCRIPTION);\n break;\n default:\n }\n }\n\n /**\n * @private\n */\n __open() {\n this.toggleActive(true);\n\n if (this.psv.config.description) {\n this.prop.mode = MODE_PANEL;\n this.psv.panel.show({\n id : IDS.DESCRIPTION,\n content: `${this.psv.config.caption ? `

${this.psv.config.caption}

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

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

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

${this.psv.config.caption}

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

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

\n
    \n ${buttons.map(button => `\n
  • \n ${button.container.innerHTML}\n ${button.container.title}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-menu-button');\n\n this.psv.on(EVENTS.OPEN_PANEL, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.OPEN_PANEL, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === IDS.MENU); break;\n case EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n this.__hideMenu();\n }\n\n /**\n * @override\n */\n show(refresh) {\n super.show(refresh);\n\n if (this.prop.active) {\n this.__showMenu();\n }\n }\n\n /**\n * @override\n * @description Toggles menu\n */\n onClick() {\n if (this.prop.active) {\n this.__hideMenu();\n }\n else {\n this.__showMenu();\n }\n }\n\n __showMenu() {\n this.psv.panel.show({\n id : IDS.MENU,\n content : MenuButton.MENU_TEMPLATE(this.parent.collapsed, this.psv, dasherize(MenuButton.BUTTON_DATA)),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? getClosest(e.target, 'li') : undefined;\n const buttonId = li ? li.dataset[MenuButton.BUTTON_DATA] : undefined;\n\n if (buttonId) {\n this.parent.getButton(buttonId).onClick();\n this.__hideMenu();\n }\n },\n });\n }\n\n __hideMenu() {\n this.psv.panel.hide(IDS.MENU);\n }\n\n}\n","/**\n * @summary Helper for pressable things (buttons, keyboard)\n * @description When the pressed thing goes up and was not pressed long enough, wait a bit more before execution\n * @private\n */\nexport class PressHandler {\n\n constructor(delay = 200) {\n this.delay = delay;\n this.time = 0;\n this.timeout = null;\n }\n\n down() {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n\n this.time = new Date().getTime();\n }\n\n up(cb) {\n if (!this.time) {\n return;\n }\n\n const elapsed = new Date().getTime() - this.time;\n if (elapsed < this.delay) {\n this.timeout = setTimeout(() => {\n cb();\n this.timeout = null;\n this.time = 0;\n }, this.delay);\n }\n else {\n cb();\n this.time = 0;\n }\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport arrow from '../icons/arrow.svg';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\nexport function getOrientedArrow(direction) {\n let angle = 0;\n switch (direction) {\n // @formatter:off\n case 'up': angle = 90; break;\n case 'right': angle = 180; break;\n case 'down': angle = -90; break;\n default: angle = 0; break;\n // @formatter:on\n }\n\n return arrow.replace('rotate(0', `rotate(${angle}`);\n}\n\n/**\n * @summary Navigation bar move button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractMoveButton extends AbstractButton {\n\n static groupId = 'move';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-move-button');\n\n this.container.title = this.psv.config.lang.move;\n\n /**\n * @override\n * @property {{longitude: boolean, latitude: boolean}} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': e.key === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': e.key === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.__stopAll();\n this.psv.dynamics.position.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => {\n this.psv.dynamics.position.stop();\n this.psv.resetIdleTimer();\n });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move down button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveDownButton extends AbstractMoveButton {\n\n static id = 'moveDown';\n static icon = getOrientedArrow('down');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move left button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveLeftButton extends AbstractMoveButton {\n\n static id = 'moveLeft';\n static icon = getOrientedArrow('left');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move right button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveRightButton extends AbstractMoveButton {\n\n static id = 'moveRight';\n static icon = getOrientedArrow('right');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: false });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move up button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveUpButton extends AbstractMoveButton {\n\n static id = 'moveUp';\n static icon = getOrientedArrow('up');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: false });\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractZoomButton extends AbstractButton {\n\n static groupId = 'zoom';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-zoom-button');\n\n /**\n * @override\n * @property {boolean} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': e.key === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': e.key === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.dynamics.zoom.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => this.psv.dynamics.zoom.stop());\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomIn from '../icons/zoom-in.svg';\n\n/**\n * @summary Navigation bar zoom-in button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomInButton extends AbstractZoomButton {\n\n static id = 'zoomIn';\n static icon = zoomIn;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, false);\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomOut from '../icons/zoom-out.svg';\n\n/**\n * @summary Navigation bar zoom-out button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomOutButton extends AbstractZoomButton {\n\n static id = 'zoomOut';\n static icon = zoomOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, true);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { getStyle, Slider } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class ZoomRangeButton extends AbstractButton {\n\n static id = 'zoomRange';\n static groupId = 'zoom';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-zoom-range', false, false);\n\n /**\n * @override\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mediaMinWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomRange = document.createElement('div');\n this.zoomRange.className = 'psv-zoom-range-line';\n this.container.appendChild(this.zoomRange);\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomValue = document.createElement('div');\n this.zoomValue.className = 'psv-zoom-range-handle';\n this.zoomRange.appendChild(this.zoomValue);\n\n /**\n * @member {PSV.Slider}\n * @readonly\n * @private\n */\n this.slider = new Slider({\n container: this.container,\n direction: Slider.HORIZONTAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n if (this.psv.prop.ready) {\n this.__moveZoomValue(this.psv.getZoomLevel());\n }\n else {\n this.psv.once(EVENTS.READY, this);\n }\n\n this.refreshUi();\n }\n\n /**\n * @override\n */\n destroy() {\n this.slider.destroy();\n\n delete this.zoomRange;\n delete this.zoomValue;\n\n this.psv.off(EVENTS.ZOOM_UPDATED, this);\n this.psv.off(EVENTS.READY, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.ZOOM_UPDATED: this.__moveZoomValue(e.args[0]); break;\n case EVENTS.READY: this.__moveZoomValue(this.psv.getZoomLevel()); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return {\n initial: !SYSTEM.isTouchEnabled.initial,\n promise: SYSTEM.isTouchEnabled.promise.then(enabled => !enabled),\n };\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.supported) {\n if (this.psv.prop.size.width <= this.prop.mediaMinWidth && this.prop.visible) {\n this.hide();\n }\n else if (this.psv.prop.size.width > this.prop.mediaMinWidth && !this.prop.visible) {\n this.show();\n }\n }\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @summary Moves the zoom cursor\n * @param {number} level\n * @private\n */\n __moveZoomValue(level) {\n this.zoomValue.style.left = (level / 100 * this.zoomRange.offsetWidth - this.zoomValue.offsetWidth / 2) + 'px';\n }\n\n\n /**\n * @summary Zoom change\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mousedown) {\n this.psv.zoom(e.value * 100);\n }\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @namespace PSV.plugins\n */\n\n/**\n * @summary Base plugins class\n * @memberof PSV.plugins\n * @abstract\n */\nexport class AbstractPlugin extends EventEmitter {\n\n /**\n * @summary Unique identifier of the plugin\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Initializes the plugin\n * @package\n */\n init() {\n }\n\n /**\n * @summary Destroys the plugin\n * @package\n */\n destroy() {\n delete this.psv;\n }\n\n}\n","import { MathUtils } from 'three';\nimport { AbstractAdapter } from '../adapters/AbstractAdapter';\nimport { EquirectangularAdapter } from '../adapters/equirectangular';\nimport { AbstractPlugin } from '../plugins/AbstractPlugin';\nimport { PSVError } from '../PSVError';\nimport { clone, deepmerge, each, isNil, logWarn, parseAngle, parseSpeed, pluginInterop } from '../utils';\nimport { ACTIONS, KEY_CODES } from './constants';\n\n/**\n * @summary Default options\n * @type {PSV.Options}\n * @memberOf PSV\n * @constant\n */\nexport const DEFAULTS = {\n panorama : null,\n overlay : null,\n overlayOpacity : 1,\n container : null,\n adapter : null,\n plugins : [],\n caption : null,\n description : null,\n downloadUrl : null,\n loadingImg : null,\n loadingTxt : 'Loading...',\n size : null,\n fisheye : false,\n minFov : 30,\n maxFov : 90,\n defaultZoomLvl : 50,\n defaultLong : 0,\n defaultLat : 0,\n sphereCorrection : null,\n moveSpeed : 1,\n zoomSpeed : 1,\n autorotateDelay : null,\n autorotateIdle : false,\n autorotateSpeed : '2rpm',\n autorotateLat : null,\n moveInertia : true,\n mousewheel : true,\n mousemove : true,\n captureCursor : false,\n mousewheelCtrlKey : false,\n touchmoveTwoFingers: false,\n useXmpData : true,\n panoData : null,\n requestHeaders : null,\n canvasBackground : '#000',\n withCredentials : false,\n navbar : [\n 'autorotate',\n 'zoom',\n 'move',\n 'download',\n 'description',\n 'caption',\n 'fullscreen',\n ],\n lang : {\n autorotate: 'Automatic rotation',\n zoom : 'Zoom',\n zoomOut : 'Zoom out',\n zoomIn : 'Zoom in',\n move : 'Move',\n download : 'Download',\n fullscreen: 'Fullscreen',\n menu : 'Menu',\n twoFingers: 'Use two fingers to navigate',\n ctrlZoom : 'Use ctrl + scroll to zoom the image',\n loadError : 'The panorama can\\'t be loaded',\n },\n keyboard : {\n [KEY_CODES.ArrowUp] : ACTIONS.ROTATE_LAT_UP,\n [KEY_CODES.ArrowDown] : ACTIONS.ROTATE_LAT_DOWN,\n [KEY_CODES.ArrowRight]: ACTIONS.ROTATE_LONG_RIGHT,\n [KEY_CODES.ArrowLeft] : ACTIONS.ROTATE_LONG_LEFT,\n [KEY_CODES.PageUp] : ACTIONS.ZOOM_IN,\n [KEY_CODES.PageDown] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Plus] : ACTIONS.ZOOM_IN,\n [KEY_CODES.Minus] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Space] : ACTIONS.TOGGLE_AUTOROTATE,\n },\n};\n\n/**\n * @summary List of unmodifiable options and their error messages\n * @private\n */\nexport const READONLY_OPTIONS = {\n panorama : 'Use setPanorama method to change the panorama',\n panoData : 'Use setPanorama method to change the panorama',\n container: 'Cannot change viewer container',\n adapter : 'Cannot change adapter',\n plugins : 'Cannot change plugins',\n};\n\n/**\n * @summary List of deprecated options and their warning messages\n * @private\n */\nexport const DEPRECATED_OPTIONS = {\n zoomButtonIncrement : 'zoomButtonIncrement is deprecated, use zoomSpeed',\n mousewheelSpeed : 'mousewheelSpeed is deprecated, use zoomSpeed',\n sphereCorrectionReorder: 'sphereCorrectionReorder is deprecated',\n};\n\n/**\n * @summary Parsers/validators for each option\n * @private\n */\nexport const CONFIG_PARSERS = {\n container : (container) => {\n if (!container) {\n throw new PSVError('No value given for container.');\n }\n return container;\n },\n adapter : (adapter) => {\n if (!adapter) {\n adapter = [EquirectangularAdapter];\n }\n else if (Array.isArray(adapter)) {\n adapter = [pluginInterop(adapter[0], AbstractAdapter), adapter[1]];\n }\n else {\n adapter = [pluginInterop(adapter, AbstractAdapter)];\n }\n if (!adapter[0]) {\n throw new PSVError('Un undefined value with given for adapter.');\n }\n return adapter;\n },\n overlayOpacity : (overlayOpacity) => {\n return MathUtils.clamp(overlayOpacity, 0, 1);\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 MathUtils.clamp(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 MathUtils.clamp(maxFov, 1, 179);\n },\n lang : (lang) => {\n if (Array.isArray(lang.twoFingers)) {\n logWarn('lang.twoFingers must not be an array');\n lang.twoFingers = lang.twoFingers[0];\n }\n return {\n ...DEFAULTS.lang,\n ...lang,\n };\n },\n keyboard : (keyboard) => {\n // keyboard=true becomes the default map\n if (keyboard === true) {\n return clone(DEFAULTS.keyboard);\n }\n return keyboard;\n },\n autorotateLat : (autorotateLat, config) => {\n // default autorotateLat is defaultLat\n if (autorotateLat === null) {\n return parseAngle(config.defaultLat, true);\n }\n // autorotateLat is between -PI/2 and PI/2\n else {\n return parseAngle(autorotateLat, true);\n }\n },\n autorotateSpeed: (autorotateSpeed) => {\n return parseSpeed(autorotateSpeed);\n },\n autorotateIdle : (autorotateIdle, config) => {\n if (autorotateIdle && isNil(config.autorotateDelay)) {\n logWarn('autorotateIdle requires a non null autorotateDelay');\n return false;\n }\n return autorotateIdle;\n },\n fisheye : (fisheye) => {\n // translate boolean fisheye to amount\n if (fisheye === true) {\n return 1;\n }\n else if (fisheye === false) {\n return 0;\n }\n return fisheye;\n },\n plugins : (plugins) => {\n return plugins\n .map((plugin) => {\n if (Array.isArray(plugin)) {\n plugin = [pluginInterop(plugin[0], AbstractPlugin), plugin[1]];\n }\n else {\n plugin = [pluginInterop(plugin, AbstractPlugin)];\n }\n if (!plugin[0]) {\n throw new PSVError('Un undefined value was given for plugins.');\n }\n return plugin;\n });\n },\n};\n\n/**\n * @summary Merge user config with default config and performs validation\n * @param {PSV.Options} options\n * @returns {PSV.Options}\n * @memberOf PSV\n * @private\n */\nexport function getConfig(options) {\n const tempConfig = clone(DEFAULTS);\n deepmerge(tempConfig, options);\n\n const config = {};\n\n each(tempConfig, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (CONFIG_PARSERS[key]) {\n config[key] = CONFIG_PARSERS[key](value, tempConfig);\n }\n else {\n config[key] = value;\n }\n });\n\n return config;\n}\n","import { DescriptionButton } from '../buttons/DescriptionButton';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Navbar caption class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class NavbarCaption extends AbstractComponent {\n\n static id = 'caption';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} caption\n */\n constructor(navbar, caption) {\n super(navbar, 'psv-caption');\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {number} contentWidth - width of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : 0,\n contentWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-caption-content';\n this.container.appendChild(this.content);\n\n this.setCaption(caption);\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n this.show();\n this.content.innerHTML = html;\n this.prop.contentWidth = html ? this.content.offsetWidth : 0;\n this.refreshUi();\n }\n\n /**\n * @summary Toggles content and icon depending on available space\n * @private\n */\n refreshUi() {\n const availableWidth = this.container.offsetWidth;\n if (availableWidth >= this.prop.contentWidth) {\n this.show();\n }\n else if (availableWidth < this.prop.contentWidth) {\n this.hide();\n }\n this.__refreshButton();\n }\n\n /**\n * @override\n */\n hide() {\n this.content.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n show() {\n this.content.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @private\n */\n __refreshButton() {\n this.psv.navbar.getButton(DescriptionButton.id, false)?.refreshUi(true);\n }\n\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\nimport { DescriptionButton } from '../buttons/DescriptionButton';\nimport { DownloadButton } from '../buttons/DownloadButton';\nimport { FullscreenButton } from '../buttons/FullscreenButton';\nimport { MenuButton } from '../buttons/MenuButton';\nimport { MoveDownButton } from '../buttons/MoveDownButton';\nimport { MoveLeftButton } from '../buttons/MoveLeftButton';\nimport { MoveRightButton } from '../buttons/MoveRightButton';\nimport { MoveUpButton } from '../buttons/MoveUpButton';\nimport { ZoomInButton } from '../buttons/ZoomInButton';\nimport { ZoomOutButton } from '../buttons/ZoomOutButton';\nimport { ZoomRangeButton } from '../buttons/ZoomRangeButton';\nimport { DEFAULTS } from '../data/config';\nimport { PSVError } from '../PSVError';\nimport { clone, logWarn } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { NavbarCaption } from './NavbarCaption';\n\n/**\n * @summary List of available buttons\n * @type {Object>}\n * @private\n */\nconst AVAILABLE_BUTTONS = {};\n\n/**\n * @summary List of available buttons\n * @type {Object>>}\n * @private\n */\nconst AVAILABLE_GROUPS = {};\n\n/**\n * @summary Register a new button available for all viewers\n * @param {Class} button\n * @param {'start' | 'end' | '[id]:left' | '[id]:right'} [defaultPosition]\n * If provided the default configuration of the navbar will be modified.\n * @memberOf PSV\n */\nexport function registerButton(button, defaultPosition) {\n if (!button.id) {\n throw new PSVError('Button ID is required');\n }\n\n AVAILABLE_BUTTONS[button.id] = button;\n\n if (button.groupId) {\n AVAILABLE_GROUPS[button.groupId] = AVAILABLE_GROUPS[button.groupId] || [];\n AVAILABLE_GROUPS[button.groupId].push(button);\n }\n\n if (typeof defaultPosition === 'string') {\n switch (defaultPosition) {\n case 'start':\n DEFAULTS.navbar.unshift(button.id);\n break;\n case 'end':\n DEFAULTS.navbar.push(button.id);\n break;\n default:\n const [id, pos] = defaultPosition.split(':');\n DEFAULTS.navbar.splice(DEFAULTS.navbar.indexOf(id) + (pos === 'right' ? 1 : 0), 0, button.id);\n }\n }\n}\n\n[\n AutorotateButton,\n ZoomOutButton,\n ZoomRangeButton,\n ZoomInButton,\n DescriptionButton,\n DownloadButton,\n FullscreenButton,\n MoveLeftButton,\n MoveRightButton,\n MoveUpButton,\n MoveDownButton,\n].forEach(registerButton);\n\n/**\n * @summary Navigation bar component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Navbar extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-navbar psv--capture-event');\n\n /**\n * @summary List of buttons of the navbar\n * @member {PSV.buttons.AbstractButton[]}\n * @override\n */\n this.children = [];\n\n /**\n * @summary List of collapsed buttons\n * @member {PSV.buttons.AbstractButton[]}\n * @private\n */\n this.collapsed = [];\n }\n\n /**\n * @summary Change the buttons visible on the navbar\n * @param {string|Array} buttons\n * @throws {PSV.PSVError} when a button is unknown\n */\n setButtons(buttons) {\n this.children.slice().forEach(item => item.destroy());\n this.children.length = 0;\n\n const cleanedButtons = this.__cleanButtons(buttons);\n\n // force description button if caption is present (used on narrow screens)\n if (cleanedButtons.indexOf(NavbarCaption.id) !== -1 && cleanedButtons.indexOf(DescriptionButton.id) === -1) {\n cleanedButtons.splice(cleanedButtons.indexOf(NavbarCaption.id), 0, DescriptionButton.id);\n }\n\n /* eslint-disable no-new */\n cleanedButtons.forEach((button) => {\n if (typeof button === 'object') {\n new CustomButton(this, button);\n }\n else if (AVAILABLE_BUTTONS[button]) {\n new AVAILABLE_BUTTONS[button](this);\n }\n else if (AVAILABLE_GROUPS[button]) {\n AVAILABLE_GROUPS[button].forEach(buttonCtor => new buttonCtor(this)); // eslint-disable-line new-cap\n }\n else if (button === NavbarCaption.id) {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else {\n throw new PSVError('Unknown button ' + button);\n }\n });\n\n new MenuButton(this);\n /* eslint-enable no-new */\n\n this.children.forEach((item) => {\n if (typeof item.checkSupported === 'function') {\n item.checkSupported();\n }\n });\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n const caption = this.getButton(NavbarCaption.id, false);\n caption?.setCaption(html);\n }\n\n /**\n * @summary Returns a button by its identifier\n * @param {string} id\n * @param {boolean} [warnNotFound=true]\n * @returns {PSV.buttons.AbstractButton}\n */\n getButton(id, warnNotFound = true) {\n let button = null;\n\n this.children.some((item) => {\n if (item.prop.id === id) {\n button = item;\n return true;\n }\n else {\n return false;\n }\n });\n\n if (!button && warnNotFound) {\n logWarn(`button \"${id}\" not found in the navbar`);\n }\n\n return button;\n }\n\n /**\n * @summary Shows the navbar\n */\n show() {\n this.container.classList.add('psv-navbar--open');\n this.prop.visible = true;\n }\n\n /**\n * @summary Hides the navbar\n */\n hide() {\n this.container.classList.remove('psv-navbar--open');\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n refreshUi() {\n super.refreshUi();\n\n if (this.psv.prop.uiRefresh === true) {\n const availableWidth = this.container.offsetWidth;\n\n let totalWidth = 0;\n const visibleButtons = [];\n const collapsableButtons = [];\n\n this.children.forEach((item) => {\n if (item.prop.visible) {\n totalWidth += item.prop.width;\n visibleButtons.push(item);\n if (item.prop.collapsable) {\n collapsableButtons.push(item);\n }\n }\n });\n\n if (!visibleButtons.length) {\n return;\n }\n\n if (availableWidth < totalWidth && collapsableButtons.length > 0) {\n collapsableButtons.forEach(item => item.collapse());\n this.collapsed = collapsableButtons;\n\n this.getButton(MenuButton.id).show(false);\n }\n else if (availableWidth >= totalWidth && this.collapsed.length > 0) {\n this.collapsed.forEach(item => item.uncollapse());\n this.collapsed = [];\n\n this.getButton(MenuButton.id).hide(false);\n }\n\n const caption = this.getButton(NavbarCaption.id, false);\n if (caption) {\n caption.refreshUi();\n }\n }\n }\n\n /**\n * @summary Ensure the buttons configuration is correct\n * @private\n */\n __cleanButtons(buttons) {\n // true becomes the default array\n if (buttons === true) {\n return clone(DEFAULTS.navbar);\n }\n // can be a space or coma separated list\n else if (typeof buttons === 'string') {\n return buttons.split(/[ ,]/);\n }\n else {\n return buttons || [];\n }\n }\n\n}\n","import { MathUtils } from 'three';\nimport { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { 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, MathUtils.clamp(value, 0, 100) / 100 * 2 * Math.PI - Math.PI / 2\n );\n context.stroke();\n\n this.psv.trigger(EVENTS.LOAD_PROGRESS, Math.round(value));\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Notification component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Notification extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-notification');\n\n /**\n * @override\n * @property {*} timeout\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId: undefined,\n timeout : null,\n };\n\n /**\n * Notification content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-notification-content';\n this.container.appendChild(this.content);\n\n this.content.addEventListener('click', () => this.hide());\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Notification cannot be toggled');\n }\n\n /**\n * @summary Displays a notification on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.content\n * @param {number} [config.timeout]\n * @fires PSV.show-notification\n *\n * @example\n * viewer.showNotification({ content: 'Hello world', timeout: 5000 })\n * @example\n * viewer.showNotification('Hello world')\n */\n show(config) {\n if (this.prop.timeout) {\n clearTimeout(this.prop.timeout);\n this.prop.timeout = null;\n }\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.content.innerHTML = config.content;\n\n this.container.classList.add('psv-notification--visible');\n this.prop.visible = true;\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION, config.id);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(config.id), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @param {string} [id]\n * @fires PSV.hide-notification\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.container.classList.remove('psv-notification--visible');\n this.prop.visible = false;\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Overlay component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Overlay extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-overlay');\n\n /**\n * @override\n * @property {string} contentId\n * @property {boolean} dissmisable\n */\n this.prop = {\n ...this.prop,\n contentId : undefined,\n dissmisable: true,\n };\n\n /**\n * Image container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.image = document.createElement('div');\n this.image.className = 'psv-overlay-image';\n this.container.appendChild(this.image);\n\n /**\n * Text container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.text = document.createElement('div');\n this.text.className = 'psv-overlay-text';\n this.container.appendChild(this.text);\n\n /**\n * Subtext container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.subtext = document.createElement('div');\n this.subtext.className = 'psv-overlay-subtext';\n this.container.appendChild(this.subtext);\n\n this.psv.on(EVENTS.CLICK, this);\n this.psv.on(EVENTS.KEY_PRESS, this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.CLICK, this);\n this.psv.off(EVENTS.KEY_PRESS, this);\n\n delete this.image;\n delete this.text;\n delete this.subtext;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case EVENTS.CLICK:\n if (this.isVisible() && this.prop.dissmisable) {\n this.hide();\n e.stopPropagation();\n }\n break;\n case EVENTS.KEY_PRESS:\n if (this.isVisible() && this.prop.dissmisable && e.args[0] === KEY_CODES.Escape) {\n this.hide();\n e.preventDefault();\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Overlay cannot be toggled');\n }\n\n /**\n * @summary Displays an overlay on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.image - SVG image/icon displayed above the text\n * @param {string} config.text - main message\n * @param {string} [config.subtext] - secondary message\n * @param {boolean} [config.dissmisable=true] - if the user can hide the overlay by clicking\n * @fires PSV.show-overlay\n */\n show(config) {\n if (typeof config === 'string') {\n config = { text: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.dissmisable = config.dissmisable !== false;\n this.image.innerHTML = config.image || '';\n this.text.innerHTML = config.text || '';\n this.subtext.innerHTML = config.subtext || '';\n\n super.show();\n\n this.psv.trigger(EVENTS.SHOW_OVERLAY, config.id);\n }\n\n /**\n * @summary Hides the overlay\n * @param {string} [id]\n * @fires PSV.hide-overlay\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n super.hide();\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_OVERLAY, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PSVError } from '../PSVError';\nimport { toggleClass } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Minimum width of the panel\n * @type {number}\n * @constant\n * @private\n */\nconst PANEL_MIN_WIDTH = 200;\n\n/**\n * @summary Panel component\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Panel extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-panel psv--capture-event');\n\n /**\n * @override\n * @property {string} contentId\n * @property {number} mouseX\n * @property {number} mouseY\n * @property {boolean} mousedown\n * @property {function} clickHandler\n * @property {function} keyHandler\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId : undefined,\n mouseX : 0,\n mouseY : 0,\n mousedown : false,\n clickHandler: null,\n keyHandler : null,\n width : {},\n };\n\n const resizer = document.createElement('div');\n resizer.className = 'psv-panel-resizer';\n this.container.appendChild(resizer);\n\n const closeBtn = document.createElement('div');\n closeBtn.className = 'psv-panel-close-button';\n this.container.appendChild(closeBtn);\n\n /**\n * @summary Content container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-panel-content';\n this.container.appendChild(this.content);\n\n // Stop wheel event bubbling from panel\n this.container.addEventListener(SYSTEM.mouseWheelEvent, e => e.stopPropagation());\n\n closeBtn.addEventListener('click', () => this.hide());\n\n // Event for panel resizing + stop bubling\n resizer.addEventListener('mousedown', this);\n resizer.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n\n this.psv.on(EVENTS.KEY_PRESS, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.KEY_PRESS, this);\n\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n delete this.prop;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onMouseUp(e); break;\n case EVENTS.KEY_PRESS:\n if (this.isVisible() && e.args[0] === KEY_CODES.Escape) {\n this.hide();\n e.preventDefault();\n }\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n * @summary This method is not supported\n * @throws {PSV.PSVError} always\n */\n toggle() {\n throw new PSVError('Panel cannot be toggled');\n }\n\n /**\n * @summary Shows the panel\n * @param {string|Object} config\n * @param {string} [config.id] - unique identifier to use with \"hide\" and to store the user desired width\n * @param {string} config.content - HTML content of the panel\n * @param {boolean} [config.noMargin=false] - remove the default margins\n * @param {string} [config.width] - initial width\n * @param {Function} [config.clickHandler] - called when the user clicks inside the panel or presses the Enter key while an element focused\n * @fires PSV.open-panel\n */\n show(config) {\n const wasVisible = this.isVisible(config.id);\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.visible = true;\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.content.removeEventListener('keydown', this.prop.keyHandler);\n this.prop.clickHandler = null;\n this.prop.keyHandler = null;\n }\n\n if (config.id && this.prop.width[config.id]) {\n this.container.style.width = this.prop.width[config.id];\n }\n else if (config.width) {\n this.container.style.width = config.width;\n }\n else {\n this.container.style.width = null;\n }\n\n this.content.innerHTML = config.content;\n this.content.scrollTop = 0;\n this.container.classList.add('psv-panel--open');\n\n toggleClass(this.content, 'psv-panel-content--no-margin', config.noMargin === true);\n\n if (config.clickHandler) {\n this.prop.clickHandler = config.clickHandler;\n this.prop.keyHandler = (e) => {\n if (e.key === KEY_CODES.Enter) {\n config.clickHandler(e);\n }\n };\n this.content.addEventListener('click', this.prop.clickHandler);\n this.content.addEventListener('keydown', this.prop.keyHandler);\n\n // focus the first element if possible, after animation ends\n if (!wasVisible) {\n setTimeout(() => {\n this.content.querySelector('a,button,[tabindex]')?.focus();\n }, 300);\n }\n }\n\n this.psv.trigger(EVENTS.OPEN_PANEL, config.id);\n }\n\n /**\n * @summary Hides the panel\n * @param {string} [id]\n * @fires PSV.close-panel\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.prop.visible = false;\n this.prop.contentId = undefined;\n\n this.content.innerHTML = null;\n this.container.classList.remove('psv-panel--open');\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.prop.clickHandler = null;\n }\n\n this.psv.trigger(EVENTS.CLOSE_PANEL, contentId);\n }\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n evt.stopPropagation();\n this.__startResize(evt);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n evt.stopPropagation();\n this.__startResize(evt.changedTouches[0]);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.prop.mousedown = false;\n this.content.classList.remove('psv-panel-content--no-interaction');\n }\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.__resize(evt);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown) {\n this.__resize(evt.touches[0]);\n }\n }\n\n /**\n * @summary Initializes the panel resize\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startResize(evt) {\n this.prop.mouseX = evt.clientX;\n this.prop.mouseY = evt.clientY;\n this.prop.mousedown = true;\n this.content.classList.add('psv-panel-content--no-interaction');\n }\n\n /**\n * @summary Resizes the panel\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __resize(evt) {\n const x = evt.clientX;\n const y = evt.clientY;\n const width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px';\n\n if (this.prop.contentId) {\n this.prop.width[this.prop.contentId] = width;\n }\n\n this.container.style.width = width;\n\n this.prop.mouseX = x;\n this.prop.mouseY = y;\n }\n\n}\n","/**\n * @namespace PSV.services\n */\n\n/**\n * @summary Base services class\n * @memberof PSV.services\n * @abstract\n */\nexport class AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = psv.config;\n\n /**\n * @summary Properties holder\n * @type {Object}\n * @readonly\n */\n this.prop = psv.prop;\n }\n\n /**\n * @summary Destroys the service\n */\n destroy() {\n delete this.psv;\n delete this.config;\n delete this.prop;\n }\n\n}\n","import { Euler, MathUtils, Vector2, Vector3 } 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 Vector2();\nconst vector3 = new Vector3();\nconst eulerZero = new 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 MathUtils.radToDeg(2 * Math.atan(Math.tan(MathUtils.degToRad(vFov) / 2) * this.prop.aspect));\n }\n\n /**\n * @summary Converts a speed into a duration from current position to a new position\n * @param {string|number} value\n * @param {number} angle\n * @returns {number}\n */\n speedToDuration(value, angle) {\n if (!value || typeof value !== 'number') {\n // desired radial speed\n const speed = value ? parseSpeed(value) : this.config.autorotateSpeed;\n // compute duration\n return angle / Math.abs(speed) * 1000;\n }\n else {\n return Math.abs(value);\n }\n }\n\n /**\n * @summary Converts pixel texture coordinates to spherical radians coordinates\n * @param {PSV.Point} point\n * @returns {PSV.Position}\n * @throws {PSV.PSVError} when the current adapter does not support texture coordinates\n */\n textureCoordsToSphericalCoords(point) {\n const panoData = this.prop.panoData;\n if (!panoData) {\n throw new PSVError('Current adapter does not support texture coordinates.');\n }\n\n const relativeX = (point.x + panoData.croppedX) / panoData.fullWidth * Math.PI * 2;\n const relativeY = (point.y + panoData.croppedY) / panoData.fullHeight * Math.PI;\n\n const result = {\n longitude: relativeX >= Math.PI ? relativeX - Math.PI : relativeX + Math.PI,\n latitude : Math.PI / 2 - relativeY,\n };\n\n // Apply panoData pose and sphereCorrection\n if (!eulerZero.equals(this.psv.renderer.mesh.rotation) || !eulerZero.equals(this.psv.renderer.meshContainer.rotation)) {\n this.sphericalCoordsToVector3(result, vector3);\n vector3.applyEuler(this.psv.renderer.mesh.rotation);\n vector3.applyEuler(this.psv.renderer.meshContainer.rotation);\n return this.vector3ToSphericalCoords(vector3);\n }\n else {\n return result;\n }\n }\n\n /**\n * @summary Converts spherical radians coordinates to pixel texture coordinates\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n * @throws {PSV.PSVError} when the current adapter does not support texture coordinates\n */\n sphericalCoordsToTextureCoords(position) {\n const panoData = this.prop.panoData;\n if (!panoData) {\n throw new PSVError('Current adapter does not support texture coordinates.');\n }\n\n // Apply panoData pose and sphereCorrection\n if (!eulerZero.equals(this.psv.renderer.mesh.rotation) || !eulerZero.equals(this.psv.renderer.meshContainer.rotation)) {\n this.sphericalCoordsToVector3(position, vector3);\n applyEulerInverse(vector3, this.psv.renderer.meshContainer.rotation);\n applyEulerInverse(vector3, this.psv.renderer.mesh.rotation);\n position = this.vector3ToSphericalCoords(vector3);\n }\n\n const relativeLong = position.longitude / Math.PI / 2 * panoData.fullWidth;\n const relativeLat = position.latitude / Math.PI * panoData.fullHeight;\n\n return {\n x: Math.round(position.longitude < Math.PI ? relativeLong + panoData.fullWidth / 2 : relativeLong - panoData.fullWidth / 2) - panoData.croppedX,\n y: Math.round(panoData.fullHeight / 2 - relativeLat) - panoData.croppedY,\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to a THREE.Vector3\n * @param {PSV.Position} position\n * @param {external:THREE.Vector3} [vector]\n * @returns {external:THREE.Vector3}\n */\n sphericalCoordsToVector3(position, vector) {\n if (!vector) {\n vector = new Vector3();\n }\n vector.x = SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude);\n vector.y = SPHERE_RADIUS * Math.sin(position.latitude);\n vector.z = SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude);\n return vector;\n }\n\n /**\n * @summary Converts a THREE.Vector3 to spherical radians coordinates\n * @param {external:THREE.Vector3} vector\n * @returns {PSV.Position}\n */\n vector3ToSphericalCoords(vector) {\n const phi = Math.acos(vector.y / Math.sqrt(vector.x * vector.x + vector.y * vector.y + vector.z * vector.z));\n const theta = Math.atan2(vector.x, vector.z);\n\n return {\n longitude: theta < 0 ? -theta : Math.PI * 2 - theta,\n latitude : Math.PI / 2 - phi,\n };\n }\n\n /**\n * @summary Converts position on the viewer to a THREE.Vector3\n * @param {PSV.Point} viewerPoint\n * @returns {external:THREE.Vector3}\n */\n viewerCoordsToVector3(viewerPoint) {\n const sphereIntersect = this.getIntersections(viewerPoint).filter(i => i.object.userData[MESH_USER_DATA]);\n\n if (sphereIntersect.length) {\n return sphereIntersect[0].point;\n }\n else {\n return null;\n }\n }\n\n /**\n * @summary Converts a THREE.Vector3 to position on the viewer\n * @param {external:THREE.Vector3} vector\n * @returns {PSV.Point}\n */\n vector3ToViewerCoords(vector) {\n const vectorClone = vector.clone();\n vectorClone.project(this.psv.renderer.camera);\n\n return {\n x: Math.round((vectorClone.x + 1) / 2 * this.prop.size.width),\n y: Math.round((1 - vectorClone.y) / 2 * this.prop.size.height),\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to position on the viewer\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n */\n sphericalCoordsToViewerCoords(position) {\n return this.vector3ToViewerCoords(this.sphericalCoordsToVector3(position, vector3));\n }\n\n /**\n * @summary Returns intersections with objects in the scene\n * @param {PSV.Point} viewerPoint\n * @return {external:THREE.Intersection[]}\n */\n getIntersections(viewerPoint) {\n vector2.x = 2 * viewerPoint.x / this.prop.size.width - 1;\n vector2.y = -2 * viewerPoint.y / this.prop.size.height + 1;\n\n this.psv.renderer.raycaster.setFromCamera(vector2, this.psv.renderer.camera);\n\n return this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true)\n .filter(i => !!i.object.userData);\n }\n\n /**\n * @summary Converts x/y to latitude/longitude if present and ensure boundaries\n * @param {PSV.ExtendedPosition} position\n * @returns {PSV.Position}\n */\n cleanPosition(position) {\n if (position.x !== undefined && position.y !== undefined) {\n return this.textureCoordsToSphericalCoords(position);\n }\n else {\n return {\n longitude: parseAngle(position.longitude),\n latitude : parseAngle(position.latitude, !this.prop.littlePlanet),\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 : MathUtils.degToRad(panoData?.poseHeading || 0),\n tilt: MathUtils.degToRad(panoData?.posePitch || 0),\n roll: MathUtils.degToRad(panoData?.poseRoll || 0),\n };\n }\n\n}\n","import { MathUtils, SplineCurve, Vector2 } from 'three';\nimport {\n ACTIONS,\n CTRLZOOM_TIMEOUT,\n DBLCLICK_DELAY,\n EVENTS,\n IDS,\n INERTIA_WINDOW,\n KEY_CODES,\n LONGTOUCH_DELAY,\n MOVE_THRESHOLD,\n OBJECT_EVENTS,\n TWOFINGERSOVERLAY_DELAY\n} from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport gestureIcon from '../icons/gesture.svg';\nimport mousewheelIcon from '../icons/mousewheel.svg';\nimport {\n clone,\n distance,\n each,\n getClosest,\n getPosition,\n isEmpty,\n isFullscreenEnabled,\n normalizeWheel,\n throttle\n} from '../utils';\nimport { Animation } from '../utils/Animation';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Events handler\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class EventsHandler extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @property {number} moveThreshold - computed threshold based on device pixel ratio\n * @property {boolean} moving - is the user moving\n * @property {boolean} zooming - is the user zooming\n * @property {number} startMouseX - start x position of the click/touch\n * @property {number} startMouseY - start y position of the click/touch\n * @property {number} mouseX - current x position of the cursor\n * @property {number} mouseY - current y position of the cursor\n * @property {number[][]} mouseHistory - list of latest positions of the cursor, [time, x, y]\n * @property {number} pinchDist - distance between fingers when zooming\n * @property {PressHandler} keyHandler\n * @property {boolean} ctrlKeyDown - when the Ctrl key is pressed\n * @property {PSV.ClickData} dblclickData - temporary storage of click data between two clicks\n * @property {number} dblclickTimeout - timeout id for double click\n * @property {number} twofingersTimeout - timeout id for \"two fingers\" overlay\n * @property {number} ctrlZoomTimeout - timeout id for \"ctrol zoom\" overlay\n * @protected\n */\n this.state = {\n moveThreshold : MOVE_THRESHOLD * SYSTEM.pixelRatio,\n keyboardEnabled : false,\n moving : false,\n zooming : false,\n startMouseX : 0,\n startMouseY : 0,\n mouseX : 0,\n mouseY : 0,\n mouseHistory : [],\n pinchDist : 0,\n keyHandler : new PressHandler(),\n ctrlKeyDown : false,\n dblclickData : null,\n dblclickTimeout : null,\n longtouchTimeout : null,\n twofingersTimeout: null,\n ctrlZoomTimeout : null,\n };\n\n /**\n * @summary Throttled wrapper of {@link PSV.Viewer#autoSize}\n * @type {Function}\n * @private\n */\n this.__onResize = throttle(() => this.psv.autoSize(), 50);\n }\n\n /**\n * @summary Initializes event handlers\n * @protected\n */\n init() {\n window.addEventListener('resize', this);\n window.addEventListener('keydown', this);\n window.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseenter', this);\n this.psv.container.addEventListener('mousedown', this);\n this.psv.container.addEventListener('mouseleave', this);\n this.psv.container.addEventListener('mousemove', this);\n window.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('touchmove', this);\n window.addEventListener('touchend', this);\n this.psv.container.addEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.addEventListener(SYSTEM.fullscreenEvent, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n window.removeEventListener('resize', this);\n window.removeEventListener('keydown', this);\n window.removeEventListener('keyup', this);\n this.psv.container.removeEventListener('mouseenter', this);\n this.psv.container.removeEventListener('mousedown', this);\n this.psv.container.removeEventListener('mouseleave', this);\n this.psv.container.removeEventListener('mousemove', this);\n window.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchstart', this);\n this.psv.container.removeEventListener('touchmove', this);\n window.removeEventListener('touchend', this);\n this.psv.container.removeEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.removeEventListener(SYSTEM.fullscreenEvent, this);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n clearTimeout(this.state.longtouchTimeout);\n clearTimeout(this.state.twofingersTimeout);\n clearTimeout(this.state.ctrlZoomTimeout);\n\n delete this.state;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'resize': this.__onResize(); break;\n case 'keydown': this.__onKeyDown(evt); break;\n case 'keyup': this.__onKeyUp(); break;\n case 'mouseup': this.__onMouseUp(evt); break;\n case 'touchend': this.__onTouchEnd(evt); break;\n case SYSTEM.fullscreenEvent: this.__fullscreenToggled(); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n if (!getClosest(evt.target, '.psv--capture-event')) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(evt); break;\n case 'mouseenter': this.__onMouseEnter(evt); break;\n case 'mouseleave': this.__onMouseLeave(evt); break;\n case 'mousemove': this.__onMouseMove(evt); break;\n case 'touchstart': this.__onTouchStart(evt); break;\n case 'touchmove': this.__onTouchMove(evt); break;\n case SYSTEM.mouseWheelEvent: this.__onMouseWheel(evt); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n }\n\n /**\n * @summary Enables the keyboard controls\n * @protected\n */\n enableKeyboard() {\n this.state.keyboardEnabled = true;\n }\n\n /**\n * @summary Disables the keyboard controls\n * @protected\n */\n disableKeyboard() {\n this.state.keyboardEnabled = false;\n }\n\n /**\n * @summary Handles keyboard events\n * @param {KeyboardEvent} e\n * @private\n */\n __onKeyDown(e) {\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = e.key === KEY_CODES.Control;\n\n if (this.state.ctrlKeyDown) {\n clearTimeout(this.state.ctrlZoomTimeout);\n this.psv.overlay.hide(IDS.CTRL_ZOOM);\n }\n }\n\n const e2 = this.psv.trigger(EVENTS.KEY_PRESS, e.key);\n if (e2.isDefaultPrevented()) {\n return;\n }\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n const action = this.config.keyboard[e.key];\n if (action === ACTIONS.TOGGLE_AUTOROTATE) {\n this.psv.toggleAutorotate();\n }\n else if (action && !this.state.keyHandler.time) {\n if (action !== ACTIONS.ZOOM_IN && action !== ACTIONS.ZOOM_OUT) {\n this.psv.__stopAll();\n }\n\n /* eslint-disable */\n switch (action) {\n // @formatter:off\n case ACTIONS.ROTATE_LAT_UP: this.psv.dynamics.position.roll({latitude: false}); break;\n case ACTIONS.ROTATE_LAT_DOWN: this.psv.dynamics.position.roll({latitude: true}); break;\n case ACTIONS.ROTATE_LONG_RIGHT: this.psv.dynamics.position.roll({longitude: false}); break;\n case ACTIONS.ROTATE_LONG_LEFT: this.psv.dynamics.position.roll({longitude: true}); break;\n case ACTIONS.ZOOM_IN: this.psv.dynamics.zoom.roll(false); break;\n case ACTIONS.ZOOM_OUT: this.psv.dynamics.zoom.roll(true); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n this.state.keyHandler.down();\n }\n }\n\n /**\n * @summary Handles keyboard events\n * @private\n */\n __onKeyUp() {\n this.state.ctrlKeyDown = false;\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n this.state.keyHandler.up(() => {\n this.psv.dynamics.position.stop();\n this.psv.dynamics.zoom.stop();\n this.psv.resetIdleTimer();\n });\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse enter events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseEnter(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse leave events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseLeave(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.config.mousemove) {\n if (evt.buttons !== 0) {\n evt.preventDefault();\n this.__move(evt);\n }\n else if (this.config.captureCursor) {\n this.__moveAbsolute(evt);\n }\n }\n\n if (!isEmpty(this.prop.objectsObservers)) {\n const viewerPos = getPosition(this.psv.container);\n\n const viewerPoint = {\n x: evt.clientX - viewerPos.left,\n y: evt.clientY - viewerPos.top,\n };\n\n const intersections = this.psv.dataHelper.getIntersections(viewerPoint);\n\n const emit = (observer, key, type) => {\n observer.listener.handleEvent(new CustomEvent(type, {\n detail: {\n originalEvent: evt,\n object : observer.object,\n data : observer.object.userData[key],\n viewerPoint : viewerPoint,\n },\n }));\n };\n\n each(this.prop.objectsObservers, (observer, key) => {\n const intersection = intersections.find(i => i.object.userData[key]);\n\n if (intersection) {\n if (observer.object && intersection.object !== observer.object) {\n emit(observer, key, OBJECT_EVENTS.LEAVE_OBJECT);\n delete observer.object;\n }\n\n if (!observer.object) {\n observer.object = intersection.object;\n emit(observer, key, OBJECT_EVENTS.ENTER_OBJECT);\n }\n else {\n emit(observer, key, OBJECT_EVENTS.HOVER_OBJECT);\n }\n }\n else if (observer.object) {\n emit(observer, key, OBJECT_EVENTS.LEAVE_OBJECT);\n delete observer.object;\n }\n });\n }\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n if (evt.touches.length === 1) {\n if (!this.config.touchmoveTwoFingers) {\n this.__startMove(evt.touches[0]);\n evt.preventDefault(); // prevent mouse events emulation\n }\n\n if (!this.prop.longtouchTimeout) {\n this.prop.longtouchTimeout = setTimeout(() => {\n this.__click(evt.touches[0], true);\n this.prop.longtouchTimeout = null;\n }, LONGTOUCH_DELAY);\n }\n }\n else if (evt.touches.length === 2) {\n this.__cancelLongTouch();\n this.__cancelTwoFingersOverlay();\n this.__startMoveZoom(evt);\n evt.preventDefault();\n }\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchEnd(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n this.__cancelLongTouch();\n this.__cancelTwoFingersOverlay();\n\n if (evt.touches.length === 1) {\n this.__stopMoveZoom();\n }\n else if (evt.touches.length === 0) {\n this.__stopMove(evt.changedTouches[0]);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\n this.__cancelLongTouch();\n\n if (evt.touches.length === 1) {\n if (this.config.touchmoveTwoFingers) {\n if (!this.prop.twofingersTimeout) {\n this.prop.twofingersTimeout = setTimeout(() => {\n this.psv.overlay.show({\n id : IDS.TWO_FINGERS,\n image: gestureIcon,\n text : this.config.lang.twoFingers,\n });\n }, TWOFINGERSOVERLAY_DELAY);\n }\n }\n else {\n evt.preventDefault();\n this.__move(evt.touches[0]);\n }\n }\n else if (evt.touches.length === 2) {\n evt.preventDefault();\n this.__moveZoom(evt);\n this.__cancelTwoFingersOverlay();\n }\n }\n\n /**\n * @summary Cancel the long touch timer if any\n * @private\n */\n __cancelLongTouch() {\n if (this.prop.longtouchTimeout) {\n clearTimeout(this.prop.longtouchTimeout);\n this.prop.longtouchTimeout = null;\n }\n }\n\n /**\n * @summary Cancel the two fingers overlay timer if any\n * @private\n */\n __cancelTwoFingersOverlay() {\n if (this.prop.twofingersTimeout) {\n clearTimeout(this.prop.twofingersTimeout);\n this.prop.twofingersTimeout = null;\n }\n this.psv.overlay.hide(IDS.TWO_FINGERS);\n }\n\n /**\n * @summary Handles mouse wheel events\n * @param {WheelEvent} evt\n * @private\n */\n __onMouseWheel(evt) {\n if (!this.config.mousewheel) {\n return;\n }\n\n if (this.config.mousewheelCtrlKey && !this.state.ctrlKeyDown) {\n this.psv.overlay.show({\n id : IDS.CTRL_ZOOM,\n image: mousewheelIcon,\n text : this.config.lang.ctrlZoom,\n });\n\n clearTimeout(this.state.ctrlZoomTimeout);\n this.state.ctrlZoomTimeout = setTimeout(() => this.psv.overlay.hide(IDS.CTRL_ZOOM), CTRLZOOM_TIMEOUT);\n\n return;\n }\n\n evt.preventDefault();\n evt.stopPropagation();\n\n const delta = normalizeWheel(evt).spinY * 5 * this.config.zoomSpeed;\n if (delta !== 0) {\n this.psv.dynamics.zoom.step(-delta, 5);\n }\n }\n\n /**\n * @summary Handles fullscreen events\n * @param {boolean} [force] force state\n * @fires PSV.fullscreen-updated\n * @package\n */\n __fullscreenToggled(force) {\n this.prop.fullscreen = force !== undefined ? force : isFullscreenEnabled(this.psv.container);\n\n if (this.config.keyboard) {\n if (this.prop.fullscreen) {\n this.psv.startKeyboardControl();\n }\n else {\n this.psv.stopKeyboardControl();\n }\n }\n\n this.psv.trigger(EVENTS.FULLSCREEN_UPDATED, this.prop.fullscreen);\n }\n\n /**\n * @summary Initializes the movement\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startMove(evt) {\n this.psv.__stopAll()\n .then(() => {\n this.state.mouseX = evt.clientX;\n this.state.mouseY = evt.clientY;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = false;\n\n this.state.mouseHistory.length = 0;\n this.__logMouseMove(evt);\n });\n }\n\n /**\n * @summary Initializes the combines move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __startMoveZoom(evt) {\n this.psv.__stopAll()\n .then(() => {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n this.state.pinchDist = distance(p1, p2);\n this.state.mouseX = (p1.x + p2.x) / 2;\n this.state.mouseY = (p1.y + p2.y) / 2;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = true;\n });\n }\n\n /**\n * @summary Stops the movement\n * @description If the move threshold was not reached a click event is triggered, otherwise an animation is launched to simulate inertia\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMove(evt) {\n this.psv.resetIdleTimer();\n\n if (!getClosest(evt.target, '.psv-container')) {\n this.state.moving = false;\n this.state.mouseHistory.length = 0;\n return;\n }\n\n if (this.state.moving) {\n // move threshold to trigger a click\n if (Math.abs(evt.clientX - this.state.startMouseX) < this.state.moveThreshold\n && Math.abs(evt.clientY - this.state.startMouseY) < this.state.moveThreshold) {\n this.__click(evt);\n this.state.moving = false;\n }\n // inertia animation\n else if (this.config.moveInertia) {\n this.__logMouseMove(evt);\n this.__stopMoveInertia(evt);\n }\n else {\n this.state.moving = false;\n }\n\n this.state.mouseHistory.length = 0;\n }\n }\n\n /**\n * @summary Stops the combined move and zoom\n * @private\n */\n __stopMoveZoom() {\n this.psv.resetIdleTimer();\n this.state.mouseHistory.length = 0;\n this.state.moving = false;\n this.state.zooming = false;\n }\n\n /**\n * @summary Performs an animation to simulate inertia when the movement stops\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMoveInertia(evt) {\n // get direction at end of movement\n const curve = new SplineCurve(this.state.mouseHistory.map(([, x, y]) => new Vector2(x, y)));\n const direction = curve.getTangent(1);\n\n // average speed\n const speed = this.state.mouseHistory.slice(1).reduce(({ total, prev }, curr) => {\n return {\n total: total + Math.sqrt(Math.pow(curr[1] - prev[1], 2) + Math.pow(curr[2] - prev[2], 2)) / (curr[0] - [prev[0]]),\n prev : curr,\n };\n }, {\n total: 0,\n prev : this.state.mouseHistory[0],\n }).total / this.state.mouseHistory.length;\n\n const current = {\n clientX: evt.clientX,\n clientY: evt.clientY,\n };\n\n this.prop.animationPromise = new Animation({\n properties: {\n speed: { start: speed, end: 0 },\n },\n duration : 1000,\n easing : 'outQuad',\n onTick : (properties) => {\n // 3 is a magic number\n current.clientX += properties.speed * direction.x * 3 * SYSTEM.pixelRatio;\n current.clientY += properties.speed * direction.y * 3 * SYSTEM.pixelRatio;\n this.__move(current, 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 * MathUtils.degToRad(this.prop.hFov),\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * MathUtils.degToRad(this.prop.vFov),\n };\n\n const currentPosition = this.psv.getPosition();\n this.psv.rotate({\n longitude: currentPosition.longitude - rotation.longitude,\n latitude : currentPosition.latitude + rotation.latitude,\n });\n\n this.state.mouseX = x;\n this.state.mouseY = y;\n\n if (log !== false) {\n this.__logMouseMove(evt);\n }\n }\n }\n\n /**\n * @summary Performs movement absolute to cursor position in viewer\n * @param {MouseEvent} evt\n * @private\n */\n __moveAbsolute(evt) {\n if (this.state.moving) {\n const containerRect = this.psv.container.getBoundingClientRect();\n this.psv.dynamics.position.goto({\n longitude: ((evt.clientX - containerRect.left) / containerRect.width - 0.5) * Math.PI * 2,\n latitude : -((evt.clientY - containerRect.top) / containerRect.height - 0.5) * Math.PI,\n }, 10);\n }\n }\n\n /**\n * @summary Perfoms combined move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __moveZoom(evt) {\n if (this.state.zooming && this.state.moving) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n const p = distance(p1, p2);\n const delta = 80 * (p - this.state.pinchDist) / this.prop.size.width * this.config.zoomSpeed;\n\n this.psv.zoom(this.psv.getZoomLevel() + delta);\n\n this.__move({\n clientX: (p1.x + p2.x) / 2,\n clientY: (p1.y + p2.y) / 2,\n });\n\n this.state.pinchDist = p;\n }\n }\n\n /**\n * @summary Stores each mouse position during a mouse move\n * @description Positions older than \"INERTIA_WINDOW\" are removed
\n * Positions before a pause of \"INERTIA_WINDOW\" / 10 are removed\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __logMouseMove(evt) {\n const now = Date.now();\n\n const last = this.state.mouseHistory.length ? this.state.mouseHistory[this.state.mouseHistory.length - 1] : [0, -1, -1];\n\n // avoid duplicates\n if (last[1] === evt.clientX && last[2] === evt.clientY) {\n last[0] = now;\n }\n else if (now === last[0]) {\n last[1] = evt.clientX;\n last[2] = evt.clientY;\n }\n else {\n this.state.mouseHistory.push([now, evt.clientX, evt.clientY]);\n }\n\n let previous = null;\n\n for (let i = 0; i < this.state.mouseHistory.length;) {\n if (this.state.mouseHistory[i][0] < now - INERTIA_WINDOW) {\n this.state.mouseHistory.splice(i, 1);\n }\n else if (previous && this.state.mouseHistory[i][0] - previous > INERTIA_WINDOW / 10) {\n this.state.mouseHistory.splice(0, i);\n i = 0;\n previous = this.state.mouseHistory[i][0];\n }\n else {\n previous = this.state.mouseHistory[i][0];\n i++;\n }\n }\n }\n\n}\n","import { Group, PerspectiveCamera, Raycaster, Scene, Vector3, WebGLRenderer } from 'three';\nimport { EVENTS, MESH_USER_DATA, SPHERE_RADIUS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { each, isExtendedPosition } from '../utils';\nimport { Animation } from '../utils/Animation';\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 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 Scene();\n\n /**\n * @member {external:THREE.PerspectiveCamera}\n * @readonly\n * @protected\n */\n this.camera = new 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 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 Raycaster();\n\n /**\n * @member {number}\n * @private\n */\n this.timestamp = null;\n\n /**\n * @member {boolean}\n * @private\n */\n this.ready = false;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.canvasContainer = document.createElement('div');\n this.canvasContainer.className = 'psv-canvas-container';\n this.canvasContainer.style.background = this.psv.config.canvasBackground;\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n this.canvasContainer.appendChild(this.renderer.domElement);\n this.psv.container.appendChild(this.canvasContainer);\n\n psv.on(EVENTS.SIZE_UPDATED, this);\n psv.on(EVENTS.ZOOM_UPDATED, this);\n psv.on(EVENTS.POSITION_UPDATED, this);\n psv.on(EVENTS.CONFIG_CHANGED, this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n // cancel render loop\n this.renderer.setAnimationLoop(null);\n\n // destroy ThreeJS view\n this.__cleanTHREEScene(this.scene);\n\n // remove container\n this.psv.container.removeChild(this.canvasContainer);\n\n delete this.canvasContainer;\n delete this.renderer;\n delete this.scene;\n delete this.camera;\n delete this.mesh;\n delete this.meshContainer;\n delete this.raycaster;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case EVENTS.SIZE_UPDATED: this.__onSizeUpdated(); break;\n case EVENTS.ZOOM_UPDATED: this.__onZoomUpdated(); break;\n case EVENTS.POSITION_UPDATED: this.__onPositionUpdated(); break;\n case EVENTS.CONFIG_CHANGED:\n if (evt.args[0].includes('fisheye')) {\n this.__onPositionUpdated();\n }\n if (evt.args[0].includes('mousemove')) {\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n }\n break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Hides the viewer\n */\n hide() {\n this.canvasContainer.style.opacity = 0;\n }\n\n /**\n * @summary Shows the viewer\n */\n show() {\n this.canvasContainer.style.opacity = 1;\n }\n\n /**\n * @summary Updates the size of the renderer and the aspect of the camera\n * @private\n */\n __onSizeUpdated() {\n this.renderer.setSize(this.prop.size.width, this.prop.size.height);\n this.camera.aspect = this.prop.aspect;\n this.camera.updateProjectionMatrix();\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Updates the fov of the camera\n * @private\n */\n __onZoomUpdated() {\n this.camera.fov = this.prop.vFov;\n this.camera.updateProjectionMatrix();\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Updates the position of the camera\n * @private\n */\n __onPositionUpdated() {\n this.camera.position.set(0, 0, 0);\n this.camera.lookAt(this.prop.direction);\n if (this.config.fisheye) {\n this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate();\n }\n this.prop.needsUpdate = true;\n }\n\n /**\n * @summary Main event loop, calls {@link render} if `prop.needsUpdate` is true\n * @param {number} timestamp\n * @fires PSV.before-render\n * @private\n */\n __renderLoop(timestamp) {\n const elapsed = this.timestamp !== null ? timestamp - this.timestamp : 0;\n this.timestamp = timestamp;\n\n this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp, elapsed);\n each(this.psv.dynamics, d => d.update(elapsed));\n\n if (this.prop.idleTime > 0 && timestamp - this.prop.idleTime > this.config.autorotateDelay) {\n this.psv.startAutorotate();\n }\n\n if (this.prop.needsUpdate) {\n this.render();\n this.prop.needsUpdate = false;\n }\n }\n\n /**\n * @summary Performs a render\n * @description Do not call this method directly, instead call\n * {@link PSV.Viewer#needsUpdate} on {@link PSV.event:before-render}.\n * @fires PSV.render\n */\n render() {\n this.renderer.render(this.scene, this.camera);\n this.psv.trigger(EVENTS.RENDER);\n }\n\n /**\n * @summary Applies the texture to the scene, creates the scene if needed\n * @param {PSV.TextureData} textureData\n * @fires PSV.panorama-loaded\n * @package\n */\n setTexture(textureData) {\n this.prop.panoData = textureData.panoData;\n\n this.psv.adapter.setTexture(this.mesh, textureData);\n\n if (!this.ready) {\n this.renderer.setAnimationLoop(t => this.__renderLoop(t));\n this.ready = true;\n }\n\n this.psv.needsUpdate();\n\n this.psv.trigger(EVENTS.PANORAMA_LOADED, textureData);\n }\n\n /**\n * @summary Applies the overlay to the mesh\n * @param {PSV.TextureData} textureData\n * @param {number} opacity\n * @package\n */\n setOverlay(textureData, opacity) {\n this.psv.adapter.setOverlay(this.mesh, textureData, opacity);\n this.psv.needsUpdate();\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 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 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 Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new 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 Scene)) {\n item.dispose();\n }\n\n if (item !== object) {\n this.__cleanTHREEScene(item);\n }\n });\n }\n\n}\n","import { FileLoader } 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 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 config: null,\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 this.__waitImages();\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 this.config = config;\n\n const t = this.container;\n const a = this.arrow;\n\n // compute size\n const style = {\n posClass : config.position ? cleanPosition(config.position, false) : ['top', 'center'],\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 * @summary If the tooltip contains images, recompute its size once they are loaded\n * @private\n */\n __waitImages() {\n const images = this.content.querySelectorAll('img');\n\n if (images.length > 0) {\n const promises = [];\n\n images.forEach((image) => {\n promises.push(new Promise((resolve) => {\n image.onload = resolve;\n image.onerror = resolve;\n }));\n });\n\n Promise.all(promises)\n .then(() => {\n if (this.prop.state === STATE.SHOWING || this.prop.state === STATE.READY) {\n const rect = this.container.getBoundingClientRect();\n this.prop.width = rect.right - rect.left;\n this.prop.height = rect.bottom - rect.top;\n this.move(this.config);\n }\n });\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 { Cache, MathUtils, Vector3 } from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Loader } from './components/Loader';\nimport { Navbar } from './components/Navbar';\nimport { Notification } from './components/Notification';\nimport { Overlay } from './components/Overlay';\nimport { Panel } from './components/Panel';\nimport { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config';\nimport { CHANGE_EVENTS, DEFAULT_TRANSITION, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants';\nimport { SYSTEM } from './data/system';\nimport errorIcon from './icons/error.svg';\nimport { AbstractPlugin } from './plugins/AbstractPlugin';\nimport { PSVError } from './PSVError';\nimport { DataHelper } from './services/DataHelper';\nimport { EventsHandler } from './services/EventsHandler';\nimport { Renderer } from './services/Renderer';\nimport { TextureLoader } from './services/TextureLoader';\nimport { TooltipRenderer } from './services/TooltipRenderer';\nimport {\n Animation,\n Dynamic,\n each,\n exitFullscreen,\n getAbortError,\n getAngle,\n getShortestArc,\n isAbortError,\n isExtendedPosition,\n isFullscreenEnabled,\n isNil,\n logWarn,\n MultiDynamic,\n pluginInterop,\n requestFullscreen,\n throttle,\n toggleClass\n} from './utils';\n\nCache.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 {boolean} littlePlanet - special tweaks for LittlePlanetAdapter\n * @property {number} idleTime - time of the last user action\n * @property {object} objectsObservers\n * @property {PSV.Size} size - size of the container\n * @property {PSV.PanoData} panoData - panorama metadata, if supported\n */\n this.prop = {\n ready : false,\n uiRefresh : false,\n needsUpdate : false,\n fullscreen : false,\n direction : new Vector3(0, 0, SPHERE_RADIUS),\n vFov : null,\n hFov : null,\n aspect : null,\n autorotateEnabled: false,\n animationPromise : null,\n loadingPromise : null,\n littlePlanet : false,\n idleTime : -1,\n objectsObservers : {},\n size : {\n width : 0,\n height: 0,\n },\n panoData : {\n fullWidth : 0,\n fullHeight : 0,\n croppedWidth : 0,\n croppedHeight: 0,\n croppedX : 0,\n croppedY : 0,\n poseHeading : 0,\n posePitch : 0,\n poseRoll : 0,\n },\n };\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = getConfig(options);\n\n /**\n * @summary Top most parent\n * @member {HTMLElement}\n * @readonly\n */\n this.parent = (typeof options.container === 'string') ? document.getElementById(options.container) : options.container;\n this.parent[VIEWER_DATA] = this;\n\n /**\n * @summary Main container\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.classList.add('psv-container');\n this.parent.appendChild(this.container);\n\n /**\n * @summary Render adapter\n * @type {PSV.adapters.AbstractAdapter}\n * @readonly\n * @package\n */\n this.adapter = new this.config.adapter[0](this, this.config.adapter[1]); // eslint-disable-line new-cap\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary All plugins\n * @type {Object}\n * @readonly\n * @package\n */\n this.plugins = {};\n\n /**\n * @type {PSV.services.Renderer}\n * @readonly\n */\n this.renderer = new Renderer(this);\n\n /**\n * @type {PSV.services.TextureLoader}\n * @readonly\n */\n this.textureLoader = new TextureLoader(this);\n\n /**\n * @type {PSV.services.EventsHandler}\n * @readonly\n */\n this.eventsHandler = new EventsHandler(this);\n\n /**\n * @type {PSV.services.DataHelper}\n * @readonly\n */\n this.dataHelper = new DataHelper(this);\n\n /**\n * @member {PSV.components.Loader}\n * @readonly\n */\n this.loader = new Loader(this);\n\n /**\n * @member {PSV.components.Navbar}\n * @readonly\n */\n this.navbar = new Navbar(this);\n\n /**\n * @member {PSV.components.Panel}\n * @readonly\n */\n this.panel = new Panel(this);\n\n /**\n * @member {PSV.services.TooltipRenderer}\n * @readonly\n */\n this.tooltip = new TooltipRenderer(this);\n\n /**\n * @member {PSV.components.Notification}\n * @readonly\n */\n this.notification = new Notification(this);\n\n /**\n * @member {PSV.components.Overlay}\n * @readonly\n */\n this.overlay = new Overlay(this);\n\n /**\n * @member {Record}\n * @package\n */\n this.dynamics = {\n zoom: new Dynamic((value) => {\n this.prop.vFov = this.dataHelper.zoomLevelToFov(value);\n this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov);\n this.trigger(EVENTS.ZOOM_UPDATED, value);\n }, this.config.defaultZoomLvl, 0, 100),\n\n position: new MultiDynamic({\n longitude: new Dynamic(null, this.config.defaultLong, 0, 2 * Math.PI, true),\n latitude : this.prop.littlePlanet\n ? new Dynamic(null, this.config.defaultLat, 0, Math.PI * 2, true)\n : new Dynamic(null, this.config.defaultLat, -Math.PI / 2, Math.PI / 2),\n }, (position) => {\n this.dataHelper.sphericalCoordsToVector3(position, this.prop.direction);\n this.trigger(EVENTS.POSITION_UPDATED, position);\n }),\n };\n\n this.__updateSpeeds();\n\n this.eventsHandler.init();\n\n this.__resizeRefresh = throttle(() => this.refreshUi('resize'), 500);\n\n // apply container size\n this.resize(this.config.size);\n\n // init plugins\n this.config.plugins.forEach(([plugin, opts]) => {\n this.plugins[plugin.id] = new plugin(this, opts); // eslint-disable-line new-cap\n });\n each(this.plugins, plugin => plugin.init?.());\n\n // init buttons\n this.navbar.setButtons(this.config.navbar);\n\n // load panorama\n if (this.config.panorama) {\n this.setPanorama(this.config.panorama);\n }\n\n toggleClass(this.container, 'psv--is-touch', SYSTEM.isTouchEnabled.initial);\n SYSTEM.isTouchEnabled.promise.then(enabled => toggleClass(this.container, 'psv--is-touch', enabled));\n\n // enable GUI after first render\n this.once(EVENTS.RENDER, () => {\n if (this.config.navbar) {\n this.container.classList.add('psv--has-navbar');\n this.navbar.show();\n }\n\n // Queue autorotate\n if (!isNil(this.config.autorotateDelay)) {\n this.prop.idleTime = performance.now();\n }\n\n this.prop.ready = true;\n\n setTimeout(() => {\n this.refreshUi('init');\n\n this.trigger(EVENTS.READY);\n }, 0);\n });\n }\n\n /**\n * @summary Destroys the viewer\n * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.\n */\n destroy() {\n this.__stopAll();\n this.stopKeyboardControl();\n this.exitFullscreen();\n\n each(this.plugins, plugin => plugin.destroy());\n delete this.plugins;\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n this.eventsHandler.destroy();\n this.renderer.destroy();\n this.textureLoader.destroy();\n this.dataHelper.destroy();\n this.adapter.destroy();\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 delete this.dynamics;\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 ['sphereCorrection', 'panoData', 'overlay', 'overlayOpacity'].forEach((opt) => {\n if (!(opt in options)) {\n options[opt] = this.config[opt];\n }\n });\n }\n\n if (options.transition === undefined || options.transition === true) {\n options.transition = DEFAULT_TRANSITION;\n }\n if (options.showLoader === undefined) {\n options.showLoader = true;\n }\n if (options.caption === undefined) {\n options.caption = this.config.caption;\n }\n if (options.description === undefined) {\n options.description = this.config.description;\n }\n if (!options.panoData && typeof this.config.panoData === 'function') {\n options.panoData = this.config.panoData;\n }\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n if (positionProvided || zoomProvided) {\n this.__stopAll();\n }\n\n this.hideError();\n\n this.config.panorama = path;\n this.config.caption = options.caption;\n this.config.description = options.description;\n\n const done = (err) => {\n this.loader.hide();\n\n this.prop.loadingPromise = null;\n\n if (isAbortError(err)) {\n return false;\n }\n else if (err) {\n this.navbar.setCaption('');\n this.showError(this.config.lang.loadError);\n console.error(err);\n throw err;\n }\n else {\n this.resetIdleTimer();\n this.setOverlay(options.overlay, options.overlayOpacity);\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 })\n .then((completed) => {\n this.prop.transitionAnimation = null;\n if (!completed) {\n throw getAbortError();\n }\n })\n .then(done, done);\n }\n\n return this.prop.loadingPromise;\n }\n\n /**\n * @summary Loads a new overlay\n * @param {*} path - URL of the new overlay file\n * @param {number} [opacity=1]\n * @returns {Promise}\n */\n setOverlay(path, opacity = 1) {\n if (!this.adapter.constructor.supportsOverlay) {\n return Promise.reject(new PSVError(`${this.adapter.constructor.id} adapter does not supports overlay`));\n }\n\n if (!path) {\n this.renderer.setOverlay(null, 0);\n return Promise.resolve();\n }\n else {\n return this.adapter.loadTexture(path, (image) => {\n const p = this.prop.panoData;\n const r = image.width / p.croppedWidth;\n return {\n fullWidth : r * p.fullWidth,\n fullHeight : r * p.fullHeight,\n croppedWidth : r * p.croppedWidth,\n croppedHeight: r * p.croppedHeight,\n croppedX : r * p.croppedX,\n croppedY : r * p.croppedY,\n };\n }, false)\n .then((textureData) => {\n this.renderer.setOverlay(textureData, opacity);\n });\n }\n }\n\n /**\n * @summary Update options\n * @param {PSV.Options} options\n * @fires PSV.config-changed\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setOptions(options) {\n const rawConfig = {\n ...this.config,\n ...options,\n };\n\n each(options, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (READONLY_OPTIONS[key]) {\n throw new PSVError(READONLY_OPTIONS[key]);\n }\n\n if (CONFIG_PARSERS[key]) {\n this.config[key] = CONFIG_PARSERS[key](value, rawConfig);\n }\n else {\n this.config[key] = value;\n }\n\n switch (key) {\n case 'overlay':\n case 'overlayOpacity':\n this.setOverlay(this.config.overlay, this.config.overlayOpacity);\n break;\n\n case 'caption':\n case 'description':\n this.navbar.setCaption(this.config.caption);\n break;\n\n case 'size':\n this.resize(value);\n break;\n\n case 'sphereCorrection':\n this.renderer.setSphereCorrection(value);\n break;\n\n case 'navbar':\n case 'lang':\n this.navbar.setButtons(this.config.navbar);\n break;\n\n case 'moveSpeed':\n case 'zoomSpeed':\n this.__updateSpeeds();\n break;\n\n case 'minFov':\n case 'maxFov':\n this.dynamics.zoom.setValue(this.dataHelper.fovToZoomLevel(this.prop.vFov));\n this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel());\n break;\n\n case 'canvasBackground':\n this.renderer.canvasContainer.style.background = this.config.canvasBackground;\n break;\n\n case 'autorotateIdle':\n this.resetIdleTimer();\n break;\n\n default:\n break;\n }\n });\n\n this.needsUpdate();\n this.refreshUi('set options');\n\n this.trigger(EVENTS.CONFIG_CHANGED, Object.keys(options));\n }\n\n /**\n * @summary Update options\n * @param {string} option\n * @param {any} value\n * @fires PSV.config-changed\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n setOption(option, value) {\n this.setOptions({ [option]: value });\n }\n\n /**\n * @summary Restarts the idle timer (if `autorotateIdle=true`)\n * @package\n */\n resetIdleTimer() {\n this.prop.idleTime = this.config.autorotateIdle ? performance.now() : -1;\n }\n\n /**\n * @summary Stops the idle timer\n * @package\n */\n disableIdleTimer() {\n this.prop.idleTime = -1;\n }\n\n /**\n * @summary Starts the automatic rotation\n * @fires PSV.autorotate\n */\n startAutorotate(refresh = false) {\n if (refresh && !this.isAutorotateEnabled()) {\n return;\n }\n if (!refresh && this.isAutorotateEnabled()) {\n return;\n }\n\n if (!refresh) {\n this.__stopAll();\n }\n\n this.dynamics.position.roll({\n longitude: this.config.autorotateSpeed < 0,\n }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed));\n\n this.dynamics.position.goto({\n latitude: this.config.autorotateLat,\n }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed));\n\n this.prop.autorotateEnabled = true;\n\n if (!refresh) {\n this.trigger(EVENTS.AUTOROTATE, true);\n }\n }\n\n /**\n * @summary Stops the automatic rotation\n * @fires PSV.autorotate\n */\n stopAutorotate() {\n if (this.isAutorotateEnabled()) {\n this.dynamics.position.stop();\n\n this.prop.autorotateEnabled = false;\n\n this.trigger(EVENTS.AUTOROTATE, false);\n }\n }\n\n /**\n * @summary Starts or stops the automatic rotation\n * @fires PSV.autorotate\n */\n toggleAutorotate() {\n if (this.isAutorotateEnabled()) {\n this.stopAutorotate();\n }\n else {\n this.startAutorotate();\n }\n }\n\n /**\n * @summary Displays an error message over the viewer\n * @param {string} message\n */\n showError(message) {\n this.overlay.show({\n id : IDS.ERROR,\n image : errorIcon,\n text : message,\n dissmisable: false,\n });\n }\n\n /**\n * @summary Hides the error message\n */\n hideError() {\n this.overlay.hide(IDS.ERROR);\n }\n\n /**\n * @summary Rotates the view to specific longitude and latitude\n * @param {PSV.ExtendedPosition} position\n * @fires PSV.before-rotate\n * @fires PSV.position-updated\n */\n rotate(position) {\n const e = this.trigger(EVENTS.BEFORE_ROTATE, position);\n if (e.isDefaultPrevented()) {\n return;\n }\n\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ROTATE_POSITION, this.dataHelper.cleanPosition(position));\n this.dynamics.position.setValue(cleanPosition);\n }\n\n /**\n * @summary Rotates and zooms the view with a smooth animation\n * @param {PSV.AnimateOptions} options - position and/or zoom level\n * @returns {PSV.Animation}\n */\n animate(options) {\n this.__stopAll();\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n const animProperties = {};\n let duration;\n\n // clean/filter position and compute duration\n if (positionProvided) {\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options));\n const currentPosition = this.getPosition();\n\n // longitude offset for shortest arc\n const tOffset = getShortestArc(currentPosition.longitude, cleanPosition.longitude);\n\n animProperties.longitude = { start: currentPosition.longitude, end: currentPosition.longitude + tOffset };\n animProperties.latitude = { start: currentPosition.latitude, end: cleanPosition.latitude };\n\n duration = this.dataHelper.speedToDuration(options.speed, getAngle(currentPosition, cleanPosition));\n }\n\n // clean/filter zoom and compute duration\n if (zoomProvided) {\n const dZoom = Math.abs(options.zoom - this.getZoomLevel());\n\n animProperties.zoom = { start: this.getZoomLevel(), end: options.zoom };\n\n if (!duration) {\n // if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration\n duration = this.dataHelper.speedToDuration(options.speed, Math.PI / 4 * dZoom / 100);\n }\n }\n\n // if no animation needed\n if (!duration) {\n if (positionProvided) {\n this.rotate(options);\n }\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n\n return new Animation();\n }\n\n this.prop.animationPromise = new Animation({\n properties: animProperties,\n duration : duration,\n easing : 'inOutSine',\n onTick : (properties) => {\n if (positionProvided) {\n this.rotate(properties);\n }\n if (zoomProvided) {\n this.zoom(properties.zoom);\n }\n },\n });\n\n this.prop.animationPromise.then(() => {\n this.prop.animationPromise = null;\n this.resetIdleTimer();\n });\n\n return this.prop.animationPromise;\n }\n\n /**\n * @summary Stops the ongoing animation\n * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously.\n * @returns {Promise} Resolved when the animation has ben cancelled\n */\n stopAnimation() {\n if (this.prop.animationPromise) {\n return new Promise((resolve) => {\n this.prop.animationPromise.then(resolve);\n this.prop.animationPromise.cancel();\n this.prop.animationPromise = null;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * @summary Zooms to a specific level between `max_fov` and `min_fov`\n * @param {number} level - new zoom level from 0 to 100\n * @fires PSV.zoom-updated\n */\n zoom(level) {\n this.dynamics.zoom.setValue(level);\n }\n\n /**\n * @summary Increases the zoom level\n * @param {number} [step=1]\n */\n zoomIn(step = 1) {\n this.dynamics.zoom.step(step);\n }\n\n /**\n * @summary Decreases the zoom level\n * @param {number} [step=1]\n */\n zoomOut(step = 1) {\n this.dynamics.zoom.step(-step);\n }\n\n /**\n * @summary Resizes the viewer\n * @param {PSV.CssSize} size\n */\n resize(size) {\n ['width', 'height'].forEach((dim) => {\n if (size && size[dim]) {\n if (/^[0-9.]+$/.test(size[dim])) {\n size[dim] += 'px';\n }\n this.parent.style[dim] = size[dim];\n }\n });\n\n this.autoSize();\n }\n\n /**\n * @summary Enters the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n enterFullscreen() {\n if (SYSTEM.fullscreenEvent) {\n requestFullscreen(this.container);\n }\n else {\n this.container.classList.add('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(true);\n }\n }\n\n /**\n * @summary Exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n exitFullscreen() {\n if (this.isFullscreenEnabled()) {\n if (SYSTEM.fullscreenEvent) {\n exitFullscreen();\n }\n else {\n this.container.classList.remove('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(false);\n }\n }\n }\n\n /**\n * @summary Enters or exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n toggleFullscreen() {\n if (!this.isFullscreenEnabled()) {\n this.enterFullscreen();\n }\n else {\n this.exitFullscreen();\n }\n }\n\n /**\n * @summary Enables the keyboard controls (done automatically when entering fullscreen)\n */\n startKeyboardControl() {\n this.eventsHandler.enableKeyboard();\n }\n\n /**\n * @summary Disables the keyboard controls (done automatically when exiting fullscreen)\n */\n stopKeyboardControl() {\n this.eventsHandler.disableKeyboard();\n }\n\n /**\n * @summary Subscribes to events on objects in the scene\n * @param {string} userDataKey - only objects with the following `userData` will be emitted\n * @param {EventListener} listener - must implement `handleEvent\n * @return {function} call to stop the subscription\n * @package\n */\n observeObjects(userDataKey, listener) {\n this.prop.objectsObservers[userDataKey] = { listener };\n\n return () => {\n delete this.prop.objectsObservers[userDataKey];\n };\n }\n\n /**\n * @summary Stops all current animations\n * @returns {Promise}\n * @package\n */\n __stopAll() {\n this.trigger(EVENTS.STOP_ALL);\n\n this.disableIdleTimer();\n this.stopAutorotate();\n return this.stopAnimation();\n }\n\n /**\n * @summary Recomputes dynamics speeds\n * @private\n */\n __updateSpeeds() {\n this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50);\n this.dynamics.position.setSpeed(MathUtils.degToRad(this.config.moveSpeed * 50));\n }\n\n}\n"],"names":["PSVError","message","Error","captureStackTrace","stack","prototype","Object","create","name","constructor","AbstractAdapter","psv","destroy","supportsTransition","panorama","supportsPreload","loadTexture","newPanoData","useXmpPanoData","createMesh","scale","setTexture","mesh","textureData","transition","setTextureOpacity","opacity","disposeTexture","setOverlay","createOverlayMaterial","ShaderMaterial","uniforms","OVERLAY_UNIFORMS","value","Texture","overlay","globalOpacity","overlayOpacity","vertexShader","fragmentShader","id","supportsDownload","supportsOverlay","DEFAULT_TRANSITION","MOVE_THRESHOLD","DBLCLICK_DELAY","LONGTOUCH_DELAY","TWOFINGERSOVERLAY_DELAY","CTRLZOOM_TIMEOUT","INERTIA_WINDOW","SPHERE_RADIUS","VIEWER_DATA","MESH_USER_DATA","ACTIONS","ROTATE_LAT_UP","ROTATE_LAT_DOWN","ROTATE_LONG_RIGHT","ROTATE_LONG_LEFT","ZOOM_IN","ZOOM_OUT","TOGGLE_AUTOROTATE","EVENTS","AUTOROTATE","BEFORE_RENDER","BEFORE_ROTATE","CLICK","CLOSE_PANEL","CONFIG_CHANGED","DOUBLE_CLICK","FULLSCREEN_UPDATED","HIDE_NOTIFICATION","HIDE_OVERLAY","HIDE_TOOLTIP","KEY_PRESS","LOAD_PROGRESS","OPEN_PANEL","PANORAMA_LOADED","POSITION_UPDATED","READY","RENDER","SHOW_NOTIFICATION","SHOW_OVERLAY","SHOW_TOOLTIP","SIZE_UPDATED","STOP_ALL","ZOOM_UPDATED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","OBJECT_EVENTS","ENTER_OBJECT","HOVER_OBJECT","LEAVE_OBJECT","IDS","MENU","TWO_FINGERS","CTRL_ZOOM","ERROR","DESCRIPTION","EASINGS","linear","t","inQuad","outQuad","inOutQuad","inCubic","outCubic","inOutCubic","inQuart","outQuart","inOutQuart","inQuint","outQuint","inOutQuint","inSine","Math","cos","PI","outSine","sin","inOutSine","inExpo","pow","outExpo","inOutExpo","inCirc","sqrt","outCirc","inOutCirc","KEY_CODES","Enter","Control","Escape","Space","PageUp","PageDown","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete","Plus","Minus","LOCALSTORAGE_TOUCH_SUPPORT","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","window","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","document","createElement","names","context","getContext","some","e","initial","navigator","maxTouchPoints","localStorage","promise","Promise","resolve","clear","listenerMouse","listenerTouch","listenerTimeout","addEventListener","listenerTimeoutId","setTimeout","removeEventListener","clearTimeout","getParameter","MAX_TEXTURE_SIZE","maxWidth","width","height","fillStyle","fillRect","getImageData","data","onmousewheel","undefined","FULLSCREEN_EVT_MAP","exitFullscreen","webkitExitFullscreen","mozCancelFullScreen","msExitFullscreen","validExits","keys","filter","exit","length","toggleClass","element","className","active","classList","toggle","add","remove","addClasses","split","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","SVGElement","parentElement","getPosition","left","top","offsetLeft","scrollLeft","clientLeft","offsetTop","scrollTop","clientTop","offsetParent","isFullscreenEnabled","elt","fullscreenElement","webkitFullscreenElement","requestFullscreen","webkitRequestFullscreen","call","getStyle","prop","getComputedStyle","normalizeWheel","event","PIXEL_STEP","LINE_HEIGHT","PAGE_HEIGHT","spinX","spinY","pixelX","pixelY","detail","wheelDelta","wheelDeltaY","wheelDeltaX","axis","HORIZONTAL_AXIS","deltaY","deltaX","deltaMode","bound","x","min","max","MathUtils","clamp","loop","result","isPowerOfTwo","sum","array","reduce","a","b","distance","p1","p2","y","getShortestArc","from","to","tCandidates","candidate","newCandidate","abs","Infinity","getAngle","position1","position2","acos","latitude","longitude","greatArcDistance","λ1","φ1","λ2","φ2","dasherize","str","replace","s","i","toLowerCase","throttle","func","wait","self","args","timeout","previous","later","Date","now","apply","remaining","arguments","isPlainObject","obj","getPrototypeOf","proto","toString","deepmerge","target","src","first","merge","Array","isArray","forEach","key","clone","isEmpty","each","object","callback","isNil","val","firstNonNull","values","deepEqual","obj1","obj2","isObject","pluginInterop","plugin","entries","p","getAbortError","error","isAbortError","err","logWarn","console","warn","isExtendedPosition","key1","key2","getXMPValue","attr","match","parseInt","isNaN","CSS_POSITIONS","bottom","right","center","parsePosition","tokens","toLocaleLowerCase","slice","xFirst","map","token","reverse","parsed","join","parseFloat","LEFT_MAP","TOP_MAP","cleanPosition","allowCenter","tempPos","parseSpeed","speed","speedStr","trim","speedValue","speedUnit","degToRad","parseAngle","angle","zeroCenter","halfCircle","unit","createTexture","img","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","__cancelled","push","cancel","cancelAnimationFrame","Dynamic","fn","defaultValue","loopValue","mode","STOP","speedMult","currentSpeed","setSpeed","goto","position","POSITION","step","roll","INFINITE","stop","setValue","update","elapsed","dstStop","targetSpeed","next","MultiDynamic","dynamics","d","positions","steps","rolls","hasUpdates","dynamic","Slider","container","direction","onUpdate","mousedown","mouseover","handleEvent","type","stopPropagation","__onMouseDown","__onMouseEnter","__onMouseLeave","__onTouchStart","__onMouseMove","__onTouchMove","__onMouseUp","__onTouchEnd","evt","__update","changedTouches","moving","boundingClientRect","getBoundingClientRect","cursor","vertical","pos","size","click","VERTICAL","EventEmitter","HORIZONTAL","EquirectangularAdapter","config","resolution","SPHERE_SEGMENTS","SPHERE_HORIZONTAL_SEGMENTS","useXmpData","reject","__loadXMP","loader","setProgress","xmpPanoData","textureLoader","loadImage","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","__createEquirectangularTexture","onProgress","loadFile","blob","__loadBlobAsString","binary","indexOf","substring","includes","reader","FileReader","onload","onerror","readAsText","ratio","resizedPanoData","buffer","drawImage","geometry","SphereGeometry","material","Mesh","__setUniform","transparent","dispose","uniform","AbstractComponent","children","visible","appendChild","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","tabbable","enabled","supported","collapsed","offsetWidth","icon","__setIcon","lang","title","tabIndex","onClick","checkSupported","supportedOrObject","isSupported","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","groupId","AutorotateButton","on","off","isAutorotateEnabled","autorotateIdle","resetIdleTimer","toggleAutorotate","play","playActive","CustomButton","random","substr","content","MODE_NOTIF","MODE_PANEL","DescriptionButton","closed","__close","caption","getButton","captionHidden","hasDescription","description","__open","notification","panel","info","DownloadButton","link","href","downloadUrl","download","pop","adapter","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","menuIcon","buttons","dataKey","menu","button","PressHandler","time","down","getTime","up","getOrientedArrow","arrow","AbstractMoveButton","move","handler","__stopAll","MoveDownButton","MoveLeftButton","MoveRightButton","MoveUpButton","AbstractZoomButton","zoom","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mediaMinWidth","zoomRange","zoomValue","slider","__onSliderUpdate","ready","__moveZoomValue","getZoomLevel","once","level","AbstractPlugin","init","DEFAULTS","plugins","loadingImg","loadingTxt","fisheye","minFov","maxFov","defaultZoomLvl","defaultLong","defaultLat","sphereCorrection","moveSpeed","zoomSpeed","autorotateDelay","autorotateSpeed","autorotateLat","moveInertia","mousewheel","mousemove","captureCursor","mousewheelCtrlKey","touchmoveTwoFingers","requestHeaders","canvasBackground","withCredentials","autorotate","fullscreen","twoFingers","ctrlZoom","loadError","keyboard","READONLY_OPTIONS","DEPRECATED_OPTIONS","zoomButtonIncrement","mousewheelSpeed","sphereCorrectionReorder","CONFIG_PARSERS","getConfig","tempConfig","hasOwnProperty","NavbarCaption","contentWidth","setCaption","html","availableWidth","__refreshButton","AVAILABLE_BUTTONS","AVAILABLE_GROUPS","registerButton","defaultPosition","unshift","Navbar","setButtons","item","cleanedButtons","__cleanButtons","buttonCtor","warnNotFound","totalWidth","visibleButtons","collapsableButtons","Loader","clientWidth","tickness","lastChild","inner","round","maxHeight","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","trigger","Notification","contentId","Overlay","dissmisable","image","text","subtext","preventDefault","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","keyHandler","resizer","closeBtn","wasVisible","focus","__startResize","__resize","touches","clientX","clientY","AbstractService","vector2","Vector2","vector3","Vector3","eulerZero","Euler","DataHelper","fovToZoomLevel","fov","temp","zoomLevelToFov","vFovToHFov","vFov","radToDeg","atan","tan","aspect","speedToDuration","textureCoordsToSphericalCoords","point","relativeX","relativeY","equals","renderer","rotation","meshContainer","sphericalCoordsToVector3","applyEuler","vector3ToSphericalCoords","sphericalCoordsToTextureCoords","relativeLong","relativeLat","z","phi","theta","atan2","viewerCoordsToVector3","viewerPoint","sphereIntersect","getIntersections","userData","vector3ToViewerCoords","vectorClone","project","camera","sphericalCoordsToViewerCoords","raycaster","setFromCamera","intersectObjects","scene","littlePlanet","cleanSphereCorrection","pan","tilt","cleanPanoramaPose","EventsHandler","state","moveThreshold","keyboardEnabled","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","__onKeyDown","__onKeyUp","__fullscreenToggled","__onMouseWheel","enableKeyboard","disableKeyboard","e2","isDefaultPrevented","action","__startMove","__stopMove","__move","__moveAbsolute","objectsObservers","viewerPos","intersections","dataHelper","emit","observer","listener","CustomEvent","originalEvent","intersection","find","__click","__cancelLongTouch","__cancelTwoFingersOverlay","__startMoveZoom","__stopMoveZoom","gestureIcon","__moveZoom","mousewheelIcon","delta","force","startKeyboardControl","stopKeyboardControl","__logMouseMove","__stopMoveInertia","curve","SplineCurve","getTangent","curr","total","prev","animationPromise","longtouch","boundingRect","rightclick","viewerX","viewerY","sphereIntersection","psvSphere","sphericalCoords","objects","o","textureCoords","textureX","textureY","NaN","log","hFov","currentPosition","rotate","containerRect","last","Renderer","WebGLRenderer","alpha","antialias","setPixelRatio","domElement","Scene","PerspectiveCamera","Group","Raycaster","canvasContainer","background","setAnimationLoop","__cleanTHREEScene","__onSizeUpdated","__onZoomUpdated","__onPositionUpdated","setSize","updateProjectionMatrix","set","lookAt","copy","multiplyScalar","negate","__renderLoop","idleTime","startAutorotate","render","setPanoramaPose","cleanCorrection","setSphereCorrection","positionProvided","zoomProvided","group","verticalAxis","rotateOnWorldAxis","horizontalAxis","cross","getWorldDirection","normalize","animation","completed","traverse","TextureLoader","FileLoader","setResponseType","setWithCredentials","setRequestHeader","abortLoading","url","lengthComputable","newProgress","createElementNS","URL","revokeObjectURL","createObjectURL","preloadPanorama","STATE","NONE","SHOWING","HIDING","Tooltip","__onTransitionEnd","rect","__waitImages","posClass","arrowTop","arrowLeft","__computeTooltipPosition","offset","newPos","propertyName","topBottom","box","images","querySelectorAll","promises","all","TooltipRenderer","testTooltip","tooltip","Cache","Viewer","autorotateEnabled","loadingPromise","getElementById","eventsHandler","__updateSpeeds","__resizeRefresh","resize","opts","setPanorama","performance","reason","getPlugin","pluginId","pluginCtor","getSize","clientHeight","path","transitionAnimation","opt","showLoader","hideError","done","showError","r","setOptions","rawConfig","setOption","option","disableIdleTimer","stopAutorotate","errorIcon","change","animate","animProperties","tOffset","dZoom","stopAnimation","dim","enterFullscreen","observeObjects","userDataKey"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA,SAASA,QAAT,CAAkBC,OAAlB,EAA2B;EACzB,EAAA,IAAA,CAAKA,OAAL,GAAeA,OAAf,CADyB;;IAIzB,IAAI,mBAAA,IAAuBC,KAA3B,EAAkC;EAChCA,IAAAA,KAAK,CAACC,iBAAN,CAAwB,IAAxB,EAA8BH,QAA9B,CAAA,CAAA;EACD,GAFD,MAGK;EACH,IAAA,IAAA,CAAKI,KAAL,GAAc,IAAIF,KAAJ,EAAD,CAAcE,KAA3B,CAAA;EACD,GAAA;EACF,CAAA;;EAEDJ,QAAQ,CAACK,SAAT,GAAqBC,MAAM,CAACC,MAAP,CAAcL,KAAK,CAACG,SAApB,CAArB,CAAA;EACAL,QAAQ,CAACK,SAAT,CAAmBG,IAAnB,GAA0B,UAA1B,CAAA;EACAR,QAAQ,CAACK,SAAT,CAAmBI,WAAnB,GAAiCT,QAAjC;;ECjBA;EACA;EACA;;EAGA;EACA;EACA;EACA;EACA;;AACA,MAAaU,eAAb,gBAAA,YAAA;EAEE;EACF;EACA;EACA;EACA;EACA;;EAGE;EACF;EACA;EACA;EACA;EACA;;EAGE;EACF;EACA;EACA;;EAGE;EACF;EACA;EACE,EAAA,SAAA,eAAA,CAAYC,GAAZ,EAAiB;EACf;EACJ;EACA;EACA;EACA;MACI,IAAKA,CAAAA,GAAL,GAAWA,GAAX,CAAA;EACD,GAAA;EAED;EACF;EACA;;;EAtCA,EAAA,IAAA,MAAA,GAAA,eAAA,CAAA,SAAA,CAAA;;IAAA,MAuCEC,CAAAA,OAvCF,GAuCE,SAAU,OAAA,GAAA;EACR,IAAA,OAAO,KAAKD,GAAZ,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EACA;EA/CA,GAAA;;EAAA,EAAA,MAAA,CAgDEE,kBAhDF,GAgDE,SAAmBC,kBAAAA,CAA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b,QAAd,CAAuBF,QAAvB,CAAgCpL,eAAS,CAAC4H,QAAV,CAAmB,KAAK8G,MAAL,CAAY6L,SAAZ,GAAwB,EAA3C,CAAhC,CAAA,CAAA;KAv+BJ,CAAA;;EAAA,EAAA,OAAA,MAAA,CAAA;EAAA,CAAA,CAA4BhM,mBAA5B;;;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/autorotate-keypoints.js b/dist/plugins/autorotate-keypoints.js index 5902b1b18..c56ccacd8 100644 --- a/dist/plugins/autorotate-keypoints.js +++ b/dist/plugins/autorotate-keypoints.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.AutorotateKeypointsPlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -351,7 +351,7 @@ } // apply offsets to avoid crossing the origin - var workVectors = [new THREE.Vector2(workPoints[0][0], workPoints[0][1])]; + var workVectors = [new three.Vector2(workPoints[0][0], workPoints[0][1])]; var k = 0; for (var _i = 1; _i <= 3; _i++) { @@ -371,10 +371,10 @@ k = 0; } - workVectors.push(new THREE.Vector2(workPoints[_i][0] + k * 2 * Math.PI, workPoints[_i][1])); + workVectors.push(new three.Vector2(workPoints[_i][0] + k * 2 * Math.PI, workPoints[_i][1])); } - var curve = new THREE.SplineCurve(workVectors).getPoints(NUM_STEPS * 3).map(function (p) { + var curve = new three.SplineCurve(workVectors).getPoints(NUM_STEPS * 3).map(function (p) { return [p.x, p.y]; }); // debugCurve(this.markers, curve, NUM_STEPS); // only keep the curve for the current movement diff --git a/dist/plugins/autorotate-keypoints.js.map b/dist/plugins/autorotate-keypoints.js.map index 2e841a8a8..f5ac113fd 100644 --- a/dist/plugins/autorotate-keypoints.js.map +++ b/dist/plugins/autorotate-keypoints.js.map @@ -1 +1 @@ -{"version":3,"file":"autorotate-keypoints.js","sources":["../../src/plugins/autorotate-keypoints/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, PSVError, utils } from '../..';\n\n/**\n * @typedef {Object} PSV.plugins.AutorotateKeypointsPlugin.KeypointObject\n * @property {PSV.ExtendedPosition} [position]\n * @property {string} [markerId] - use the position and tooltip of a marker\n * @property {number} [pause=0] - pause the animation when reaching this point, will display the tooltip if available\n * @property {string|{content: string, position: string}} [tooltip]\n */\n\n/**\n * @typedef {PSV.ExtendedPosition|string|PSV.plugins.AutorotateKeypointsPlugin.KeypointObject} PSV.plugins.AutorotateKeypointsPlugin.Keypoint\n * @summary Definition of keypoints for automatic rotation, can be a position object, a marker id or an keypoint object\n */\n\n/**\n * @typedef {Object} PSV.plugins.AutorotateKeypointsPlugin.Options\n * @property {boolean} [startFromClosest=true] - start from the closest keypoint instead of the first keypoint\n * @property {PSV.plugins.AutorotateKeypointsPlugin.Keypoint[]} keypoints\n */\n\n\nconst NUM_STEPS = 16;\n\nfunction serializePt(position) {\n return [position.longitude, position.latitude];\n}\n\n\n/**\n * @summary Replaces the standard autorotate animation by a smooth transition between multiple points\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class AutorotateKeypointsPlugin extends AbstractPlugin {\n\n static id = 'autorotate-keypoints';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.AutorotateKeypointsPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @property {number} idx - current index in keypoints\n * @property {number[][]} curve - curve between idx and idx + 1\n * @property {number[]} startStep - start point of the current step\n * @property {number[]} endStep - end point of the current step\n * @property {number} startTime - start time of the current step\n * @property {number} stepDuration - expected duration of the step\n * @property {number} remainingPause - time remaining for the pause\n * @property {number} lastTime - previous timestamp in render loop\n * @property {PSV.components.Tooltip} tooltip - currently displayed tooltip\n * @private\n */\n this.state = {};\n\n /**\n * @member {PSV.plugins.AutorotateKeypointsPlugin.Options}\n * @private\n */\n this.config = {\n startFromClosest: true,\n ...options,\n };\n\n /**\n * @type {PSV.plugins.AutorotateKeypointsPlugin.Keypoint[]} keypoints\n */\n this.keypoints = null;\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n if (this.config.keypoints) {\n this.setKeypoints(this.config.keypoints);\n delete this.config.keypoints;\n }\n\n this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n delete this.markers;\n delete this.keypoints;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.AUTOROTATE) {\n this.__configure();\n }\n else if (e.type === CONSTANTS.EVENTS.BEFORE_RENDER) {\n this.__beforeRender(e.args[0]);\n }\n }\n\n /**\n * @summary Changes the keypoints\n * @param {PSV.plugins.AutorotateKeypointsPlugin.Keypoint[]} keypoints\n */\n setKeypoints(keypoints) {\n if (keypoints?.length < 2) {\n throw new PSVError('At least two points are required');\n }\n\n this.keypoints = utils.clone(keypoints);\n\n if (this.keypoints) {\n this.keypoints.forEach((pt, i) => {\n if (typeof pt === 'string') {\n pt = { markerId: pt };\n }\n else if (utils.isExtendedPosition(pt)) {\n pt = { position: pt };\n }\n if (pt.markerId) {\n if (!this.markers) {\n throw new PSVError(`Keypoint #${i} references a marker but the markers plugin is not loaded`);\n }\n const marker = this.markers.getMarker(pt.markerId);\n pt.position = serializePt(marker.props.position);\n }\n else if (pt.position) {\n pt.position = serializePt(this.psv.dataHelper.cleanPosition(pt.position));\n }\n else {\n throw new PSVError(`Keypoint #${i} is missing marker or position`);\n }\n\n if (typeof pt.tooltip === 'string') {\n pt.tooltip = { content: pt.tooltip };\n }\n\n this.keypoints[i] = pt;\n });\n }\n\n this.__configure();\n }\n\n /**\n * @private\n */\n __configure() {\n if (!this.psv.isAutorotateEnabled() || !this.keypoints) {\n this.__hideTooltip();\n this.state = {};\n return;\n }\n\n // cancel core rotation\n this.psv.dynamics.position.stop();\n\n this.state = {\n idx : -1,\n curve : [],\n startStep : null,\n endStep : null,\n startTime : null,\n stepDuration : null,\n remainingPause: null,\n lastTime : null,\n tooltip : null,\n };\n\n if (this.config.startFromClosest) {\n const currentPosition = serializePt(this.psv.getPosition());\n const index = this.__findMinIndex(this.keypoints, (keypoint) => {\n return utils.greatArcDistance(keypoint.position, currentPosition);\n });\n\n this.keypoints.push(...this.keypoints.splice(0, index));\n }\n }\n\n /**\n * @private\n */\n __beforeRender(timestamp) {\n if (this.psv.isAutorotateEnabled()) {\n // initialisation\n if (!this.state.startTime) {\n this.state.endStep = serializePt(this.psv.getPosition());\n this.__nextStep();\n\n this.state.startTime = timestamp;\n this.state.lastTime = timestamp;\n }\n\n this.__nextFrame(timestamp);\n }\n }\n\n /**\n * @private\n */\n __incrementIdx() {\n this.state.idx++;\n if (this.state.idx === this.keypoints.length) {\n this.state.idx = 0;\n }\n }\n\n /**\n * @private\n */\n __showTooltip() {\n const keypoint = this.keypoints[this.state.idx];\n\n if (keypoint.tooltip) {\n const position = this.psv.dataHelper.vector3ToViewerCoords(this.psv.prop.direction);\n\n this.state.tooltip = this.psv.tooltip.create({\n content : keypoint.tooltip.content,\n position: keypoint.tooltip.position,\n top : position.y,\n left : position.x,\n });\n }\n else if (keypoint.markerId) {\n const marker = this.markers.getMarker(keypoint.markerId);\n marker.showTooltip();\n this.state.tooltip = marker.tooltip;\n }\n }\n\n /**\n * @private\n */\n __hideTooltip() {\n if (this.state.tooltip) {\n const keypoint = this.keypoints[this.state.idx];\n\n if (keypoint.tooltip) {\n this.state.tooltip.hide();\n }\n else if (keypoint.markerId) {\n const marker = this.markers.getMarker(keypoint.markerId);\n marker.hideTooltip();\n }\n\n this.state.tooltip = null;\n }\n }\n\n /**\n * @private\n */\n __nextPoint() {\n // get the 4 points necessary to compute the current movement\n // the two points of the current segments and one point before and after\n const workPoints = [];\n if (this.state.idx === -1) {\n const currentPosition = serializePt(this.psv.getPosition());\n workPoints.push(\n currentPosition,\n currentPosition,\n this.keypoints[0].position,\n this.keypoints[1].position\n );\n }\n else {\n for (let i = -1; i < 3; i++) {\n const keypoint = this.state.idx + i < 0\n ? this.keypoints[this.keypoints.length - 1]\n : this.keypoints[(this.state.idx + i) % this.keypoints.length];\n workPoints.push(keypoint.position);\n }\n }\n\n // apply offsets to avoid crossing the origin\n const workVectors = [new THREE.Vector2(workPoints[0][0], workPoints[0][1])];\n\n let k = 0;\n for (let i = 1; i <= 3; i++) {\n const d = workPoints[i - 1][0] - workPoints[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 if (k !== 0 && i === 1) {\n // do not modify first point, apply the reverse offset the the previous point instead\n workVectors[0].x -= k * 2 * Math.PI;\n k = 0;\n }\n workVectors.push(new THREE.Vector2(workPoints[i][0] + k * 2 * Math.PI, workPoints[i][1]));\n }\n\n const curve = new THREE.SplineCurve(workVectors)\n .getPoints(NUM_STEPS * 3)\n .map(p => ([p.x, p.y]));\n\n // debugCurve(this.markers, curve, NUM_STEPS);\n\n // only keep the curve for the current movement\n this.state.curve = curve.slice(NUM_STEPS + 1, NUM_STEPS * 2 + 1);\n\n if (this.state.idx !== -1) {\n this.state.remainingPause = this.keypoints[this.state.idx].pause;\n\n if (this.state.remainingPause) {\n this.__showTooltip();\n }\n else {\n this.__incrementIdx();\n }\n }\n else {\n this.__incrementIdx();\n }\n }\n\n /**\n * @private\n */\n __nextStep() {\n if (this.state.curve.length === 0) {\n this.__nextPoint();\n\n // reset transformation made to the previous point\n this.state.endStep[0] = utils.parseAngle(this.state.endStep[0]);\n }\n\n // target next point\n this.state.startStep = this.state.endStep;\n this.state.endStep = this.state.curve.shift();\n\n // compute duration from distance and speed\n const distance = utils.greatArcDistance(this.state.startStep, this.state.endStep);\n this.state.stepDuration = distance * 1000 / Math.abs(this.psv.config.autorotateSpeed);\n\n if (distance === 0) { // edge case\n this.__nextStep();\n }\n }\n\n /**\n * @private\n */\n __nextFrame(timestamp) {\n const ellapsed = timestamp - this.state.lastTime;\n this.state.lastTime = timestamp;\n\n // currently paused\n if (this.state.remainingPause) {\n this.state.remainingPause = Math.max(0, this.state.remainingPause - ellapsed);\n if (this.state.remainingPause > 0) {\n return;\n }\n else {\n this.__hideTooltip();\n this.__incrementIdx();\n this.state.startTime = timestamp;\n }\n }\n\n let progress = (timestamp - this.state.startTime) / this.state.stepDuration;\n if (progress >= 1) {\n this.__nextStep();\n progress = 0;\n this.state.startTime = timestamp;\n }\n\n this.psv.rotate({\n longitude: this.state.startStep[0] + (this.state.endStep[0] - this.state.startStep[0]) * progress,\n latitude : this.state.startStep[1] + (this.state.endStep[1] - this.state.startStep[1]) * progress,\n });\n }\n\n /**\n * @private\n */\n __findMinIndex(array, mapper) {\n let idx = 0;\n let current = Number.MAX_VALUE;\n\n array.forEach((item, i) => {\n const value = mapper ? mapper(item) : item;\n if (value < current) {\n current = value;\n idx = i;\n }\n });\n\n return idx;\n }\n\n}\n"],"names":["NUM_STEPS","serializePt","position","longitude","latitude","AutorotateKeypointsPlugin","psv","options","state","config","startFromClosest","keypoints","markers","init","getPlugin","setKeypoints","on","CONSTANTS","EVENTS","AUTOROTATE","BEFORE_RENDER","destroy","off","handleEvent","e","type","__configure","__beforeRender","args","length","PSVError","utils","clone","forEach","pt","i","markerId","isExtendedPosition","marker","getMarker","props","dataHelper","cleanPosition","tooltip","content","isAutorotateEnabled","__hideTooltip","dynamics","stop","idx","curve","startStep","endStep","startTime","stepDuration","remainingPause","lastTime","currentPosition","getPosition","index","__findMinIndex","keypoint","greatArcDistance","push","splice","timestamp","__nextStep","__nextFrame","__incrementIdx","__showTooltip","vector3ToViewerCoords","prop","direction","create","top","y","left","x","showTooltip","hide","hideTooltip","__nextPoint","workPoints","workVectors","THREE","Vector2","k","d","Math","PI","SplineCurve","getPoints","map","p","slice","pause","parseAngle","shift","distance","abs","autorotateSpeed","ellapsed","max","progress","rotate","array","mapper","current","Number","MAX_VALUE","item","value","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAGA,IAAMA,SAAS,GAAG,EAAlB,CAAA;;EAEA,SAASC,WAAT,CAAqBC,QAArB,EAA+B;IAC7B,OAAO,CAACA,QAAQ,CAACC,SAAV,EAAqBD,QAAQ,CAACE,QAA9B,CAAP,CAAA;EACD,CAAA;EAGD;EACA;EACA;EACA;EACA;;;AACA,MAAaC,yBAAb,gBAAA,UAAA,eAAA,EAAA;EAAA,EAAA,cAAA,CAAA,yBAAA,EAAA,eAAA,CAAA,CAAA;;EAIE;EACF;EACA;EACA;IACE,SAAYC,yBAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,eAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;EACA;EACA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B,IAAoDoD,QAAAA;OAF3F,CAAA,CAAA;EAID,GAAA;EAED;EACF;EACA;EA9WA,GAAA;;EAAA,EAAA,MAAA,CA+WE3C,cA/WF,GA+WE,SAAA,cAAA,CAAe6C,KAAf,EAAsBC,MAAtB,EAA8B;MAC5B,IAAIzD,GAAG,GAAG,CAAV,CAAA;EACA,IAAA,IAAI0D,OAAO,GAAGC,MAAM,CAACC,SAArB,CAAA;EAEAJ,IAAAA,KAAK,CAACxE,OAAN,CAAc,UAAC6E,IAAD,EAAO3E,CAAP,EAAa;QACzB,IAAM4E,KAAK,GAAGL,MAAM,GAAGA,MAAM,CAACI,IAAD,CAAT,GAAkBA,IAAtC,CAAA;;QACA,IAAIC,KAAK,GAAGJ,OAAZ,EAAqB;EACnBA,QAAAA,OAAO,GAAGI,KAAV,CAAA;EACA9D,QAAAA,GAAG,GAAGd,CAAN,CAAA;EACD,OAAA;OALH,CAAA,CAAA;EAQA,IAAA,OAAOc,GAAP,CAAA;KA3XJ,CAAA;;EAAA,EAAA,OAAA,yBAAA,CAAA;EAAA,CAAA,CAA+C+D,gCAA/C,EAAA;EAAa3G,0BAEJ4G,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"autorotate-keypoints.js","sources":["../../src/plugins/autorotate-keypoints/index.js"],"sourcesContent":["import { SplineCurve, Vector2 } from 'three';\nimport { AbstractPlugin, CONSTANTS, PSVError, utils } from '../..';\n\n/**\n * @typedef {Object} PSV.plugins.AutorotateKeypointsPlugin.KeypointObject\n * @property {PSV.ExtendedPosition} [position]\n * @property {string} [markerId] - use the position and tooltip of a marker\n * @property {number} [pause=0] - pause the animation when reaching this point, will display the tooltip if available\n * @property {string|{content: string, position: string}} [tooltip]\n */\n\n/**\n * @typedef {PSV.ExtendedPosition|string|PSV.plugins.AutorotateKeypointsPlugin.KeypointObject} PSV.plugins.AutorotateKeypointsPlugin.Keypoint\n * @summary Definition of keypoints for automatic rotation, can be a position object, a marker id or an keypoint object\n */\n\n/**\n * @typedef {Object} PSV.plugins.AutorotateKeypointsPlugin.Options\n * @property {boolean} [startFromClosest=true] - start from the closest keypoint instead of the first keypoint\n * @property {PSV.plugins.AutorotateKeypointsPlugin.Keypoint[]} keypoints\n */\n\n\nconst NUM_STEPS = 16;\n\nfunction serializePt(position) {\n return [position.longitude, position.latitude];\n}\n\n\n/**\n * @summary Replaces the standard autorotate animation by a smooth transition between multiple points\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class AutorotateKeypointsPlugin extends AbstractPlugin {\n\n static id = 'autorotate-keypoints';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.AutorotateKeypointsPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @property {number} idx - current index in keypoints\n * @property {number[][]} curve - curve between idx and idx + 1\n * @property {number[]} startStep - start point of the current step\n * @property {number[]} endStep - end point of the current step\n * @property {number} startTime - start time of the current step\n * @property {number} stepDuration - expected duration of the step\n * @property {number} remainingPause - time remaining for the pause\n * @property {number} lastTime - previous timestamp in render loop\n * @property {PSV.components.Tooltip} tooltip - currently displayed tooltip\n * @private\n */\n this.state = {};\n\n /**\n * @member {PSV.plugins.AutorotateKeypointsPlugin.Options}\n * @private\n */\n this.config = {\n startFromClosest: true,\n ...options,\n };\n\n /**\n * @type {PSV.plugins.AutorotateKeypointsPlugin.Keypoint[]} keypoints\n */\n this.keypoints = null;\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n if (this.config.keypoints) {\n this.setKeypoints(this.config.keypoints);\n delete this.config.keypoints;\n }\n\n this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n delete this.markers;\n delete this.keypoints;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.AUTOROTATE) {\n this.__configure();\n }\n else if (e.type === CONSTANTS.EVENTS.BEFORE_RENDER) {\n this.__beforeRender(e.args[0]);\n }\n }\n\n /**\n * @summary Changes the keypoints\n * @param {PSV.plugins.AutorotateKeypointsPlugin.Keypoint[]} keypoints\n */\n setKeypoints(keypoints) {\n if (keypoints?.length < 2) {\n throw new PSVError('At least two points are required');\n }\n\n this.keypoints = utils.clone(keypoints);\n\n if (this.keypoints) {\n this.keypoints.forEach((pt, i) => {\n if (typeof pt === 'string') {\n pt = { markerId: pt };\n }\n else if (utils.isExtendedPosition(pt)) {\n pt = { position: pt };\n }\n if (pt.markerId) {\n if (!this.markers) {\n throw new PSVError(`Keypoint #${i} references a marker but the markers plugin is not loaded`);\n }\n const marker = this.markers.getMarker(pt.markerId);\n pt.position = serializePt(marker.props.position);\n }\n else if (pt.position) {\n pt.position = serializePt(this.psv.dataHelper.cleanPosition(pt.position));\n }\n else {\n throw new PSVError(`Keypoint #${i} is missing marker or position`);\n }\n\n if (typeof pt.tooltip === 'string') {\n pt.tooltip = { content: pt.tooltip };\n }\n\n this.keypoints[i] = pt;\n });\n }\n\n this.__configure();\n }\n\n /**\n * @private\n */\n __configure() {\n if (!this.psv.isAutorotateEnabled() || !this.keypoints) {\n this.__hideTooltip();\n this.state = {};\n return;\n }\n\n // cancel core rotation\n this.psv.dynamics.position.stop();\n\n this.state = {\n idx : -1,\n curve : [],\n startStep : null,\n endStep : null,\n startTime : null,\n stepDuration : null,\n remainingPause: null,\n lastTime : null,\n tooltip : null,\n };\n\n if (this.config.startFromClosest) {\n const currentPosition = serializePt(this.psv.getPosition());\n const index = this.__findMinIndex(this.keypoints, (keypoint) => {\n return utils.greatArcDistance(keypoint.position, currentPosition);\n });\n\n this.keypoints.push(...this.keypoints.splice(0, index));\n }\n }\n\n /**\n * @private\n */\n __beforeRender(timestamp) {\n if (this.psv.isAutorotateEnabled()) {\n // initialisation\n if (!this.state.startTime) {\n this.state.endStep = serializePt(this.psv.getPosition());\n this.__nextStep();\n\n this.state.startTime = timestamp;\n this.state.lastTime = timestamp;\n }\n\n this.__nextFrame(timestamp);\n }\n }\n\n /**\n * @private\n */\n __incrementIdx() {\n this.state.idx++;\n if (this.state.idx === this.keypoints.length) {\n this.state.idx = 0;\n }\n }\n\n /**\n * @private\n */\n __showTooltip() {\n const keypoint = this.keypoints[this.state.idx];\n\n if (keypoint.tooltip) {\n const position = this.psv.dataHelper.vector3ToViewerCoords(this.psv.prop.direction);\n\n this.state.tooltip = this.psv.tooltip.create({\n content : keypoint.tooltip.content,\n position: keypoint.tooltip.position,\n top : position.y,\n left : position.x,\n });\n }\n else if (keypoint.markerId) {\n const marker = this.markers.getMarker(keypoint.markerId);\n marker.showTooltip();\n this.state.tooltip = marker.tooltip;\n }\n }\n\n /**\n * @private\n */\n __hideTooltip() {\n if (this.state.tooltip) {\n const keypoint = this.keypoints[this.state.idx];\n\n if (keypoint.tooltip) {\n this.state.tooltip.hide();\n }\n else if (keypoint.markerId) {\n const marker = this.markers.getMarker(keypoint.markerId);\n marker.hideTooltip();\n }\n\n this.state.tooltip = null;\n }\n }\n\n /**\n * @private\n */\n __nextPoint() {\n // get the 4 points necessary to compute the current movement\n // the two points of the current segments and one point before and after\n const workPoints = [];\n if (this.state.idx === -1) {\n const currentPosition = serializePt(this.psv.getPosition());\n workPoints.push(\n currentPosition,\n currentPosition,\n this.keypoints[0].position,\n this.keypoints[1].position\n );\n }\n else {\n for (let i = -1; i < 3; i++) {\n const keypoint = this.state.idx + i < 0\n ? this.keypoints[this.keypoints.length - 1]\n : this.keypoints[(this.state.idx + i) % this.keypoints.length];\n workPoints.push(keypoint.position);\n }\n }\n\n // apply offsets to avoid crossing the origin\n const workVectors = [new Vector2(workPoints[0][0], workPoints[0][1])];\n\n let k = 0;\n for (let i = 1; i <= 3; i++) {\n const d = workPoints[i - 1][0] - workPoints[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 if (k !== 0 && i === 1) {\n // do not modify first point, apply the reverse offset the the previous point instead\n workVectors[0].x -= k * 2 * Math.PI;\n k = 0;\n }\n workVectors.push(new Vector2(workPoints[i][0] + k * 2 * Math.PI, workPoints[i][1]));\n }\n\n const curve = new SplineCurve(workVectors)\n .getPoints(NUM_STEPS * 3)\n .map(p => ([p.x, p.y]));\n\n // debugCurve(this.markers, curve, NUM_STEPS);\n\n // only keep the curve for the current movement\n this.state.curve = curve.slice(NUM_STEPS + 1, NUM_STEPS * 2 + 1);\n\n if (this.state.idx !== -1) {\n this.state.remainingPause = this.keypoints[this.state.idx].pause;\n\n if (this.state.remainingPause) {\n this.__showTooltip();\n }\n else {\n this.__incrementIdx();\n }\n }\n else {\n this.__incrementIdx();\n }\n }\n\n /**\n * @private\n */\n __nextStep() {\n if (this.state.curve.length === 0) {\n this.__nextPoint();\n\n // reset transformation made to the previous point\n this.state.endStep[0] = utils.parseAngle(this.state.endStep[0]);\n }\n\n // target next point\n this.state.startStep = this.state.endStep;\n this.state.endStep = this.state.curve.shift();\n\n // compute duration from distance and speed\n const distance = utils.greatArcDistance(this.state.startStep, this.state.endStep);\n this.state.stepDuration = distance * 1000 / Math.abs(this.psv.config.autorotateSpeed);\n\n if (distance === 0) { // edge case\n this.__nextStep();\n }\n }\n\n /**\n * @private\n */\n __nextFrame(timestamp) {\n const ellapsed = timestamp - this.state.lastTime;\n this.state.lastTime = timestamp;\n\n // currently paused\n if (this.state.remainingPause) {\n this.state.remainingPause = Math.max(0, this.state.remainingPause - ellapsed);\n if (this.state.remainingPause > 0) {\n return;\n }\n else {\n this.__hideTooltip();\n this.__incrementIdx();\n this.state.startTime = timestamp;\n }\n }\n\n let progress = (timestamp - this.state.startTime) / this.state.stepDuration;\n if (progress >= 1) {\n this.__nextStep();\n progress = 0;\n this.state.startTime = timestamp;\n }\n\n this.psv.rotate({\n longitude: this.state.startStep[0] + (this.state.endStep[0] - this.state.startStep[0]) * progress,\n latitude : this.state.startStep[1] + (this.state.endStep[1] - this.state.startStep[1]) * progress,\n });\n }\n\n /**\n * @private\n */\n __findMinIndex(array, mapper) {\n let idx = 0;\n let current = Number.MAX_VALUE;\n\n array.forEach((item, i) => {\n const value = mapper ? mapper(item) : item;\n if (value < current) {\n current = value;\n idx = i;\n }\n });\n\n return idx;\n }\n\n}\n"],"names":["NUM_STEPS","serializePt","position","longitude","latitude","AutorotateKeypointsPlugin","psv","options","state","config","startFromClosest","keypoints","markers","init","getPlugin","setKeypoints","on","CONSTANTS","EVENTS","AUTOROTATE","BEFORE_RENDER","destroy","off","handleEvent","e","type","__configure","__beforeRender","args","length","PSVError","utils","clone","forEach","pt","i","markerId","isExtendedPosition","marker","getMarker","props","dataHelper","cleanPosition","tooltip","content","isAutorotateEnabled","__hideTooltip","dynamics","stop","idx","curve","startStep","endStep","startTime","stepDuration","remainingPause","lastTime","currentPosition","getPosition","index","__findMinIndex","keypoint","greatArcDistance","push","splice","timestamp","__nextStep","__nextFrame","__incrementIdx","__showTooltip","vector3ToViewerCoords","prop","direction","create","top","y","left","x","showTooltip","hide","hideTooltip","__nextPoint","workPoints","workVectors","Vector2","k","d","Math","PI","SplineCurve","getPoints","map","p","slice","pause","parseAngle","shift","distance","abs","autorotateSpeed","ellapsed","max","progress","rotate","array","mapper","current","Number","MAX_VALUE","item","value","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAGA,IAAMA,SAAS,GAAG,EAAlB,CAAA;;EAEA,SAASC,WAAT,CAAqBC,QAArB,EAA+B;IAC7B,OAAO,CAACA,QAAQ,CA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K,CAAAA,KAAL,CAAW2C,SAAX,CAAqB,CAArB,CAAA,GAA0B,CAAC,IAAA,CAAK3C,KAAL,CAAW4C,OAAX,CAAmB,CAAnB,CAAwB,GAAA,IAAA,CAAK5C,KAAL,CAAW2C,SAAX,CAAqB,CAArB,CAAzB,IAAoDmD,QAD3E;QAEdlG,QAAQ,EAAG,KAAKI,KAAL,CAAW2C,SAAX,CAAqB,CAArB,CAA0B,GAAA,CAAC,IAAK3C,CAAAA,KAAL,CAAW4C,OAAX,CAAmB,CAAnB,CAAA,GAAwB,IAAK5C,CAAAA,KAAL,CAAW2C,SAAX,CAAqB,CAArB,CAAzB,IAAoDmD,QAAAA;OAF3F,CAAA,CAAA;EAID,GAAA;EAED;EACF;EACA;EA9WA,GAAA;;EAAA,EAAA,MAAA,CA+WE1C,cA/WF,GA+WE,SAAA,cAAA,CAAe4C,KAAf,EAAsBC,MAAtB,EAA8B;MAC5B,IAAIxD,GAAG,GAAG,CAAV,CAAA;EACA,IAAA,IAAIyD,OAAO,GAAGC,MAAM,CAACC,SAArB,CAAA;EAEAJ,IAAAA,KAAK,CAACvE,OAAN,CAAc,UAAC4E,IAAD,EAAO1E,CAAP,EAAa;QACzB,IAAM2E,KAAK,GAAGL,MAAM,GAAGA,MAAM,CAACI,IAAD,CAAT,GAAkBA,IAAtC,CAAA;;QACA,IAAIC,KAAK,GAAGJ,OAAZ,EAAqB;EACnBA,QAAAA,OAAO,GAAGI,KAAV,CAAA;EACA7D,QAAAA,GAAG,GAAGd,CAAN,CAAA;EACD,OAAA;OALH,CAAA,CAAA;EAQA,IAAA,OAAOc,GAAP,CAAA;KA3XJ,CAAA;;EAAA,EAAA,OAAA,yBAAA,CAAA;EAAA,CAAA,CAA+C8D,gCAA/C,EAAA;EAAa1G,0BAEJ2G,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/compass.css b/dist/plugins/compass.css index 5ccdd2879..9181d2620 100644 --- a/dist/plugins/compass.css +++ b/dist/plugins/compass.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @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 3415bd40c..66a07fa26 100644 --- a/dist/plugins/compass.js +++ b/dist/plugins/compass.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.CompassPlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -329,7 +329,7 @@ var context = this.canvas.getContext('2d'); context.clearRect(0, 0, this.canvas.width, this.canvas.height); var longitude = this.psv.getPosition().longitude; - var fov = THREE.MathUtils.degToRad(this.psv.prop.hFov); + var fov = three.MathUtils.degToRad(this.psv.prop.hFov); this.__drawCone(context, this.config.coneColor, longitude, fov); diff --git a/dist/plugins/compass.js.map b/dist/plugins/compass.js.map index e07bfb733..756c2bdbe 100644 --- a/dist/plugins/compass.js.map +++ b/dist/plugins/compass.js.map @@ -1 +1 @@ -{"version":3,"file":"compass.js","sources":["../../src/plugins/compass/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, SYSTEM, utils } from '../..';\nimport compass from './compass.svg';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.CompassPlugin.Options\n * @property {string} [size='120px'] - size of the compass\n * @property {string} [position='top left'] - position of the compass\n * @property {string} [backgroundSvg] - SVG used as background of the compass\n * @property {string} [coneColor='rgba(255, 255, 255, 0.5)'] - color of the cone of the compass\n * @property {boolean} [navigation=true] - allows to click on the compass to rotate the viewer\n * @property {string} [navigationColor='rgba(255, 0, 0, 0.2)'] - color of the navigation cone\n * @property {PSV.plugins.CompassPlugin.Hotspot[]} [hotspots] - small dots visible on the compass (will contain every marker with the \"compass\" data)\n * @property {string} [hotspotColor='rgba(0, 0, 0, 0.5)'] - default color of hotspots\n */\n\n/**\n * @typedef {PSV.ExtendedPosition} PSV.plugins.CompassPlugin.Hotspot\n * @type {string} [color] - override the global \"hotspotColor\"\n */\n\n\nconst HOTSPOT_SIZE_RATIO = 1 / 40;\n\n\n/**\n * @summary Adds a compass on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class CompassPlugin extends AbstractPlugin {\n\n static id = 'compass';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.CompassPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.CompassPlugin.Options}\n * @private\n */\n this.config = {\n size : '120px',\n position : 'top left',\n backgroundSvg : compass,\n coneColor : 'rgba(255, 255, 255, 0.5)',\n navigation : true,\n navigationColor: 'rgba(255, 0, 0, 0.2)',\n hotspotColor : 'rgba(0, 0, 0, 0.5)',\n ...options,\n };\n this.config.position = utils.cleanPosition(this.config.position, 'top left');\n\n /**\n * @private\n */\n this.prop = {\n visible : true,\n mouse : null,\n mouseDown: false,\n markers : [],\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.container = document.createElement('div');\n this.container.className = `psv-compass psv-compass--${this.config.position.join('-')}`;\n this.container.innerHTML = this.config.backgroundSvg;\n\n this.container.style.width = this.config.size;\n this.container.style.height = this.config.size;\n if (this.config.position[0] === 'center') {\n this.container.style.marginTop = `calc(-${this.config.size} / 2)`;\n }\n if (this.config.position[1] === 'center') {\n this.container.style.marginLeft = `calc(-${this.config.size} / 2)`;\n }\n\n /**\n * @member {HTMLCanvasElement}\n * @readonly\n * @private\n */\n this.canvas = document.createElement('canvas');\n\n this.container.appendChild(this.canvas);\n\n if (this.config.navigation) {\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('mousemove', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseup', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('touchmove', this);\n this.container.addEventListener('touchend', this);\n }\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n this.psv.container.appendChild(this.container);\n\n this.canvas.width = this.container.clientWidth * SYSTEM.pixelRatio;\n this.canvas.height = this.container.clientWidth * SYSTEM.pixelRatio;\n\n this.psv.on(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.on('set-markers', this);\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.off('set-markers', this);\n }\n\n this.psv.container.removeChild(this.container);\n\n delete this.canvas;\n delete this.container;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.RENDER:\n this.__update();\n break;\n case 'set-markers':\n this.prop.markers = e.args[0].filter(m => m.data?.compass);\n this.__update();\n break;\n case 'mouseenter':\n case 'mousemove':\n case 'touchmove':\n this.prop.mouse = e.changedTouches?.[0] || e;\n if (this.prop.mouseDown) {\n this.__click();\n }\n else {\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mousedown':\n case 'touchstart':\n this.prop.mouseDown = true;\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseup':\n case 'touchend':\n this.prop.mouse = e.changedTouches?.[0] || e;\n this.prop.mouseDown = false;\n this.__click();\n if (e.changedTouches) {\n this.prop.mouse = null;\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseleave':\n this.prop.mouse = null;\n this.prop.mouseDown = false;\n this.__update();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Hides the compass\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Shows the compass\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Changes the hotspots on the compass\n * @param {PSV.plugins.CompassPlugin.Hotspot[]} hotspots\n */\n setHotspots(hotspots) {\n this.config.hotspots = hotspots;\n this.__update();\n }\n\n /**\n * @summary Removes all hotspots\n */\n clearHotspots() {\n this.setHotspots(null);\n }\n\n /**\n * @summary Updates the compass for current zoom and position\n * @private\n */\n __update() {\n const context = this.canvas.getContext('2d');\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n const longitude = this.psv.getPosition().longitude;\n const fov = THREE.MathUtils.degToRad(this.psv.prop.hFov);\n\n this.__drawCone(context, this.config.coneColor, longitude, fov);\n\n const mouseAngle = this.__getMouseAngle();\n if (mouseAngle !== null) {\n this.__drawCone(context, this.config.navigationColor, mouseAngle, fov);\n }\n\n this.prop.markers.forEach((marker) => {\n this.__drawMarker(context, marker);\n });\n this.config.hotspots?.forEach((spot) => {\n if ('longitude' in spot && !('latitude' in spot)) {\n spot.latitude = 0;\n }\n const pos = this.psv.dataHelper.cleanPosition(spot);\n this.__drawPoint(context, spot.color || this.config.hotspotColor, pos.longitude, pos.latitude);\n });\n }\n\n /**\n * @summary Rotates the viewer depending on the position of the mouse on the compass\n * @private\n */\n __click() {\n const mouseAngle = this.__getMouseAngle();\n\n if (mouseAngle !== null) {\n this.psv.rotate({\n longitude: mouseAngle,\n latitude : 0,\n });\n }\n }\n\n /**\n * @summary Draw a cone\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} fov\n * @private\n */\n __drawCone(context, color, longitude, fov) {\n const a1 = longitude - Math.PI / 2 - fov / 2;\n const a2 = a1 + fov;\n const c = this.canvas.width / 2;\n\n context.beginPath();\n context.moveTo(c, c);\n context.lineTo(c + Math.cos(a1) * c, c + Math.sin(a1) * c);\n context.arc(c, c, c, a1, a2, false);\n context.lineTo(c, c);\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Draw a Marker\n * @param {CanvasRenderingContext2D} context\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __drawMarker(context, marker) {\n let color = this.config.hotspotColor;\n if (typeof marker.data.compass === 'string') {\n color = marker.data.compass;\n }\n\n if (marker.isPoly()) {\n context.beginPath();\n marker.props.def.forEach(([longitude, latitude], i) => {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n\n context[i === 0 ? 'moveTo' : 'lineTo'](c + Math.cos(a) * c * d, c + Math.sin(a) * c * d);\n });\n if (marker.isPolygon()) {\n context.fillStyle = color;\n context.fill();\n }\n else {\n context.strokeStyle = color;\n context.lineWidth = Math.max(1, this.canvas.width * HOTSPOT_SIZE_RATIO / 2);\n context.stroke();\n }\n }\n else {\n const pos = marker.props.position;\n this.__drawPoint(context, color, pos.longitude, pos.latitude);\n }\n }\n\n /**\n * @summary Draw a point\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} latitude - in viewer reference\n * @private\n */\n __drawPoint(context, color, longitude, latitude) {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n const r = Math.max(2, this.canvas.width * HOTSPOT_SIZE_RATIO);\n\n context.beginPath();\n context.ellipse(\n c + Math.cos(a) * c * d, c + Math.sin(a) * c * d,\n r, r,\n 0, 0, Math.PI * 2\n );\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Gets the longitude corresponding to the mouse position on the compass\n * @return {number | null}\n * @private\n */\n __getMouseAngle() {\n if (!this.prop.mouse) {\n return null;\n }\n\n const boundingRect = this.container.getBoundingClientRect();\n const mouseX = this.prop.mouse.clientX - boundingRect.left - boundingRect.width / 2;\n const mouseY = this.prop.mouse.clientY - boundingRect.top - boundingRect.width / 2;\n\n if (Math.sqrt(mouseX * mouseX + mouseY * mouseY) > boundingRect.width / 2) {\n return null;\n }\n\n return Math.atan2(mouseY, mouseX) + Math.PI / 2;\n }\n\n}\n"],"names":["HOTSPOT_SIZE_RATIO","CompassPlugin","psv","options","config","size","position","backgroundSvg","compass","coneColor","navigation","navigationColor","hotspotColor","utils","cleanPosition","prop","visible","mouse","mouseDown","markers","container","document","createElement","className","join","innerHTML","style","width","height","marginTop","marginLeft","canvas","appendChild","addEventListener","init","getPlugin","clientWidth","SYSTEM","pixelRatio","on","CONSTANTS","EVENTS","RENDER","destroy","off","removeChild","handleEvent","e","type","__update","args","filter","m","data","changedTouches","__click","stopPropagation","preventDefault","hide","display","show","setHotspots","hotspots","clearHotspots","context","getContext","clearRect","longitude","getPosition","fov","THREE","MathUtils","degToRad","hFov","__drawCone","mouseAngle","__getMouseAngle","forEach","marker","__drawMarker","spot","latitude","pos","dataHelper","__drawPoint","color","rotate","a1","Math","PI","a2","c","beginPath","moveTo","lineTo","cos","sin","arc","fillStyle","fill","isPoly","props","def","i","a","d","isPolygon","strokeStyle","lineWidth","max","stroke","r","ellipse","boundingRect","getBoundingClientRect","mouseX","clientX","left","mouseY","clientY","top","sqrt","atan2","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAGA,IAAMA,kBAAkB,GAAG,CAAA,G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AAO,IAAP,CAAA;EACD,KAAA;;EAED,IAAA,OAAO6D,IAAI,CAACkC,KAAL,CAAWJ,MAAX,EAAmBH,MAAnB,CAAA,GAA6B3B,IAAI,CAACC,EAAL,GAAU,CAA9C,CAAA;KA/VJ,CAAA;;EAAA,EAAA,OAAA,aAAA,CAAA;EAAA,CAAA,CAAmCkC,gCAAnC,EAAA;EAAa1H,cAEJ2H,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"compass.js","sources":["../../src/plugins/compass/index.js"],"sourcesContent":["import { MathUtils } from 'three';\nimport { AbstractPlugin, CONSTANTS, SYSTEM, utils } from '../..';\nimport compass from './compass.svg';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.CompassPlugin.Options\n * @property {string} [size='120px'] - size of the compass\n * @property {string} [position='top left'] - position of the compass\n * @property {string} [backgroundSvg] - SVG used as background of the compass\n * @property {string} [coneColor='rgba(255, 255, 255, 0.5)'] - color of the cone of the compass\n * @property {boolean} [navigation=true] - allows to click on the compass to rotate the viewer\n * @property {string} [navigationColor='rgba(255, 0, 0, 0.2)'] - color of the navigation cone\n * @property {PSV.plugins.CompassPlugin.Hotspot[]} [hotspots] - small dots visible on the compass (will contain every marker with the \"compass\" data)\n * @property {string} [hotspotColor='rgba(0, 0, 0, 0.5)'] - default color of hotspots\n */\n\n/**\n * @typedef {PSV.ExtendedPosition} PSV.plugins.CompassPlugin.Hotspot\n * @type {string} [color] - override the global \"hotspotColor\"\n */\n\n\nconst HOTSPOT_SIZE_RATIO = 1 / 40;\n\n\n/**\n * @summary Adds a compass on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class CompassPlugin extends AbstractPlugin {\n\n static id = 'compass';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.CompassPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.CompassPlugin.Options}\n * @private\n */\n this.config = {\n size : '120px',\n position : 'top left',\n backgroundSvg : compass,\n coneColor : 'rgba(255, 255, 255, 0.5)',\n navigation : true,\n navigationColor: 'rgba(255, 0, 0, 0.2)',\n hotspotColor : 'rgba(0, 0, 0, 0.5)',\n ...options,\n };\n this.config.position = utils.cleanPosition(this.config.position, 'top left');\n\n /**\n * @private\n */\n this.prop = {\n visible : true,\n mouse : null,\n mouseDown: false,\n markers : [],\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.container = document.createElement('div');\n this.container.className = `psv-compass psv-compass--${this.config.position.join('-')}`;\n this.container.innerHTML = this.config.backgroundSvg;\n\n this.container.style.width = this.config.size;\n this.container.style.height = this.config.size;\n if (this.config.position[0] === 'center') {\n this.container.style.marginTop = `calc(-${this.config.size} / 2)`;\n }\n if (this.config.position[1] === 'center') {\n this.container.style.marginLeft = `calc(-${this.config.size} / 2)`;\n }\n\n /**\n * @member {HTMLCanvasElement}\n * @readonly\n * @private\n */\n this.canvas = document.createElement('canvas');\n\n this.container.appendChild(this.canvas);\n\n if (this.config.navigation) {\n this.container.addEventListener('mouseenter', this);\n this.container.addEventListener('mouseleave', this);\n this.container.addEventListener('mousemove', this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mouseup', this);\n this.container.addEventListener('touchstart', this);\n this.container.addEventListener('touchmove', this);\n this.container.addEventListener('touchend', this);\n }\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n this.psv.container.appendChild(this.container);\n\n this.canvas.width = this.container.clientWidth * SYSTEM.pixelRatio;\n this.canvas.height = this.container.clientWidth * SYSTEM.pixelRatio;\n\n this.psv.on(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.on('set-markers', this);\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.RENDER, this);\n\n if (this.markers) {\n this.markers.off('set-markers', this);\n }\n\n this.psv.container.removeChild(this.container);\n\n delete this.canvas;\n delete this.container;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.RENDER:\n this.__update();\n break;\n case 'set-markers':\n this.prop.markers = e.args[0].filter(m => m.data?.compass);\n this.__update();\n break;\n case 'mouseenter':\n case 'mousemove':\n case 'touchmove':\n this.prop.mouse = e.changedTouches?.[0] || e;\n if (this.prop.mouseDown) {\n this.__click();\n }\n else {\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mousedown':\n case 'touchstart':\n this.prop.mouseDown = true;\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseup':\n case 'touchend':\n this.prop.mouse = e.changedTouches?.[0] || e;\n this.prop.mouseDown = false;\n this.__click();\n if (e.changedTouches) {\n this.prop.mouse = null;\n this.__update();\n }\n e.stopPropagation();\n e.preventDefault();\n break;\n case 'mouseleave':\n this.prop.mouse = null;\n this.prop.mouseDown = false;\n this.__update();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Hides the compass\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Shows the compass\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Changes the hotspots on the compass\n * @param {PSV.plugins.CompassPlugin.Hotspot[]} hotspots\n */\n setHotspots(hotspots) {\n this.config.hotspots = hotspots;\n this.__update();\n }\n\n /**\n * @summary Removes all hotspots\n */\n clearHotspots() {\n this.setHotspots(null);\n }\n\n /**\n * @summary Updates the compass for current zoom and position\n * @private\n */\n __update() {\n const context = this.canvas.getContext('2d');\n context.clearRect(0, 0, this.canvas.width, this.canvas.height);\n\n const longitude = this.psv.getPosition().longitude;\n const fov = MathUtils.degToRad(this.psv.prop.hFov);\n\n this.__drawCone(context, this.config.coneColor, longitude, fov);\n\n const mouseAngle = this.__getMouseAngle();\n if (mouseAngle !== null) {\n this.__drawCone(context, this.config.navigationColor, mouseAngle, fov);\n }\n\n this.prop.markers.forEach((marker) => {\n this.__drawMarker(context, marker);\n });\n this.config.hotspots?.forEach((spot) => {\n if ('longitude' in spot && !('latitude' in spot)) {\n spot.latitude = 0;\n }\n const pos = this.psv.dataHelper.cleanPosition(spot);\n this.__drawPoint(context, spot.color || this.config.hotspotColor, pos.longitude, pos.latitude);\n });\n }\n\n /**\n * @summary Rotates the viewer depending on the position of the mouse on the compass\n * @private\n */\n __click() {\n const mouseAngle = this.__getMouseAngle();\n\n if (mouseAngle !== null) {\n this.psv.rotate({\n longitude: mouseAngle,\n latitude : 0,\n });\n }\n }\n\n /**\n * @summary Draw a cone\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} fov\n * @private\n */\n __drawCone(context, color, longitude, fov) {\n const a1 = longitude - Math.PI / 2 - fov / 2;\n const a2 = a1 + fov;\n const c = this.canvas.width / 2;\n\n context.beginPath();\n context.moveTo(c, c);\n context.lineTo(c + Math.cos(a1) * c, c + Math.sin(a1) * c);\n context.arc(c, c, c, a1, a2, false);\n context.lineTo(c, c);\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Draw a Marker\n * @param {CanvasRenderingContext2D} context\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __drawMarker(context, marker) {\n let color = this.config.hotspotColor;\n if (typeof marker.data.compass === 'string') {\n color = marker.data.compass;\n }\n\n if (marker.isPoly()) {\n context.beginPath();\n marker.props.def.forEach(([longitude, latitude], i) => {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n\n context[i === 0 ? 'moveTo' : 'lineTo'](c + Math.cos(a) * c * d, c + Math.sin(a) * c * d);\n });\n if (marker.isPolygon()) {\n context.fillStyle = color;\n context.fill();\n }\n else {\n context.strokeStyle = color;\n context.lineWidth = Math.max(1, this.canvas.width * HOTSPOT_SIZE_RATIO / 2);\n context.stroke();\n }\n }\n else {\n const pos = marker.props.position;\n this.__drawPoint(context, color, pos.longitude, pos.latitude);\n }\n }\n\n /**\n * @summary Draw a point\n * @param {CanvasRenderingContext2D} context\n * @param {string} color\n * @param {number} longitude - in viewer reference\n * @param {number} latitude - in viewer reference\n * @private\n */\n __drawPoint(context, color, longitude, latitude) {\n const a = longitude - Math.PI / 2;\n const d = (latitude + Math.PI / 2) / Math.PI;\n const c = this.canvas.width / 2;\n const r = Math.max(2, this.canvas.width * HOTSPOT_SIZE_RATIO);\n\n context.beginPath();\n context.ellipse(\n c + Math.cos(a) * c * d, c + Math.sin(a) * c * d,\n r, r,\n 0, 0, Math.PI * 2\n );\n context.fillStyle = color;\n context.fill();\n }\n\n /**\n * @summary Gets the longitude corresponding to the mouse position on the compass\n * @return {number | null}\n * @private\n */\n __getMouseAngle() {\n if (!this.prop.mouse) {\n return null;\n }\n\n const boundingRect = this.container.getBoundingClientRect();\n const mouseX = this.prop.mouse.clientX - boundingRect.left - boundingRect.width / 2;\n const mouseY = this.prop.mouse.clientY - boundingRect.top - boundingRect.width / 2;\n\n if (Math.sqrt(mouseX * mouseX + mouseY * mouseY) > boundingRect.width / 2) {\n return null;\n }\n\n return Math.atan2(mouseY, mouseX) + Math.PI / 2;\n }\n\n}\n"],"names":["HOTSPOT_SIZE_RATIO","CompassPlugin","psv","options","config","size","position","backgroundSvg","compass","coneColor","navigation","navigationColor","hotspotColor","utils","cleanPosition","prop","visible","mouse","mouseDown","markers","container","document","createElement","className","join","innerHTML","style","width","height","marginTop","marginLeft","canvas","appendChild","addEventListener","init","getPlugin","clientWidth","SYSTEM","pixelRatio","on","CONSTANTS","EVENTS","RENDER","destroy","off","removeChild","handleEvent","e","type","__update","args","filter","m","data","changedTouches","__click","stopPropagation","preventDefault","hide","display","show","setHotspots","hotspots","clearHotspots","context","getContext","clearRect","longitude","getPosition","fov","MathUtils","degToRad","hFov","__drawCone","mouseAngle","__getMouseAngle","forEach","marker","__drawMarker","spot","latitude","pos","dataHelper","__drawPoint","color","rotate","a1","Math","PI","a2","c","beginPath","moveTo","lineTo","cos","sin","arc","fillStyle","fill","isPoly","props","def","i","a","d","isPolygon","strokeStyle","lineWidth","max","stroke","r","ellipse","boundingRect","getBoundingClientRect","mouseX","clientX","left","mouseY","clientY","top","sqrt","atan2","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAMA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;;EAGA,IAAMA,kBAAkB,GAAG,CAAA,GAAI,EAA/B,CAAA;EAGA;EACA;EACA;EACA;EACA;;AACA,MAAaC,aAAb,gBAAA,UAAA,eAAA,EAAA;EAAA,EAAA,cAAA,CAAA,aAAA,EAAA,eAAA,CAAA,CAAA;;EAIE;EACF;EACA;EACA;IACE,SAAYC,aAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,eAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GAAA,QAAA,CAAA;EACEC,MAAAA,IAAI,EAAa,OADnB;EAEEC,MAAAA,QAAQ,EAAS,UAFnB;EAGEC,MAAAA,aAAa,EAAIC,OAHnB;EAIEC,MAAAA,SAAS,EAAQ,0BAJnB;EAKEC,MAAAA,UAAU,EAAO,IALnB;EAMEC,MAAAA,eAAe,EAAE,sBANnB;EAOEC,MAAAA,YAAY,EAAK,oBAAA;EAPnB,KAAA,EAQKT,OARL,CAAA,CAAA;EAUA,IAAA,KAAA,CAAKC,MAAL,CAAYE,QAAZ,GAAuBO,uBAAK,CAACC,aAAN,CAAoB,KAAA,CAAKV,MAAL,CAAYE,QAAhC,EAA0C,UAA1C,CAAvB,CAAA;E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AACI,IAAvC,GAA8CJ,YAAY,CAACrF,KAAb,GAAqB,CAAlF,CAAA;EACA,IAAA,IAAM0F,MAAM,GAAG,IAAA,CAAKtG,IAAL,CAAUE,KAAV,CAAgBqG,OAAhB,GAA0BN,YAAY,CAACO,GAAvC,GAA6CP,YAAY,CAACrF,KAAb,GAAqB,CAAjF,CAAA;;EAEA,IAAA,IAAI4D,IAAI,CAACiC,IAAL,CAAUN,MAAM,GAAGA,MAAT,GAAkBG,MAAM,GAAGA,MAArC,CAA+CL,GAAAA,YAAY,CAACrF,KAAb,GAAqB,CAAxE,EAA2E;EACzE,MAAA,OAAO,IAAP,CAAA;EACD,KAAA;;EAED,IAAA,OAAO4D,IAAI,CAACkC,KAAL,CAAWJ,MAAX,EAAmBH,MAAnB,CAAA,GAA6B3B,IAAI,CAACC,EAAL,GAAU,CAA9C,CAAA;KA/VJ,CAAA;;EAAA,EAAA,OAAA,aAAA,CAAA;EAAA,CAAA,CAAmCkC,gCAAnC,EAAA;EAAazH,cAEJ0H,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/gallery.css b/dist/plugins/gallery.css index 36dc0389d..5b06bb8a1 100644 --- a/dist/plugins/gallery.css +++ b/dist/plugins/gallery.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -7,23 +7,30 @@ .psv-gallery { position: absolute; left: 0; - bottom: calc(-100px - 30px - 20px); + bottom: 0; width: 100%; background: rgba(61, 61, 61, 0.5); border-bottom: 1px solid rgba(255, 255, 255, 0.7); overflow-x: auto; overflow-y: hidden; - -webkit-transition: bottom ease-in-out 0.1s; - transition: bottom ease-in-out 0.1s; + -webkit-transition: -webkit-transform ease-in-out 0.1s; + transition: -webkit-transform ease-in-out 0.1s; + transition: transform ease-in-out 0.1s; + transition: transform ease-in-out 0.1s, -webkit-transform ease-in-out 0.1s; + -webkit-transform: translateY(100%); + transform: translateY(100%); z-index: 90; } -.psv-gallery--open { - bottom: 0; -} -.psv--has-navbar .psv-gallery--open { +.psv--has-navbar .psv-gallery { bottom: 40px; + -webkit-transform: translateY(calc(100% + 40px)); + transform: translateY(calc(100% + 40px)); } +.psv-gallery--open { + -webkit-transform: translateY(0) !important; + transform: translateY(0) !important; +} .psv-gallery-container { display: -webkit-box; display: -ms-flexbox; @@ -36,10 +43,9 @@ flex: none; position: relative; margin-right: 15px; - width: 200px; - height: 100px; border-radius: 5px; overflow: hidden; + cursor: pointer; } .psv-gallery-item-title { position: absolute; diff --git a/dist/plugins/gallery.css.map b/dist/plugins/gallery.css.map index ae1ac0096..0c5d62143 100644 --- a/dist/plugins/gallery.css.map +++ b/dist/plugins/gallery.css.map @@ -1 +1 @@ -{"version":3,"sources":["","style.scss"],"names":[],"mappings":"AAAA;;;;;GAAA;ACAA;EACE,kBAAkB;EAClB,OAAO;EACP,kCAAkC;EAClC,WAAW;EACX,iCAAiC;EACjC,iDAAiD;EACjD,gBAAgB;EAChB,kBAAkB;EAClB,2CAAmC;EAAnC,mCAAmC;EACnC,WAAW;AACb;AACA;EACE,SAAS;AACX;AACA;EACE,YAAY;AACd;;AAEA;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,aAAa;AACf;AACA;EACE,mBAAU;MAAV,cAAU;UAAV,UAAU;EACV,kBAAkB;EAClB,kBAAkB;EAClB,YAAY;EACZ,aAAa;EACb,kBAAkB;EAClB,gBAAgB;AAClB;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,8BAAsB;UAAtB,sBAAsB;EACtB,WAAW;EACX,aAAa;EACb,cAAc;EACd,8BAA8B;EAC9B,qBAAqB;EACrB,kBAAkB;EAClB,+BAA+B;EAC/B,UAAU;EACV,2CAAmC;EAAnC,mCAAmC;AACrC;AACA;EACE,mBAAmB;EACnB,uBAAuB;EACvB,gBAAgB;EAChB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,kCAAkC;EAClC,sBAAsB;EACtB,mCAA2B;UAA3B,2BAA2B;EAC3B,sDAAsC;EAAtC,8CAAsC;EAAtC,sCAAsC;EAAtC,0EAAsC;EACtC,UAAU;AACZ;AACA;EACE,YAAY;AACd;AACA;EACE,mBAAmB;AACrB;AACA;EACE,uCAA+B;UAA/B,+BAA+B;AACjC;AACA;EACE,WAAW;EACX,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,8BAAsB;UAAtB,sBAAsB;EACtB,uBAAuB;EACvB,UAAU;AACZ","file":"gallery.css","sourcesContent":[null,".psv-gallery {\n position: absolute;\n left: 0;\n bottom: calc(-100px - 30px - 20px);\n width: 100%;\n background: rgba(61, 61, 61, 0.5);\n border-bottom: 1px solid rgba(255, 255, 255, 0.7);\n overflow-x: auto;\n overflow-y: hidden;\n transition: bottom ease-in-out 0.1s;\n z-index: 90;\n}\n.psv-gallery--open {\n bottom: 0;\n}\n.psv--has-navbar .psv-gallery--open {\n bottom: 40px;\n}\n\n.psv-gallery-container {\n display: flex;\n padding: 15px;\n}\n.psv-gallery-item {\n flex: none;\n position: relative;\n margin-right: 15px;\n width: 200px;\n height: 100px;\n border-radius: 5px;\n overflow: hidden;\n}\n.psv-gallery-item-title {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n box-sizing: border-box;\n width: 100%;\n height: 2.2em;\n padding: 0.5em;\n background: rgba(0, 0, 0, 0.6);\n font: 16px sans-serif;\n line-height: 1.2em;\n color: rgba(255, 255, 255, 0.7);\n z-index: 2;\n transition: height ease-in-out 0.2s;\n}\n.psv-gallery-item-title span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n user-select: none;\n}\n.psv-gallery-item-thumb {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-size: cover;\n transform: scale3d(1, 1, 1);\n transition: transform ease-in-out 0.2s;\n z-index: 1;\n}\n.psv-gallery-item:hover .psv-gallery-item-title {\n height: 100%;\n}\n.psv-gallery-item:hover .psv-gallery-item-title span {\n white-space: normal;\n}\n.psv-gallery-item:hover .psv-gallery-item-thumb {\n transform: scale3d(1.2, 1.2, 1);\n}\n.psv-gallery-item--active::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border: 3px solid white;\n z-index: 3;\n}"]} \ No newline at end of file +{"version":3,"sources":["","style.scss"],"names":[],"mappings":"AAAA;;;;;GAAA;ACAA;EACE,kBAAkB;EAClB,OAAO;EACP,SAAS;EACT,WAAW;EACX,iCAAiC;EACjC,iDAAiD;EACjD,gBAAgB;EAChB,kBAAkB;EAClB,sDAAsC;EAAtC,8CAAsC;EAAtC,sCAAsC;EAAtC,0EAAsC;EACtC,mCAA2B;UAA3B,2BAA2B;EAC3B,WAAW;AACb;AACA;EACE,YAAY;EACZ,gDAAwC;UAAxC,wCAAwC;AAC1C;;AAEA;EACE,2CAAmC;UAAnC,mCAAmC;AACrC;AACA;EACE,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,aAAa;AACf;AACA;EACE,mBAAU;MAAV,cAAU;UAAV,UAAU;EACV,kBAAkB;EAClB,kBAAkB;EAClB,kBAAkB;EAClB,gBAAgB;EAChB,eAAe;AACjB;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,oBAAa;EAAb,oBAAa;EAAb,aAAa;EACb,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,wBAAuB;MAAvB,qBAAuB;UAAvB,uBAAuB;EACvB,8BAAsB;UAAtB,sBAAsB;EACtB,WAAW;EACX,aAAa;EACb,cAAc;EACd,8BAA8B;EAC9B,qBAAqB;EACrB,kBAAkB;EAClB,+BAA+B;EAC/B,UAAU;EACV,2CAAmC;EAAnC,mCAAmC;AACrC;AACA;EACE,mBAAmB;EACnB,uBAAuB;EACvB,gBAAgB;EAChB,yBAAiB;KAAjB,sBAAiB;MAAjB,qBAAiB;UAAjB,iBAAiB;AACnB;AACA;EACE,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,kCAAkC;EAClC,sBAAsB;EACtB,mCAA2B;UAA3B,2BAA2B;EAC3B,sDAAsC;EAAtC,8CAAsC;EAAtC,sCAAsC;EAAtC,0EAAsC;EACtC,UAAU;AACZ;AACA;EACE,YAAY;AACd;AACA;EACE,mBAAmB;AACrB;AACA;EACE,uCAA+B;UAA/B,+BAA+B;AACjC;AACA;EACE,WAAW;EACX,kBAAkB;EAClB,MAAM;EACN,OAAO;EACP,WAAW;EACX,YAAY;EACZ,8BAAsB;UAAtB,sBAAsB;EACtB,uBAAuB;EACvB,UAAU;AACZ","file":"gallery.css","sourcesContent":[null,".psv-gallery {\n position: absolute;\n left: 0;\n bottom: 0;\n width: 100%;\n background: rgba(61, 61, 61, 0.5);\n border-bottom: 1px solid rgba(255, 255, 255, 0.7);\n overflow-x: auto;\n overflow-y: hidden;\n transition: transform ease-in-out 0.1s;\n transform: translateY(100%);\n z-index: 90;\n}\n.psv--has-navbar .psv-gallery {\n bottom: 40px;\n transform: translateY(calc(100% + 40px));\n}\n\n.psv-gallery--open {\n transform: translateY(0) !important;\n}\n.psv-gallery-container {\n display: flex;\n padding: 15px;\n}\n.psv-gallery-item {\n flex: none;\n position: relative;\n margin-right: 15px;\n border-radius: 5px;\n overflow: hidden;\n cursor: pointer;\n}\n.psv-gallery-item-title {\n position: absolute;\n top: 0;\n left: 0;\n display: flex;\n justify-content: center;\n align-items: flex-start;\n box-sizing: border-box;\n width: 100%;\n height: 2.2em;\n padding: 0.5em;\n background: rgba(0, 0, 0, 0.6);\n font: 16px sans-serif;\n line-height: 1.2em;\n color: rgba(255, 255, 255, 0.7);\n z-index: 2;\n transition: height ease-in-out 0.2s;\n}\n.psv-gallery-item-title span {\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n user-select: none;\n}\n.psv-gallery-item-thumb {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n background-position: center center;\n background-size: cover;\n transform: scale3d(1, 1, 1);\n transition: transform ease-in-out 0.2s;\n z-index: 1;\n}\n.psv-gallery-item:hover .psv-gallery-item-title {\n height: 100%;\n}\n.psv-gallery-item:hover .psv-gallery-item-title span {\n white-space: normal;\n}\n.psv-gallery-item:hover .psv-gallery-item-thumb {\n transform: scale3d(1.2, 1.2, 1);\n}\n.psv-gallery-item--active::after {\n content: \"\";\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n border: 3px solid white;\n z-index: 3;\n}"]} \ No newline at end of file diff --git a/dist/plugins/gallery.d.ts b/dist/plugins/gallery.d.ts index 7862da340..fb58cde54 100644 --- a/dist/plugins/gallery.d.ts +++ b/dist/plugins/gallery.d.ts @@ -1,8 +1,9 @@ -import { PanoramaOptions, AbstractPlugin, Viewer } from 'photo-sphere-viewer'; +import { Size, PanoramaOptions, AbstractPlugin, Viewer } from 'photo-sphere-viewer'; type GalleryPluginOptions = { items?: GalleryPluginItem[]; visibleOnLoad?: boolean; + thumbnailSize?: Size; }; type GalleryPluginItem = { @@ -19,9 +20,9 @@ declare const EVENTS: { }; /** - * @summary Adds a compass on the viewer + * @summary Adds a gallery of multiple panoramas */ -declare class CompassPlugin extends AbstractPlugin { +declare class GalleryPlugin extends AbstractPlugin { static EVENTS: typeof EVENTS; @@ -59,4 +60,4 @@ declare class CompassPlugin extends AbstractPlugin { } -export { CompassPlugin, EVENTS, GalleryPluginItem, GalleryPluginOptions }; +export { EVENTS, GalleryPlugin, GalleryPluginItem, GalleryPluginOptions }; diff --git a/dist/plugins/gallery.js b/dist/plugins/gallery.js index 8f49fa6c0..5cf57d359 100644 --- a/dist/plugins/gallery.js +++ b/dist/plugins/gallery.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -112,9 +112,9 @@ }; var GALLERY_ITEM_DATA = 'psvGalleryItem'; var GALLERY_ITEM_DATA_KEY = photoSphereViewer.utils.dasherize(GALLERY_ITEM_DATA); - var ITEMS_TEMPLATE = function ITEMS_TEMPLATE(items, dataKey) { + var ITEMS_TEMPLATE = function ITEMS_TEMPLATE(items, dataKey, size) { return "\n\n"; }; @@ -206,7 +206,7 @@ GalleryButton.id = 'gallery'; GalleryButton.icon = gallery; - var blankIcon = "\n \n \n \n \n \n \n \n \n \n \n\n"; + var blankIcon = "\n \n \n \n \n \n \n \n \n \n \n\n"; var ACTIVE_CLASS = 'psv-gallery-item--active'; /** @@ -382,7 +382,7 @@ ; _proto.setItems = function setItems(items) { - this.container.innerHTML = ITEMS_TEMPLATE(items, GALLERY_ITEM_DATA_KEY); + this.container.innerHTML = ITEMS_TEMPLATE(items, GALLERY_ITEM_DATA_KEY, this.plugin.config.thumbnailSize); if (this.observer) { this.observer.disconnect(); @@ -424,6 +424,7 @@ * @typedef {Object} PSV.plugins.GalleryPlugin.Options * @property {PSV.plugins.GalleryPlugin.Item[]} [items] * @property {boolean} [visibleOnLoad=false] - Displays the gallery when loading the first panorama + * @property {PSV.Size} [thumbnailSize] - Size of thumbnails, default (200x100) is set with CSS */ // add gallery button @@ -453,7 +454,11 @@ _this.config = _extends({ items: null, - visibleOnLoad: false + visibleOnLoad: false, + thumbnailSize: { + width: 200, + height: 100 + } }, options); /** * @type {Object} diff --git a/dist/plugins/gallery.js.map b/dist/plugins/gallery.js.map index 0ed62c98e..67c4d439e 100644 --- a/dist/plugins/gallery.js.map +++ b/dist/plugins/gallery.js.map @@ -1 +1 @@ -{"version":3,"file":"gallery.js","sources":["../../src/plugins/gallery/constants.js","../../src/plugins/gallery/GalleryButton.js","../../src/plugins/gallery/GalleryComponent.js","../../src/plugins/gallery/index.js"],"sourcesContent":["import { utils } from '../..';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GalleryPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event show-gallery\n * @memberof PSV.plugins.GalleryPlugin\n * @summary Triggered when the gallery is shown\n */\n SHOW_GALLERY: 'show-gallery',\n /**\n * @event hide-gallery\n * @memberof PSV.plugins.GalleryPlugin\n * @summary Triggered when the gallery is hidden\n */\n HIDE_GALLERY: 'hide-gallery',\n};\n\nexport const GALLERY_ITEM_DATA = 'psvGalleryItem';\nexport const GALLERY_ITEM_DATA_KEY = utils.dasherize(GALLERY_ITEM_DATA);\n\nexport const ITEMS_TEMPLATE = (items, dataKey) => `\n\n`;\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport gallery from './gallery.svg';\n\n/**\n * @summary Navigation bar gallery button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class GalleryButton extends AbstractButton {\n\n static id = 'gallery';\n static icon = gallery;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-gallery-button', true);\n\n /**\n * @type {PSV.plugins.GalleryPlugin}\n * @readonly\n * @private\n */\n this.plugin = this.psv.getPlugin('gallery');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.SHOW_GALLERY, this);\n this.plugin.on(EVENTS.HIDE_GALLERY, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.SHOW_GALLERY, this);\n this.plugin.off(EVENTS.HIDE_GALLERY, this);\n }\n\n delete this.plugin;\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 === EVENTS.SHOW_GALLERY) {\n this.toggleActive(true);\n }\n else if (e.type === EVENTS.HIDE_GALLERY) {\n this.toggleActive(false);\n }\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\n }\n\n /**\n * @override\n * @description Toggles gallery\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import { AbstractComponent, SYSTEM, utils } from '../..';\nimport blankIcon from './blank.svg';\nimport { GALLERY_ITEM_DATA, GALLERY_ITEM_DATA_KEY, ITEMS_TEMPLATE } from './constants';\n\nconst ACTIVE_CLASS = 'psv-gallery-item--active';\n\n/**\n * @private\n */\nexport class GalleryComponent extends AbstractComponent {\n\n constructor(plugin) {\n super(plugin.psv, 'psv-gallery psv--capture-event');\n\n /**\n * @type {SVGElement}\n * @private\n * @readonly\n */\n this.blankIcon = (() => {\n const temp = document.createElement('div');\n temp.innerHTML = blankIcon;\n return temp.firstChild;\n })();\n this.blankIcon.style.display = 'none';\n this.psv.container.appendChild(this.blankIcon);\n\n if ('IntersectionObserver' in window) {\n /**\n * @type {IntersectionObserver}\n * @private\n * @readonly\n */\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.intersectionRatio > 0) {\n entry.target.style.backgroundImage = `url(${entry.target.dataset.src})`;\n delete entry.target.dataset.src;\n this.observer.unobserve(entry.target);\n }\n });\n }, {\n root: this.psv.container,\n });\n }\n\n /**\n * @type {PSV.plugins.GalleryPlugin}\n * @private\n * @readonly\n */\n this.plugin = plugin;\n\n /**\n * @type {Object}\n * @private\n */\n this.prop = {\n ...this.prop,\n mousedown : false,\n initMouseX: null,\n mouseX : null,\n };\n\n this.container.addEventListener(SYSTEM.mouseWheelEvent, this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mousemove', this);\n this.container.addEventListener('click', this);\n window.addEventListener('mouseup', this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.container.removeChild(this.blankIcon);\n\n window.removeEventListener('mouseup', this);\n\n this.observer?.disconnect();\n\n delete this.plugin;\n delete this.blankIcon;\n delete this.observer;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case SYSTEM.mouseWheelEvent:\n const spinY = utils.normalizeWheel(e).spinY;\n this.container.scrollLeft += spinY * 50;\n e.preventDefault();\n break;\n\n case 'mousedown':\n this.prop.mousedown = true;\n this.prop.initMouseX = e.clientX;\n this.prop.mouseX = e.clientX;\n break;\n\n case 'mousemove':\n if (this.prop.mousedown) {\n const delta = this.prop.mouseX - e.clientX;\n this.container.scrollLeft += delta;\n this.prop.mouseX = e.clientX;\n }\n break;\n\n case 'mouseup':\n this.prop.mousedown = false;\n this.prop.mouseX = null;\n e.preventDefault();\n break;\n\n case 'click':\n // prevent click on drag\n if (Math.abs(this.prop.initMouseX - e.clientX) < 10) {\n const item = utils.getClosest(e.target, `[data-${GALLERY_ITEM_DATA_KEY}]`);\n if (item) {\n this.plugin.__click(item.dataset[GALLERY_ITEM_DATA]);\n }\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n show() {\n this.container.classList.add('psv-gallery--open');\n this.prop.visible = true;\n }\n\n /**\n * @override\n */\n hide() {\n this.container.classList.remove('psv-gallery--open');\n this.prop.visible = false;\n }\n\n /**\n * @summary Sets the list of items\n * @param {PSV.plugins.GalleryPlugin.Item[]} items\n */\n setItems(items) {\n this.container.innerHTML = ITEMS_TEMPLATE(items, GALLERY_ITEM_DATA_KEY);\n\n if (this.observer) {\n this.observer.disconnect();\n\n for (const child of this.container.querySelectorAll('[data-src]')) {\n this.observer.observe(child);\n }\n }\n }\n\n /**\n * @param {number | string} id\n */\n setActive(id) {\n const currentActive = this.container.querySelector('.' + ACTIVE_CLASS);\n currentActive?.classList.remove(ACTIVE_CLASS);\n\n if (id) {\n const nextActive = this.container.querySelector(`[data-${GALLERY_ITEM_DATA_KEY}=\"${id}\"]`);\n nextActive?.classList.add(ACTIVE_CLASS);\n }\n }\n\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { GalleryButton } from './GalleryButton';\nimport { GalleryComponent } from './GalleryComponent';\nimport './style.scss';\n\n/**\n * @typedef {Object} PSV.plugins.GalleryPlugin.Item\n * @property {number|string} id - Unique identifier of the item\n * @property {*} panorama\n * @property {string} [thumbnail] - URL of the thumbnail\n * @property {string} [name] - Text visible over the thumbnail\n * @property {PSV.PanoramaOptions} [options] - Any option supported by the `setPanorama()` method\n */\n\n/**\n * @typedef {Object} PSV.plugins.GalleryPlugin.Options\n * @property {PSV.plugins.GalleryPlugin.Item[]} [items]\n * @property {boolean} [visibleOnLoad=false] - Displays the gallery when loading the first panorama\n */\n\n\n// add gallery button\nDEFAULTS.lang[GalleryButton.id] = 'Gallery';\nregisterButton(GalleryButton, 'caption:left');\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds a gallery of multiple panoramas\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class GalleryPlugin extends AbstractPlugin {\n\n static id = 'gallery';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GalleryPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.GalleryPlugin.Options}\n * @private\n */\n this.config = {\n items : null,\n visibleOnLoad: false,\n ...options,\n };\n\n /**\n * @type {Object}\n * @private\n */\n this.prop = {\n handler : null,\n currentId: null,\n };\n\n /**\n * @type {GalleryComponent}\n * @private\n * @readonly\n */\n this.gallery = new GalleryComponent(this);\n\n /**\n * @type {PSV.plugins.GalleryPlugin.Item[]}\n * @private\n */\n this.items = [];\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n if (this.config.visibleOnLoad) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.show();\n });\n }\n\n this.setItems(this.config.items);\n delete this.config.items;\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n this.gallery.destroy();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n const item = this.items.find(i => utils.deepEqual(i.panorama, e.args[0].panorama));\n this.prop.currentId = item?.id;\n this.gallery.setActive(item?.id);\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Shows the gallery\n * @fires PSV.plugins.GalleryPlugin.show-gallery\n */\n show() {\n this.trigger(EVENTS.SHOW_GALLERY);\n return this.gallery.show();\n }\n\n /**\n * @summary Hides the carousem\n * @fires PSV.plugins.GalleryPlugin.hide-gallery\n */\n hide() {\n this.trigger(EVENTS.HIDE_GALLERY);\n return this.gallery.hide();\n }\n\n /**\n * @summary Hides or shows the gallery\n */\n toggle() {\n return this.gallery.toggle();\n }\n\n /**\n * @summary Sets the list of items\n * @param {PSV.plugins.GalleryPlugin.Item[]} items\n * @param {function} [handler] function that will be called when an item is clicked instead of the default behavior\n */\n setItems(items, handler) {\n if (!items?.length) {\n items = [];\n }\n else {\n items.forEach((item, i) => {\n if (!item.id) {\n throw new PSVError(`Item ${i} has no \"id\".`);\n }\n if (!item.panorama) {\n throw new PSVError(`Item ${item.id} has no \"panorama\".`);\n }\n });\n }\n\n this.prop.handler = handler;\n this.items = items.map(item => ({\n ...item,\n id: `${item.id}`,\n }));\n\n this.gallery.setItems(items);\n }\n\n /**\n * @param {string} id\n * @package\n */\n __click(id) {\n if (id === this.prop.currentId) {\n return;\n }\n\n if (this.prop.handler) {\n this.prop.handler(id);\n }\n else {\n const item = this.items.find(i => i.id === id);\n this.psv.setPanorama(item.panorama, {\n caption: item.name,\n ...item.options,\n });\n }\n\n this.prop.currentId = id;\n this.gallery.setActive(id);\n }\n\n}\n"],"names":["EVENTS","SHOW_GALLERY","HIDE_GALLERY","GALLERY_ITEM_DATA","GALLERY_ITEM_DATA_KEY","utils","dasherize","ITEMS_TEMPLATE","items","dataKey","map","item","id","name","thumbnail","join","GalleryButton","navbar","plugin","psv","getPlugin","on","destroy","off","handleEvent","e","type","toggleActive","isSupported","onClick","toggle","AbstractButton","icon","gallery","ACTIVE_CLASS","GalleryComponent","blankIcon","temp","document","createElement","innerHTML","firstChild","style","display","container","appendChild","window","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","backgroundImage","dataset","src","unobserve","root","prop","mousedown","initMouseX","mouseX","addEventListener","SYSTEM","mouseWheelEvent","hide","removeChild","removeEventListener","disconnect","spinY","normalizeWheel","scrollLeft","preventDefault","clientX","delta","Math","abs","getClosest","__click","show","classList","add","visible","remove","setItems","querySelectorAll","child","observe","setActive","currentActive","querySelector","nextActive","AbstractComponent","DEFAULTS","lang","registerButton","GalleryPlugin","options","config","visibleOnLoad","handler","currentId","init","CONSTANTS","PANORAMA_LOADED","once","READY","find","i","deepEqual","panorama","args","trigger","length","PSVError","setPanorama","caption","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;;AACO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAE,cANM;;EAOpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAE,cAAA;EAZM,EAAf;EAeA,IAAMC,iBAAiB,GAAG,gBAA1B,CAAA;EACA,IAAMC,qBAAqB,GAAGC,uBAAK,CAACC,SAAN,CAAgBH,iBAAhB,CAA9B,CAAA;EAEA,IAAMI,cAAc,GAAG,SAAjBA,cAAiB,CAACC,KAAD,EAAQC,OA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;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"gallery.js","sources":["../../src/plugins/gallery/constants.js","../../src/plugins/gallery/GalleryButton.js","../../src/plugins/gallery/GalleryComponent.js","../../src/plugins/gallery/index.js"],"sourcesContent":["import { utils } from '../..';\n\n/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GalleryPlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event show-gallery\n * @memberof PSV.plugins.GalleryPlugin\n * @summary Triggered when the gallery is shown\n */\n SHOW_GALLERY: 'show-gallery',\n /**\n * @event hide-gallery\n * @memberof PSV.plugins.GalleryPlugin\n * @summary Triggered when the gallery is hidden\n */\n HIDE_GALLERY: 'hide-gallery',\n};\n\nexport const GALLERY_ITEM_DATA = 'psvGalleryItem';\nexport const GALLERY_ITEM_DATA_KEY = utils.dasherize(GALLERY_ITEM_DATA);\n\nexport const ITEMS_TEMPLATE = (items, dataKey, size) => `\n\n`;\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport gallery from './gallery.svg';\n\n/**\n * @summary Navigation bar gallery button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class GalleryButton extends AbstractButton {\n\n static id = 'gallery';\n static icon = gallery;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-gallery-button', true);\n\n /**\n * @type {PSV.plugins.GalleryPlugin}\n * @readonly\n * @private\n */\n this.plugin = this.psv.getPlugin('gallery');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.SHOW_GALLERY, this);\n this.plugin.on(EVENTS.HIDE_GALLERY, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.SHOW_GALLERY, this);\n this.plugin.off(EVENTS.HIDE_GALLERY, this);\n }\n\n delete this.plugin;\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 === EVENTS.SHOW_GALLERY) {\n this.toggleActive(true);\n }\n else if (e.type === EVENTS.HIDE_GALLERY) {\n this.toggleActive(false);\n }\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\n }\n\n /**\n * @override\n * @description Toggles gallery\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import { AbstractComponent, SYSTEM, utils } from '../..';\nimport blankIcon from './blank.svg';\nimport { GALLERY_ITEM_DATA, GALLERY_ITEM_DATA_KEY, ITEMS_TEMPLATE } from './constants';\n\nconst ACTIVE_CLASS = 'psv-gallery-item--active';\n\n/**\n * @private\n */\nexport class GalleryComponent extends AbstractComponent {\n\n constructor(plugin) {\n super(plugin.psv, 'psv-gallery psv--capture-event');\n\n /**\n * @type {SVGElement}\n * @private\n * @readonly\n */\n this.blankIcon = (() => {\n const temp = document.createElement('div');\n temp.innerHTML = blankIcon;\n return temp.firstChild;\n })();\n this.blankIcon.style.display = 'none';\n this.psv.container.appendChild(this.blankIcon);\n\n if ('IntersectionObserver' in window) {\n /**\n * @type {IntersectionObserver}\n * @private\n * @readonly\n */\n this.observer = new IntersectionObserver((entries) => {\n entries.forEach((entry) => {\n if (entry.intersectionRatio > 0) {\n entry.target.style.backgroundImage = `url(${entry.target.dataset.src})`;\n delete entry.target.dataset.src;\n this.observer.unobserve(entry.target);\n }\n });\n }, {\n root: this.psv.container,\n });\n }\n\n /**\n * @type {PSV.plugins.GalleryPlugin}\n * @private\n * @readonly\n */\n this.plugin = plugin;\n\n /**\n * @type {Object}\n * @private\n */\n this.prop = {\n ...this.prop,\n mousedown : false,\n initMouseX: null,\n mouseX : null,\n };\n\n this.container.addEventListener(SYSTEM.mouseWheelEvent, this);\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('mousemove', this);\n this.container.addEventListener('click', this);\n window.addEventListener('mouseup', this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.container.removeChild(this.blankIcon);\n\n window.removeEventListener('mouseup', this);\n\n this.observer?.disconnect();\n\n delete this.plugin;\n delete this.blankIcon;\n delete this.observer;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case SYSTEM.mouseWheelEvent:\n const spinY = utils.normalizeWheel(e).spinY;\n this.container.scrollLeft += spinY * 50;\n e.preventDefault();\n break;\n\n case 'mousedown':\n this.prop.mousedown = true;\n this.prop.initMouseX = e.clientX;\n this.prop.mouseX = e.clientX;\n break;\n\n case 'mousemove':\n if (this.prop.mousedown) {\n const delta = this.prop.mouseX - e.clientX;\n this.container.scrollLeft += delta;\n this.prop.mouseX = e.clientX;\n }\n break;\n\n case 'mouseup':\n this.prop.mousedown = false;\n this.prop.mouseX = null;\n e.preventDefault();\n break;\n\n case 'click':\n // prevent click on drag\n if (Math.abs(this.prop.initMouseX - e.clientX) < 10) {\n const item = utils.getClosest(e.target, `[data-${GALLERY_ITEM_DATA_KEY}]`);\n if (item) {\n this.plugin.__click(item.dataset[GALLERY_ITEM_DATA]);\n }\n }\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n show() {\n this.container.classList.add('psv-gallery--open');\n this.prop.visible = true;\n }\n\n /**\n * @override\n */\n hide() {\n this.container.classList.remove('psv-gallery--open');\n this.prop.visible = false;\n }\n\n /**\n * @summary Sets the list of items\n * @param {PSV.plugins.GalleryPlugin.Item[]} items\n */\n setItems(items) {\n this.container.innerHTML = ITEMS_TEMPLATE(items, GALLERY_ITEM_DATA_KEY, this.plugin.config.thumbnailSize);\n\n if (this.observer) {\n this.observer.disconnect();\n\n for (const child of this.container.querySelectorAll('[data-src]')) {\n this.observer.observe(child);\n }\n }\n }\n\n /**\n * @param {number | string} id\n */\n setActive(id) {\n const currentActive = this.container.querySelector('.' + ACTIVE_CLASS);\n currentActive?.classList.remove(ACTIVE_CLASS);\n\n if (id) {\n const nextActive = this.container.querySelector(`[data-${GALLERY_ITEM_DATA_KEY}=\"${id}\"]`);\n nextActive?.classList.add(ACTIVE_CLASS);\n }\n }\n\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { GalleryButton } from './GalleryButton';\nimport { GalleryComponent } from './GalleryComponent';\nimport './style.scss';\n\n/**\n * @typedef {Object} PSV.plugins.GalleryPlugin.Item\n * @property {number|string} id - Unique identifier of the item\n * @property {*} panorama\n * @property {string} [thumbnail] - URL of the thumbnail\n * @property {string} [name] - Text visible over the thumbnail\n * @property {PSV.PanoramaOptions} [options] - Any option supported by the `setPanorama()` method\n */\n\n/**\n * @typedef {Object} PSV.plugins.GalleryPlugin.Options\n * @property {PSV.plugins.GalleryPlugin.Item[]} [items]\n * @property {boolean} [visibleOnLoad=false] - Displays the gallery when loading the first panorama\n * @property {PSV.Size} [thumbnailSize] - Size of thumbnails, default (200x100) is set with CSS\n */\n\n\n// add gallery button\nDEFAULTS.lang[GalleryButton.id] = 'Gallery';\nregisterButton(GalleryButton, 'caption:left');\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Adds a gallery of multiple panoramas\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class GalleryPlugin extends AbstractPlugin {\n\n static id = 'gallery';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GalleryPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.GalleryPlugin.Options}\n * @private\n */\n this.config = {\n items : null,\n visibleOnLoad: false,\n thumbnailSize: {\n width : 200,\n height: 100,\n },\n ...options,\n };\n\n /**\n * @type {Object}\n * @private\n */\n this.prop = {\n handler : null,\n currentId: null,\n };\n\n /**\n * @type {GalleryComponent}\n * @private\n * @readonly\n */\n this.gallery = new GalleryComponent(this);\n\n /**\n * @type {PSV.plugins.GalleryPlugin.Item[]}\n * @private\n */\n this.items = [];\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n if (this.config.visibleOnLoad) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.show();\n });\n }\n\n this.setItems(this.config.items);\n delete this.config.items;\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n this.gallery.destroy();\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n const item = this.items.find(i => utils.deepEqual(i.panorama, e.args[0].panorama));\n this.prop.currentId = item?.id;\n this.gallery.setActive(item?.id);\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Shows the gallery\n * @fires PSV.plugins.GalleryPlugin.show-gallery\n */\n show() {\n this.trigger(EVENTS.SHOW_GALLERY);\n return this.gallery.show();\n }\n\n /**\n * @summary Hides the carousem\n * @fires PSV.plugins.GalleryPlugin.hide-gallery\n */\n hide() {\n this.trigger(EVENTS.HIDE_GALLERY);\n return this.gallery.hide();\n }\n\n /**\n * @summary Hides or shows the gallery\n */\n toggle() {\n return this.gallery.toggle();\n }\n\n /**\n * @summary Sets the list of items\n * @param {PSV.plugins.GalleryPlugin.Item[]} items\n * @param {function} [handler] function that will be called when an item is clicked instead of the default behavior\n */\n setItems(items, handler) {\n if (!items?.length) {\n items = [];\n }\n else {\n items.forEach((item, i) => {\n if (!item.id) {\n throw new PSVError(`Item ${i} has no \"id\".`);\n }\n if (!item.panorama) {\n throw new PSVError(`Item ${item.id} has no \"panorama\".`);\n }\n });\n }\n\n this.prop.handler = handler;\n this.items = items.map(item => ({\n ...item,\n id: `${item.id}`,\n }));\n\n this.gallery.setItems(items);\n }\n\n /**\n * @param {string} id\n * @package\n */\n __click(id) {\n if (id === this.prop.currentId) {\n return;\n }\n\n if (this.prop.handler) {\n this.prop.handler(id);\n }\n else {\n const item = this.items.find(i => i.id === id);\n this.psv.setPanorama(item.panorama, {\n caption: item.name,\n ...item.options,\n });\n }\n\n this.prop.currentId = id;\n this.gallery.setActive(id);\n }\n\n}\n"],"names":["EVENTS","SHOW_GALLERY","HIDE_GALLERY","GALLERY_ITEM_DATA","GALLERY_ITEM_DATA_KEY","utils","dasherize","ITEMS_TEMPLATE","items","dataKey","size","map","item","id","width","height","name","thumbnail","join","GalleryButton","navbar","plugin","psv","getPlugin","on","destroy","off","handleEvent","e","type","toggleActive","isSupported","onClick","toggle","AbstractButton","icon","gallery","ACTIVE_CLASS","GalleryComponent","blankIcon","temp","document","createElement","innerHTML","firstChild","style","display","container","appendChild","window","observer","IntersectionObserver","entries","forEach","entry","intersectionRatio","target","backgroundImage","dataset","src","unobserve","root","prop","mousedown","initMouseX","mouseX","addEventListener","SYSTEM","mouseWheelEvent","hide","removeChild","removeEventListener","disconnect","spinY","normalizeWheel","scrollLeft","preventDefault","clientX","delta","Math","abs","getClosest","__click","show","classList","add","visible","remove","setItems","config","thumbnailSize","querySelectorAll","child","observe","setActive","currentActive","querySelector","nextActive","AbstractComponent","DEFAULTS","lang","registerButton","GalleryPlugin","options","visibleOnLoad","handler","currentId","init","CONSTANTS","PANORAMA_LOADED","once","READY","find","i","deepEqual","panorama","args","trigger","length","PSVError","setPanorama","caption","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;;AACO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAE,cANM;;EAOpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAE,cAAA;EAZM,EAAf;EAeA,IAAMC,iBAAiB,GAAG,gBAA1B,CAAA;EACA,IAAMC,qBAAqB,GAAGC,uBAAK,CAACC,SAAN,CAAgBH,iBAAhB,CAA9B,CAAA;EAEA,IAAMI,cAAc,GA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EAAE7G,IAAI,CAACI,IAAAA;SACXJ,EAAAA,IAAI,CAAC2F,OAFV,CAAA,CAAA,CAAA;EAID,KAAA;;EAED,IAAA,IAAA,CAAKzC,IAAL,CAAU4C,SAAV,GAAsB7F,EAAtB,CAAA;EACA,IAAA,IAAA,CAAKuB,OAAL,CAAa0D,SAAb,CAAuBjF,EAAvB,CAAA,CAAA;KAzKJ,CAAA;;EAAA,EAAA,OAAA,aAAA,CAAA;EAAA,CAAA,CAAmC6G,gCAAnC,EAAA;EAAapB,cAEJzF,KAAK;EAFDyF,cAIJtG,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/gyroscope.js b/dist/plugins/gyroscope.js index 7b75735cc..387d14080 100644 --- a/dist/plugins/gyroscope.js +++ b/dist/plugins/gyroscope.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.GyroscopePlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -66,13 +66,13 @@ GYROSCOPE_UPDATED: 'gyroscope-updated' }; - var _zee = new THREE.Vector3(0, 0, 1); + var _zee = new three.Vector3(0, 0, 1); - var _euler = new THREE.Euler(); + var _euler = new three.Euler(); - var _q0 = new THREE.Quaternion(); + var _q0 = new three.Quaternion(); - var _q1 = new THREE.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)); // - PI/2 around the x-axis + var _q1 = new three.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)); // - PI/2 around the x-axis /** * Copied from three.js examples before deletion in r134 @@ -88,7 +88,7 @@ var scope = this; var EPS = 0.000001; - var lastQuaternion = new THREE.Quaternion(); + var lastQuaternion = new three.Quaternion(); this.object = object; this.object.rotation.reorder('YXZ'); this.enabled = true; @@ -148,13 +148,13 @@ var device = scope.deviceOrientation; if (device) { - var alpha = device.alpha ? THREE.MathUtils.degToRad(device.alpha) + scope.alphaOffset : 0; // Z + var alpha = device.alpha ? three.MathUtils.degToRad(device.alpha) + scope.alphaOffset : 0; // Z - var beta = device.beta ? THREE.MathUtils.degToRad(device.beta) : 0; // X' + var beta = device.beta ? three.MathUtils.degToRad(device.beta) : 0; // X' - var gamma = device.gamma ? THREE.MathUtils.degToRad(device.gamma) : 0; // Y'' + var gamma = device.gamma ? three.MathUtils.degToRad(device.gamma) : 0; // Y'' - var orient = scope.screenOrientation ? THREE.MathUtils.degToRad(scope.screenOrientation) : 0; // O + var orient = scope.screenOrientation ? three.MathUtils.degToRad(scope.screenOrientation) : 0; // O setObjectQuaternion(scope.object.quaternion, alpha, beta, gamma, orient); @@ -267,7 +267,7 @@ photoSphereViewer.DEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope'; photoSphereViewer.registerButton(GyroscopeButton, 'caption:right'); - var direction = new THREE.Vector3(); + var direction = new three.Vector3(); /** * @summary Adds gyroscope controls on mobile devices * @extends PSV.plugins.AbstractPlugin @@ -410,7 +410,7 @@ _this2.psv.config.moveInertia = false; // enable gyro controls if (!_this2.controls) { - _this2.controls = new DeviceOrientationControls(new THREE.Object3D()); + _this2.controls = new DeviceOrientationControls(new three.Object3D()); } else { _this2.controls.connect(); } // force reset diff --git a/dist/plugins/gyroscope.js.map b/dist/plugins/gyroscope.js.map index 542769e87..dcb462bf6 100644 --- a/dist/plugins/gyroscope.js.map +++ b/dist/plugins/gyroscope.js.map @@ -1 +1 @@ -{"version":3,"file":"gyroscope.js","sources":["../../src/plugins/gyroscope/constants.js","../../src/plugins/gyroscope/DeviceOrientationControls.js","../../src/plugins/gyroscope/GyroscopeButton.js","../../src/plugins/gyroscope/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GyroscopePlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event gyroscope-updated\n * @memberof PSV.plugins.GyroscopePlugin\n * @summary Triggered when the gyroscope mode is enabled/disabled\n * @param {boolean} enabled\n */\n GYROSCOPE_UPDATED: 'gyroscope-updated',\n};\n","import {\n Euler,\n MathUtils,\n Quaternion,\n Vector3\n} from 'three';\n\nconst _zee = new Vector3( 0, 0, 1 );\nconst _euler = new Euler();\nconst _q0 = new Quaternion();\nconst _q1 = new Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis\n\n/**\n * Copied from three.js examples before deletion in r134\n * (deleted because of constructors/OS inconsistencies)\n * @private\n */\nclass DeviceOrientationControls {\n\n constructor( object ) {\n\n if ( window.isSecureContext === false ) {\n\n console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );\n\n }\n\n const scope = this;\n\n const EPS = 0.000001;\n const lastQuaternion = new Quaternion();\n\n this.object = object;\n this.object.rotation.reorder( 'YXZ' );\n\n this.enabled = true;\n\n this.deviceOrientation = {};\n this.screenOrientation = 0;\n\n this.alphaOffset = 0; // radians\n\n const onDeviceOrientationChangeEvent = function ( event ) {\n\n scope.deviceOrientation = event;\n\n };\n\n const onScreenOrientationChangeEvent = function () {\n\n scope.screenOrientation = window.orientation || 0;\n\n };\n\n // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n\n const setObjectQuaternion = function ( quaternion, alpha, beta, gamma, orient ) {\n\n _euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us\n\n quaternion.setFromEuler( _euler ); // orient the device\n\n quaternion.multiply( _q1 ); // camera looks out the back of the device, not the top\n\n quaternion.multiply( _q0.setFromAxisAngle( _zee, - orient ) ); // adjust for screen orientation\n\n };\n\n this.connect = function () {\n\n onScreenOrientationChangeEvent(); // run once on load\n\n // iOS 13+\n\n if ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {\n\n window.DeviceOrientationEvent.requestPermission().then( function ( response ) {\n\n if ( response == 'granted' ) {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n } ).catch( function ( error ) {\n\n console.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );\n\n } );\n\n } else {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n scope.enabled = true;\n\n };\n\n this.disconnect = function () {\n\n window.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n scope.enabled = false;\n\n };\n\n this.update = function () {\n\n if ( scope.enabled === false ) return;\n\n const device = scope.deviceOrientation;\n\n if ( device ) {\n\n const alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z\n\n const beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'\n\n const gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''\n\n const orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O\n\n setObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );\n\n if ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n lastQuaternion.copy( scope.object.quaternion );\n\n }\n\n }\n\n };\n\n this.dispose = function () {\n\n scope.disconnect();\n\n };\n\n this.connect();\n\n }\n\n}\n\nexport { DeviceOrientationControls };\n","import { AbstractButton } from '../..';\nimport compass from './compass.svg';\nimport { EVENTS } from './constants';\n\n/**\n * @summary Navigation bar gyroscope button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class GyroscopeButton extends AbstractButton {\n\n static id = 'gyroscope';\n static icon = compass;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-gyroscope-button', true);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.plugin = this.psv.getPlugin('gyroscope');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.GYROSCOPE_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.GYROSCOPE_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === EVENTS.GYROSCOPE_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles gyroscope control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { DeviceOrientationControls } from './DeviceOrientationControls';\nimport { GyroscopeButton } from './GyroscopeButton';\n\n\n/**\n * @typedef {Object} PSV.plugins.GyroscopePlugin.Options\n * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`)\n * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control\n * @property {'smooth' | 'fast'} [moveMode='smooth'] - How the gyroscope data is used to rotate the panorama.\n */\n\n\n// add gyroscope button\nDEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope';\nregisterButton(GyroscopeButton, 'caption:right');\n\n\nexport { EVENTS } from './constants';\n\n\nconst direction = new THREE.Vector3();\n\n\n/**\n * @summary Adds gyroscope controls on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class GyroscopePlugin extends AbstractPlugin {\n\n static id = 'gyroscope';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GyroscopePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @private\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {number} alphaOffset - current alpha offset for gyroscope controls\n * @property {boolean} enabled\n * @property {boolean} config_moveInertia - original config \"moveInertia\"\n */\n this.prop = {\n isSupported : this.__checkSupport(),\n alphaOffset : 0,\n enabled : false,\n config_moveInertia: true,\n };\n\n /**\n * @member {PSV.plugins.GyroscopePlugin.Options}\n * @private\n */\n this.config = {\n touchmove : true,\n absolutePosition: false,\n moveMode: 'smooth',\n ...options,\n };\n\n /**\n * @member {DeviceOrientationControls}\n * @private\n */\n this.controls = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.stop();\n\n delete this.controls;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n this.stop();\n break;\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n this.__onBeforeRender();\n break;\n case CONSTANTS.EVENTS.BEFORE_ROTATE:\n this.__onBeforeRotate(e);\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the gyroscope is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return this.prop.enabled;\n }\n\n /**\n * @summary Enables the gyroscope navigation if available\n * @returns {Promise}\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n return this.prop.isSupported\n .then((supported) => {\n if (supported) {\n return this.__requestPermission();\n }\n else {\n utils.logWarn('gyroscope not available');\n return Promise.reject();\n }\n })\n .then((granted) => {\n if (granted) {\n return Promise.resolve();\n }\n else {\n utils.logWarn('gyroscope not allowed');\n return Promise.reject();\n }\n })\n .then(() => {\n this.psv.__stopAll();\n\n // disable inertia\n this.prop.config_moveInertia = this.psv.config.moveInertia;\n this.psv.config.moveInertia = false;\n\n // enable gyro controls\n if (!this.controls) {\n this.controls = new DeviceOrientationControls(new THREE.Object3D());\n }\n else {\n this.controls.connect();\n }\n\n // force reset\n this.controls.deviceOrientation = null;\n this.controls.screenOrientation = 0;\n this.controls.alphaOffset = 0;\n\n this.prop.alphaOffset = this.config.absolutePosition ? 0 : null;\n this.prop.enabled = true;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, true);\n });\n }\n\n /**\n * @summary Disables the gyroscope navigation\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.controls.disconnect();\n\n this.prop.enabled = false;\n this.psv.config.moveInertia = this.prop.config_moveInertia;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, false);\n\n this.psv.resetIdleTimer();\n }\n }\n\n /**\n * @summary Enables or disables the gyroscope navigation\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Handles gyro movements\n * @private\n */\n __onBeforeRender() {\n if (!this.isEnabled()) {\n return;\n }\n\n if (!this.controls.deviceOrientation) {\n return;\n }\n\n const position = this.psv.getPosition();\n\n // on first run compute the offset depending on the current viewer position and device orientation\n if (this.prop.alphaOffset === null) {\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n this.prop.alphaOffset = sphericalCoords.longitude - position.longitude;\n }\n else {\n this.controls.alphaOffset = this.prop.alphaOffset;\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n\n const target = {\n longitude: sphericalCoords.longitude,\n latitude : -sphericalCoords.latitude,\n };\n\n // having a slow speed on smalls movements allows to absorb the device/hand vibrations\n const step = this.config.moveMode === 'smooth' ? 3 : 10;\n this.psv.dynamics.position.goto(target, utils.getAngle(position, target) < 0.01 ? 1 : step);\n }\n }\n\n /**\n * @summary Intercepts moves and offsets the alpha angle\n * @param {external:uEvent.Event} e\n * @private\n */\n __onBeforeRotate(e) {\n if (this.isEnabled()) {\n e.preventDefault();\n\n if (this.config.touchmove) {\n this.prop.alphaOffset -= e.args[0].longitude - this.psv.getPosition().longitude;\n }\n }\n }\n\n /**\n * @summary Detects if device orientation is supported\n * @returns {Promise}\n * @private\n */\n __checkSupport() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return Promise.resolve(true);\n }\n else if ('DeviceOrientationEvent' in window) {\n return new Promise((resolve) => {\n const listener = (e) => {\n resolve(e && e.alpha !== null && !isNaN(e.alpha));\n\n window.removeEventListener('deviceorientation', listener);\n };\n\n window.addEventListener('deviceorientation', listener, false);\n setTimeout(listener, 10000);\n });\n }\n else {\n return Promise.resolve(false);\n }\n }\n\n /**\n * @summary Request permission to the motion API\n * @returns {Promise}\n * @private\n */\n __requestPermission() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return DeviceOrientationEvent.requestPermission()\n .then(response => response === 'granted')\n .catch(() => false);\n }\n else {\n return Promise.resolve(true);\n }\n }\n\n}\n"],"names":["EVENTS","GYROSCOPE_UPDATED","_zee","Vector3","_euler","Euler","_q0","Quaternion","_q1","Math","sqrt","DeviceOrientationControls","object","window","isSecureContext","console","error","scope","EPS","lastQuaternion","rotation","reorder","enabled","deviceOrientation","screenOrientation","alphaOffset","onDeviceOrientationChangeEvent","event","onScreenOrientationChangeEvent","orientation","setObjectQuaternion","quaternion","alpha","beta","gamma","orient","set","setFromEuler","multiply","setFromAxisAngle","connect","DeviceOrientationEvent","undefined","requestPermission","then","response","addEventListener","catch","disconnect","removeEventListener","update","device","MathUtils","degToRad","dot","copy","dispose","GyroscopeButton","navbar","plugin","psv","getPlugin","on","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","id","icon","compass","DEFAULTS","lang","registerButton","direction","THREE","GyroscopePlugin","options","__checkSupport","config_moveInertia","config","touchmove","absolutePosition","moveMode","controls","init","CONSTANTS","STOP_ALL","BEFORE_ROTATE","BEFORE_RENDER","stop","__onBeforeRender","__onBeforeRotate","isEnabled","start","supported","__requestPermission","utils","logWarn","Promise","reject","granted","resolve","__stopAll","moveInertia","Object3D","trigger","resetIdleTimer","position","getPosition","getWorldDirection","sphericalCoords","dataHelper","vector3ToSphericalCoords","longitude","target","latitude","step","dynamics","goto","getAngle","preventDefault","DeviceMotionEvent","listener","isNaN","setTimeout","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;AACO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAE,mBAAA;EAPC;;ECCtB,IAAMC,IAAI,GAAG,IAAIC,aAAJ,CAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,CAAb,CAAA;;EACA,IAAMC,MAAM,GAAG,IAAIC,WAAJ,EAAf,CAAA;;EACA,IAAMC,GAAG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BAAsB,CAACE,iBAAvB,GACJC,IADI,CACC,UAAAC,QAAQ,EAAA;UAAA,OAAIA,QAAQ,KAAK,SAAjB,CAAA;SADT,CAAA,CAEJE,KAFI,CAEE,YAAA;EAAA,QAAA,OAAM,KAAN,CAAA;EAAA,OAFF,CAAP,CAAA;EAGD,KAJD,MAKK;EACH,MAAA,OAAO6D,OAAO,CAACG,OAAR,CAAgB,IAAhB,CAAP,CAAA;EACD,KAAA;KApRL,CAAA;;EAAA,EAAA,OAAA,eAAA,CAAA;EAAA,CAAA,CAAqCwB,gCAArC,EAAA;EAAalD,gBAEJR,KAAK;EAFDQ,gBAIJrF,SAASA;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"gyroscope.js","sources":["../../src/plugins/gyroscope/constants.js","../../src/plugins/gyroscope/DeviceOrientationControls.js","../../src/plugins/gyroscope/GyroscopeButton.js","../../src/plugins/gyroscope/index.js"],"sourcesContent":["/**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GyroscopePlugin\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event gyroscope-updated\n * @memberof PSV.plugins.GyroscopePlugin\n * @summary Triggered when the gyroscope mode is enabled/disabled\n * @param {boolean} enabled\n */\n GYROSCOPE_UPDATED: 'gyroscope-updated',\n};\n","import {\n Euler,\n MathUtils,\n Quaternion,\n Vector3\n} from 'three';\n\nconst _zee = new Vector3( 0, 0, 1 );\nconst _euler = new Euler();\nconst _q0 = new Quaternion();\nconst _q1 = new Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis\n\n/**\n * Copied from three.js examples before deletion in r134\n * (deleted because of constructors/OS inconsistencies)\n * @private\n */\nclass DeviceOrientationControls {\n\n constructor( object ) {\n\n if ( window.isSecureContext === false ) {\n\n console.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );\n\n }\n\n const scope = this;\n\n const EPS = 0.000001;\n const lastQuaternion = new Quaternion();\n\n this.object = object;\n this.object.rotation.reorder( 'YXZ' );\n\n this.enabled = true;\n\n this.deviceOrientation = {};\n this.screenOrientation = 0;\n\n this.alphaOffset = 0; // radians\n\n const onDeviceOrientationChangeEvent = function ( event ) {\n\n scope.deviceOrientation = event;\n\n };\n\n const onScreenOrientationChangeEvent = function () {\n\n scope.screenOrientation = window.orientation || 0;\n\n };\n\n // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n\n const setObjectQuaternion = function ( quaternion, alpha, beta, gamma, orient ) {\n\n _euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us\n\n quaternion.setFromEuler( _euler ); // orient the device\n\n quaternion.multiply( _q1 ); // camera looks out the back of the device, not the top\n\n quaternion.multiply( _q0.setFromAxisAngle( _zee, - orient ) ); // adjust for screen orientation\n\n };\n\n this.connect = function () {\n\n onScreenOrientationChangeEvent(); // run once on load\n\n // iOS 13+\n\n if ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {\n\n window.DeviceOrientationEvent.requestPermission().then( function ( response ) {\n\n if ( response == 'granted' ) {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n } ).catch( function ( error ) {\n\n console.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );\n\n } );\n\n } else {\n\n window.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n }\n\n scope.enabled = true;\n\n };\n\n this.disconnect = function () {\n\n window.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n window.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n scope.enabled = false;\n\n };\n\n this.update = function () {\n\n if ( scope.enabled === false ) return;\n\n const device = scope.deviceOrientation;\n\n if ( device ) {\n\n const alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z\n\n const beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'\n\n const gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''\n\n const orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O\n\n setObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );\n\n if ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n lastQuaternion.copy( scope.object.quaternion );\n\n }\n\n }\n\n };\n\n this.dispose = function () {\n\n scope.disconnect();\n\n };\n\n this.connect();\n\n }\n\n}\n\nexport { DeviceOrientationControls };\n","import { AbstractButton } from '../..';\nimport compass from './compass.svg';\nimport { EVENTS } from './constants';\n\n/**\n * @summary Navigation bar gyroscope button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class GyroscopeButton extends AbstractButton {\n\n static id = 'gyroscope';\n static icon = compass;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-gyroscope-button', true);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.plugin = this.psv.getPlugin('gyroscope');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.GYROSCOPE_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.GYROSCOPE_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === EVENTS.GYROSCOPE_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles gyroscope control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import { Object3D, Vector3 } from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { DeviceOrientationControls } from './DeviceOrientationControls';\nimport { GyroscopeButton } from './GyroscopeButton';\n\n\n/**\n * @typedef {Object} PSV.plugins.GyroscopePlugin.Options\n * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`)\n * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control\n * @property {'smooth' | 'fast'} [moveMode='smooth'] - How the gyroscope data is used to rotate the panorama.\n */\n\n\n// add gyroscope button\nDEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope';\nregisterButton(GyroscopeButton, 'caption:right');\n\n\nexport { EVENTS } from './constants';\n\n\nconst direction = new Vector3();\n\n\n/**\n * @summary Adds gyroscope controls on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class GyroscopePlugin extends AbstractPlugin {\n\n static id = 'gyroscope';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GyroscopePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @private\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {number} alphaOffset - current alpha offset for gyroscope controls\n * @property {boolean} enabled\n * @property {boolean} config_moveInertia - original config \"moveInertia\"\n */\n this.prop = {\n isSupported : this.__checkSupport(),\n alphaOffset : 0,\n enabled : false,\n config_moveInertia: true,\n };\n\n /**\n * @member {PSV.plugins.GyroscopePlugin.Options}\n * @private\n */\n this.config = {\n touchmove : true,\n absolutePosition: false,\n moveMode: 'smooth',\n ...options,\n };\n\n /**\n * @member {DeviceOrientationControls}\n * @private\n */\n this.controls = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_ROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n this.stop();\n\n delete this.controls;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n this.stop();\n break;\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n this.__onBeforeRender();\n break;\n case CONSTANTS.EVENTS.BEFORE_ROTATE:\n this.__onBeforeRotate(e);\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the gyroscope is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return this.prop.enabled;\n }\n\n /**\n * @summary Enables the gyroscope navigation if available\n * @returns {Promise}\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n return this.prop.isSupported\n .then((supported) => {\n if (supported) {\n return this.__requestPermission();\n }\n else {\n utils.logWarn('gyroscope not available');\n return Promise.reject();\n }\n })\n .then((granted) => {\n if (granted) {\n return Promise.resolve();\n }\n else {\n utils.logWarn('gyroscope not allowed');\n return Promise.reject();\n }\n })\n .then(() => {\n this.psv.__stopAll();\n\n // disable inertia\n this.prop.config_moveInertia = this.psv.config.moveInertia;\n this.psv.config.moveInertia = false;\n\n // enable gyro controls\n if (!this.controls) {\n this.controls = new DeviceOrientationControls(new Object3D());\n }\n else {\n this.controls.connect();\n }\n\n // force reset\n this.controls.deviceOrientation = null;\n this.controls.screenOrientation = 0;\n this.controls.alphaOffset = 0;\n\n this.prop.alphaOffset = this.config.absolutePosition ? 0 : null;\n this.prop.enabled = true;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, true);\n });\n }\n\n /**\n * @summary Disables the gyroscope navigation\n * @fires PSV.plugins.GyroscopePlugin.gyroscope-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.controls.disconnect();\n\n this.prop.enabled = false;\n this.psv.config.moveInertia = this.prop.config_moveInertia;\n\n this.trigger(EVENTS.GYROSCOPE_UPDATED, false);\n\n this.psv.resetIdleTimer();\n }\n }\n\n /**\n * @summary Enables or disables the gyroscope navigation\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Handles gyro movements\n * @private\n */\n __onBeforeRender() {\n if (!this.isEnabled()) {\n return;\n }\n\n if (!this.controls.deviceOrientation) {\n return;\n }\n\n const position = this.psv.getPosition();\n\n // on first run compute the offset depending on the current viewer position and device orientation\n if (this.prop.alphaOffset === null) {\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n this.prop.alphaOffset = sphericalCoords.longitude - position.longitude;\n }\n else {\n this.controls.alphaOffset = this.prop.alphaOffset;\n this.controls.update();\n this.controls.object.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n\n const target = {\n longitude: sphericalCoords.longitude,\n latitude : -sphericalCoords.latitude,\n };\n\n // having a slow speed on smalls movements allows to absorb the device/hand vibrations\n const step = this.config.moveMode === 'smooth' ? 3 : 10;\n this.psv.dynamics.position.goto(target, utils.getAngle(position, target) < 0.01 ? 1 : step);\n }\n }\n\n /**\n * @summary Intercepts moves and offsets the alpha angle\n * @param {external:uEvent.Event} e\n * @private\n */\n __onBeforeRotate(e) {\n if (this.isEnabled()) {\n e.preventDefault();\n\n if (this.config.touchmove) {\n this.prop.alphaOffset -= e.args[0].longitude - this.psv.getPosition().longitude;\n }\n }\n }\n\n /**\n * @summary Detects if device orientation is supported\n * @returns {Promise}\n * @private\n */\n __checkSupport() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return Promise.resolve(true);\n }\n else if ('DeviceOrientationEvent' in window) {\n return new Promise((resolve) => {\n const listener = (e) => {\n resolve(e && e.alpha !== null && !isNaN(e.alpha));\n\n window.removeEventListener('deviceorientation', listener);\n };\n\n window.addEventListener('deviceorientation', listener, false);\n setTimeout(listener, 10000);\n });\n }\n else {\n return Promise.resolve(false);\n }\n }\n\n /**\n * @summary Request permission to the motion API\n * @returns {Promise}\n * @private\n */\n __requestPermission() {\n if ('DeviceMotionEvent' in window && typeof DeviceMotionEvent.requestPermission === 'function') {\n return DeviceOrientationEvent.requestPermission()\n .then(response => response === 'granted')\n .catch(() => false);\n }\n else {\n return Promise.resolve(true);\n }\n }\n\n}\n"],"names":["EVENTS","GYROSCOPE_UPDATED","_zee","Vector3","_euler","Euler","_q0","Quaternion","_q1","Math","sqrt","DeviceOrientationControls","object","window","isSecureContext","console","error","scope","EPS","lastQuaternion","rotation","reorder","enabled","deviceOrientation","screenOrientation","alphaOffset","onDeviceOrientationChangeEvent","event","onScreenOrientationChangeEvent","orientation","setObjectQuaternion","quaternion","alpha","beta","gamma","orient","set","setFromEuler","multiply","setFromAxisAngle","connect","DeviceOrientationEvent","undefined","requestPermission","then","response","addEventListener","catch","disconnect","removeEventListener","update","device","MathUtils","degToRad","dot","copy","dispose","GyroscopeButton","navbar","plugin","psv","getPlugin","on","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","id","icon","compass","DEFAULTS","lang","registerButton","direction","GyroscopePlugin","options","__checkSupport","config_moveInertia","config","touchmove","absolutePosition","moveMode","controls","init","CONSTANTS","STOP_ALL","BEFORE_ROTATE","BEFORE_RENDER","stop","__onBeforeRender","__onBeforeRotate","isEnabled","start","supported","__requestPermission","utils","logWarn","Promise","reject","granted","resolve","__stopAll","moveInertia","Object3D","trigger","resetIdleTimer","position","getPosition","getWorldDirection","sphericalCoords","dataHelper","vector3ToSphericalCoords","longitude","target","latitude","step","dynamics","goto","getAngle","preventDefault","DeviceMotionEvent","listener","is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KAAX,CAAV,CAAA;EACD,OATM,CAAP,CAAA;EAUD,KAXI,MAYA;EACH,MAAA,OAAOxB,OAAO,CAACG,OAAR,CAAgB,KAAhB,CAAP,CAAA;EACD,KAAA;EACF,GAAA;EAED;EACF;EACA;EACA;EACA;EA3QA,GAAA;;IAAA,MA4QEN,CAAAA,mBA5QF,GA4QE,SAAsB,mBAAA,GAAA;MACpB,IAAI,mBAAA,IAAuB3F,MAAvB,IAAiC,OAAOqH,iBAAiB,CAACvF,iBAAzB,KAA+C,UAApF,EAAgG;EAC9F,MAAA,OAAOF,sBAAsB,CAACE,iBAAvB,GACJC,IADI,CACC,UAAAC,QAAQ,EAAA;UAAA,OAAIA,QAAQ,KAAK,SAAjB,CAAA;SADT,CAAA,CAEJE,KAFI,CAEE,YAAA;EAAA,QAAA,OAAM,KAAN,CAAA;EAAA,OAFF,CAAP,CAAA;EAGD,KAJD,MAKK;EACH,MAAA,OAAO4D,OAAO,CAACG,OAAR,CAAgB,IAAhB,CAAP,CAAA;EACD,KAAA;KApRL,CAAA;;EAAA,EAAA,OAAA,eAAA,CAAA;EAAA,CAAA,CAAqCwB,gCAArC,EAAA;EAAalD,gBAEJP,KAAK;EAFDO,gBAIJpF,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/markers.css b/dist/plugins/markers.css index 77528c465..a388b292f 100644 --- a/dist/plugins/markers.css +++ b/dist/plugins/markers.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/markers.js b/dist/plugins/markers.js index 0e13c3aac..b319555cc 100644 --- a/dist/plugins/markers.js +++ b/dist/plugins/markers.js @@ -1,14 +1,14 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer'), require('uevent')) : - typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer', 'uevent'], factory) : + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : + typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.MarkersPlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -210,64 +210,6 @@ }).join('') + "\n \n\n"; }; - /** - * @summary Ensures that a number is in a given interval - * @memberOf PSV.utils - * @param {number} x - * @param {number} min - * @param {number} max - * @returns {number} - */ - /** - * @summary Compute the shortest offset between two longitudes - * @memberOf PSV.utils - * @param {number} from - * @param {number} to - * @returns {number} - */ - - function getShortestArc(from, to) { - var tCandidates = [0, // direct - Math.PI * 2, // clock-wise cross zero - -Math.PI * 2 // counter-clock-wise cross zero - ]; - return tCandidates.reduce(function (value, candidate) { - var newCandidate = to - from + candidate; - return Math.abs(newCandidate) < Math.abs(value) ? newCandidate : value; - }, Infinity); - } - - /** - * @summary Custom error used in the lib - * @param {string} message - * @constructor - * @memberOf PSV - */ - function PSVError(message) { - this.message = message; // Use V8's native method if available, otherwise fallback - - if ('captureStackTrace' in Error) { - Error.captureStackTrace(this, PSVError); - } else { - this.stack = new Error().stack; - } - } - - PSVError.prototype = Object.create(Error.prototype); - PSVError.prototype.name = 'PSVError'; - PSVError.prototype.constructor = PSVError; - - /** - * @summary Displays a warning in the console - * @memberOf PSV.utils - * @param {string} message - */ - - function logWarn(message) { - console.warn("PhotoSphereViewer: " + message); - } - new THREE.Quaternion(); - /** * Returns intermediary point between two points on the sphere * {@link http://www.movable-type.co.uk/scripts/latlong.html} @@ -488,7 +430,7 @@ this.loader = null; if (this.is3d()) { - this.loader = new THREE.TextureLoader(); + this.loader = new three.TextureLoader(); if (this.psv.config.withCredentials) { this.loader.setWithCredentials(true); @@ -507,7 +449,8 @@ } else if (this.isPolyline()) { this.$el = document.createElementNS(SVG_NS, 'polyline'); } else if (this.isSvg()) { - this.$el = document.createElementNS(SVG_NS, this.type); + var svgType = this.type === 'square' ? 'rect' : this.type; + this.$el = document.createElementNS(SVG_NS, svgType); } if (!this.is3d()) { @@ -629,8 +572,8 @@ if (Array.isArray(this.config.scale.longitude)) { var _bounds = this.config.scale.longitude; - var halfFov = THREE.MathUtils.degToRad(this.psv.prop.hFov) / 2; - var arc = Math.abs(getShortestArc(this.props.position.longitude, position.longitude)); + var halfFov = three.MathUtils.degToRad(this.psv.prop.hFov) / 2; + var arc = Math.abs(photoSphereViewer.utils.getShortestArc(this.props.position.longitude, position.longitude)); scale *= _bounds[1] + (_bounds[0] - _bounds[1]) * photoSphereViewer.CONSTANTS.EASINGS.outQuad(Math.max(0, (halfFov - arc) / halfFov)); } @@ -759,7 +702,7 @@ // reset CSS class if (this.isNormal()) { - this.$el.setAttribute('class', 'psv-marker psv-marker--normal'); + this.$el.className = 'psv-marker psv-marker--normal'; } else { this.$el.setAttribute('class', 'psv-marker psv-marker--svg'); } // add CSS classes @@ -770,11 +713,11 @@ } if (this.config.tooltip) { - photoSphereViewer.utils.addClasses(this.$el, 'psv-marker--has-tooltip'); + this.$el.classList.add('psv-marker--has-tooltip'); } if (this.config.content) { - photoSphereViewer.utils.addClasses(this.$el, 'psv-marler--has-content'); + this.$el.classList.add('psv-marler--has-content'); } // apply style @@ -790,7 +733,7 @@ if (this.config.scale) { if (typeof this.config.scale === 'number') { - logWarn('Single value marker scale is deprecated, please use an array of two values.'); + photoSphereViewer.utils.logWarn('Single value marker scale is deprecated, please use an array of two values.'); this.config.scale = { zoom: [0, this.config.scale] }; @@ -1040,15 +983,15 @@ if (!this.$el) { var _this$config$opacity2, _mesh$userData; - var material = new THREE.MeshBasicMaterial({ + var material = new three.MeshBasicMaterial({ 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); + var geometry = new three.PlaneGeometry(1, 1); + var mesh = new three.Mesh(geometry, material); mesh.userData = (_mesh$userData = {}, _mesh$userData[MARKER_DATA] = this, _mesh$userData); - this.$el = new THREE.Group().add(mesh); // overwrite the visible property to be tied to the Marker instance + this.$el = new three.Group().add(mesh); // overwrite the visible property to be tied to the Marker instance // and do it without context bleed Object.defineProperty(this.$el, 'visible', { @@ -1445,14 +1388,13 @@ this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.DOUBLE_CLICK, this); this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.RENDER, this); this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.CONFIG_CHANGED, this); - - if (this.config.markers) { - this.psv.once(photoSphereViewer.CONSTANTS.EVENTS.READY, function () { + this.psv.once(photoSphereViewer.CONSTANTS.EVENTS.READY, function () { + if (_this2.config.markers) { _this2.setMarkers(_this2.config.markers); delete _this2.config.markers; - }); - } + } + }); } /** * @package @@ -2097,7 +2039,7 @@ ; _proto.__updateMarkerSize = function __updateMarkerSize(marker) { - photoSphereViewer.utils.addClasses(marker.$el, 'psv-marker--transparent'); + marker.$el.classList.add('psv-marker--transparent'); var transform; if (marker.isSvg()) { @@ -2111,7 +2053,7 @@ var rect = marker.$el.getBoundingClientRect(); marker.props.width = rect.width; marker.props.height = rect.height; - photoSphereViewer.utils.removeClasses(marker.$el, 'psv-marker--transparent'); + marker.$el.classList.remove('psv-marker--transparent'); if (transform) { if (marker.isSvg()) { @@ -2207,12 +2149,12 @@ _proto.__getPolyIntermediaryPoint = function __getPolyIntermediaryPoint(P1, P2) { var C = this.psv.prop.direction.clone().normalize(); - var N = new THREE.Vector3().crossVectors(P1, P2).normalize(); - var V = new THREE.Vector3().crossVectors(N, P1).normalize(); + var N = new three.Vector3().crossVectors(P1, P2).normalize(); + var V = new three.Vector3().crossVectors(N, P1).normalize(); var X = P1.clone().multiplyScalar(-C.dot(V)); var Y = V.clone().multiplyScalar(C.dot(P1)); - var H = new THREE.Vector3().addVectors(X, Y).normalize(); - var a = new THREE.Vector3().crossVectors(H, C); + var H = new three.Vector3().addVectors(X, Y).normalize(); + var a = new three.Vector3().crossVectors(H, C); return H.applyAxisAngle(a, 0.01).multiplyScalar(photoSphereViewer.CONSTANTS.SPHERE_RADIUS); } /** diff --git a/dist/plugins/markers.js.map b/dist/plugins/markers.js.map index 2fe7a5ee3..8a858f6e6 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 marker-visibility\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the visibility of a marker changes\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {boolean} visible\n */\n MARKER_VISIBILITY : 'marker-visibility',\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 Types of tooltip events\n * @memberOf PSV.plugins.MarkersPlugin\n * @enum {string}\n * @constant\n * @private\n */\nexport const MARKER_TOOLTIP_TRIGGER = {\n click: 'click',\n hover: 'hover',\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 Ensure a value is within 0 and `max`\n * @param {number} value\n * @param {number} max\n * @return {number}\n */\nexport function loop(value, max) {\n let result = value % max;\n\n if (result < 0) {\n result += max;\n }\n\n return result;\n}\n\n/**\n * @summary Checks if a value is an integer\n * @memberOf PSV.utils\n * @param {*} value\n * @returns {boolean}\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value;\n}\n\n/**\n * @summary Tests if a number is power of two\n * @memberOf PSV.utils\n * @param {number} x\n * @return {boolean}\n */\nexport function isPowerOfTwo(x) {\n return (Math.log(x) / Math.log(2)) % 1 === 0;\n}\n\n/**\n * @summary Computes the sum of an array\n * @memberOf PSV.utils\n * @param {number[]} array\n * @returns {number}\n */\nexport function sum(array) {\n return array.reduce((a, b) => a + b, 0);\n}\n\n/**\n * @summary Computes the distance between two points\n * @memberOf PSV.utils\n * @param {PSV.Point} p1\n * @param {PSV.Point} p2\n * @returns {number}\n */\nexport function distance(p1, p2) {\n return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2));\n}\n\n/**\n * @summary Compute the shortest offset between two longitudes\n * @memberOf PSV.utils\n * @param {number} from\n * @param {number} to\n * @returns {number}\n */\nexport function getShortestArc(from, to) {\n const tCandidates = [\n 0, // direct\n Math.PI * 2, // clock-wise cross zero\n -Math.PI * 2, // counter-clock-wise cross zero\n ];\n\n return tCandidates.reduce((value, candidate) => {\n const newCandidate = to - from + candidate;\n return Math.abs(newCandidate) < Math.abs(value) ? newCandidate : value;\n }, Infinity);\n}\n\n/**\n * @summary Computes the angle between the current position and a target position\n * @memberOf PSV.utils\n * @param {PSV.Position} position1\n * @param {PSV.Position} position2\n * @returns {number}\n */\nexport function getAngle(position1, position2) {\n return Math.acos(\n Math.cos(position1.latitude)\n * Math.cos(position2.latitude)\n * Math.cos(position1.longitude - position2.longitude)\n + Math.sin(position1.latitude)\n * Math.sin(position2.latitude)\n );\n}\n\n/**\n * @summary Returns the distance between two points on a sphere of radius one\n * {@link http://www.movable-type.co.uk/scripts/latlong.html}\n * @memberOf PSV.utils\n * @param {number[]} p1\n * @param {number[]} p2\n * @returns {number}\n */\nexport function greatArcDistance(p1, p2) {\n const [λ1, φ1] = p1;\n const [λ2, φ2] = p2;\n\n const x = (λ2 - λ1) * Math.cos((φ1 + φ2) / 2);\n const y = (φ2 - φ1);\n return Math.sqrt(x * x + y * y);\n}\n","/**\n * @summary 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, loop } from './math';\n\n/**\n * @summary Returns the plugin constructor from the imported object\n * For retrocompatibility with previous default exports\n * @memberOf PSV.utils\n * @package\n */\nexport function pluginInterop(plugin, target) {\n if (plugin) {\n for (const [, p] of [['_', plugin], ...Object.entries(plugin)]) {\n if (p.prototype instanceof target) {\n return p;\n }\n }\n }\n return null;\n}\n\n/**\n * @summary Builds an Error with name 'AbortError'\n * @memberOf PSV.utils\n * @return {Error}\n */\nexport function getAbortError() {\n const error = new Error('Loading was aborted.');\n error.name = 'AbortError';\n return error;\n}\n\n/**\n * @summary Tests if an Error has name 'AbortError'\n * @memberOf PSV.utils\n * @param {Error} err\n * @return {boolean}\n */\nexport function isAbortError(err) {\n return err?.name === 'AbortError';\n}\n\n/**\n * @summary Displays a warning in the console\n * @memberOf PSV.utils\n * @param {string} message\n */\nexport function logWarn(message) {\n console.warn(`PhotoSphereViewer: ${message}`);\n}\n\n/**\n * @summary Checks if an object is a {PSV.ExtendedPosition}, ie has x/y or longitude/latitude\n * @memberOf PSV.utils\n * @param {object} object\n * @returns {boolean}\n */\nexport function isExtendedPosition(object) {\n return [['x', 'y'], ['longitude', 'latitude']].some(([key1, key2]) => {\n return object[key1] !== undefined && object[key2] !== undefined;\n });\n}\n\n/**\n * @summary Returns the value of a given attribute in the panorama metadata\n * @memberOf PSV.utils\n * @param {string} data\n * @param {string} attr\n * @returns (number)\n */\nexport function getXMPValue(data, attr) {\n // XMP data are stored in children\n let result = data.match('(.*)');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n // XMP data are stored in attributes\n result = data.match('GPano:' + attr + '=\"(.*?)\"');\n if (result !== null) {\n const val = parseInt(result[1], 10);\n return isNaN(val) ? null : val;\n }\n\n return null;\n}\n\n/**\n * @readonly\n * @private\n * @type {{top: string, left: string, bottom: string, center: string, right: string}}\n */\nconst CSS_POSITIONS = {\n top : '0%',\n bottom: '100%',\n left : '0%',\n right : '100%',\n center: '50%',\n};\n\n/**\n * @summary Translate CSS values like \"top center\" or \"10% 50%\" as top and left positions\n * @memberOf PSV.utils\n * @description The implementation is as close as possible to the \"background-position\" specification\n * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position}\n * @param {string|PSV.Point} value\n * @returns {PSV.Point}\n */\nexport function parsePosition(value) {\n if (!value) {\n return { x: 0.5, y: 0.5 };\n }\n\n if (typeof value === 'object') {\n return value;\n }\n\n let tokens = value.toLocaleLowerCase().split(' ').slice(0, 2);\n\n if (tokens.length === 1) {\n if (CSS_POSITIONS[tokens[0]] !== undefined) {\n tokens = [tokens[0], 'center'];\n }\n else {\n tokens = [tokens[0], tokens[0]];\n }\n }\n\n const xFirst = tokens[1] !== 'left' && tokens[1] !== 'right' && tokens[0] !== 'top' && tokens[0] !== 'bottom';\n\n tokens = tokens.map(token => CSS_POSITIONS[token] || token);\n\n if (!xFirst) {\n tokens.reverse();\n }\n\n const parsed = tokens.join(' ').match(/^([0-9.]+)% ([0-9.]+)%$/);\n\n if (parsed) {\n return {\n x: parseFloat(parsed[1]) / 100,\n y: parseFloat(parsed[2]) / 100,\n };\n }\n else {\n return { x: 0.5, y: 0.5 };\n }\n}\n\n/**\n * @readonly\n * @private\n */\nconst LEFT_MAP = { 0: 'left', 0.5: 'center', 1: 'right' };\n/**\n * @readonly\n * @private\n */\nconst TOP_MAP = { 0: 'top', 0.5: 'center', 1: 'bottom' };\n\n/**\n * @summary Parse a CSS-like position into an array of position keywords among top, bottom, left, right and center\n * @memberOf PSV.utils\n * @param {string | string[]} value\n * @param {string} defaultValue\n * @param {boolean} [allowCenter=true]\n * @return {string[]}\n */\nexport function cleanPosition(value, defaultValue, allowCenter = true) {\n if (!value) {\n return defaultValue.split(' ');\n }\n\n if (typeof value === 'string') {\n const tempPos = parsePosition(value);\n\n if (!(tempPos.x in LEFT_MAP) || !(tempPos.y in TOP_MAP)) {\n throw new PSVError(`Unable to parse position \"${value}\"`);\n }\n\n value = [TOP_MAP[tempPos.y], LEFT_MAP[tempPos.x]];\n }\n\n if (!allowCenter && value[0] === 'center' && value[1] === 'center') {\n throw new PSVError('Unable to parse position \"center center\"');\n }\n\n return value;\n}\n\n/**\n * @summary Parses an speed\n * @memberOf PSV.utils\n * @param {string|number} speed - The speed, in radians/degrees/revolutions per second/minute\n * @returns {number} radians per second\n * @throws {PSV.PSVError} when the speed cannot be parsed\n */\nexport function parseSpeed(speed) {\n let parsed;\n\n if (typeof speed === 'string') {\n const speedStr = speed.toString().trim();\n\n // Speed extraction\n let speedValue = parseFloat(speedStr.replace(/^(-?[0-9]+(?:\\.[0-9]*)?).*$/, '$1'));\n const speedUnit = speedStr.replace(/^-?[0-9]+(?:\\.[0-9]*)?(.*)$/, '$1').trim();\n\n // \"per minute\" -> \"per second\"\n if (speedUnit.match(/(pm|per minute)$/)) {\n speedValue /= 60;\n }\n\n // Which unit?\n switch (speedUnit) {\n // Degrees per minute / second\n case 'dpm':\n case 'degrees per minute':\n case 'dps':\n case 'degrees per second':\n parsed = THREE.MathUtils.degToRad(speedValue);\n break;\n\n // Radians per minute / second\n case 'rdpm':\n case 'radians per minute':\n case 'rdps':\n case 'radians per second':\n parsed = speedValue;\n break;\n\n // Revolutions per minute / second\n case 'rpm':\n case 'revolutions per minute':\n case 'rps':\n case 'revolutions per second':\n parsed = speedValue * Math.PI * 2;\n break;\n\n // Unknown unit\n default:\n throw new PSVError('Unknown speed unit \"' + speedUnit + '\"');\n }\n }\n else {\n parsed = speed;\n }\n\n return parsed;\n}\n\n/**\n * @summary Parses an angle value in radians or degrees and returns a normalized value in radians\n * @memberOf PSV.utils\n * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg\n * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi\n * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi\n * @returns {number}\n * @throws {PSV.PSVError} when the angle cannot be parsed\n */\nexport function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) {\n let parsed;\n\n if (typeof angle === 'string') {\n const match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\\.[0-9]*)?)(.*)$/);\n\n if (!match) {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n const value = parseFloat(match[1]);\n const unit = match[2];\n\n if (unit) {\n switch (unit) {\n case 'deg':\n case 'degs':\n parsed = THREE.MathUtils.degToRad(value);\n break;\n case 'rad':\n case 'rads':\n parsed = value;\n break;\n default:\n throw new PSVError('Unknown angle unit \"' + unit + '\"');\n }\n }\n else {\n parsed = value;\n }\n }\n else if (typeof angle === 'number' && !isNaN(angle)) {\n parsed = angle;\n }\n else {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n parsed = loop(zeroCenter ? parsed + Math.PI : parsed, Math.PI * 2);\n\n return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed;\n}\n\n/**\n * @summary Creates a THREE texture from an image\n * @memberOf PSV.utils\n * @param {HTMLImageElement | HTMLCanvasElement} img\n * @return {external:THREE.Texture}\n */\nexport function createTexture(img) {\n const texture = new THREE.Texture(img);\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n return texture;\n}\n\nconst quaternion = new THREE.Quaternion();\n\n/**\n * @summary Applies the inverse of Euler angles to a vector\n * @memberOf PSV.utils\n * @param {external:THREE.Vector3} vector\n * @param {external:THREE.Euler} euler\n */\nexport function applyEulerInverse(vector, euler) {\n quaternion.setFromEuler(euler).invert();\n vector.applyQuaternion(quaternion);\n}\n","import { 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, utils } from '../..';\nimport { getShortestArc, logWarn } from '../../utils';\nimport { MARKER_DATA, MARKER_TOOLTIP_TRIGGER, 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 {boolean} visible - actually visible in the view\n * @property {boolean} staticTooltip - the tooltip must always be shown\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 visible : false,\n staticTooltip: false,\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.MathUtils.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.props.visible && this.config.tooltip.content && this.props.position2D) {\n const config = {\n ...this.config.tooltip,\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 Recompute the position of the tooltip\n */\n refreshTooltip() {\n if (this.tooltip) {\n this.showTooltip();\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 if (!this.config.tooltip) {\n this.config.tooltip = {};\n }\n if (!this.config.tooltip.trigger) {\n this.config.tooltip.trigger = MARKER_TOOLTIP_TRIGGER.hover;\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, this.config.height / 100, 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 MARKER_TOOLTIP_TRIGGER,\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 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 if (this.prop.showAllTooltips) {\n this.hideAllTooltips();\n }\n else {\n this.showAllTooltips();\n }\n }\n\n /**\n * @summary Displays all tooltips\n */\n showAllTooltips() {\n this.prop.showAllTooltips = true;\n utils.each(this.markers, (marker) => {\n marker.props.staticTooltip = true;\n marker.showTooltip();\n });\n }\n\n /**\n * @summary Hides all tooltips\n */\n hideAllTooltips() {\n this.prop.showAllTooltips = false;\n utils.each(this.markers, (marker) => {\n marker.props.staticTooltip = false;\n marker.hideTooltip();\n });\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 Forces the display of the tooltip\n * @param {string} markerId\n */\n showMarkerTooltip(markerId) {\n const marker = this.getMarker(markerId);\n marker.props.staticTooltip = true;\n marker.showTooltip();\n }\n\n /**\n * @summary Hides the tooltip\n * @param {string} markerId\n */\n hideMarkerTooltip(markerId) {\n const marker = this.getMarker(markerId);\n marker.props.staticTooltip = false;\n marker.hideTooltip();\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 visibilityChanged = false;\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 visibilityChanged = marker.props.visible !== isVisible;\n marker.props.visible = isVisible;\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) {\n marker.hideTooltip();\n }\n else if (marker.props.staticTooltip) {\n marker.showTooltip();\n }\n else if (marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.click || (marker === this.prop.hoveringMarker && !marker.isPoly())) {\n marker.refreshTooltip();\n }\n else if (marker !== this.prop.hoveringMarker) {\n marker.hideTooltip();\n }\n\n if (visibilityChanged) {\n this.trigger(EVENTS.MARKER_VISIBILITY, marker, isVisible);\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 (!marker.props.staticTooltip && marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.hover) {\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 (!marker.props.staticTooltip && marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.hover) {\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 (!marker.props.staticTooltip) {\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.hoveringMarker.props.staticTooltip) {\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 (this.prop.currentMarker && this.prop.currentMarker !== marker) {\n this.trigger(EVENTS.UNSELECT_MARKER, this.prop.currentMarker);\n\n this.psv.panel.hide(ID_PANEL_MARKER);\n\n if (!this.prop.showAllTooltips && this.prop.currentMarker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.click) {\n this.hideMarkerTooltip(this.prop.currentMarker);\n }\n\n this.prop.currentMarker = null;\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 if (marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.click) {\n if (marker.tooltip) {\n this.hideMarkerTooltip(marker);\n }\n else {\n this.showMarkerTooltip(marker);\n }\n }\n else {\n this.showMarkerPanel(marker.id);\n }\n }\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","MARKER_VISIBILITY","GOTO_MARKER_DONE","LEAVE_MARKER","OVER_MARKER","RENDER_MARKERS_LIST","SELECT_MARKER","SELECT_MARKER_LIST","UNSELECT_MARKER","HIDE_MARKERS","SET_MARKERS","SHOW_MARKERS","MARKER_TOOLTIP_TRIGGER","click","hover","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","staticTooltip","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","MathUtils","degToRad","prop","hFov","arc","outQuad","max","listContent","content","showTooltip","mousePosition","viewerPos","getPosition","container","box","size","arrow","top","clientY","left","clientX","move","refreshTooltip","hideTooltip","hide","newType","deepmerge","trigger","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","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","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","showMarkerTooltip","hideMarkerTooltip","showMarkerPanel","panel","contentId","hideMarkersList","showMarkersList","hideList","change","noMargin","clickHandler","li","getClosest","dataset","getZoomLevel","viewerPosition","isVisible","visibilityChanged","__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;;AACO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAI,mBARD;;EASpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAK,kBAfD;;EAgBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAtBD;;EAuBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aA7BD;;EA8BpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,mBAAmB,EAAE,qBArCD;;EAsCpB;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAQ,eA9CD;;EA+CpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAG,oBArDD;;EAsDpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAM,iBA5DD;;EA6DpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAlED;;EAmEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aAzED;;EA0EpB;EACF;EACA;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CAAea,SAAf,CAAyBjV,eAAzB,CAAJ,EAA+C;EAClD,QAAA,IAAA,CAAKkJ,IAAL,CAAUgH,aAAV,GAA0B,IAAKiE,CAAAA,eAAL,CAAqB,IAAKjL,CAAAA,IAAL,CAAUgH,aAA/B,CAA1B,GAA0E,IAAKjK,CAAAA,GAAL,CAASmO,KAAT,CAAe5J,IAAf,EAA1E,CAAA;EACD,OAAA;EACF,KAAA;EACF,GAAA;EAED;EACF;EACA;EACA;EAv8BA,GAAA;;IAAA,MAw8BEwI,CAAAA,sBAx8BF,GAw8BE,SAAyB,sBAAA,GAAA;EACvB,IAAA,IAAM+F,KAAK,GAAG9W,MAAM,CAACyQ,MAAP,CAAc,IAAKvS,CAAAA,OAAnB,CAA4B6Y,CAAAA,IAA5B,CAAiC,UAAAxY,MAAM,EAAA;QAAA,OAAIA,MAAM,CAAC2G,IAAP,EAAJ,CAAA;EAAA,KAAvC,CAAd,CAAA;;EAEA,IAAA,IAAI,CAAC4R,KAAD,IAAU,KAAK7P,IAAL,CAAUkH,YAAxB,EAAsC;QACpC,IAAKlH,CAAAA,IAAL,CAAUkH,YAAV,EAAA,CAAA;EACA,MAAA,IAAA,CAAKlH,IAAL,CAAUkH,YAAV,GAAyB,IAAzB,CAAA;OAFF,MAIK,IAAI2I,KAAK,IAAI,CAAC,IAAK7P,CAAAA,IAAL,CAAUkH,YAAxB,EAAsC;EACzC,MAAA,IAAA,CAAKlH,IAAL,CAAUkH,YAAV,GAAyB,IAAKnK,CAAAA,GAAL,CAASgT,cAAT,CAAwBlZ,WAAxB,EAAqC,IAArC,CAAzB,CAAA;EACD,KAAA;KAj9BL,CAAA;;EAAA,EAAA,OAAA,aAAA,CAAA;EAAA,CAAA,CAAmCmZ,gCAAnC,EAAA;EAAalJ,cAEJtP,KAAK;EAFDsP,cAIJjR,SAASA;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"markers.js","sources":["../../src/plugins/markers/constants.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 marker-visibility\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the visibility of a marker changes\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {boolean} visible\n */\n MARKER_VISIBILITY : 'marker-visibility',\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 Types of tooltip events\n * @memberOf PSV.plugins.MarkersPlugin\n * @enum {string}\n * @constant\n * @private\n */\nexport const MARKER_TOOLTIP_TRIGGER = {\n click: 'click',\n hover: 'hover',\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","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 { Group, MathUtils, Mesh, MeshBasicMaterial, PlaneGeometry, TextureLoader } from 'three';\nimport { CONSTANTS, PSVError, utils } from '../..';\nimport { MARKER_DATA, MARKER_TOOLTIP_TRIGGER, 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 {boolean} visible - actually visible in the view\n * @property {boolean} staticTooltip - the tooltip must always be shown\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 visible : false,\n staticTooltip: false,\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 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 const svgType = this.type === 'square' ? 'rect' : this.type;\n this.$el = document.createElementNS(SVG_NS, svgType);\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 = MathUtils.degToRad(this.psv.prop.hFov) / 2;\n const arc = Math.abs(utils.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.props.visible && this.config.tooltip.content && this.props.position2D) {\n const config = {\n ...this.config.tooltip,\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 Recompute the position of the tooltip\n */\n refreshTooltip() {\n if (this.tooltip) {\n this.showTooltip();\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 if (!this.config.tooltip) {\n this.config.tooltip = {};\n }\n if (!this.config.tooltip.trigger) {\n this.config.tooltip.trigger = MARKER_TOOLTIP_TRIGGER.hover;\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.className = '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 this.$el.classList.add('psv-marker--has-tooltip');\n }\n if (this.config.content) {\n this.$el.classList.add('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 utils.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 MeshBasicMaterial({\n transparent: true,\n opacity : this.config.opacity ?? 1,\n depthTest : false,\n });\n const geometry = new PlaneGeometry(1, 1);\n const mesh = new Mesh(geometry, material);\n mesh.userData = { [MARKER_DATA]: this };\n this.$el = new 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, this.config.height / 100, 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 { Vector3 } 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 MARKER_TOOLTIP_TRIGGER,\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 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 this.psv.once(CONSTANTS.EVENTS.READY, () => {\n if (this.config.markers) {\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 if (this.prop.showAllTooltips) {\n this.hideAllTooltips();\n }\n else {\n this.showAllTooltips();\n }\n }\n\n /**\n * @summary Displays all tooltips\n */\n showAllTooltips() {\n this.prop.showAllTooltips = true;\n utils.each(this.markers, (marker) => {\n marker.props.staticTooltip = true;\n marker.showTooltip();\n });\n }\n\n /**\n * @summary Hides all tooltips\n */\n hideAllTooltips() {\n this.prop.showAllTooltips = false;\n utils.each(this.markers, (marker) => {\n marker.props.staticTooltip = false;\n marker.hideTooltip();\n });\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 Forces the display of the tooltip\n * @param {string} markerId\n */\n showMarkerTooltip(markerId) {\n const marker = this.getMarker(markerId);\n marker.props.staticTooltip = true;\n marker.showTooltip();\n }\n\n /**\n * @summary Hides the tooltip\n * @param {string} markerId\n */\n hideMarkerTooltip(markerId) {\n const marker = this.getMarker(markerId);\n marker.props.staticTooltip = false;\n marker.hideTooltip();\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 visibilityChanged = false;\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 visibilityChanged = marker.props.visible !== isVisible;\n marker.props.visible = isVisible;\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) {\n marker.hideTooltip();\n }\n else if (marker.props.staticTooltip) {\n marker.showTooltip();\n }\n else if (marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.click || (marker === this.prop.hoveringMarker && !marker.isPoly())) {\n marker.refreshTooltip();\n }\n else if (marker !== this.prop.hoveringMarker) {\n marker.hideTooltip();\n }\n\n if (visibilityChanged) {\n this.trigger(EVENTS.MARKER_VISIBILITY, marker, isVisible);\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 marker.$el.classList.add('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 marker.$el.classList.remove('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 Vector3().crossVectors(P1, P2).normalize();\n const V = new 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 Vector3().addVectors(X, Y).normalize();\n const a = new 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 (!marker.props.staticTooltip && marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.hover) {\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 (!marker.props.staticTooltip && marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.hover) {\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 (!marker.props.staticTooltip) {\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.hoveringMarker.props.staticTooltip) {\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 (this.prop.currentMarker && this.prop.currentMarker !== marker) {\n this.trigger(EVENTS.UNSELECT_MARKER, this.prop.currentMarker);\n\n this.psv.panel.hide(ID_PANEL_MARKER);\n\n if (!this.prop.showAllTooltips && this.prop.currentMarker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.click) {\n this.hideMarkerTooltip(this.prop.currentMarker);\n }\n\n this.prop.currentMarker = null;\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 if (marker.config.tooltip.trigger === MARKER_TOOLTIP_TRIGGER.click) {\n if (marker.tooltip) {\n this.hideMarkerTooltip(marker);\n }\n else {\n this.showMarkerTooltip(marker);\n }\n }\n else {\n this.showMarkerPanel(marker.id);\n }\n }\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","MARKER_VISIBILITY","GOTO_MARKER_DONE","LEAVE_MARKER","OVER_MARKER","RENDER_MARKERS_LIST","SELECT_MARKER","SELECT_MARKER_LIST","UNSELECT_MARKER","HIDE_MARKERS","SET_MARKERS","SHOW_MARKERS","MARKER_TOOLTIP_TRIGGER","click","hover","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","greatArcIntermediaryPoint","p1","p2","f","λ1","φ1","λ2","φ2","r","utils","greatArcDistance","a","Math","sin","b","x","cos","y","z","atan2","sqrt","getPolygonCenter","polygon","workPoints","k","i","length","d","PI","push","sum","reduce","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","PSVError","getType","visible","$el","data","undefined","tooltip","props","dynamicSize","anchor","staticTooltip","position","position2D","positions3D","width","height","def","loader","is3d","TextureLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","isNormal","document","createElement","isPolygon","createElementNS","isPolyline","isSvg","svgType","update","destroy","isPoly","isPolyPx","isPolyRad","getScale","zoomLevel","scale","Array","isArray","zoom","bounds","EASINGS","inQuad","longitude","halfFov","MathUtils","degToRad","prop","hFov","arc","abs","getShortestArc","outQuad","max","listContent","content","showTooltip","mousePosition","viewerPos","getPosition","container","box","size","arrow","top","clientY","left","clientX","move","create","refreshTooltip","hideTooltip","hide","newType","deepmerge","trigger","className","setAttribute","addClasses","classList","add","style","opacity","parsePosition","logWarn","__updateNormal","__updatePoly","__updateSvg","__update3d","isExtendedPosition","backgroundImage","innerHTML","transformOrigin","dataHelper","cleanPosition","sphericalCoordsToVector3","cx","cy","rx","ry","each","value","setAttributeNS","svgStyle","dasherize","fill","actualPoly","splice","coord","sphericalCoords","textureCoordsToSphericalCoords","latitude","centroid","material","MeshBasicMaterial","transparent","depthTest","geometry","PlaneGeometry","mesh","Mesh","userData","Group","Object","defineProperty","enumerable","get","children","set","load","texture","anisotropy","needsUpdate","copy","orientation","lookAt","rotateX","rotateY","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","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","showMarkerTooltip","hideMarkerTooltip","showMarkerPanel","panel","contentId","hideMarkersList","showMarkersList","hideList","change","noMargin","clickHandler","li","getClosest","dataset","getZoomLevel","viewerPosition","isVisible","visibilityChanged","__getMarkerPosition","__isMarkerVisible","positions","__getPolyPositions","points","pos","__updateMarkerSize","transform","toggleClass","dot","direction","getAttributeNS","removeAttributeNS","getBoundingClientRect","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;;AACO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAI,mBARD;;EASpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAK,kBAfD;;EAgBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAtBD;;EAuBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aA7BD;;EA8BpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,mBAAmB,EAAE,qBArCD;;EAsCpB;EACF;EACA;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAQ,eA9CD;;EA+CpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAG,oBArDD;;EAsDpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAM,iBA5DD;;EA6DpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAlED;;EAmEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAU,aAzED;;EA0EpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAS,cAAA;EA/ED,EAAf;EAkFP;EACA;EACA;EACA;EACA;EACA;EACA;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AAKxR,CAAAA,OAAnB,CAA4B6X,CAAAA,IAA5B,CAAiC,UAAAxX,MAAM,EAAA;QAAA,OAAIA,MAAM,CAACoF,IAAP,EAAJ,CAAA;EAAA,KAAvC,CAAd,CAAA;;EAEA,IAAA,IAAI,CAACmS,KAAD,IAAU,KAAKnQ,IAAL,CAAUyH,YAAxB,EAAsC;QACpC,IAAKzH,CAAAA,IAAL,CAAUyH,YAAV,EAAA,CAAA;EACA,MAAA,IAAA,CAAKzH,IAAL,CAAUyH,YAAV,GAAyB,IAAzB,CAAA;OAFF,MAIK,IAAI0I,KAAK,IAAI,CAAC,IAAKnQ,CAAAA,IAAL,CAAUyH,YAAxB,EAAsC;EACzC,MAAA,IAAA,CAAKzH,IAAL,CAAUyH,YAAV,GAAyB,IAAK5K,CAAAA,GAAL,CAASwT,cAAT,CAAwBlY,WAAxB,EAAqC,IAArC,CAAzB,CAAA;EACD,KAAA;KAj9BL,CAAA;;EAAA,EAAA,OAAA,aAAA,CAAA;EAAA,CAAA,CAAmCmY,gCAAnC,EAAA;EAAajJ,cAEJvO,KAAK;EAFDuO,cAIJlQ,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/resolution.js b/dist/plugins/resolution.js index d0a3a2e10..9a9c3527b 100644 --- a/dist/plugins/resolution.js +++ b/dist/plugins/resolution.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.css b/dist/plugins/settings.css index 2ae28e982..ff8062270 100644 --- a/dist/plugins/settings.css +++ b/dist/plugins/settings.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index 197ad693e..89e159a46 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/stereo.js b/dist/plugins/stereo.js index c113ae6eb..ecf422373 100644 --- a/dist/plugins/stereo.js +++ b/dist/plugins/stereo.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/video.css b/dist/plugins/video.css index bd0e837a2..be04fce0e 100644 --- a/dist/plugins/video.css +++ b/dist/plugins/video.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/video.js b/dist/plugins/video.js index dcca65fdd..0a1da3ca7 100644 --- a/dist/plugins/video.js +++ b/dist/plugins/video.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.VideoPlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -1201,7 +1201,7 @@ var workPoints = [keypoints[Math.max(0, k1 - 1)].position, keypoints[k1].position, keypoints[k2].position, keypoints[Math.min(l, k2 + 1)].position]; // apply offsets to avoid crossing the origin - var workVectors = [new THREE.Vector2(workPoints[0][0], workPoints[0][1])]; + var workVectors = [new three.Vector2(workPoints[0][0], workPoints[0][1])]; var k = 0; for (var _i = 1; _i <= 3; _i++) { @@ -1221,10 +1221,10 @@ k = 0; } - workVectors.push(new THREE.Vector2(workPoints[_i][0] + k * 2 * Math.PI, workPoints[_i][1])); + workVectors.push(new three.Vector2(workPoints[_i][0] + k * 2 * Math.PI, workPoints[_i][1])); } - this.autorotate.curve = new THREE.SplineCurve(workVectors); + this.autorotate.curve = new three.SplineCurve(workVectors); this.autorotate.start = keypoints[k1]; this.autorotate.end = keypoints[k2]; // debugCurve(this.markers, this.autorotate.curve.getPoints(16 * 3).map(p => ([p.x, p.y])), 16); }; diff --git a/dist/plugins/video.js.map b/dist/plugins/video.js.map index f284c0ee0..629dfbd54 100644 --- a/dist/plugins/video.js.map +++ b/dist/plugins/video.js.map @@ -1 +1 @@ -{"version":3,"file":"video.js","sources":["../../src/plugins/video/constants.js","../../src/plugins/video/PauseOverlay.js","../../src/plugins/video/PlayPauseButton.js","../../src/plugins/video/utils.js","../../src/plugins/video/ProgressBar.js","../../src/plugins/video/TimeCaption.js","../../src/plugins/video/VolumeButton.js","../../src/plugins/video/index.js"],"sourcesContent":["export const EVENTS = {\n /**\n * @event play\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video starts playing\n */\n PLAY : 'play',\n /**\n * @event pause\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video is paused\n */\n PAUSE : 'pause',\n /**\n * @event volume-change\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video volume changes\n * @param {number} volume\n */\n VOLUME_CHANGE: 'volume-change',\n /**\n * @event progress\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video play progression changes\n * @param {{time: number, duration: number, progress: number}} data\n */\n PROGRESS : 'progress',\n /**\n * @event buffer\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video buffer changes\n * @param {number} maxBuffer\n */\n BUFFER : 'buffer',\n};\n","import { AbstractComponent, CONSTANTS, utils } from '../..';\nimport { EVENTS } from './constants';\nimport playIcon from './play.svg';\n\n/**\n * @private\n */\nexport class PauseOverlay extends AbstractComponent {\n\n constructor(plugin) {\n super(plugin.psv, 'psv-video-overlay');\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = plugin;\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.button = document.createElement('button');\n this.button.className = 'psv-video-bigbutton';\n this.button.innerHTML = playIcon;\n this.container.appendChild(this.button);\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.PLAY, this);\n this.plugin.on(EVENTS.PAUSE, this);\n this.button.addEventListener('click', this);\n }\n\n /**\n * @private\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.PLAY, this);\n this.plugin.off(EVENTS.PAUSE, this);\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.PLAY:\n case EVENTS.PAUSE:\n utils.toggleClass(this.button, 'psv-video-bigbutton--pause', !this.plugin.isPlaying());\n break;\n case 'click':\n this.plugin.playPause();\n break;\n }\n /* eslint-enable */\n }\n\n}\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport pauseIcon from './pause.svg';\nimport playIcon from './play.svg';\n\n/**\n * @summary Navigation bar video play/pause button\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class PlayPauseButton extends AbstractButton {\n\n static id = 'videoPlay';\n static groupId = 'video';\n static icon = playIcon;\n static iconActive = pauseIcon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-video-play-button', true);\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('video');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.PLAY, this);\n this.plugin.on(EVENTS.PAUSE, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.PLAY, this);\n this.plugin.off(EVENTS.PAUSE, this);\n }\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 case EVENTS.PLAY:\n case EVENTS.PAUSE:\n this.toggleActive(this.plugin.isPlaying());\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles video playback\n */\n onClick() {\n this.plugin.playPause();\n }\n\n}\n","/**\n * @private\n */\nexport function formatTime(time) {\n const seconds = Math.round(time % 60);\n const minutes = Math.round(time - seconds) / 60;\n return `${minutes}:${('0' + seconds).slice(-2)}`;\n}\n","import { AbstractComponent, CONSTANTS, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { formatTime } from './utils';\n\n/**\n * @private\n */\nexport class ProgressBar extends AbstractComponent {\n\n constructor(plugin) {\n super(plugin.psv, 'psv-video-progressbar');\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = plugin;\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.bufferElt = document.createElement('div');\n this.bufferElt.className = 'psv-video-progressbar__buffer';\n this.container.appendChild(this.bufferElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.progressElt = document.createElement('div');\n this.progressElt.className = 'psv-video-progressbar__progress';\n this.container.appendChild(this.progressElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.handleElt = document.createElement('div');\n this.handleElt.className = 'psv-video-progressbar__handle';\n this.container.appendChild(this.handleElt);\n\n /**\n * @type {PSV.utils.Slider}\n * @private\n * @readonly\n */\n this.slider = new utils.Slider({\n psv : this.psv,\n container: this.container,\n direction: utils.Slider.HORIZONTAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.BUFFER, this);\n this.plugin.on(EVENTS.PROGRESS, this);\n\n this.prop.req = window.requestAnimationFrame(() => this.__updateProgress());\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.BUFFER, this);\n this.plugin.off(EVENTS.PROGRESS, this);\n\n this.slider.destroy();\n this.prop.tooltip?.hide();\n window.cancelAnimationFrame(this.prop.req);\n\n delete this.prop.tooltip;\n delete this.slider;\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.BUFFER:\n case EVENTS.PROGRESS:\n this.bufferElt.style.width = `${this.plugin.getBufferProgress() * 100}%`;\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __updateProgress() {\n this.progressElt.style.width = `${this.plugin.getProgress() * 100}%`;\n\n this.prop.req = window.requestAnimationFrame(() => this.__updateProgress());\n }\n\n /**\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mouseover) {\n this.handleElt.style.display = 'block';\n this.handleElt.style.left = `${e.value * 100}%`;\n\n const time = formatTime(this.plugin.getDuration() * e.value);\n\n if (!this.prop.tooltip) {\n this.prop.tooltip = this.psv.tooltip.create({\n top : e.cursor.clientY,\n left : e.cursor.clientX,\n content: time,\n });\n }\n else {\n this.prop.tooltip.content.innerHTML = time;\n this.prop.tooltip.move({\n top : e.cursor.clientY,\n left: e.cursor.clientX,\n });\n }\n }\n else {\n this.handleElt.style.display = 'none';\n\n this.prop.tooltip?.hide();\n delete this.prop.tooltip;\n }\n if (e.click) {\n this.plugin.setProgress(e.value);\n }\n }\n\n}\n","import { AbstractComponent, CONSTANTS } from '../..';\nimport { EVENTS } from './constants';\nimport { formatTime } from './utils';\n\n/**\n * @summary Navigation bar video time display\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class TimeCaption extends AbstractComponent {\n\n static id = 'videoTime';\n static groupId = 'video';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-caption psv-video-time');\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 /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('video');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.PROGRESS, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.PROGRESS, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.PROGRESS:\n this.content.innerHTML = `${formatTime(this.plugin.getTime())} / ${formatTime(this.plugin.getDuration())}`;\n break;\n }\n /* eslint-enable */\n }\n\n}\n","import { AbstractButton, CONSTANTS, utils } from '../..';\nimport { EVENTS } from './constants';\nimport volumeIcon from './volume.svg';\n\n/**\n * @summary Navigation bar video volume button\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class VolumeButton extends AbstractButton {\n\n static id = 'videoVolume';\n static groupId = 'video';\n static icon = volumeIcon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-video-volume-button', true);\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('video');\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.rangeContainer = document.createElement('div');\n this.rangeContainer.className = 'psv-video-volume__container';\n this.container.appendChild(this.rangeContainer);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.range = document.createElement('div');\n this.range.className = 'psv-video-volume__range';\n this.rangeContainer.appendChild(this.range);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.trackElt = document.createElement('div');\n this.trackElt.className = 'psv-video-volume__track';\n this.range.appendChild(this.trackElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.progressElt = document.createElement('div');\n this.progressElt.className = 'psv-video-volume__progress';\n this.range.appendChild(this.progressElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.handleElt = document.createElement('div');\n this.handleElt.className = 'psv-video-volume__handle';\n this.range.appendChild(this.handleElt);\n\n /**\n * @type {PSV.utils.Slider}\n * @private\n * @readonly\n */\n this.slider = new utils.Slider({\n psv : this.psv,\n container: this.range,\n direction: utils.Slider.VERTICAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.PLAY, this);\n this.plugin.on(EVENTS.VOLUME_CHANGE, this);\n\n this.__setVolume(0);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.PLAY, this);\n this.plugin.off(EVENTS.VOLUME_CHANGE, this);\n }\n\n this.slider.destroy();\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 case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.PLAY:\n case EVENTS.VOLUME_CHANGE:\n this.__setVolume(this.plugin.getVolume());\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles video muted\n */\n onClick() {\n this.plugin.setMute();\n }\n\n /**\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mousedown) {\n this.plugin.setVolume(e.value);\n }\n }\n\n /**\n * @private\n */\n __setVolume(volume) {\n let level;\n if (volume === 0) level = 0;\n else if (volume < 0.333) level = 1;\n else if (volume < 0.666) level = 2;\n else level = 3;\n\n utils.toggleClass(this.container, 'psv-video-volume-button--0', level === 0);\n utils.toggleClass(this.container, 'psv-video-volume-button--1', level === 1);\n utils.toggleClass(this.container, 'psv-video-volume-button--2', level === 2);\n utils.toggleClass(this.container, 'psv-video-volume-button--3', level === 3);\n\n this.handleElt.style.bottom = `${volume * 100}%`;\n this.progressElt.style.height = `${volume * 100}%`;\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { PauseOverlay } from './PauseOverlay';\nimport { PlayPauseButton } from './PlayPauseButton';\nimport { ProgressBar } from './ProgressBar';\nimport { TimeCaption } from './TimeCaption';\nimport { VolumeButton } from './VolumeButton';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.VideoPlugin.Keypoint\n * @property {PSV.ExtendedPosition} position\n * @property {number} time\n */\n\n/**\n * @typedef {Object} PSV.plugins.VideoPlugin.Options\n * @property {boolean} [progressbar=true] - displays a progressbar on top of the navbar\n * @property {boolean} [bigbutton=true] - displays a big \"play\" button in the center of the viewer\n * @property {PSV.plugins.VideoPlugin.Keypoint[]} [keypoints] - defines autorotate timed keypoints\n */\n\n\n// add video buttons\nDEFAULTS.lang[PlayPauseButton.id] = 'Play/Pause';\nDEFAULTS.lang[VolumeButton.id] = 'Volume';\nregisterButton(PlayPauseButton);\nregisterButton(VolumeButton);\nregisterButton(TimeCaption);\nDEFAULTS.navbar.unshift(PlayPauseButton.groupId);\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Controls a video adapter\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class VideoPlugin extends AbstractPlugin {\n\n static id = 'video';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.VideoPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n if (!this.psv.adapter.constructor.id.includes('video')) {\n throw new PSVError('VideoPlugin can only be used with a video adapter.');\n }\n\n /**\n * @member {Object}\n * @property {THREE.SplineCurve} curve\n * @property {PSV.plugins.VideoPlugin.Keypoint} start\n * @property {PSV.plugins.VideoPlugin.Keypoint} end\n * @property {PSV.plugins.VideoPlugin.Keypoint[]} keypoints\n * @private\n */\n this.autorotate = {\n curve : null,\n start : null,\n end : null,\n keypoints: null,\n };\n\n /**\n * @member {PSV.plugins.VideoPlugin.Options}\n * @private\n */\n this.config = {\n progressbar: true,\n bigbutton : true,\n ...options,\n };\n\n if (this.config.progressbar) {\n this.progressbar = new ProgressBar(this);\n }\n\n if (this.config.bigbutton) {\n this.overlay = new PauseOverlay(this);\n }\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n if (this.config.keypoints) {\n this.setKeypoints(this.config.keypoints);\n delete this.config.keypoints;\n }\n\n this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.on(CONSTANTS.EVENTS.KEY_PRESS, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.off(CONSTANTS.EVENTS.KEY_PRESS, this);\n\n delete this.autorotate;\n delete this.progressbar;\n delete this.overlay;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n // @formatter:off\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n this.__autorotate();\n break;\n case CONSTANTS.EVENTS.AUTOROTATE:\n this.__configureAutorotate();\n break;\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n this.__bindVideo(e.args[0]);\n this.progressbar?.show();\n break;\n case CONSTANTS.EVENTS.KEY_PRESS:\n this.__onKeyPress(e, e.args[0]);\n break;\n case 'play': this.trigger(EVENTS.PLAY); break;\n case 'pause': this.trigger(EVENTS.PAUSE); break;\n case 'progress': this.trigger(EVENTS.BUFFER, this.getBufferProgress()); break;\n case 'volumechange': this.trigger(EVENTS.VOLUME_CHANGE, this.getVolume()); break;\n case 'timeupdate':\n this.trigger(EVENTS.PROGRESS, {\n time : this.getTime(),\n duration: this.getDuration(),\n progress: this.getProgress(),\n });\n break;\n }\n // @formatter:on\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __bindVideo(textureData) {\n this.video = textureData.texture.image;\n\n this.video.addEventListener('play', this);\n this.video.addEventListener('pause', this);\n this.video.addEventListener('progress', this);\n this.video.addEventListener('volumechange', this);\n this.video.addEventListener('timeupdate', this);\n }\n\n /**\n * @private\n */\n __onKeyPress(e, key) {\n if (key === CONSTANTS.KEY_CODES.Space) {\n this.playPause();\n e.preventDefault();\n }\n }\n\n /**\n * @summary Returns the durection of the video\n * @returns {number}\n */\n getDuration() {\n return this.video?.duration ?? 0;\n }\n\n /**\n * @summary Returns the current time of the video\n * @returns {number}\n */\n getTime() {\n return this.video?.currentTime ?? 0;\n }\n\n /**\n * @summary Returns the play progression of the video\n * @returns {number} 0-1\n */\n getProgress() {\n return this.video ? this.video.currentTime / this.video.duration : 0;\n }\n\n /**\n * @summary Returns if the video is playing\n * @returns {boolean}\n */\n isPlaying() {\n return this.video ? !this.video.paused : false;\n }\n\n /**\n * @summary Returns the video volume\n * @returns {number}\n */\n getVolume() {\n return this.video?.muted ? 0 : this.video?.volume ?? 0;\n }\n\n /**\n * @summary Starts or pause the video\n */\n playPause() {\n if (this.video) {\n if (this.video.paused) {\n this.video.play();\n }\n else {\n this.video.pause();\n }\n }\n }\n\n /**\n * @summary Starts the video if paused\n */\n play() {\n if (this.video && this.video.paused) {\n this.video.play();\n }\n }\n\n /**\n * @summary Pauses the cideo if playing\n */\n pause() {\n if (this.video && !this.video.paused) {\n this.video.pause();\n }\n }\n\n /**\n * @summary Sets the volume of the video\n * @param {number} volume\n */\n setVolume(volume) {\n if (this.video) {\n this.video.muted = false;\n this.video.volume = volume;\n }\n }\n\n /**\n * @summary (Un)mutes the video\n * @param {boolean} [mute] - toggle if undefined\n */\n setMute(mute) {\n if (this.video) {\n this.video.muted = mute === undefined ? !this.video.muted : mute;\n if (!this.video.muted && this.video.volume === 0) {\n this.video.volume = 0.1;\n }\n }\n }\n\n /**\n * @summary Changes the current time of the video\n * @param {number} time\n */\n setTime(time) {\n if (this.video) {\n this.video.currentTime = time;\n }\n }\n\n /**\n * @summary Changes the progression of the video\n * @param {number} progress 0-1\n */\n setProgress(progress) {\n if (this.video) {\n this.video.currentTime = this.video.duration * progress;\n }\n }\n\n getBufferProgress() {\n if (this.video) {\n let maxBuffer = 0;\n\n const buffer = this.video.buffered;\n\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= this.video.currentTime && buffer.end(i) >= this.video.currentTime) {\n maxBuffer = buffer.end(i);\n break;\n }\n }\n\n return Math.max(this.video.currentTime, maxBuffer) / this.video.duration;\n }\n else {\n return 0;\n }\n }\n\n /**\n * @summary Changes the keypoints\n * @param {PSV.plugins.VideoPlugin.Keypoint[]} keypoints\n */\n setKeypoints(keypoints) {\n if (keypoints && keypoints.length < 2) {\n throw new PSVError('At least two points are required');\n }\n\n this.autorotate.keypoints = utils.clone(keypoints);\n\n if (this.autorotate.keypoints) {\n this.autorotate.keypoints.forEach((pt, i) => {\n if (pt.position) {\n const position = this.psv.dataHelper.cleanPosition(pt.position);\n pt.position = [position.longitude, position.latitude];\n }\n else {\n throw new PSVError(`Keypoint #${i} is missing marker or position`);\n }\n\n if (utils.isNil(pt.time)) {\n throw new PSVError(`Keypoint #${i} is missing time`);\n }\n });\n\n this.autorotate.keypoints.sort((a, b) => a.time - b.time);\n }\n\n this.__configureAutorotate();\n }\n\n /**\n * @private\n */\n __configureAutorotate() {\n delete this.autorotate.curve;\n delete this.autorotate.start;\n delete this.autorotate.end;\n\n if (this.psv.isAutorotateEnabled() && this.autorotate.keypoints) {\n // cancel core rotation\n this.psv.dynamics.position.stop();\n }\n }\n\n /**\n * @private\n */\n __autorotate() {\n if (!this.psv.isAutorotateEnabled() || !this.autorotate.keypoints) {\n return;\n }\n\n const currentTime = this.getTime();\n const autorotate = this.autorotate;\n\n if (!autorotate.curve || currentTime < autorotate.start.time || currentTime >= autorotate.end.time) {\n this.__autorotateNext(currentTime);\n }\n\n if (autorotate.start === autorotate.end) {\n this.psv.rotate({\n longitude: autorotate.start.position[0],\n latitude : autorotate.start.position[1],\n });\n }\n else {\n const progress = (currentTime - autorotate.start.time) / (autorotate.end.time - autorotate.start.time);\n // only the middle segment contains the current section\n const pt = autorotate.curve.getPoint(1 / 3 + progress / 3);\n\n this.psv.dynamics.position.goto({\n longitude: pt.x,\n latitude : pt.y,\n });\n }\n }\n\n /**\n * @private\n */\n __autorotateNext(currentTime) {\n let k1 = null;\n let k2 = null;\n\n const keypoints = this.autorotate.keypoints;\n const l = keypoints.length - 1;\n\n if (currentTime < keypoints[0].time) {\n k1 = 0;\n k2 = 0;\n }\n for (let i = 0; i < l; i++) {\n if (currentTime >= keypoints[i].time && currentTime < keypoints[i + 1].time) {\n k1 = i;\n k2 = i + 1;\n break;\n }\n }\n if (currentTime >= keypoints[l].time) {\n k1 = l;\n k2 = l;\n }\n\n // get the 4 points necessary to compute the current movement\n // one point before and two points after the current\n const workPoints = [\n keypoints[Math.max(0, k1 - 1)].position,\n keypoints[k1].position,\n keypoints[k2].position,\n keypoints[Math.min(l, k2 + 1)].position,\n ];\n\n // apply offsets to avoid crossing the origin\n const workVectors = [new THREE.Vector2(workPoints[0][0], workPoints[0][1])];\n\n let k = 0;\n for (let i = 1; i <= 3; i++) {\n const d = workPoints[i - 1][0] - workPoints[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 if (k !== 0 && i === 1) {\n // do not modify first point, apply the reverse offset the the previous point instead\n workVectors[0].x -= k * 2 * Math.PI;\n k = 0;\n }\n workVectors.push(new THREE.Vector2(workPoints[i][0] + k * 2 * Math.PI, workPoints[i][1]));\n }\n\n this.autorotate.curve = new THREE.SplineCurve(workVectors);\n this.autorotate.start = keypoints[k1];\n this.autorotate.end = keypoints[k2];\n\n // debugCurve(this.markers, this.autorotate.curve.getPoints(16 * 3).map(p => ([p.x, p.y])), 16);\n }\n\n}\n"],"names":["EVENTS","PLAY","PAUSE","VOLUME_CHANGE","PROGRESS","BUFFER","PauseOverlay","plugin","psv","button","document","createElement","className","innerHTML","playIcon","container","appendChild","on","CONSTANTS","PANORAMA_LOADED","addEventListener","destroy","off","handleEvent","e","type","utils","toggleClass","isPlaying","playPause","AbstractComponent","PlayPauseButton","navbar","getPlugin","isSupported","toggleActive","onClick","AbstractButton","id","groupId","icon","iconActive","pauseIcon","formatTime","time","seconds","Math","round","minutes","slice","ProgressBar","bufferElt","progressElt","handleElt","slider","Slider","direction","HORIZONTAL","onUpdate","__onSliderUpdate","prop","req","window","requestAnimationFrame","__updateProgress","hide","tooltip","cancelAnimationFrame","style","width","getBufferProgress","getProgress","mouseover","display","left","value","getDuration","create","top","cursor","clientY","clientX","content","move","click","setProgress","TimeCaption","getTime","VolumeButton","rangeContainer","range","trackElt","VERTICAL","__setVolume","getVolume","setMute","mousedown","setVolume","volume","level","bottom","height","volumeIcon","DEFAULTS","lang","registerButton","unshift","VideoPlugin","options","adapter","constructor","includes","PSVError","autorotate","curve","start","end","keypoints","config","progressbar","bigbutton","overlay","markers","init","setKeypoints","AUTOROTATE","BEFORE_RENDER","KEY_PRESS","__autorotate","__configureAutorotate","__bindVideo","args","show","__onKeyPress","trigger","duration","progress","textureData","video","texture","image","key","KEY_CODES","Space","preventDefault","currentTime","paused","muted","play","pause","mute","undefined","setTime","maxBuffer","buffer","buffered","i","l","length","max","clone","forEach","pt","position","dataHelper","cleanPosition","longitude","latitude","isNil","sort","a","b","isAutorotateEnabled","dynamics","stop","__autorotateNext","rotate","getPoint","goto","x","y","k1","k2","workPoints","min","workVectors","THREE","Vector2","k","d","PI","push","SplineCurve","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,IAAI,EAAW,MANK;;EAOpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAU,OAZK;;EAapB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAE,eAnBK;;EAoBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,QAAQ,EAAO,UA1BK;;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AjC,CAAA;EACAF,QAAAA,CAAC,GAAG,CAAJ,CAAA;EACD,OAAA;;EACDH,MAAAA,WAAW,CAACM,IAAZ,CAAiB,IAAIL,KAAK,CAACC,OAAV,CAAkBJ,UAAU,CAAC3B,EAAD,CAAV,CAAc,CAAd,CAAA,GAAmBgC,CAAC,GAAG,CAAJ,GAAQ9I,IAAI,CAACgJ,EAAlD,EAAsDP,UAAU,CAAC3B,EAAD,CAAV,CAAc,CAAd,CAAtD,CAAjB,CAAA,CAAA;EACD,KAAA;;MAED,IAAK3C,CAAAA,UAAL,CAAgBC,KAAhB,GAAwB,IAAIwE,KAAK,CAACM,WAAV,CAAsBP,WAAtB,CAAxB,CAAA;EACA,IAAA,IAAA,CAAKxE,UAAL,CAAgBE,KAAhB,GAAwBE,SAAS,CAACgE,EAAD,CAAjC,CAAA;MACA,IAAKpE,CAAAA,UAAL,CAAgBG,GAAhB,GAAsBC,SAAS,CAACiE,EAAD,CAA/B,CAtD4B;KAjXhC,CAAA;;EAAA,EAAA,OAAA,WAAA,CAAA;EAAA,CAAA,CAAiCW,gCAAjC,EAAA;EAAatF,YAEJrE,KAAK;EAFDqE,YAIJ3G,SAASA;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"video.js","sources":["../../src/plugins/video/constants.js","../../src/plugins/video/PauseOverlay.js","../../src/plugins/video/PlayPauseButton.js","../../src/plugins/video/utils.js","../../src/plugins/video/ProgressBar.js","../../src/plugins/video/TimeCaption.js","../../src/plugins/video/VolumeButton.js","../../src/plugins/video/index.js"],"sourcesContent":["export const EVENTS = {\n /**\n * @event play\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video starts playing\n */\n PLAY : 'play',\n /**\n * @event pause\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video is paused\n */\n PAUSE : 'pause',\n /**\n * @event volume-change\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video volume changes\n * @param {number} volume\n */\n VOLUME_CHANGE: 'volume-change',\n /**\n * @event progress\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video play progression changes\n * @param {{time: number, duration: number, progress: number}} data\n */\n PROGRESS : 'progress',\n /**\n * @event buffer\n * @memberof PSV.plugins.VideoPlugin\n * @summary Triggered when the video buffer changes\n * @param {number} maxBuffer\n */\n BUFFER : 'buffer',\n};\n","import { AbstractComponent, CONSTANTS, utils } from '../..';\nimport { EVENTS } from './constants';\nimport playIcon from './play.svg';\n\n/**\n * @private\n */\nexport class PauseOverlay extends AbstractComponent {\n\n constructor(plugin) {\n super(plugin.psv, 'psv-video-overlay');\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = plugin;\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.button = document.createElement('button');\n this.button.className = 'psv-video-bigbutton';\n this.button.innerHTML = playIcon;\n this.container.appendChild(this.button);\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.PLAY, this);\n this.plugin.on(EVENTS.PAUSE, this);\n this.button.addEventListener('click', this);\n }\n\n /**\n * @private\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.PLAY, this);\n this.plugin.off(EVENTS.PAUSE, this);\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.PLAY:\n case EVENTS.PAUSE:\n utils.toggleClass(this.button, 'psv-video-bigbutton--pause', !this.plugin.isPlaying());\n break;\n case 'click':\n this.plugin.playPause();\n break;\n }\n /* eslint-enable */\n }\n\n}\n","import { AbstractButton } from '../..';\nimport { EVENTS } from './constants';\nimport pauseIcon from './pause.svg';\nimport playIcon from './play.svg';\n\n/**\n * @summary Navigation bar video play/pause button\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class PlayPauseButton extends AbstractButton {\n\n static id = 'videoPlay';\n static groupId = 'video';\n static icon = playIcon;\n static iconActive = pauseIcon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-video-play-button', true);\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('video');\n\n if (this.plugin) {\n this.plugin.on(EVENTS.PLAY, this);\n this.plugin.on(EVENTS.PAUSE, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(EVENTS.PLAY, this);\n this.plugin.off(EVENTS.PAUSE, this);\n }\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 case EVENTS.PLAY:\n case EVENTS.PAUSE:\n this.toggleActive(this.plugin.isPlaying());\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles video playback\n */\n onClick() {\n this.plugin.playPause();\n }\n\n}\n","/**\n * @private\n */\nexport function formatTime(time) {\n const seconds = Math.round(time % 60);\n const minutes = Math.round(time - seconds) / 60;\n return `${minutes}:${('0' + seconds).slice(-2)}`;\n}\n","import { AbstractComponent, CONSTANTS, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { formatTime } from './utils';\n\n/**\n * @private\n */\nexport class ProgressBar extends AbstractComponent {\n\n constructor(plugin) {\n super(plugin.psv, 'psv-video-progressbar');\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = plugin;\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.bufferElt = document.createElement('div');\n this.bufferElt.className = 'psv-video-progressbar__buffer';\n this.container.appendChild(this.bufferElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.progressElt = document.createElement('div');\n this.progressElt.className = 'psv-video-progressbar__progress';\n this.container.appendChild(this.progressElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.handleElt = document.createElement('div');\n this.handleElt.className = 'psv-video-progressbar__handle';\n this.container.appendChild(this.handleElt);\n\n /**\n * @type {PSV.utils.Slider}\n * @private\n * @readonly\n */\n this.slider = new utils.Slider({\n psv : this.psv,\n container: this.container,\n direction: utils.Slider.HORIZONTAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.BUFFER, this);\n this.plugin.on(EVENTS.PROGRESS, this);\n\n this.prop.req = window.requestAnimationFrame(() => this.__updateProgress());\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.BUFFER, this);\n this.plugin.off(EVENTS.PROGRESS, this);\n\n this.slider.destroy();\n this.prop.tooltip?.hide();\n window.cancelAnimationFrame(this.prop.req);\n\n delete this.prop.tooltip;\n delete this.slider;\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.BUFFER:\n case EVENTS.PROGRESS:\n this.bufferElt.style.width = `${this.plugin.getBufferProgress() * 100}%`;\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __updateProgress() {\n this.progressElt.style.width = `${this.plugin.getProgress() * 100}%`;\n\n this.prop.req = window.requestAnimationFrame(() => this.__updateProgress());\n }\n\n /**\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mouseover) {\n this.handleElt.style.display = 'block';\n this.handleElt.style.left = `${e.value * 100}%`;\n\n const time = formatTime(this.plugin.getDuration() * e.value);\n\n if (!this.prop.tooltip) {\n this.prop.tooltip = this.psv.tooltip.create({\n top : e.cursor.clientY,\n left : e.cursor.clientX,\n content: time,\n });\n }\n else {\n this.prop.tooltip.content.innerHTML = time;\n this.prop.tooltip.move({\n top : e.cursor.clientY,\n left: e.cursor.clientX,\n });\n }\n }\n else {\n this.handleElt.style.display = 'none';\n\n this.prop.tooltip?.hide();\n delete this.prop.tooltip;\n }\n if (e.click) {\n this.plugin.setProgress(e.value);\n }\n }\n\n}\n","import { AbstractComponent, CONSTANTS } from '../..';\nimport { EVENTS } from './constants';\nimport { formatTime } from './utils';\n\n/**\n * @summary Navigation bar video time display\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class TimeCaption extends AbstractComponent {\n\n static id = 'videoTime';\n static groupId = 'video';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-caption psv-video-time');\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 /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('video');\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.PROGRESS, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.PROGRESS, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.PROGRESS:\n this.content.innerHTML = `${formatTime(this.plugin.getTime())} / ${formatTime(this.plugin.getDuration())}`;\n break;\n }\n /* eslint-enable */\n }\n\n}\n","import { AbstractButton, CONSTANTS, utils } from '../..';\nimport { EVENTS } from './constants';\nimport volumeIcon from './volume.svg';\n\n/**\n * @summary Navigation bar video volume button\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class VolumeButton extends AbstractButton {\n\n static id = 'videoVolume';\n static groupId = 'video';\n static icon = volumeIcon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-video-volume-button', true);\n\n /**\n * @type {PSV.plugins.VideoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin('video');\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.rangeContainer = document.createElement('div');\n this.rangeContainer.className = 'psv-video-volume__container';\n this.container.appendChild(this.rangeContainer);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.range = document.createElement('div');\n this.range.className = 'psv-video-volume__range';\n this.rangeContainer.appendChild(this.range);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.trackElt = document.createElement('div');\n this.trackElt.className = 'psv-video-volume__track';\n this.range.appendChild(this.trackElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.progressElt = document.createElement('div');\n this.progressElt.className = 'psv-video-volume__progress';\n this.range.appendChild(this.progressElt);\n\n /**\n * @type {HTMLElement}\n * @private\n * @readonly\n */\n this.handleElt = document.createElement('div');\n this.handleElt.className = 'psv-video-volume__handle';\n this.range.appendChild(this.handleElt);\n\n /**\n * @type {PSV.utils.Slider}\n * @private\n * @readonly\n */\n this.slider = new utils.Slider({\n psv : this.psv,\n container: this.range,\n direction: utils.Slider.VERTICAL,\n onUpdate : e => this.__onSliderUpdate(e),\n });\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.on(EVENTS.PLAY, this);\n this.plugin.on(EVENTS.VOLUME_CHANGE, this);\n\n this.__setVolume(0);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.plugin.off(EVENTS.PLAY, this);\n this.plugin.off(EVENTS.VOLUME_CHANGE, this);\n }\n\n this.slider.destroy();\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 case CONSTANTS.EVENTS.PANORAMA_LOADED:\n case EVENTS.PLAY:\n case EVENTS.VOLUME_CHANGE:\n this.__setVolume(this.plugin.getVolume());\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles video muted\n */\n onClick() {\n this.plugin.setMute();\n }\n\n /**\n * @private\n */\n __onSliderUpdate(e) {\n if (e.mousedown) {\n this.plugin.setVolume(e.value);\n }\n }\n\n /**\n * @private\n */\n __setVolume(volume) {\n let level;\n if (volume === 0) level = 0;\n else if (volume < 0.333) level = 1;\n else if (volume < 0.666) level = 2;\n else level = 3;\n\n utils.toggleClass(this.container, 'psv-video-volume-button--0', level === 0);\n utils.toggleClass(this.container, 'psv-video-volume-button--1', level === 1);\n utils.toggleClass(this.container, 'psv-video-volume-button--2', level === 2);\n utils.toggleClass(this.container, 'psv-video-volume-button--3', level === 3);\n\n this.handleElt.style.bottom = `${volume * 100}%`;\n this.progressElt.style.height = `${volume * 100}%`;\n }\n\n}\n","import { SplineCurve, Vector2 } from 'three';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { EVENTS } from './constants';\nimport { PauseOverlay } from './PauseOverlay';\nimport { PlayPauseButton } from './PlayPauseButton';\nimport { ProgressBar } from './ProgressBar';\nimport { TimeCaption } from './TimeCaption';\nimport { VolumeButton } from './VolumeButton';\nimport './style.scss';\n\n\n/**\n * @typedef {Object} PSV.plugins.VideoPlugin.Keypoint\n * @property {PSV.ExtendedPosition} position\n * @property {number} time\n */\n\n/**\n * @typedef {Object} PSV.plugins.VideoPlugin.Options\n * @property {boolean} [progressbar=true] - displays a progressbar on top of the navbar\n * @property {boolean} [bigbutton=true] - displays a big \"play\" button in the center of the viewer\n * @property {PSV.plugins.VideoPlugin.Keypoint[]} [keypoints] - defines autorotate timed keypoints\n */\n\n\n// add video buttons\nDEFAULTS.lang[PlayPauseButton.id] = 'Play/Pause';\nDEFAULTS.lang[VolumeButton.id] = 'Volume';\nregisterButton(PlayPauseButton);\nregisterButton(VolumeButton);\nregisterButton(TimeCaption);\nDEFAULTS.navbar.unshift(PlayPauseButton.groupId);\n\n\nexport { EVENTS } from './constants';\n\n\n/**\n * @summary Controls a video adapter\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class VideoPlugin extends AbstractPlugin {\n\n static id = 'video';\n\n static EVENTS = EVENTS;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.VideoPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n if (!this.psv.adapter.constructor.id.includes('video')) {\n throw new PSVError('VideoPlugin can only be used with a video adapter.');\n }\n\n /**\n * @member {Object}\n * @property {THREE.SplineCurve} curve\n * @property {PSV.plugins.VideoPlugin.Keypoint} start\n * @property {PSV.plugins.VideoPlugin.Keypoint} end\n * @property {PSV.plugins.VideoPlugin.Keypoint[]} keypoints\n * @private\n */\n this.autorotate = {\n curve : null,\n start : null,\n end : null,\n keypoints: null,\n };\n\n /**\n * @member {PSV.plugins.VideoPlugin.Options}\n * @private\n */\n this.config = {\n progressbar: true,\n bigbutton : true,\n ...options,\n };\n\n if (this.config.progressbar) {\n this.progressbar = new ProgressBar(this);\n }\n\n if (this.config.bigbutton) {\n this.overlay = new PauseOverlay(this);\n }\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = null;\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.markers = this.psv.getPlugin('markers');\n\n if (this.config.keypoints) {\n this.setKeypoints(this.config.keypoints);\n delete this.config.keypoints;\n }\n\n this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.on(CONSTANTS.EVENTS.KEY_PRESS, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.off(CONSTANTS.EVENTS.KEY_PRESS, this);\n\n delete this.autorotate;\n delete this.progressbar;\n delete this.overlay;\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n // @formatter:off\n switch (e.type) {\n case CONSTANTS.EVENTS.BEFORE_RENDER:\n this.__autorotate();\n break;\n case CONSTANTS.EVENTS.AUTOROTATE:\n this.__configureAutorotate();\n break;\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n this.__bindVideo(e.args[0]);\n this.progressbar?.show();\n break;\n case CONSTANTS.EVENTS.KEY_PRESS:\n this.__onKeyPress(e, e.args[0]);\n break;\n case 'play': this.trigger(EVENTS.PLAY); break;\n case 'pause': this.trigger(EVENTS.PAUSE); break;\n case 'progress': this.trigger(EVENTS.BUFFER, this.getBufferProgress()); break;\n case 'volumechange': this.trigger(EVENTS.VOLUME_CHANGE, this.getVolume()); break;\n case 'timeupdate':\n this.trigger(EVENTS.PROGRESS, {\n time : this.getTime(),\n duration: this.getDuration(),\n progress: this.getProgress(),\n });\n break;\n }\n // @formatter:on\n /* eslint-enable */\n }\n\n /**\n * @private\n */\n __bindVideo(textureData) {\n this.video = textureData.texture.image;\n\n this.video.addEventListener('play', this);\n this.video.addEventListener('pause', this);\n this.video.addEventListener('progress', this);\n this.video.addEventListener('volumechange', this);\n this.video.addEventListener('timeupdate', this);\n }\n\n /**\n * @private\n */\n __onKeyPress(e, key) {\n if (key === CONSTANTS.KEY_CODES.Space) {\n this.playPause();\n e.preventDefault();\n }\n }\n\n /**\n * @summary Returns the durection of the video\n * @returns {number}\n */\n getDuration() {\n return this.video?.duration ?? 0;\n }\n\n /**\n * @summary Returns the current time of the video\n * @returns {number}\n */\n getTime() {\n return this.video?.currentTime ?? 0;\n }\n\n /**\n * @summary Returns the play progression of the video\n * @returns {number} 0-1\n */\n getProgress() {\n return this.video ? this.video.currentTime / this.video.duration : 0;\n }\n\n /**\n * @summary Returns if the video is playing\n * @returns {boolean}\n */\n isPlaying() {\n return this.video ? !this.video.paused : false;\n }\n\n /**\n * @summary Returns the video volume\n * @returns {number}\n */\n getVolume() {\n return this.video?.muted ? 0 : this.video?.volume ?? 0;\n }\n\n /**\n * @summary Starts or pause the video\n */\n playPause() {\n if (this.video) {\n if (this.video.paused) {\n this.video.play();\n }\n else {\n this.video.pause();\n }\n }\n }\n\n /**\n * @summary Starts the video if paused\n */\n play() {\n if (this.video && this.video.paused) {\n this.video.play();\n }\n }\n\n /**\n * @summary Pauses the cideo if playing\n */\n pause() {\n if (this.video && !this.video.paused) {\n this.video.pause();\n }\n }\n\n /**\n * @summary Sets the volume of the video\n * @param {number} volume\n */\n setVolume(volume) {\n if (this.video) {\n this.video.muted = false;\n this.video.volume = volume;\n }\n }\n\n /**\n * @summary (Un)mutes the video\n * @param {boolean} [mute] - toggle if undefined\n */\n setMute(mute) {\n if (this.video) {\n this.video.muted = mute === undefined ? !this.video.muted : mute;\n if (!this.video.muted && this.video.volume === 0) {\n this.video.volume = 0.1;\n }\n }\n }\n\n /**\n * @summary Changes the current time of the video\n * @param {number} time\n */\n setTime(time) {\n if (this.video) {\n this.video.currentTime = time;\n }\n }\n\n /**\n * @summary Changes the progression of the video\n * @param {number} progress 0-1\n */\n setProgress(progress) {\n if (this.video) {\n this.video.currentTime = this.video.duration * progress;\n }\n }\n\n getBufferProgress() {\n if (this.video) {\n let maxBuffer = 0;\n\n const buffer = this.video.buffered;\n\n for (let i = 0, l = buffer.length; i < l; i++) {\n if (buffer.start(i) <= this.video.currentTime && buffer.end(i) >= this.video.currentTime) {\n maxBuffer = buffer.end(i);\n break;\n }\n }\n\n return Math.max(this.video.currentTime, maxBuffer) / this.video.duration;\n }\n else {\n return 0;\n }\n }\n\n /**\n * @summary Changes the keypoints\n * @param {PSV.plugins.VideoPlugin.Keypoint[]} keypoints\n */\n setKeypoints(keypoints) {\n if (keypoints && keypoints.length < 2) {\n throw new PSVError('At least two points are required');\n }\n\n this.autorotate.keypoints = utils.clone(keypoints);\n\n if (this.autorotate.keypoints) {\n this.autorotate.keypoints.forEach((pt, i) => {\n if (pt.position) {\n const position = this.psv.dataHelper.cleanPosition(pt.position);\n pt.position = [position.longitude, position.latitude];\n }\n else {\n throw new PSVError(`Keypoint #${i} is missing marker or position`);\n }\n\n if (utils.isNil(pt.time)) {\n throw new PSVError(`Keypoint #${i} is missing time`);\n }\n });\n\n this.autorotate.keypoints.sort((a, b) => a.time - b.time);\n }\n\n this.__configureAutorotate();\n }\n\n /**\n * @private\n */\n __configureAutorotate() {\n delete this.autorotate.curve;\n delete this.autorotate.start;\n delete this.autorotate.end;\n\n if (this.psv.isAutorotateEnabled() && this.autorotate.keypoints) {\n // cancel core rotation\n this.psv.dynamics.position.stop();\n }\n }\n\n /**\n * @private\n */\n __autorotate() {\n if (!this.psv.isAutorotateEnabled() || !this.autorotate.keypoints) {\n return;\n }\n\n const currentTime = this.getTime();\n const autorotate = this.autorotate;\n\n if (!autorotate.curve || currentTime < autorotate.start.time || currentTime >= autorotate.end.time) {\n this.__autorotateNext(currentTime);\n }\n\n if (autorotate.start === autorotate.end) {\n this.psv.rotate({\n longitude: autorotate.start.position[0],\n latitude : autorotate.start.position[1],\n });\n }\n else {\n const progress = (currentTime - autorotate.start.time) / (autorotate.end.time - autorotate.start.time);\n // only the middle segment contains the current section\n const pt = autorotate.curve.getPoint(1 / 3 + progress / 3);\n\n this.psv.dynamics.position.goto({\n longitude: pt.x,\n latitude : pt.y,\n });\n }\n }\n\n /**\n * @private\n */\n __autorotateNext(currentTime) {\n let k1 = null;\n let k2 = null;\n\n const keypoints = this.autorotate.keypoints;\n const l = keypoints.length - 1;\n\n if (currentTime < keypoints[0].time) {\n k1 = 0;\n k2 = 0;\n }\n for (let i = 0; i < l; i++) {\n if (currentTime >= keypoints[i].time && currentTime < keypoints[i + 1].time) {\n k1 = i;\n k2 = i + 1;\n break;\n }\n }\n if (currentTime >= keypoints[l].time) {\n k1 = l;\n k2 = l;\n }\n\n // get the 4 points necessary to compute the current movement\n // one point before and two points after the current\n const workPoints = [\n keypoints[Math.max(0, k1 - 1)].position,\n keypoints[k1].position,\n keypoints[k2].position,\n keypoints[Math.min(l, k2 + 1)].position,\n ];\n\n // apply offsets to avoid crossing the origin\n const workVectors = [new Vector2(workPoints[0][0], workPoints[0][1])];\n\n let k = 0;\n for (let i = 1; i <= 3; i++) {\n const d = workPoints[i - 1][0] - workPoints[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 if (k !== 0 && i === 1) {\n // do not modify first point, apply the reverse offset the the previous point instead\n workVectors[0].x -= k * 2 * Math.PI;\n k = 0;\n }\n workVectors.push(new Vector2(workPoints[i][0] + k * 2 * Math.PI, workPoints[i][1]));\n }\n\n this.autorotate.curve = new SplineCurve(workVectors);\n this.autorotate.start = keypoints[k1];\n this.autorotate.end = keypoints[k2];\n\n // debugCurve(this.markers, this.autorotate.curve.getPoints(16 * 3).map(p => ([p.x, p.y])), 16);\n }\n\n}\n"],"names":["EVENTS","PLAY","PAUSE","VOLUME_CHANGE","PROGRESS","BUFFER","PauseOverlay","plugin","psv","button","document","createElement","className","innerHTML","playIcon","container","appendChild","on","CONSTANTS","PANORAMA_LOADED","addEventListener","destroy","off","handleEvent","e","type","utils","toggleClass","isPlaying","playPause","AbstractComponent","PlayPauseButton","navbar","getPlugin","isSupported","toggleActive","onClick","AbstractButton","id","groupId","icon","iconActive","pauseIcon","formatTime","time","seconds","Math","round","minutes","slice","ProgressBar","bufferElt","progressElt","handleElt","slider","Slider","direction","HORIZONTAL","onUpdate","__onSliderUpdate","prop","req","window","requestAnimationFrame","__updateProgress","hide","tooltip","cancelAnimationFrame","style","width","getBufferProgress","getProgress","mouseover","display","left","value","getDuration","create","top","cursor","clientY","clientX","content","move","click","setProgress","TimeCaption","getTime","VolumeButton","rangeContainer","range","trackElt","VERTICAL","__setVolume","getVolume","setMute","mousedown","setVolume","volume","level","bottom","height","volumeIcon","DEFAULTS","lang","registerButton","unshift","VideoPlugin","options","adapter","constructor","includes","PSVError","autorotate","curve","start","end","keypoints","config","progressbar","bigbutton","overlay","markers","init","setKeypoints","AUTOROTATE","BEFORE_RENDER","KEY_PRESS","__autorotate","__configureAutorotate","__bindVideo","args","show","__onKeyPress","trigger","duration","progress","textureData","video","texture","image","key","KEY_CODES","Space","preventDefault","currentTime","paused","muted","play","pause","mute","undefined","setTime","maxBuffer","buffer","buffered","i","l","length","max","clone","forEach","pt","position","dataHelper","cleanPosition","longitude","latitude","isNil","sort","a","b","isAutorotateEnabled","dynamics","stop","__autorotateNext","rotate","getPoint","goto","x","y","k1","k2","workPoints","min","workVectors","Vector2","k","d","PI","push","SplineCurve","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAO,MAAMA,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,IAAI,EAAW,MANK;;EAOpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAU,OAZK;;EAapB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAE,eAnBK;;EAoBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,QAAQ,EAAO,UA1BK;;EA2BpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,MAAM,EAAS,QAAA;EAjCK;;;;ECItB;EAC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AAiB,IAAIJ,aAAJ,CAAYH,UAAU,CAAC3B,EAAD,CAAV,CAAc,CAAd,CAAmB+B,GAAAA,CAAC,GAAG,CAAJ,GAAQ7I,IAAI,CAAC+I,EAA5C,EAAgDN,UAAU,CAAC3B,EAAD,CAAV,CAAc,CAAd,CAAhD,CAAjB,CAAA,CAAA;EACD,KAAA;;MAED,IAAK3C,CAAAA,UAAL,CAAgBC,KAAhB,GAAwB,IAAI6E,iBAAJ,CAAgBN,WAAhB,CAAxB,CAAA;EACA,IAAA,IAAA,CAAKxE,UAAL,CAAgBE,KAAhB,GAAwBE,SAAS,CAACgE,EAAD,CAAjC,CAAA;MACA,IAAKpE,CAAAA,UAAL,CAAgBG,GAAhB,GAAsBC,SAAS,CAACiE,EAAD,CAA/B,CAtD4B;KAjXhC,CAAA;;EAAA,EAAA,OAAA,WAAA,CAAA;EAAA,CAAA,CAAiCU,gCAAjC,EAAA;EAAarF,YAEJrE,KAAK;EAFDqE,YAIJ3G,SAASA;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/virtual-tour.css b/dist/plugins/virtual-tour.css index e99db0cbf..84767e8cf 100644 --- a/dist/plugins/virtual-tour.css +++ b/dist/plugins/virtual-tour.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.7.0 + * Photo Sphere Viewer 4.7.1 * @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 36cbbb056..f0e9e2682 100644 --- a/dist/plugins/virtual-tour.d.ts +++ b/dist/plugins/virtual-tour.d.ts @@ -1,6 +1,6 @@ import { Event } from 'uevent'; import { ViewerOptions, Position, AbstractPlugin, Viewer } from 'photo-sphere-viewer'; -import { Marker, MarkerProperties } from 'photo-sphere-viewer/dist/plugins/markers'; +import { MarkerProperties } from 'photo-sphere-viewer/dist/plugins/markers'; /** * @summary Definition of a single node in the tour @@ -15,7 +15,7 @@ type VirtualTourNode = { name?: string; caption?: string; description?: string; - markers?: Marker[]; + markers?: MarkerProperties[]; }; /** @@ -25,7 +25,7 @@ type VirtualTourNodeLink = { nodeId: string; name?: string; position?: [number, number, number?]; - markerStyle?: MarkerProperties; + markerStyle?: VirtualTourMarkerStyle; arrowStyle?: VirtualTourArrowStyle; }; @@ -43,6 +43,11 @@ type VirtualTourArrowStyle = { scale?: [number, number]; }; +/** + * @summary Style of the marker in markers mode + */ +type VirtualTourMarkerStyle = Omit; + /** * @summary Data associated to the "node-changed" event */ @@ -66,7 +71,7 @@ type VirtualTourPluginPluginOptions = { preload?: boolean | ((node: VirtualTourNode, link: VirtualTourNodeLink) => boolean); rotateSpeed?: boolean | string | number; transition?: boolean | number; - markerStyle?: MarkerProperties; + markerStyle?: VirtualTourMarkerStyle; arrowStyle?: VirtualTourArrowStyle; markerLatOffset?: number; arrowPosition?: 'top' | 'bottom'; @@ -137,4 +142,4 @@ declare class VirtualTourPlugin extends AbstractPlugin { } -export { EVENTS, MODE_3D, MODE_CLIENT, MODE_GPS, MODE_MANUAL, MODE_MARKERS, MODE_SERVER, VirtualTourArrowStyle, VirtualTourNode, VirtualTourNodeChangedData, VirtualTourNodeLink, VirtualTourPlugin, VirtualTourPluginPluginOptions }; +export { EVENTS, MODE_3D, MODE_CLIENT, MODE_GPS, MODE_MANUAL, MODE_MARKERS, MODE_SERVER, VirtualTourArrowStyle, VirtualTourMarkerStyle, VirtualTourNode, VirtualTourNodeChangedData, VirtualTourNodeLink, VirtualTourPlugin, VirtualTourPluginPluginOptions }; diff --git a/dist/plugins/virtual-tour.js b/dist/plugins/virtual-tour.js index d7b688896..93f16b796 100644 --- a/dist/plugins/virtual-tour.js +++ b/dist/plugins/virtual-tour.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.VirtualTourPlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -383,7 +383,7 @@ */ var _ref = function () { - var loader = new THREE.ObjectLoader(); + var loader = new three.ObjectLoader(); var geometries = loader.parseGeometries([arrowGeometryJson, arrowOutlineGeometryJson]); var arrow = geometries[arrowGeometryJson.uuid]; var arrowOutline = geometries[arrowOutlineGeometryJson.uuid]; @@ -771,8 +771,8 @@ _this.arrowsGroup = null; if (_this.is3D()) { - _this.arrowsGroup = new THREE.Group(); - var localLight = new THREE.PointLight(0xffffff, 1, 0); + _this.arrowsGroup = new three.Group(); + var localLight = new three.PointLight(0xffffff, 1, 0); localLight.position.set(0, _this.config.arrowPosition === 'bottom' ? 2 : -2, 0); _this.arrowsGroup.add(localLight); @@ -788,7 +788,8 @@ var _proto = VirtualTourPlugin.prototype; _proto.init = function init() { - var _this2 = this; + var _this$markers, + _this2 = this; _AbstractPlugin.prototype.init.call(this); @@ -797,7 +798,12 @@ this.gallery = this.psv.getPlugin('gallery'); if (!this.is3D() && !this.markers) { - throw new photoSphereViewer.PSVError('Tour plugin requires the Markers plugin in markers mode'); + throw new photoSphereViewer.PSVError('VirtualTour plugin requires the Markers plugin in markers mode.'); + } + + if ((_this$markers = this.markers) != null && _this$markers.config.markers) { + photoSphereViewer.utils.logWarn('No default markers can be configured on Markers plugin when using VirtualTour plugin. ' + 'Consider defining `markers` on each tour node.'); + delete this.markers.config.markers; } this.datasource = this.isServerSide() ? new ServerSideDatasource(this) : new ClientSideDatasource(this); @@ -808,7 +814,7 @@ _this2.psv.renderer.scene.add(_this2.arrowsGroup); - var ambientLight = new THREE.AmbientLight(0xffffff, 1); + var ambientLight = new three.AmbientLight(0xffffff, 1); _this2.psv.renderer.scene.add(ambientLight); @@ -980,7 +986,9 @@ } }; }), function (id) { - return _this3.setCurrentNode(id); + _this3.setCurrentNode(id); + + _this3.gallery.hide(); }); } } @@ -1131,7 +1139,7 @@ if (_this5.is3D()) { var _mesh$userData, _link$arrowStyle, _link$arrowStyle2; - var mesh = new THREE.Mesh(ARROW_GEOM, new THREE.MeshLambertMaterial()); + 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); @@ -1141,8 +1149,8 @@ latitude: 0 }, mesh.position).multiplyScalar(1 / photoSphereViewer.CONSTANTS.SPHERE_RADIUS); - var outlineMesh = new THREE.Mesh(ARROW_OUTLINE_GEOM, new THREE.MeshBasicMaterial({ - side: THREE.BackSide + var outlineMesh = new three.Mesh(ARROW_OUTLINE_GEOM, new three.MeshBasicMaterial({ + side: three.BackSide })); outlineMesh.position.copy(mesh.position); outlineMesh.rotation.copy(mesh.rotation); @@ -1162,7 +1170,9 @@ _this5.markers.addMarker(_extends({}, _this5.config.markerStyle, link.markerStyle, { id: "tour-link-" + link.nodeId, tooltip: link.name, + visible: true, hideList: true, + content: null, data: (_data = {}, _data[LINK_DATA] = link, _data) }, position), false); } @@ -1189,8 +1199,8 @@ _proto.__getLinkPosition = function __getLinkPosition(node, link) { if (this.isGps()) { - var p1 = [THREE.MathUtils.degToRad(node.position[0]), THREE.MathUtils.degToRad(node.position[1])]; - var p2 = [THREE.MathUtils.degToRad(link.position[0]), THREE.MathUtils.degToRad(link.position[1])]; + var p1 = [three.MathUtils.degToRad(node.position[0]), three.MathUtils.degToRad(node.position[1])]; + var p2 = [three.MathUtils.degToRad(link.position[0]), three.MathUtils.degToRad(link.position[1])]; var h1 = node.position[2] !== undefined ? node.position[2] : link.position[2] || 0; var h2 = link.position[2] !== undefined ? link.position[2] : node.position[2] || 0; var latitude = 0; diff --git a/dist/plugins/virtual-tour.js.map b/dist/plugins/virtual-tour.js.map index 735aa72fc..4afae61fb 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 * @private\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 * @private\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() && !this.plugin.gallery;\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 * @private\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} [description] - description visible in the side panel\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 static EVENTS = EVENTS;\n static MODE_CLIENT = MODE_CLIENT;\n static MODE_SERVER = MODE_SERVER;\n static MODE_3D = MODE_3D;\n static MODE_MARKERS = MODE_MARKERS;\n static MODE_MANUAL = MODE_MANUAL;\n static MODE_GPS = MODE_GPS;\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.GalleryPlugin}\n * @private\n */\n this.gallery = 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 this.gallery = this.psv.getPlugin('gallery');\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.gallery;\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 if (this.gallery) {\n this.gallery.setItems(\n nodes.map(node => ({\n id : node.id,\n panorama : node.panorama,\n name : node.name,\n thumbnail: node.thumbnail,\n options : {\n caption : node.caption,\n panoData : node.panoData,\n sphereCorrection: node.sphereCorrection,\n description : node.description,\n },\n })),\n id => this.setCurrentNode(id)\n );\n }\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 description : node.description,\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.MathUtils.degToRad(node.position[0]), THREE.MathUtils.degToRad(node.position[1])];\n const p2 = [THREE.MathUtils.degToRad(link.position[0]), THREE.MathUtils.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 utils.logWarn(`Starting from next version, the VirtualTourPlugin will require the GalleryPlugin to display the list of nodes.`);\n\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","gallery","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","setItems","panoData","sphereCorrection","description","fromLink","hideError","fromNode","fromLinkPosition","__getLinkPosition","all","getAbortError","speed","animate","show","hide","children","filter","clearMarkers","clearHotspots","setPanorama","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","MathUtils","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;;EACA,IAAaA,kBAAb,gBAAA,YAAA;EAEE;EACF;EACA;;EAGE;EACF;EACA;EACE,EAAA,SAAA,kBAAA,CAAYC,MAAZ,EAAoB;MAAA,IALpBC,CAAAA,KAKoB,GALZ,EAKY,CAAA;MAClB,IAAKD,CAAAA,MAAL,GAAcA,MAAd,CAAA;EACD,GAAA;;EAZH,EAAA,IAAA,MAAA,GAAA,kBAAA,CAAA,SAAA,CAAA;;IAAA,MAcEE,CAAAA,OAdF,GAcE,SAAU,OAAA,GAAA;EACR,IAAA,OAAO,KAAKF,MAAZ,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EACA;EAtBA,GAAA;;EAAA,EAAA,MAAA,CAuBEG,QA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AAC8P,UAAN,CAAiBlK,CAAC,CAACiK,MAAnB,EAA2B,IAA3B,CAAX,GAA8C1B,SAAzD,CAAA;UACA,IAAM/O,MAAM,GAAGwQ,EAAE,GAAGA,EAAE,CAACG,OAAH,CAAW3Q,MAAd,GAAuB+O,SAAxC,CAAA;;EAEA,QAAA,IAAI/O,MAAJ,EAAY;YACV,MAAI,CAACqK,cAAL,CAAoBrK,MAApB,CAAA,CAAA;;EACA,UAAA,MAAI,CAACiQ,aAAL,EAAA,CAAA;EACD,SAAA;EACF,OAAA;OAhBH,CAAA,CAAA;EAkBD,GAAA;EAED;EACF;EACA;EAnoBA,GAAA;;IAAA,MAooBEA,CAAAA,aApoBF,GAooBE,SAAgB,aAAA,GAAA;EACd,IAAA,IAAA,CAAKpK,GAAL,CAASkK,KAAT,CAAe3D,IAAf,CAAoBlH,mBAApB,CAAA,CAAA;KAroBJ,CAAA;;EAAA,EAAA,OAAA,iBAAA,CAAA;EAAA,CAAA,CAAuC0L,gCAAvC,EAAA;EAAalJ,kBAEJpH,KAAK;EAFDoH,kBAIJvE,SAASA;EAJLuE,kBAKJ7E,cAAcA;EALV6E,kBAMJ5E,cAAcA;EANV4E,kBAOJxE,UAAUA;EAPNwE,kBAQJzE,eAAeA;EARXyE,kBASJ3E,cAAcA;EATV2E,kBAUJ1E,WAAWA;;;;;;;;;;;;;;;;;"} \ 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 * @private\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 * @private\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 { ObjectLoader } 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 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() && !this.plugin.gallery;\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 * @private\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 {\n AmbientLight,\n BackSide,\n Group,\n MathUtils,\n Mesh,\n MeshBasicMaterial,\n MeshLambertMaterial,\n PointLight\n} 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} [description] - description visible in the side panel\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 static EVENTS = EVENTS;\n static MODE_CLIENT = MODE_CLIENT;\n static MODE_SERVER = MODE_SERVER;\n static MODE_3D = MODE_3D;\n static MODE_MARKERS = MODE_MARKERS;\n static MODE_MANUAL = MODE_MANUAL;\n static MODE_GPS = MODE_GPS;\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.GalleryPlugin}\n * @private\n */\n this.gallery = 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 Group();\n\n const localLight = new 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 this.gallery = this.psv.getPlugin('gallery');\n\n if (!this.is3D() && !this.markers) {\n throw new PSVError('VirtualTour plugin requires the Markers plugin in markers mode.');\n }\n\n if (this.markers?.config.markers) {\n utils.logWarn('No default markers can be configured on Markers plugin when using VirtualTour plugin. '\n + 'Consider defining `markers` on each tour node.');\n delete this.markers.config.markers;\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 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.gallery;\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 if (this.gallery) {\n this.gallery.setItems(\n nodes.map(node => ({\n id : node.id,\n panorama : node.panorama,\n name : node.name,\n thumbnail: node.thumbnail,\n options : {\n caption : node.caption,\n panoData : node.panoData,\n sphereCorrection: node.sphereCorrection,\n description : node.description,\n },\n })),\n (id) => {\n this.setCurrentNode(id);\n this.gallery.hide();\n }\n );\n }\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 description : node.description,\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 Mesh(ARROW_GEOM, new 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 Mesh(ARROW_OUTLINE_GEOM, new MeshBasicMaterial({ side: 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 visible : true,\n hideList: true,\n content : null,\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 = [MathUtils.degToRad(node.position[0]), MathUtils.degToRad(node.position[1])];\n const p2 = [MathUtils.degToRad(link.position[0]), MathUtils.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 utils.logWarn(`Starting from next version, the VirtualTourPlugin will require the GalleryPlugin to display the list of nodes.`);\n\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","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","gallery","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","setItems","panoData","sphereCorrection","description","hide","fromLink","hideError","fromNode","fromLinkPosition","__getLinkPosition","all","getAbortError","speed","animate","show","children","filter","clearMarkers","clearHotspots","setPanorama","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","visible","hideList","content","renderMarkers","setHotspots","MathUtils","degToRad","h1","undefined","h2","atan","cleanPosition","create","left","top","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;;EACA,IAAaA,kBAAb,gBAAA,YAAA;EAEE;EACF;EACA;;EAGE;EACF;EACA;EACE,EAAA,SAAA,kBAAA,CAAYC,MAAZ,EAAoB;MAAA,IALpBC,CAAAA,KAKoB,GALZ,EAKY,CAAA;MAClB,IAAKD,CAAAA,MAAL,GAAcA,MAAd,CAAA;EACD,GAAA;;EAZH,EAAA,IAAA,MAAA,GAAA,kBAAA,CAAA,SAAA,CAAA;;IAAA,MAcEE,CAAAA,OAdF,GAcE,SAAU,OAAA,GAAA;EACR,IAAA,OAAO,KAAKF,MAAZ,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EACA;EAtBA,GAAA;;EAAA,EAAA,MAAA,CAuBEG,QAvBF,GAuBE,SAASC,QAAAA,CAAAA,MAAT,EAAiB;EAAE;EACjB,IAAA,MAAM,IAAIC,0BAAJ,CAAa,0BAAb,CAAN,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EACA;EA/BA,GAAA;;EAAA,EAAA,MAAA,CAgCEC,eAhCF,GAgCE,SAAgBF,eAAAA,CAAAA,MAAhB,EAAwB;EAAE;EACxB,IAAA,MAAM,IAAIC,0BAAJ,CAAa,iCAAb,CAAN,CAAA;KAjCJ,CAAA;;EAAA,EAAA,OAAA,kBAAA,CAAA;EAAA,CAAA,EAAA;;ECJA;EACA;EACA;EACA;EACA;EACA;;EACO,SAASE,SAAT,CAAmBC,IAAnB,EAAyBC,KAAzB,EAAgC;EAAA,EAAA,IAAA,cAAA,CAAA;;EACrC,EAAA,IAAI,CAACD,IAAI,CAACE,EAAV,EAA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;EAkBD,GAAA;EAED;EACF;EACA;EA9oBA,GAAA;;IAAA,MA+oBEA,CAAAA,aA/oBF,GA+oBE,SAAgB,aAAA,GAAA;EACd,IAAA,IAAA,CAAKrK,GAAL,CAASmK,KAAT,CAAetE,IAAf,CAAoBxG,mBAApB,CAAA,CAAA;KAhpBJ,CAAA;;EAAA,EAAA,OAAA,iBAAA,CAAA;EAAA,CAAA,CAAuC2L,gCAAvC,EAAA;EAAanJ,kBAEJnH,KAAK;EAFDmH,kBAIJtE,SAASA;EAJLsE,kBAKJ5E,cAAcA;EALV4E,kBAMJ3E,cAAcA;EANV2E,kBAOJvE,UAAUA;EAPNuE,kBAQJxE,eAAeA;EARXwE,kBASJ1E,cAAcA;EATV0E,kBAUJzE,WAAWA;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/visible-range.js b/dist/plugins/visible-range.js index 095b6f566..4cbde935f 100644 --- a/dist/plugins/visible-range.js +++ b/dist/plugins/visible-range.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.7.0 +* Photo Sphere Viewer 4.7.1 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2022 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -8,7 +8,7 @@ typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer')) : typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.VisibleRangePlugin = {}), global.THREE, global.PhotoSphereViewer)); -})(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; +})(this, (function (exports, three, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { @@ -244,14 +244,14 @@ _proto.getPanoLatitudeRange = function getPanoLatitudeRange() { var p = this.psv.prop.panoData; - if (p.croppedHeight === p.fullHeight && p.croppedY === 0) { + if (p.croppedHeight === p.fullHeight) { return null; } else { var latitude = function latitude(y) { return Math.PI * (1 - y / p.fullHeight) - Math.PI / 2; }; - return [latitude(p.croppedY), latitude(p.croppedY + p.croppedHeight)]; + return [latitude(p.croppedY + p.croppedHeight), latitude(p.croppedY)]; } } /** @@ -264,7 +264,7 @@ _proto.getPanoLongitudeRange = function getPanoLongitudeRange() { var p = this.psv.prop.panoData; - if (p.croppedWidth === p.fullWidth && p.croppedX === 0) { + if (p.croppedWidth === p.fullWidth) { return null; } else { var longitude = function longitude(x) { @@ -293,7 +293,7 @@ if (this.config.longitudeRange) { range = photoSphereViewer.utils.clone(this.config.longitudeRange); - offset = THREE.MathUtils.degToRad(this.psv.prop.hFov) / 2; + offset = three.MathUtils.degToRad(this.psv.prop.hFov) / 2; range[0] = photoSphereViewer.utils.parseAngle(range[0] + offset); range[1] = photoSphereViewer.utils.parseAngle(range[1] - offset); @@ -320,9 +320,14 @@ if (this.config.latitudeRange) { range = photoSphereViewer.utils.clone(this.config.latitudeRange); - offset = THREE.MathUtils.degToRad(this.psv.prop.vFov) / 2; - range[0] = photoSphereViewer.utils.parseAngle(Math.min(range[0] + offset, range[1]), true); - range[1] = photoSphereViewer.utils.parseAngle(Math.max(range[1] - offset, range[0]), true); + offset = three.MathUtils.degToRad(this.psv.prop.vFov) / 2; + range[0] = photoSphereViewer.utils.parseAngle(range[0] + offset, true); + range[1] = photoSphereViewer.utils.parseAngle(range[1] - offset, true); // for very a narrow images, lock the latitude to the center + + if (range[0] > range[1]) { + range[0] = (range[0] + range[1]) / 2; + range[1] = range[0]; + } if (position.latitude < range[0]) { rangedPosition.latitude = range[0]; diff --git a/dist/plugins/visible-range.js.map b/dist/plugins/visible-range.js.map index 3a40cfb44..b330fa0e2 100644 --- a/dist/plugins/visible-range.js.map +++ b/dist/plugins/visible-range.js.map @@ -1 +1 @@ -{"version":3,"file":"visible-range.js","sources":["../../src/plugins/visible-range/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractPlugin, CONSTANTS, utils } from '../..';\n\n\n/**\n * @typedef {Object} PSV.plugins.VisibleRangePlugin.Options\n * @property {double[]|string[]} [latitudeRange] - latitude range as two angles\n * @property {double[]|string[]} [longitudeRange] - longitude range as two angles\n * @property {boolean} [usePanoData=false] - use panoData as visible range, you can also manually call `setRangesFromPanoData`\n */\n\nconst EPS = 0.000001;\n\n/**\n * @summary Locks visible longitude and/or latitude\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class VisibleRangePlugin extends AbstractPlugin {\n\n static id = 'visible-range';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.VisibleRangePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.VisibleRangePlugin.Options}\n * @private\n */\n this.config = {\n latitudeRange : null,\n longitudeRange: null,\n usePanoData : false,\n ...options,\n };\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.on(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this);\n this.psv.on(CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this);\n\n this.setLatitudeRange(this.config.latitudeRange);\n this.setLongitudeRange(this.config.longitudeRange);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.off(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this);\n this.psv.off(CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this);\n\n super.destroy();\n }\n\n /**\n * @private\n */\n // eslint-disable-next-line consistent-return\n handleEvent(e) {\n let sidesReached;\n let rangedPosition;\n let currentPosition;\n\n switch (e.type) {\n case CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION:\n case CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION:\n currentPosition = e.value;\n ({ rangedPosition } = this.applyRanges(currentPosition));\n\n return rangedPosition;\n\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n currentPosition = e.args[0];\n ({ sidesReached, rangedPosition } = this.applyRanges(currentPosition));\n\n if ((sidesReached.left || sidesReached.right) && this.psv.isAutorotateEnabled()) {\n this.__reverseAutorotate(sidesReached.left, sidesReached.right);\n }\n else if (Math.abs(currentPosition.longitude - rangedPosition.longitude) > EPS\n || Math.abs(currentPosition.latitude - rangedPosition.latitude) > EPS) {\n this.psv.dynamics.position.setValue(rangedPosition);\n }\n break;\n\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n if (this.config.usePanoData) {\n this.setRangesFromPanoData();\n }\n break;\n\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n currentPosition = this.psv.getPosition();\n ({ rangedPosition } = this.applyRanges(currentPosition));\n\n if (Math.abs(currentPosition.longitude - rangedPosition.longitude) > EPS\n || Math.abs(currentPosition.latitude - rangedPosition.latitude) > EPS) {\n this.psv.rotate(rangedPosition);\n }\n break;\n\n default:\n }\n }\n\n /**\n * @summary Changes the latitude range\n * @param {double[]|string[]} range - latitude range as two angles\n */\n setLatitudeRange(range) {\n // latitude range must have two values\n if (range && range.length !== 2) {\n utils.logWarn('latitude range must have exactly two elements');\n range = null;\n }\n // latitude range must be ordered\n else if (range && range[0] > range[1]) {\n utils.logWarn('latitude range values must be ordered');\n range = [range[1], range[0]];\n }\n // latitude range is between -PI/2 and PI/2\n if (range) {\n this.config.latitudeRange = range.map(angle => utils.parseAngle(angle, true));\n }\n else {\n this.config.latitudeRange = null;\n }\n\n if (this.psv.prop.ready) {\n this.psv.rotate(this.psv.getPosition());\n }\n }\n\n /**\n * @summary Changes the longitude range\n * @param {double[]|string[]} range - longitude range as two angles\n */\n setLongitudeRange(range) {\n // longitude range must have two values\n if (range && range.length !== 2) {\n utils.logWarn('longitude range must have exactly two elements');\n range = null;\n }\n // longitude range is between 0 and 2*PI\n if (range) {\n this.config.longitudeRange = range.map(angle => utils.parseAngle(angle));\n }\n else {\n this.config.longitudeRange = null;\n }\n\n if (this.psv.prop.ready) {\n this.psv.rotate(this.psv.getPosition());\n }\n }\n\n /**\n * @summary Changes the latitude and longitude ranges according the current panorama cropping data\n */\n setRangesFromPanoData() {\n this.setLatitudeRange(this.getPanoLatitudeRange());\n this.setLongitudeRange(this.getPanoLongitudeRange());\n }\n\n /**\n * @summary Gets the latitude range defined by the viewer's panoData\n * @returns {double[]|null}\n * @private\n */\n getPanoLatitudeRange() {\n const p = this.psv.prop.panoData;\n if (p.croppedHeight === p.fullHeight && p.croppedY === 0) {\n return null;\n }\n else {\n const latitude = y => Math.PI * (1 - y / p.fullHeight) - (Math.PI / 2);\n return [latitude(p.croppedY), latitude(p.croppedY + p.croppedHeight)];\n }\n }\n\n /**\n * @summary Gets the longitude range defined by the viewer's panoData\n * @returns {double[]|null}\n * @private\n */\n getPanoLongitudeRange() {\n const p = this.psv.prop.panoData;\n if (p.croppedWidth === p.fullWidth && p.croppedX === 0) {\n return null;\n }\n else {\n const longitude = x => 2 * Math.PI * (x / p.fullWidth) - Math.PI;\n return [longitude(p.croppedX), longitude(p.croppedX + p.croppedWidth)];\n }\n }\n\n /**\n * @summary Apply \"longitudeRange\" and \"latitudeRange\"\n * @param {PSV.Position} position\n * @returns {{rangedPosition: PSV.Position, sidesReached: string[]}}\n * @private\n */\n applyRanges(position) {\n const rangedPosition = {\n longitude: position.longitude,\n latitude : position.latitude,\n };\n const sidesReached = {};\n\n let range;\n let offset;\n\n if (this.config.longitudeRange) {\n range = utils.clone(this.config.longitudeRange);\n offset = THREE.MathUtils.degToRad(this.psv.prop.hFov) / 2;\n\n range[0] = utils.parseAngle(range[0] + offset);\n range[1] = utils.parseAngle(range[1] - offset);\n\n if (range[0] > range[1]) { // when the range cross longitude 0\n if (position.longitude > range[1] && position.longitude < range[0]) {\n if (position.longitude > (range[0] / 2 + range[1] / 2)) { // detect which side we are closer too\n rangedPosition.longitude = range[0];\n sidesReached.left = true;\n }\n else {\n rangedPosition.longitude = range[1];\n sidesReached.right = true;\n }\n }\n }\n else if (position.longitude < range[0]) {\n rangedPosition.longitude = range[0];\n sidesReached.left = true;\n }\n else if (position.longitude > range[1]) {\n rangedPosition.longitude = range[1];\n sidesReached.right = true;\n }\n }\n\n if (this.config.latitudeRange) {\n range = utils.clone(this.config.latitudeRange);\n offset = THREE.MathUtils.degToRad(this.psv.prop.vFov) / 2;\n\n range[0] = utils.parseAngle(Math.min(range[0] + offset, range[1]), true);\n range[1] = utils.parseAngle(Math.max(range[1] - offset, range[0]), true);\n\n if (position.latitude < range[0]) {\n rangedPosition.latitude = range[0];\n sidesReached.bottom = true;\n }\n else if (position.latitude > range[1]) {\n rangedPosition.latitude = range[1];\n sidesReached.top = true;\n }\n }\n\n return { rangedPosition, sidesReached };\n }\n\n /**\n * @summary Reverses autorotate direction with smooth transition\n * @private\n */\n __reverseAutorotate(left, right) {\n // reverse already ongoing\n if (left && this.psv.config.autorotateSpeed > 0 || right && this.psv.config.autorotateSpeed < 0) {\n return;\n }\n\n this.psv.config.autorotateSpeed = -this.psv.config.autorotateSpeed;\n this.psv.startAutorotate(true);\n }\n\n}\n"],"names":["EPS","VisibleRangePlugin","psv","options","config","latitudeRange","longitudeRange","usePanoData","init","on","CONSTANTS","EVENTS","PANORAMA_LOADED","POSITION_UPDATED","ZOOM_UPDATED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","setLatitudeRange","setLongitudeRange","destroy","off","handleEvent","e","sidesReached","rangedPosition","currentPosition","type","value","applyRanges","args","left","right","isAutorotateEnabled","__reverseAutorotate","Math","abs","longitude","latitude","dynamics","position","setValue","setRangesFromPanoData","getPosition","rotate","range","length","utils","logWarn","map","angle","parseAngle","prop","ready","getPanoLatitudeRange","getPanoLongitudeRange","p","panoData","croppedHeight","fullHeight","croppedY","y","PI","croppedWidth","fullWidth","croppedX","x","offset","clone","THREE","MathUtils","degToRad","hFov","vFov","min","max","bottom","top","autorotateSpeed","startAutorotate","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA;EACA;EACA;EACA;EACA;EACA;;EAEA,IAAMA,GAAG,GAAG,QAAZ,CAAA;EAEA;EACA;EACA;EACA;EACA;;AACA,MAAaC,kBAAb,gBAAA,UAAA,eAAA,EAAA;EAAA,EAAA,cAAA,CAAA,kBAAA,EAAA,eAAA,CAAA,CAAA;;EAIE;EACF;EACA;EACA;IACE,SAAYC,kBAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,eAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GAAA,QAAA,CAAA;EACEC,MAAAA,aAAa,EAAG,IADlB;EAEEC,MAAAA,cAAc,EAAE,IAFlB;EAGEC,MAAAA,WAAW,EAAK,KAAA;EAHlB,KAAA,EAIKJ,OAJL,CAAA,CAAA;EAPwB,IAAA,OAAA,KAAA,CAAA;EAazB,GAAA;EAED;EACF;EACA;;;EAzBA,EAAA,IAAA,MAAA,GAAA,kBAAA,CAAA,SAAA,CAAA;;IAAA,MA0BEK,CAAAA,IA1BF,GA0BE,SAAO,IAAA,GAAA;EACL,IAAA,eAAA,CAAA,SAAA,CAAMA,IAAN,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;;MAEA,IAAKN,CAAAA,GAAL,CAASO,EAAT,CAAYC,2BAAS,CAACC,MAAV,CAAiBC,eAA7B,EAA8C,IAA9C,CAAA,CAAA;MACA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,cAAc,CAACa,QAAf,GAA0BO,KAAK,CAAC,CAAD,CAA/B,CAAA;UACArB,YAAY,CAACoD,MAAb,GAAsB,IAAtB,CAAA;SAFF,MAIK,IAAIpC,QAAQ,CAACF,QAAT,GAAoBO,KAAK,CAAC,CAAD,CAA7B,EAAkC;EACrCpB,QAAAA,cAAc,CAACa,QAAf,GAA0BO,KAAK,CAAC,CAAD,CAA/B,CAAA;UACArB,YAAY,CAACqD,GAAb,GAAmB,IAAnB,CAAA;EACD,OAAA;EACF,KAAA;;MAED,OAAO;EAAEpD,MAAAA,cAAc,EAAdA,cAAF;EAAkBD,MAAAA,YAAY,EAAZA,YAAAA;OAAzB,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EArQA,GAAA;;EAAA,EAAA,MAAA,CAsQEU,mBAtQF,GAsQE,SAAA,mBAAA,CAAoBH,IAApB,EAA0BC,KAA1B,EAAiC;EAC/B;MACA,IAAID,IAAI,IAAI,IAAK7B,CAAAA,GAAL,CAASE,MAAT,CAAgB0E,eAAhB,GAAkC,CAA1C,IAA+C9C,KAAK,IAAI,KAAK9B,GAAL,CAASE,MAAT,CAAgB0E,eAAhB,GAAkC,CAA9F,EAAiG;EAC/F,MAAA,OAAA;EACD,KAAA;;EAED,IAAA,IAAA,CAAK5E,GAAL,CAASE,MAAT,CAAgB0E,eAAhB,GAAkC,CAAC,IAAA,CAAK5E,GAAL,CAASE,MAAT,CAAgB0E,eAAnD,CAAA;EACA,IAAA,IAAA,CAAK5E,GAAL,CAAS6E,eAAT,CAAyB,IAAzB,CAAA,CAAA;KA7QJ,CAAA;;EAAA,EAAA,OAAA,kBAAA,CAAA;EAAA,CAAA,CAAwCC,gCAAxC,EAAA;EAAa/E,mBAEJgF,KAAK;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"visible-range.js","sources":["../../src/plugins/visible-range/index.js"],"sourcesContent":["import { MathUtils } from 'three';\nimport { AbstractPlugin, CONSTANTS, utils } from '../..';\n\n\n/**\n * @typedef {Object} PSV.plugins.VisibleRangePlugin.Options\n * @property {double[]|string[]} [latitudeRange] - latitude range as two angles\n * @property {double[]|string[]} [longitudeRange] - longitude range as two angles\n * @property {boolean} [usePanoData=false] - use panoData as visible range, you can also manually call `setRangesFromPanoData`\n */\n\nconst EPS = 0.000001;\n\n/**\n * @summary Locks visible longitude and/or latitude\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class VisibleRangePlugin extends AbstractPlugin {\n\n static id = 'visible-range';\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.VisibleRangePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.plugins.VisibleRangePlugin.Options}\n * @private\n */\n this.config = {\n latitudeRange : null,\n longitudeRange: null,\n usePanoData : false,\n ...options,\n };\n }\n\n /**\n * @package\n */\n init() {\n super.init();\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.on(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this);\n this.psv.on(CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this);\n\n this.setLatitudeRange(this.config.latitudeRange);\n this.setLongitudeRange(this.config.longitudeRange);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n this.psv.off(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this);\n this.psv.off(CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this);\n\n super.destroy();\n }\n\n /**\n * @private\n */\n // eslint-disable-next-line consistent-return\n handleEvent(e) {\n let sidesReached;\n let rangedPosition;\n let currentPosition;\n\n switch (e.type) {\n case CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION:\n case CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION:\n currentPosition = e.value;\n ({ rangedPosition } = this.applyRanges(currentPosition));\n\n return rangedPosition;\n\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n currentPosition = e.args[0];\n ({ sidesReached, rangedPosition } = this.applyRanges(currentPosition));\n\n if ((sidesReached.left || sidesReached.right) && this.psv.isAutorotateEnabled()) {\n this.__reverseAutorotate(sidesReached.left, sidesReached.right);\n }\n else if (Math.abs(currentPosition.longitude - rangedPosition.longitude) > EPS\n || Math.abs(currentPosition.latitude - rangedPosition.latitude) > EPS) {\n this.psv.dynamics.position.setValue(rangedPosition);\n }\n break;\n\n case CONSTANTS.EVENTS.PANORAMA_LOADED:\n if (this.config.usePanoData) {\n this.setRangesFromPanoData();\n }\n break;\n\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n currentPosition = this.psv.getPosition();\n ({ rangedPosition } = this.applyRanges(currentPosition));\n\n if (Math.abs(currentPosition.longitude - rangedPosition.longitude) > EPS\n || Math.abs(currentPosition.latitude - rangedPosition.latitude) > EPS) {\n this.psv.rotate(rangedPosition);\n }\n break;\n\n default:\n }\n }\n\n /**\n * @summary Changes the latitude range\n * @param {double[]|string[]} range - latitude range as two angles\n */\n setLatitudeRange(range) {\n // latitude range must have two values\n if (range && range.length !== 2) {\n utils.logWarn('latitude range must have exactly two elements');\n range = null;\n }\n // latitude range must be ordered\n else if (range && range[0] > range[1]) {\n utils.logWarn('latitude range values must be ordered');\n range = [range[1], range[0]];\n }\n // latitude range is between -PI/2 and PI/2\n if (range) {\n this.config.latitudeRange = range.map(angle => utils.parseAngle(angle, true));\n }\n else {\n this.config.latitudeRange = null;\n }\n\n if (this.psv.prop.ready) {\n this.psv.rotate(this.psv.getPosition());\n }\n }\n\n /**\n * @summary Changes the longitude range\n * @param {double[]|string[]} range - longitude range as two angles\n */\n setLongitudeRange(range) {\n // longitude range must have two values\n if (range && range.length !== 2) {\n utils.logWarn('longitude range must have exactly two elements');\n range = null;\n }\n // longitude range is between 0 and 2*PI\n if (range) {\n this.config.longitudeRange = range.map(angle => utils.parseAngle(angle));\n }\n else {\n this.config.longitudeRange = null;\n }\n\n if (this.psv.prop.ready) {\n this.psv.rotate(this.psv.getPosition());\n }\n }\n\n /**\n * @summary Changes the latitude and longitude ranges according the current panorama cropping data\n */\n setRangesFromPanoData() {\n this.setLatitudeRange(this.getPanoLatitudeRange());\n this.setLongitudeRange(this.getPanoLongitudeRange());\n }\n\n /**\n * @summary Gets the latitude range defined by the viewer's panoData\n * @returns {double[]|null}\n * @private\n */\n getPanoLatitudeRange() {\n const p = this.psv.prop.panoData;\n if (p.croppedHeight === p.fullHeight) {\n return null;\n }\n else {\n const latitude = y => Math.PI * (1 - y / p.fullHeight) - (Math.PI / 2);\n return [latitude(p.croppedY + p.croppedHeight), latitude(p.croppedY)];\n }\n }\n\n /**\n * @summary Gets the longitude range defined by the viewer's panoData\n * @returns {double[]|null}\n * @private\n */\n getPanoLongitudeRange() {\n const p = this.psv.prop.panoData;\n if (p.croppedWidth === p.fullWidth) {\n return null;\n }\n else {\n const longitude = x => 2 * Math.PI * (x / p.fullWidth) - Math.PI;\n return [longitude(p.croppedX), longitude(p.croppedX + p.croppedWidth)];\n }\n }\n\n /**\n * @summary Apply \"longitudeRange\" and \"latitudeRange\"\n * @param {PSV.Position} position\n * @returns {{rangedPosition: PSV.Position, sidesReached: string[]}}\n * @private\n */\n applyRanges(position) {\n const rangedPosition = {\n longitude: position.longitude,\n latitude : position.latitude,\n };\n const sidesReached = {};\n\n let range;\n let offset;\n\n if (this.config.longitudeRange) {\n range = utils.clone(this.config.longitudeRange);\n offset = MathUtils.degToRad(this.psv.prop.hFov) / 2;\n\n range[0] = utils.parseAngle(range[0] + offset);\n range[1] = utils.parseAngle(range[1] - offset);\n\n if (range[0] > range[1]) { // when the range cross longitude 0\n if (position.longitude > range[1] && position.longitude < range[0]) {\n if (position.longitude > (range[0] / 2 + range[1] / 2)) { // detect which side we are closer too\n rangedPosition.longitude = range[0];\n sidesReached.left = true;\n }\n else {\n rangedPosition.longitude = range[1];\n sidesReached.right = true;\n }\n }\n }\n else if (position.longitude < range[0]) {\n rangedPosition.longitude = range[0];\n sidesReached.left = true;\n }\n else if (position.longitude > range[1]) {\n rangedPosition.longitude = range[1];\n sidesReached.right = true;\n }\n }\n\n if (this.config.latitudeRange) {\n range = utils.clone(this.config.latitudeRange);\n offset = MathUtils.degToRad(this.psv.prop.vFov) / 2;\n\n range[0] = utils.parseAngle(range[0] + offset, true);\n range[1] = utils.parseAngle(range[1] - offset, true);\n\n // for very a narrow images, lock the latitude to the center\n if (range[0] > range[1]) {\n range[0] = (range[0] + range[1]) / 2;\n range[1] = range[0];\n }\n\n if (position.latitude < range[0]) {\n rangedPosition.latitude = range[0];\n sidesReached.bottom = true;\n }\n else if (position.latitude > range[1]) {\n rangedPosition.latitude = range[1];\n sidesReached.top = true;\n }\n }\n\n return { rangedPosition, sidesReached };\n }\n\n /**\n * @summary Reverses autorotate direction with smooth transition\n * @private\n */\n __reverseAutorotate(left, right) {\n // reverse already ongoing\n if (left && this.psv.config.autorotateSpeed > 0 || right && this.psv.config.autorotateSpeed < 0) {\n return;\n }\n\n this.psv.config.autorotateSpeed = -this.psv.config.autorotateSpeed;\n this.psv.startAutorotate(true);\n }\n\n}\n"],"names":["EPS","VisibleRangePlugin","psv","options","config","latitudeRange","longitudeRange","usePanoData","init","on","CONSTANTS","EVENTS","PANORAMA_LOADED","POSITION_UPDATED","ZOOM_UPDATED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","setLatitudeRange","setLongitudeRange","destroy","off","handleEvent","e","sidesReached","rangedPosition","currentPosition","type","value","applyRanges","args","left","right","isAutorotateEnabled","__reverseAutorotate","Math","abs","longitude","latitude","dynamics","position","setValue","setRangesFromPanoData","getPosition","rotate","range","length","utils","logWarn","map","angle","parseAngle","prop","ready","getPanoLatitudeRange","getPanoLongitudeRange","p","panoData","croppedHeight","fullHeight","y","PI","croppedY","croppedWidth","fullWidth","x","croppedX","offset","clone","MathUtils","degToRad","hFov","vFov","bottom","top","autorotateSpeed","startAutorotate","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA;EACA;EACA;EACA;EACA;EACA;;EAEA,IAAMA,GAAG,GAAG,QAAZ,CAAA;EAEA;EACA;EACA;EACA;EACA;;AACA,MAAaC,kBAAb,gBAAA,UAAA,eAAA,EAAA;EAAA,EAAA,cAAA,CAAA,kBAAA,EAAA,eAAA,CAAA,CAAA;;EAIE;EACF;EACA;EACA;IACE,SAAYC,kBAAAA,CAAAA,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA,IAAA,IAAA,KAAA,CAAA;;EACxB,IAAA,KAAA,GAAA,eAAA,CAAA,IAAA,CAAA,IAAA,EAAMD,GAAN,CAAA,IAAA,IAAA,CAAA;EAEA;EACJ;EACA;EACA;;EACI,IAAA,KAAA,CAAKE,MAAL,GAAA,QAAA,CAAA;EACEC,MAAAA,aAAa,EAAG,IADlB;EAEEC,MAAAA,cAAc,EAAE,IAFlB;EAGEC,MAAAA,WAAW,EAAK,KAAA;EAHlB,KAAA,EAIKJ,OAJL,CAAA,CAAA;EAPwB,IAAA,OAAA,KAAA,CAAA;EAazB,GAAA;EAED;EACF;EACA;;;EAzBA,EAAA,IAAA,MAAA,GAAA,kBAAA,CAAA,SAAA,CAAA;;IAAA,MA0BEK,CAAAA,IA1BF,GA0BE,SAAO,IAAA,GAAA;EACL,IAAA,eAAA,CAAA,SAAA,CAAMA,IAAN,CAAA,IAAA,CAAA,IAAA,CAAA,CAAA;;MAEA,IAAKN,CAAAA,GAAL,CAASO,EAAT,CAAYC,2BAAS,CAACC,MAAV,CAAiBC,eAA7B,EAA8C,IAA9C,CAAA,CAAA;MACA,IAAKV,CAAAA,GAAL,CAASO,EAAT,CAAYC,2BAAS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EAAkC;EAChCpB,QAAAA,cAAc,CAACa,QAAf,GAA0BO,KAAK,CAAC,CAAD,CAA/B,CAAA;UACArB,YAAY,CAACiD,MAAb,GAAsB,IAAtB,CAAA;SAFF,MAIK,IAAIjC,QAAQ,CAACF,QAAT,GAAoBO,KAAK,CAAC,CAAD,CAA7B,EAAkC;EACrCpB,QAAAA,cAAc,CAACa,QAAf,GAA0BO,KAAK,CAAC,CAAD,CAA/B,CAAA;UACArB,YAAY,CAACkD,GAAb,GAAmB,IAAnB,CAAA;EACD,OAAA;EACF,KAAA;;MAED,OAAO;EAAEjD,MAAAA,cAAc,EAAdA,cAAF;EAAkBD,MAAAA,YAAY,EAAZA,YAAAA;OAAzB,CAAA;EACD,GAAA;EAED;EACF;EACA;EACA;EA3QA,GAAA;;EAAA,EAAA,MAAA,CA4QEU,mBA5QF,GA4QE,SAAA,mBAAA,CAAoBH,IAApB,EAA0BC,KAA1B,EAAiC;EAC/B;MACA,IAAID,IAAI,IAAI,IAAK7B,CAAAA,GAAL,CAASE,MAAT,CAAgBuE,eAAhB,GAAkC,CAA1C,IAA+C3C,KAAK,IAAI,KAAK9B,GAAL,CAASE,MAAT,CAAgBuE,eAAhB,GAAkC,CAA9F,EAAiG;EAC/F,MAAA,OAAA;EACD,KAAA;;EAED,IAAA,IAAA,CAAKzE,GAAL,CAASE,MAAT,CAAgBuE,eAAhB,GAAkC,CAAC,IAAA,CAAKzE,GAAL,CAASE,MAAT,CAAgBuE,eAAnD,CAAA;EACA,IAAA,IAAA,CAAKzE,GAAL,CAAS0E,eAAT,CAAyB,IAAzB,CAAA,CAAA;KAnRJ,CAAA;;EAAA,EAAA,OAAA,kBAAA,CAAA;EAAA,CAAA,CAAwCC,gCAAxC,EAAA;EAAa5E,mBAEJ6E,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/docs/.netlify/functions/releases.js b/docs/.netlify/functions/releases.js new file mode 100644 index 000000000..0924bf299 --- /dev/null +++ b/docs/.netlify/functions/releases.js @@ -0,0 +1,38 @@ +const axios = require('axios'); + +exports.handler = async function(event, context) { + if (event.httpMethod !== 'GET') { + return { statusCode: 405, body: 'Method Not Allowed' }; + } + + return await axios({ + url : 'https://api.github.com/graphql', + method : 'POST', + headers: { + 'Authorization': `bearer ${process.env.GH_TOKEN}`, + }, + data : { + query: ` + query { + repository(owner: "mistic100", name: "photo-sphere-viewer") { + releases(first: 20, orderBy: {field: CREATED_AT, direction: DESC}) { + nodes { + id + name + description + publishedAt + url + } + } + } + }`, + }, + }) + .then(result => { + const releases = result.data.data.repository.releases.nodes; + return { + statusCode: 200, + body: JSON.stringify(releases) + }; + }); +}; diff --git a/docs/.vuepress/components/Changelog.vue b/docs/.vuepress/components/Changelog.vue index 3424a4e6c..831eceb75 100644 --- a/docs/.vuepress/components/Changelog.vue +++ b/docs/.vuepress/components/Changelog.vue @@ -44,7 +44,7 @@ if (cacheDate && (new Date() - new Date(cacheDate)) < 1000 * 3600) { return Promise.resolve(JSON.parse(localStorage.releasesCache)); } else { - return fetch('https://api.github.com/repos/mistic100/Photo-Sphere-Viewer/releases') + return fetch('/.netlify/functions/releases') .then((response) => { if (response.ok) { return response.json(); @@ -61,7 +61,7 @@ }, formatRelease(release) { // Convert markdown to html - let desc = marked.parse(release.body, { breaks: true }); + let desc = marked.parse(release.description, { breaks: true }); // Remove some escaping done by marked.js desc = desc.replace(/"/g, '"').replace(/'/g, "'"); @@ -74,9 +74,9 @@ return { id : release.id, - url : release.html_url, + url : release.url, title: release.name, - date : format(parseISO(release.published_at), 'PPP'), + date : format(parseISO(release.publishedAt), 'PPP'), desc : desc, }; } diff --git a/docs/.vuepress/components/CropPlayground.vue b/docs/.vuepress/components/CropPlayground.vue index 7a91b2a4d..901d1162d 100644 --- a/docs/.vuepress/components/CropPlayground.vue +++ b/docs/.vuepress/components/CropPlayground.vue @@ -71,16 +71,16 @@ Apply - - + +
-
- + +
{{xmpData}}
-
-
+ + diff --git a/docs/.vuepress/components/Playground.vue b/docs/.vuepress/components/Playground.vue index 570b00e1e..269b0a0f7 100644 --- a/docs/.vuepress/components/Playground.vue +++ b/docs/.vuepress/components/Playground.vue @@ -438,7 +438,7 @@ - + @@ -499,6 +499,7 @@ @@ -27,8 +23,10 @@ box-shadow 0 0 20px rgba(0, 0, 0, 0.8) text-decoration none !important - .demo-gallery-item-content - h3, p + p:first-child + margin 0 + + h3, p:last-child margin 1rem .header-anchor diff --git a/docs/.vuepress/theme/components/Home.vue b/docs/.vuepress/theme/components/Home.vue index 0bc3de555..18148cbd1 100644 --- a/docs/.vuepress/theme/components/Home.vue +++ b/docs/.vuepress/theme/components/Home.vue @@ -7,7 +7,6 @@
@@ -45,7 +44,7 @@
- +
@@ -152,6 +151,7 @@ left 0 width 100% height 100% + background-image url(./background.jpg) background-position top center background-size cover opacity 1 @@ -189,7 +189,7 @@ .hero-content background rgba(0, 0, 0, 0.5) - padding 0.01px + padding 1px border-radius 20px margin 1rem diff --git a/docs/.vuepress/public/assets/home-bg.jpg b/docs/.vuepress/theme/components/background.jpg similarity index 100% rename from docs/.vuepress/public/assets/home-bg.jpg rename to docs/.vuepress/theme/components/background.jpg diff --git a/docs/.vuepress/public/assets/icons/down.svg b/docs/.vuepress/theme/components/down.svg similarity index 100% rename from docs/.vuepress/public/assets/icons/down.svg rename to docs/.vuepress/theme/components/down.svg diff --git a/docs/README.md b/docs/README.md index 06eda93d3..f0b3c628b 100644 --- a/docs/README.md +++ b/docs/README.md @@ -19,7 +19,6 @@ features: details: Display texts, images and even dynamic areas directly on your photos. - title: Videos details: Photo Sphere Viewer also supports video, both equirectangular and cubemaps. -footer: Licensed under MIT License, documentation under CC BY 3.0 --- @@ -28,3 +27,9 @@ footer: Licensed under MIT License, documentation under CC BY 3.0 I forked the original Photo Sphere Viewer [by Jérémy Heleine](http://jeremyheleine.me) to provide a better code architecture and a bunch of new features. ::: + +::: slot footer +Licensed under MIT License, documentation under CC BY 3.0 + + Deploys by Netlify +::: diff --git a/docs/demos/README.md b/docs/demos/README.md index 27ad83e96..aeefa0b5d 100644 --- a/docs/demos/README.md +++ b/docs/demos/README.md @@ -16,12 +16,38 @@ Visit each [plugin page](../plugins/) to see an example. :::: gallery -::: item video="/assets/demos/base.webm" link="https://jsfiddle.net/mistic100/5r684etx/show" +::: item link="https://jsfiddle.net/mistic100/5r684etx/show" +![](../images/demos/default.jpg) ### Zero config Simple panorama with default options. ::: -::: item video="/assets/demos/fisheye.webm" link="https://jsfiddle.net/mistic100/wsL1x5k0/show" +::: item link="https://jsfiddle.net/mistic100/cLp08us4/show" +![](../images/demos/description.jpg) +### Description +« i » button will display the `description` in the side panel. +::: + +::: item link="https://jsfiddle.net/mistic100/j63dqub9/show" +![](../images/demos/navbar.jpg) +### Custom navbar +Customize the navbar with default and custom buttons. +::: + +::: item link="https://jsfiddle.net/mistic100/95asmzve/show" +![](../images/demos/fisheye.jpg) +### Fisheye +Display the panorama with a fisheye effect. +::: + +::: item link="https://jsfiddle.net/mistic100/wpvtyz1j/show" +![](../images/demos/autorotate.gif) +### Autorotate +Automatically performs a rotation if the user is innactive. +::: + +::: item link="https://jsfiddle.net/mistic100/wsL1x5k0/show" +![](../images/demos/animation.gif) ### Intro animation Use the `Animation` helper to create a cool intro. ::: @@ -33,7 +59,8 @@ Use the `Animation` helper to create a cool intro. :::: gallery -::: item image="/assets/demos/custom-marker.jpg" link="https://jsfiddle.net/mistic100/Lm3wzesb/show" +::: item link="https://jsfiddle.net/mistic100/Lm3wzesb/show" +![](../images/demos/custom-marker.jpg) ### Custom tooltip Advanced styling of a marker's tooltip. ::: diff --git a/docs/guide/adapters/cubemap-video.md b/docs/guide/adapters/cubemap-video.md index 82c18f483..a82b15497 100644 --- a/docs/guide/adapters/cubemap-video.md +++ b/docs/guide/adapters/cubemap-video.md @@ -62,4 +62,4 @@ This adapter supports video files consisting of a grid of the six faces of the c The layout of a frame must be as follow: -![cubemap-video](/assets/cubemap-video.png) +![cubemap-video](../../images/cubemap-video.png) diff --git a/docs/guide/adapters/equirectangular.md b/docs/guide/adapters/equirectangular.md index 24a3e1ca8..5f44c9468 100644 --- a/docs/guide/adapters/equirectangular.md +++ b/docs/guide/adapters/equirectangular.md @@ -54,7 +54,7 @@ The data can also contains angular values: - Pose Pitch - Pose Roll -![XMP_pano_pixels](/assets/XMP_pano_pixels.png) +![XMP_pano_pixels](../../images/XMP_pano_pixels.png) More information on [Google documentation](https://developers.google.com/streetview/spherical-metadata). diff --git a/docs/guide/adapters/little-planet.md b/docs/guide/adapters/little-planet.md new file mode 100644 index 000000000..ced77738a --- /dev/null +++ b/docs/guide/adapters/little-planet.md @@ -0,0 +1,21 @@ +# Little planet + +> Displays an [equirectangular](equirectangular.md) panorama with a little planet effect. + +This adapter is available in the core `photo-sphere-viewer` package in `dist/adapters/little-planet.js`. + +::: warning Compatibility +This adapter is not complatible with some options and plugins, it is provided as it just for fun. +::: + +```js +new PhotoSphereViewer.Viewer({ + adapter: PhotoSphereViewer.LittlePlanetAdapter, + panorama: 'path/panorama.jpg', +}); +``` + + +## Example + + diff --git a/docs/guide/config.md b/docs/guide/config.md index 7680668d3..eaca60054 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -194,6 +194,21 @@ Requires two fingers to rotate the panorama. This allows standard touch-scroll n ## Advanced options +#### `overlay` +- type: `*` + +Path to an additional transparent panorama which will be displayed on top of the main one. The overlay can also be changed with the `setOverlay()` method or within the options of the `setPanorama()` method. + +::: warning Adapters +Only the default [equirectangular](./adapters/equirectangular.md) and the [cubemap](./adapters/cubemap.md) adapters support this feature. +::: + +#### `overlayOpacity` +- type: `number` +- default: `1` + +Opacity of the `overlay`. + #### `sphereCorrection` - type: `{ pan: double, tilt: double, roll: double }` - default: `{ pan:0, tilt:0, roll: 0 }` @@ -202,7 +217,7 @@ Allows to rotate the panorama sphere. Angles are in radians. **Note:** if the XMP data and/or `panoData` contains heading/pitch/roll data, they will be applied before `sphereCorrection`. -![pan-tilt-toll](/assets/pan-tilt-roll.png) +![pan-tilt-toll](../images/pan-tilt-roll.png) #### `moveSpeed` - type: `double` diff --git a/docs/guide/navbar.md b/docs/guide/navbar.md index 35f333067..47e5a2a15 100644 --- a/docs/guide/navbar.md +++ b/docs/guide/navbar.md @@ -34,8 +34,8 @@ You can also add as many custom buttons you want. A custom button is an object w Content of the button. Preferably a square image or SVG icon. -#### `onClick` (required) -- type : `function` +#### `onClick(viewer)` (required) +- type : `function(Viewer)` Function called when the button is clicked. @@ -87,7 +87,7 @@ new PhotoSphereViewer.Viewer({ content: '', title: 'Hello world', className: 'custom-button', - onClick: () => { + onClick: (viewer) => { alert('Hello from custom button'); }, }, diff --git a/docs/.vuepress/public/assets/XMP_pano_pixels.png b/docs/images/XMP_pano_pixels.png similarity index 100% rename from docs/.vuepress/public/assets/XMP_pano_pixels.png rename to docs/images/XMP_pano_pixels.png diff --git a/docs/.vuepress/public/assets/cubemap-video.png b/docs/images/cubemap-video.png similarity index 100% rename from docs/.vuepress/public/assets/cubemap-video.png rename to docs/images/cubemap-video.png diff --git a/docs/images/demos/animation.gif b/docs/images/demos/animation.gif new file mode 100644 index 000000000..8fd6b958d Binary files /dev/null and b/docs/images/demos/animation.gif differ diff --git a/docs/.vuepress/public/assets/demos/fisheye.webm b/docs/images/demos/animation.webm similarity index 100% rename from docs/.vuepress/public/assets/demos/fisheye.webm rename to docs/images/demos/animation.webm diff --git a/docs/images/demos/autorotate.gif b/docs/images/demos/autorotate.gif new file mode 100644 index 000000000..2c98224b6 Binary files /dev/null and b/docs/images/demos/autorotate.gif differ diff --git a/docs/.vuepress/public/assets/demos/base.webm b/docs/images/demos/autorotate.webm similarity index 100% rename from docs/.vuepress/public/assets/demos/base.webm rename to docs/images/demos/autorotate.webm diff --git a/docs/.vuepress/public/assets/demos/custom-marker.jpg b/docs/images/demos/custom-marker.jpg similarity index 100% rename from docs/.vuepress/public/assets/demos/custom-marker.jpg rename to docs/images/demos/custom-marker.jpg diff --git a/docs/images/demos/default.jpg b/docs/images/demos/default.jpg new file mode 100644 index 000000000..77eede5f6 Binary files /dev/null and b/docs/images/demos/default.jpg differ diff --git a/docs/images/demos/description.jpg b/docs/images/demos/description.jpg new file mode 100644 index 000000000..a9ac9bd66 Binary files /dev/null and b/docs/images/demos/description.jpg differ diff --git a/docs/images/demos/fisheye.jpg b/docs/images/demos/fisheye.jpg new file mode 100644 index 000000000..4cc8deb7f Binary files /dev/null and b/docs/images/demos/fisheye.jpg differ diff --git a/docs/images/demos/navbar.jpg b/docs/images/demos/navbar.jpg new file mode 100644 index 000000000..ae9218241 Binary files /dev/null and b/docs/images/demos/navbar.jpg differ diff --git a/docs/.vuepress/public/assets/pan-tilt-roll.png b/docs/images/pan-tilt-roll.png similarity index 100% rename from docs/.vuepress/public/assets/pan-tilt-roll.png rename to docs/images/pan-tilt-roll.png diff --git a/docs/plugins/plugin-compass.md b/docs/plugins/plugin-compass.md index 49f7b2925..7b93cd88b 100644 --- a/docs/plugins/plugin-compass.md +++ b/docs/plugins/plugin-compass.md @@ -29,7 +29,7 @@ const viewer = new PhotoSphereViewer.Viewer({ ## Example - + ::: tip The north is always at longitude=0, if you need to change where is the north you can use `panoData.poseHeading` or `sphereCorrection.pan` option. diff --git a/docs/plugins/plugin-gallery.md b/docs/plugins/plugin-gallery.md index 909e970af..73e4182f3 100644 --- a/docs/plugins/plugin-gallery.md +++ b/docs/plugins/plugin-gallery.md @@ -43,7 +43,7 @@ const viewer = new PhotoSphereViewer.Viewer({ ## Example - + ## Configuration @@ -60,6 +60,12 @@ The list of items, see bellow. Displays the gallery when loading the first panorama. The user will be able to toggle the gallery with the navbar button. +#### `thumbnailSize` +- type: `{ width: number, height: number }` +- default: `{ width: 200, height: 100 }` + +Size of the thumbnails. + ### Items #### `id` (required) diff --git a/docs/plugins/plugin-virtual-tour.md b/docs/plugins/plugin-virtual-tour.md index 1f15f3c63..e9ed73a6f 100644 --- a/docs/plugins/plugin-virtual-tour.md +++ b/docs/plugins/plugin-virtual-tour.md @@ -83,7 +83,7 @@ If the [Gallery plugin](./plugin-gallery.md) is loaded, it will be configured wi ## Example - + ## Nodes options diff --git a/example/cubemap-overlay.html b/example/cubemap-overlay.html new file mode 100644 index 000000000..77ef48111 --- /dev/null +++ b/example/cubemap-overlay.html @@ -0,0 +1,99 @@ + + + + + + PhotoSphereViewer - overlay demo + + + + + + +
+ + + + + + + + + + diff --git a/example/cubemap.html b/example/cubemap.html index 6d75cd71f..8a1bba84b 100644 --- a/example/cubemap.html +++ b/example/cubemap.html @@ -6,7 +6,6 @@ PhotoSphereViewer - cubemap demo - diff --git a/example/equirectangular-overlay.html b/example/equirectangular-overlay.html new file mode 100644 index 000000000..6dc727a7c --- /dev/null +++ b/example/equirectangular-overlay.html @@ -0,0 +1,65 @@ + + + + + + PhotoSphereViewer - overlay demo + + + + + + +
+ + + + + + + + + diff --git a/example/index.html b/example/index.html index 0ae2b9bfd..590be4258 100644 --- a/example/index.html +++ b/example/index.html @@ -32,6 +32,7 @@
Adapters
Cubemap Cubemap Tiles Cubemap Video + Little Planet @@ -49,7 +50,7 @@
Plugins
Markers (cubemap) Resolution Settings - Video (equirectangular) + Video Virtual Tour Visible Range @@ -62,6 +63,8 @@
Misc
diff --git a/example/little-planet.html b/example/little-planet.html new file mode 100644 index 000000000..29eb49d59 --- /dev/null +++ b/example/little-planet.html @@ -0,0 +1,77 @@ + + + + + + PhotoSphereViewer - little planet demo + + + + + + +
+ + + + + + + + + + diff --git a/example/plugin-gallery.html b/example/plugin-gallery.html index df4291cb9..498145e2d 100644 --- a/example/plugin-gallery.html +++ b/example/plugin-gallery.html @@ -89,6 +89,15 @@ caption: 'Cape Florida Light, Key Biscayne © Pixexid', }, }, + { + id : 7, + panorama : base + 'key-biscayne-7.jpg', + thumbnail: base + 'key-biscayne-7-thumb.jpg', + name : 'Seven', + options : { + caption: 'Cape Florida Light, Key Biscayne © Pixexid', + }, + }, ]; const viewer = new PhotoSphereViewer.Viewer({ @@ -100,6 +109,10 @@ [PhotoSphereViewer.GalleryPlugin, { items : items, visibleOnLoad: true, + // thumbnailSize: { + // width: 100, + // height: 100, + // } }], ], }); diff --git a/example/plugin-virtual-tour.html b/example/plugin-virtual-tour.html index a9b78af38..d6d84f015 100644 --- a/example/plugin-virtual-tour.html +++ b/example/plugin-virtual-tour.html @@ -110,10 +110,22 @@ name : 'Six', links : [ { nodeId: '5', latitude: 0, longitude: '130deg' }, + { nodeId: '7', latitude: 0, longitude: '-60deg' }, ], position : [-80.156465, 25.666496, 2], panoData : { poseHeading: 328 }, }, + { + id : '7', + panorama : base + 'key-biscayne-7.jpg', + thumbnail: base + 'key-biscayne-7-thumb.jpg', + name : 'Seven', + links : [ + { nodeId: '6', latitude: 0, longitude: '80deg' }, + ], + position : [-80.157070, 25.666500, 3], + panoData : { poseHeading: 250 }, + }, ]; const nodesById = {}; diff --git a/example/plugin-visible-range.html b/example/plugin-visible-range.html index 4208f711a..ba845bbf8 100644 --- a/example/plugin-visible-range.html +++ b/example/plugin-visible-range.html @@ -18,25 +18,13 @@