diff --git a/.eslintrc.json b/.eslintrc.json index 579ae9f09..c40211ee1 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -14,6 +14,7 @@ "no-bitwise": "off", "no-else-return": "off", "no-multiple-empty-lines": "off", + "no-param-reassign": "off", "no-plusplus": "off", "no-restricted-properties": "off", "no-underscore-dangle": "off", @@ -55,12 +56,6 @@ "switches": "never" } ], - "no-param-reassign": [ - "error", - { - "props": false - } - ], "no-console": [ "error", { diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 000000000..feb4f86ab --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,10 @@ +version: 2 +updates: +- package-ecosystem: npm + directory: "/" + schedule: + interval: daily + time: "04:00" + open-pull-requests-limit: 10 + assignees: + - mistic100 diff --git a/.gitignore b/.gitignore index 9f380e56a..cfaf1f5ba 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ -/node_modules +node_modules /.idea /*.iml /public -/package-lock.json -/yarn.lock -/yarn-error.log +package-lock.json +yarn.lock +yarn-error.log /three-examples diff --git a/.jsdoc.json b/.jsdoc.json index 52f320f26..2f0d1dd93 100644 --- a/.jsdoc.json +++ b/.jsdoc.json @@ -1,7 +1,4 @@ { - "source": { - "excludePattern": "PhotoSphereViewerCompat\\.js" - }, "opts": { "recurse": true, "private": false, diff --git a/dist/adapters/cubemap.d.ts b/dist/adapters/cubemap.d.ts new file mode 100644 index 000000000..e2f333b00 --- /dev/null +++ b/dist/adapters/cubemap.d.ts @@ -0,0 +1,24 @@ +import { AbstractAdapter, TextureData } from 'photo-sphere-viewer'; + +/** + * @summary Object defining a cubemap + */ +type Cubemap = string[6] | { + top: string; + right: string; + bottom: string; + left: string; + front: string; + back: string; +}; + +/** + * @summary Adapter for cubemaps + */ +declare class CubemapAdapter extends AbstractAdapter { + + loadTexture(panorama: Cubemap): Promise; + +} + +export { Cubemap, CubemapAdapter }; diff --git a/dist/adapters/cubemap.js b/dist/adapters/cubemap.js new file mode 100644 index 000000000..4c3e2af27 --- /dev/null +++ b/dist/adapters/cubemap.js @@ -0,0 +1,205 @@ +/*! +* Photo Sphere Viewer 4.3.0 +* @copyright 2014-2015 Jérémy Heleine +* @copyright 2015-2021 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.CubemapAdapter = {}), 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 || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); + } + + /** + * @typedef {Object} PSV.adapters.CubemapAdapter.Cubemap + * @summary Object defining a cubemap + * @property {string} top + * @property {string} right + * @property {string} bottom + * @property {string} left + * @property {string} front + * @property {string} back + */ + + var CUBE_VERTICES = 8; + var CUBE_MAP = [0, 2, 4, 5, 3, 1]; + var CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front']; + /** + * @summary Adapter for cubemaps + * @memberof PSV.adapters + */ + + var CubemapAdapter = /*#__PURE__*/function (_AbstractAdapter) { + _inheritsLoose(CubemapAdapter, _AbstractAdapter); + + function CubemapAdapter() { + return _AbstractAdapter.apply(this, arguments) || this; + } + + var _proto = CubemapAdapter.prototype; + + /** + * @override + * @param {string[] | PSV.adapters.CubemapAdapter.Cubemap} panorama + * @returns {Promise.} + */ + _proto.loadTexture = function loadTexture(panorama) { + var _this = this; + + var cleanPanorama = []; + + if (Array.isArray(panorama)) { + if (panorama.length !== 6) { + return Promise.reject(new photoSphereViewer.PSVError('Must provide exactly 6 image paths when using cubemap.')); + } // reorder images + + + for (var i = 0; i < 6; i++) { + cleanPanorama[i] = panorama[CUBE_MAP[i]]; + } + } else if (typeof panorama === 'object') { + if (!CUBE_HASHMAP.every(function (side) { + return !!panorama[side]; + })) { + return Promise.reject(new photoSphereViewer.PSVError('Must provide exactly left, front, right, back, top, bottom when using cubemap.')); + } // transform into array + + + CUBE_HASHMAP.forEach(function (side, i) { + cleanPanorama[i] = panorama[side]; + }); + } else { + return Promise.reject(new photoSphereViewer.PSVError('Invalid cubemap panorama, are you using the right adapter?')); + } + + if (this.psv.config.fisheye) { + photoSphereViewer.utils.logWarn('fisheye effect with cubemap texture can generate distorsion'); + } + + var promises = []; + var progress = [0, 0, 0, 0, 0, 0]; + + var _loop = function _loop(_i) { + promises.push(_this.psv.textureLoader.loadImage(cleanPanorama[_i], function (p) { + progress[_i] = p; + + _this.psv.loader.setProgress(photoSphereViewer.utils.sum(progress) / 6); + }).then(function (img) { + return _this.__createCubemapTexture(img); + })); + }; + + for (var _i = 0; _i < 6; _i++) { + _loop(_i); + } + + return Promise.all(promises).then(function (texture) { + return { + texture: texture + }; + }); + } + /** + * @summary Creates the final texture from image + * @param {HTMLImageElement} img + * @returns {external:THREE.Texture} + * @private + */ + ; + + _proto.__createCubemapTexture = function __createCubemapTexture(img) { + var finalImage; // resize image + + if (img.width > photoSphereViewer.SYSTEM.maxTextureWidth) { + var buffer = document.createElement('canvas'); + var ratio = photoSphereViewer.SYSTEM.getMaxCanvasWidth() / img.width; + buffer.width = img.width * ratio; + buffer.height = img.height * ratio; + var ctx = buffer.getContext('2d'); + ctx.drawImage(img, 0, 0, buffer.width, buffer.height); + finalImage = buffer; + } else { + finalImage = img; + } + + return photoSphereViewer.utils.createTexture(finalImage); + } + /** + * @override + */ + ; + + _proto.createMesh = function createMesh(scale) { + if (scale === void 0) { + scale = 1; + } + + var cubeSize = photoSphereViewer.CONSTANTS.SPHERE_RADIUS * 2 * scale; + var geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_VERTICES, CUBE_VERTICES, CUBE_VERTICES); + var materials = []; + + for (var i = 0; i < 6; i++) { + materials.push(new THREE.MeshBasicMaterial({ + side: THREE.BackSide + })); + } + + var mesh = new THREE.Mesh(geometry, materials); + mesh.scale.set(1, 1, -1); + return mesh; + } + /** + * @override + */ + ; + + _proto.setTexture = function setTexture(mesh, textureData) { + var texture = textureData.texture; + + for (var i = 0; i < 6; i++) { + if (mesh.material[i].map) { + mesh.material[i].map.dispose(); + } + + mesh.material[i].map = texture[i]; + } + } + /** + * @override + */ + ; + + _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { + for (var i = 0; i < 6; i++) { + mesh.material[i].opacity = opacity; + mesh.material[i].transparent = opacity < 1; + } + }; + + return CubemapAdapter; + }(photoSphereViewer.AbstractAdapter); + CubemapAdapter.id = 'cubemap'; + CubemapAdapter.supportsTransition = true; + + exports.CubemapAdapter = CubemapAdapter; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=cubemap.js.map diff --git a/dist/adapters/cubemap.js.map b/dist/adapters/cubemap.js.map new file mode 100644 index 000000000..092880e52 --- /dev/null +++ b/dist/adapters/cubemap.js.map @@ -0,0 +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 * @typedef {Object} PSV.adapters.CubemapAdapter.Cubemap\n * @summary Object defining a cubemap\n * @property {string} top\n * @property {string} right\n * @property {string} bottom\n * @property {string} left\n * @property {string} front\n * @property {string} back\n */\n\nconst CUBE_VERTICES = 8;\nconst CUBE_MAP = [0, 2, 4, 5, 3, 1];\nconst CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front'];\n\n/**\n * @summary Adapter for cubemaps\n * @memberof PSV.adapters\n */\nexport class CubemapAdapter extends AbstractAdapter {\n\n static id = 'cubemap';\n static supportsTransition = true;\n\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_MAP[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 => ({ 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 let finalImage;\n\n // resize image\n if (img.width > SYSTEM.maxTextureWidth) {\n const buffer = document.createElement('canvas');\n const ratio = SYSTEM.getMaxCanvasWidth() / img.width;\n\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 finalImage = buffer;\n }\n else {\n finalImage = img;\n }\n\n return utils.createTexture(finalImage);\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_VERTICES, CUBE_VERTICES, CUBE_VERTICES);\n\n const materials = [];\n for (let i = 0; i < 6; i++) {\n materials.push(new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n }));\n }\n\n const mesh = new THREE.Mesh(geometry, materials);\n mesh.scale.set(1, 1, -1);\n\n return mesh;\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n const { texture } = textureData;\n\n for (let i = 0; i < 6; i++) {\n if (mesh.material[i].map) {\n mesh.material[i].map.dispose();\n }\n\n mesh.material[i].map = texture[i];\n }\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i].opacity = opacity;\n mesh.material[i].transparent = opacity < 1;\n }\n }\n\n}\n"],"names":["CUBE_VERTICES","CUBE_MAP","CUBE_HASHMAP","CubemapAdapter","loadTexture","panorama","cleanPanorama","Array","isArray","length","Promise","reject","PSVError","i","every","side","forEach","psv","config","fisheye","utils","logWarn","promises","progress","push","textureLoader","loadImage","p","loader","setProgress","sum","then","img","__createCubemapTexture","all","texture","finalImage","width","SYSTEM","maxTextureWidth","buffer","document","createElement","ratio","getMaxCanvasWidth","height","ctx","getContext","drawImage","createTexture","createMesh","scale","cubeSize","CONSTANTS","SPHERE_RADIUS","geometry","THREE","BoxGeometry","materials","MeshBasicMaterial","BackSide","mesh","Mesh","set","setTexture","textureData","material","map","dispose","setTextureOpacity","opacity","transparent","AbstractAdapter","id","supportsTransition"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA,IAAMA,aAAa,GAAG,CAAtB;EACA,IAAMC,QAAQ,GAAG,CAAC,CAAD,EA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line at end of file diff --git a/dist/adapters/equirectangular-tiles.d.ts b/dist/adapters/equirectangular-tiles.d.ts new file mode 100644 index 000000000..35e5638ec --- /dev/null +++ b/dist/adapters/equirectangular-tiles.d.ts @@ -0,0 +1,30 @@ +import { AbstractAdapter, Viewer, TextureData } from 'photo-sphere-viewer'; + +/** + * @summary Configuration of a tiled panorama + */ +type EquirectangularTilesPanorama = { + baseUrl?: string; + width: number; + cols: number; + rows: number; + tileUrl: (col: number, row: number) => string; +}; + +type EquirectangularTilesAdapterOptions = { + showErrorTile?: boolean; + baseBlur?: boolean; +} + +/** + * @summary Adapter for tiled panoramas + */ +declare class EquirectangularTilesAdapter extends AbstractAdapter { + + constructor(psv: Viewer, options: EquirectangularTilesAdapterOptions); + + loadTexture(panorama: EquirectangularTilesPanorama): Promise; + +} + +export { EquirectangularTilesAdapter, EquirectangularTilesAdapterOptions, EquirectangularTilesPanorama }; diff --git a/dist/adapters/equirectangular-tiles.js b/dist/adapters/equirectangular-tiles.js new file mode 100644 index 000000000..b38114bbf --- /dev/null +++ b/dist/adapters/equirectangular-tiles.js @@ -0,0 +1,803 @@ +/*! +* Photo Sphere Viewer 4.3.0 +* @copyright 2014-2015 Jérémy Heleine +* @copyright 2015-2021 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.EquirectangularTilesAdapter = {}), global.THREE, global.PhotoSphereViewer)); +}(this, (function (exports, THREE, photoSphereViewer) { 'use strict'; + + function _extends() { + _extends = Object.assign || function (target) { + for (var i = 1; i < arguments.length; i++) { + var source = arguments[i]; + + for (var key in source) { + if (Object.prototype.hasOwnProperty.call(source, key)) { + target[key] = source[key]; + } + } + } + + return target; + }; + + return _extends.apply(this, arguments); + } + + function _inheritsLoose(subClass, superClass) { + subClass.prototype = Object.create(superClass.prototype); + subClass.prototype.constructor = subClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || 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; + } + + /** + * @summary Loading task + * @memberOf PSV.adapters.EquirectangularTilesAdapter + * @package + */ + var Task = /*#__PURE__*/function () { + /** + * @param {string} id + * @param {number} priority + * @param {function(Task): Promise} fn + */ + function Task(id, priority, fn) { + this.id = id; + this.priority = priority; + this.fn = fn; + this.status = Task.STATUS.PENDING; + } + + var _proto = Task.prototype; + + _proto.start = function start() { + var _this = this; + + this.status = Task.STATUS.RUNNING; + return this.fn(this).then(function () { + _this.status = Task.STATUS.DONE; + }, function () { + _this.status = Task.STATUS.ERROR; + }); + }; + + _proto.cancel = function cancel() { + this.status = Task.STATUS.CANCELLED; + }; + + _proto.isCancelled = function isCancelled() { + return this.status === Task.STATUS.CANCELLED; + }; + + return Task; + }(); + Task.STATUS = { + PENDING: 0, + RUNNING: 1, + CANCELLED: 2, + DONE: 3, + ERROR: 4 + }; + + /** + * @summary Loading queue + * @memberOf PSV.adapters.EquirectangularTilesAdapter + * @package + */ + + var Queue = /*#__PURE__*/function () { + /** + * @param {int} concurency + */ + function Queue(concurency) { + this.concurency = concurency; + this.runningTasks = {}; + this.tasks = {}; + } + + var _proto = Queue.prototype; + + _proto.enqueue = function enqueue(task) { + this.tasks[task.id] = task; + }; + + _proto.clear = function clear() { + Object.values(this.tasks).forEach(function (task) { + return task.cancel(); + }); + this.tasks = {}; + this.runningTasks = {}; + }; + + _proto.setPriority = function setPriority(taskId, priority) { + if (this.tasks[taskId]) { + this.tasks[taskId].priority = priority; + } + }; + + _proto.setAllPriorities = function setAllPriorities(priority) { + Object.values(this.tasks).forEach(function (task) { + task.priority = priority; + }); + }; + + _proto.start = function start() { + var _this = this; + + if (Object.keys(this.runningTasks).length >= this.concurency) { + return; + } + + var nextTask = Object.values(this.tasks).filter(function (task) { + return task.status === Task.STATUS.PENDING && task.priority > 0; + }).sort(function (a, b) { + return a.priority - b.priority; + }).pop(); + + if (nextTask) { + this.runningTasks[nextTask.id] = true; + nextTask.start().then(function () { + if (!nextTask.isCancelled()) { + delete _this.tasks[nextTask.id]; + delete _this.runningTasks[nextTask.id]; + + _this.start(); + } + }); + this.start(); // start tasks until max concurrency is reached + } + }; + + return Queue; + }(); + + /** + * @callback TileUrl + * @summary Function called to build a tile url + * @memberOf PSV.adapters.EquirectangularTilesAdapter + * @param {int} col + * @param {int} row + * @returns {string} + */ + + /** + * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama + * @summary Configuration of a tiled panorama + * @property {string} [baseUrl] - low resolution panorama loaded before tiles + * @property {int} width - complete panorama width (height is always width/2) + * @property {int} cols - number of vertical tiles + * @property {int} rows - number of horizontal tiles + * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url + */ + + /** + * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options + * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded + * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama + */ + + /** + * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile + * @private + * @property {int} col + * @property {int} row + * @property {int} angle + */ + + var SPHERE_SEGMENTS = 64; + var NB_VERTICES = 3 * (SPHERE_SEGMENTS * 2 + (SPHERE_SEGMENTS / 2 - 2) * SPHERE_SEGMENTS * 2); + var NB_GROUPS = SPHERE_SEGMENTS * 2 + (SPHERE_SEGMENTS / 2 - 2) * SPHERE_SEGMENTS; + var QUEUE_CONCURENCY = 4; + + function tileId(tile) { + return tile.col + "x" + tile.row; + } + + function powerOfTwo(x) { + return Math.log(x) / Math.log(2) % 1 === 0; + } + /** + * @summary Adapter for tiled panoramas + * @memberof PSV.adapters + */ + + + var EquirectangularTilesAdapter = /*#__PURE__*/function (_AbstractAdapter) { + _inheritsLoose(EquirectangularTilesAdapter, _AbstractAdapter); + + /** + * @param {PSV.Viewer} psv + * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options + */ + function EquirectangularTilesAdapter(psv, options) { + var _this; + + _this = _AbstractAdapter.call(this, psv) || this; + /** + * @member {PSV.adapters.EquirectangularTilesAdapter.Options} + * @private + */ + + _this.config = _extends({ + showErrorTile: true, + baseBlur: true + }, options); + /** + * @member {external:THREE.MeshBasicMaterial[]} + * @private + */ + + _this.materials = []; + /** + * @member {PSV.adapters.EquirectangularTilesAdapter.Queue} + * @private + */ + + _this.queue = new Queue(QUEUE_CONCURENCY); + /** + * @type {Object} + * @property {int} colSize - size in pixels of a column + * @property {int} rowSize - size in pixels of a row + * @property {int} facesByCol - number of mesh faces by column + * @property {int} facesByRow - number of mesh faces by row + * @property {Record} tiles - loaded tiles + * @property {external:THREE.SphereGeometry} geom + * @property {*} originalUvs + * @property {external:THREE.MeshBasicMaterial} errorMaterial + * @private + */ + + _this.prop = { + colSize: 0, + rowSize: 0, + facesByCol: 0, + facesByRow: 0, + tiles: {}, + geom: null, + originalUvs: null, + errorMaterial: null + }; + /** + * @member {external:THREE.ImageLoader} + * @private + */ + + _this.loader = new THREE.ImageLoader(); + + if (_this.psv.config.withCredentials) { + _this.loader.setWithCredentials(true); + } + + if (_this.psv.config.requestHeaders && typeof _this.psv.config.requestHeaders === 'object') { + _this.loader.setRequestHeader(_this.psv.config.requestHeaders); + } + + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.POSITION_UPDATED, _assertThisInitialized(_this)); + + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED, _assertThisInitialized(_this)); + + return _this; + } + + var _proto = EquirectangularTilesAdapter.prototype; + + _proto.destroy = function destroy() { + var _this$prop$errorMater, _this$prop$errorMater2, _this$prop$errorMater3; + + this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.POSITION_UPDATED, this); + this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED, this); + + this.__cleanup(); + + (_this$prop$errorMater = this.prop.errorMaterial) == null ? void 0 : (_this$prop$errorMater2 = _this$prop$errorMater.map) == null ? void 0 : _this$prop$errorMater2.dispose(); + (_this$prop$errorMater3 = this.prop.errorMaterial) == null ? void 0 : _this$prop$errorMater3.dispose(); + delete this.queue; + delete this.loader; + delete this.prop.geom; + delete this.prop.originalUvs; + delete this.prop.errorMaterial; + + _AbstractAdapter.prototype.destroy.call(this); + }; + + _proto.handleEvent = function handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + case photoSphereViewer.CONSTANTS.EVENTS.POSITION_UPDATED: + case photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED: + this.__refresh(); + + break; + } + /* eslint-enable */ + + } + /** + * @summary Clears loading queue, dispose all materials + * @private + */ + ; + + _proto.__cleanup = function __cleanup() { + this.queue.clear(); + this.prop.tiles = {}; + this.materials.forEach(function (mat) { + var _mat$map; + + mat == null ? void 0 : (_mat$map = mat.map) == null ? void 0 : _mat$map.dispose(); + mat == null ? void 0 : mat.dispose(); + }); + this.materials.length = 0; + } + /** + * @override + * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama + * @returns {Promise.} + */ + ; + + _proto.loadTexture = function loadTexture(panorama) { + var _this2 = this; + + if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) { + return Promise.reject(new photoSphereViewer.PSVError('Invalid panorama configuration, are you using the right adapter?')); + } + + if (panorama.cols > SPHERE_SEGMENTS) { + return Promise.reject(new photoSphereViewer.PSVError("Panorama cols must not be greater than " + SPHERE_SEGMENTS + ".")); + } + + if (panorama.rows > SPHERE_SEGMENTS / 2) { + return Promise.reject(new photoSphereViewer.PSVError("Panorama rows must not be greater than " + SPHERE_SEGMENTS / 2 + ".")); + } + + if (!powerOfTwo(panorama.cols) || !powerOfTwo(panorama.rows)) { + return Promise.reject(new photoSphereViewer.PSVError('Panorama cols and rows must be powers of 2.')); + } + + panorama.height = panorama.width / 2; + this.prop.colSize = panorama.width / panorama.cols; + this.prop.rowSize = panorama.height / panorama.rows; + this.prop.facesByCol = SPHERE_SEGMENTS / panorama.cols; + this.prop.facesByRow = SPHERE_SEGMENTS / 2 / panorama.rows; + + this.__cleanup(); + + if (this.prop.geom) { + this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone()); + } + + var panoData = { + fullWidth: panorama.width, + fullHeight: panorama.height, + croppedWidth: panorama.width, + croppedHeight: panorama.height, + croppedX: 0, + croppedY: 0 + }; + + if (panorama.baseUrl) { + return this.psv.textureLoader.loadImage(panorama.baseUrl, function (p) { + return _this2.psv.loader.setProgress(p); + }).then(function (img) { + return { + texture: _this2.__createBaseTexture(img), + panoData: panoData + }; + }); + } else { + return Promise.resolve({ + texture: null, + panoData: panoData + }); + } + } + /** + * @override + */ + ; + + _proto.createMesh = function createMesh(scale) { + if (scale === void 0) { + scale = 1; + } + + var geometry = new THREE.SphereGeometry(photoSphereViewer.CONSTANTS.SPHERE_RADIUS * scale, SPHERE_SEGMENTS, SPHERE_SEGMENTS / 2, -Math.PI / 2).toNonIndexed(); + var i = 0; + var k = 0; // first row + + for (; i < SPHERE_SEGMENTS * 3; i += 3) { + geometry.addGroup(i, 3, k++); + } // second to before last rows + + + for (; i < NB_VERTICES - SPHERE_SEGMENTS * 3; i += 6) { + geometry.addGroup(i, 6, k++); + } // last row + + + for (; i < NB_VERTICES; i += 3) { + geometry.addGroup(i, 3, k++); + } + + this.prop.geom = geometry; + this.prop.originalUvs = geometry.getAttribute('uv').clone(); + var mesh = new THREE.Mesh(geometry, this.materials); + mesh.scale.set(-1, 1, 1); + return mesh; + } + /** + * @summary Applies the base texture and starts the loading of tiles + * @override + */ + ; + + _proto.setTexture = function setTexture(mesh, textureData) { + var _this3 = this; + + if (textureData.texture) { + var material = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + map: textureData.texture + }); + + for (var i = 0; i < NB_GROUPS; i++) { + this.materials.push(material); + } + } + + setTimeout(function () { + return _this3.__refresh(); + }); + } + /** + * @summary Compute visible tiles and load them + * @private + */ + ; + + _proto.__refresh = function __refresh() { + var _this4 = this; + + var viewerSize = this.psv.prop.size; + var panorama = this.psv.config.panorama; + var tilesToLoad = []; + var tilePosition = new THREE.Vector3(); + + for (var col = 0; col <= panorama.cols; col++) { + for (var row = 0; row <= panorama.rows; row++) { + // TODO prefilter with less complex math if possible + var tileTexturePosition = { + x: col * this.prop.colSize, + y: row * this.prop.rowSize + }; + this.psv.dataHelper.sphericalCoordsToVector3(this.psv.dataHelper.textureCoordsToSphericalCoords(tileTexturePosition), tilePosition); + + if (tilePosition.dot(this.psv.prop.direction) > 0) { + var tileViewerPosition = this.psv.dataHelper.vector3ToViewerCoords(tilePosition); + + if (tileViewerPosition.x >= 0 && tileViewerPosition.x <= viewerSize.width && tileViewerPosition.y >= 0 && tileViewerPosition.y <= viewerSize.height) { + (function () { + var angle = tilePosition.angleTo(_this4.psv.prop.direction); + + _this4.__getAdjacentTiles(col, row).forEach(function (tile) { + var existingTile = tilesToLoad.find(function (c) { + return c.row === tile.row && c.col === tile.col; + }); + + if (existingTile) { + existingTile.angle = Math.min(existingTile.angle, angle); + } else { + tilesToLoad.push(_extends({}, tile, { + angle: angle + })); + } + }); + })(); + } + } + } + } + + this.__loadTiles(tilesToLoad); + } + /** + * @summary Get the 4 adjacent tiles + * @private + */ + ; + + _proto.__getAdjacentTiles = function __getAdjacentTiles(col, row) { + var panorama = this.psv.config.panorama; + return [{ + col: col - 1, + row: row - 1 + }, { + col: col, + row: row - 1 + }, { + col: col, + row: row + }, // eslint-disable-line object-shorthand + { + col: col - 1, + row: row + }].map(function (tile) { + // examples are for cols=16 and rows=8 + if (tile.row < 0) { + // wrap on top + tile.row = -tile.row - 1; // -1 => 0, -2 => 1 + + tile.col += panorama.cols / 2; // change hemisphere + } else if (tile.row >= panorama.rows) { + // wrap on bottom + tile.row = panorama.rows - 1 - (tile.row - panorama.rows); // 8 => 7, 9 => 6 + + tile.col += panorama.cols / 2; // change hemisphere + } + + if (tile.col < 0) { + // wrap on left + tile.col += panorama.cols; // -1 => 15, -2 => 14 + } else if (tile.col >= panorama.cols) { + // wrap on right + tile.col -= panorama.cols; // 16 => 0, 17 => 1 + } + + return tile; + }); + } + /** + * @summary Loads tiles and change existing tiles priority + * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles + * @private + */ + ; + + _proto.__loadTiles = function __loadTiles(tiles) { + var _this5 = this; + + this.queue.setAllPriorities(0); + tiles.forEach(function (tile) { + var id = tileId(tile); + var priority = Math.PI / 2 - tile.angle; + + if (_this5.prop.tiles[id]) { + _this5.queue.setPriority(id, priority); + } else { + _this5.prop.tiles[id] = true; + + _this5.queue.enqueue(new Task(id, priority, function (task) { + return _this5.__loadTile(tile, task); + })); + } + }); + this.queue.start(); + } + /** + * @summary Loads and draw a tile + * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile + * @param {PSV.adapters.EquirectangularTilesAdapter.Task} task + * @return {Promise} + * @private + */ + ; + + _proto.__loadTile = function __loadTile(tile, task) { + var _this6 = this; + + var panorama = this.psv.config.panorama; + var url = panorama.tileUrl(tile.col, tile.row); + + if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') { + this.loader.setRequestHeader(this.psv.config.requestHeaders(url)); + } + + return new Promise(function (resolve, reject) { + return _this6.loader.load(url, resolve, undefined, reject); + }).then(function (image) { + if (!task.isCancelled()) { + var material = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + map: photoSphereViewer.utils.createTexture(image) + }); + + _this6.__swapMaterial(tile.col, tile.row, material); + + _this6.psv.needsUpdate(); + } + }).catch(function () { + if (!task.isCancelled() && _this6.config.showErrorTile) { + var material = _this6.__getErrorMaterial(); + + _this6.__swapMaterial(tile.col, tile.row, material); + + _this6.psv.needsUpdate(); + } + }); + } + /** + * @summary Applies a new texture to the faces + * @param {int} col + * @param {int} row + * @param {external:THREE.MeshBasicMaterial} material + * @private + */ + ; + + _proto.__swapMaterial = function __swapMaterial(col, row, material) { + var _this7 = this; + + var uvs = this.prop.geom.getAttribute('uv'); + + for (var c = 0; c < this.prop.facesByCol; c++) { + var _loop = function _loop(r) { + // position of the face (two triangles of the same square) + var faceCol = col * _this7.prop.facesByCol + c; + var faceRow = row * _this7.prop.facesByRow + r; + var isFirstRow = faceRow === 0; + var isLastRow = faceRow === SPHERE_SEGMENTS / 2 - 1; // first vertex for this face (3 or 6 vertices in total) + + var firstVertex = void 0; + + if (isFirstRow) { + firstVertex = faceCol * 3; + } else if (isLastRow) { + firstVertex = NB_VERTICES - SPHERE_SEGMENTS * 3 + faceCol * 3; + } else { + firstVertex = 3 * (SPHERE_SEGMENTS + (faceRow - 1) * SPHERE_SEGMENTS * 2 + faceCol * 2); + } // swap material + + + var matIndex = _this7.prop.geom.groups.find(function (g) { + return g.start === firstVertex; + }).materialIndex; + + _this7.materials[matIndex] = material; // define new uvs + + var top = 1 - r / _this7.prop.facesByRow; + var bottom = 1 - (r + 1) / _this7.prop.facesByRow; + var left = c / _this7.prop.facesByCol; + var right = (c + 1) / _this7.prop.facesByCol; + + if (isFirstRow) { + uvs.setXY(firstVertex, (left + right) / 2, top); + uvs.setXY(firstVertex + 1, left, bottom); + uvs.setXY(firstVertex + 2, right, bottom); + } else if (isLastRow) { + uvs.setXY(firstVertex, right, top); + uvs.setXY(firstVertex + 1, left, top); + uvs.setXY(firstVertex + 2, (left + right) / 2, bottom); + } else { + uvs.setXY(firstVertex, right, top); + uvs.setXY(firstVertex + 1, left, top); + uvs.setXY(firstVertex + 2, right, bottom); + uvs.setXY(firstVertex + 3, left, top); + uvs.setXY(firstVertex + 4, left, bottom); + uvs.setXY(firstVertex + 5, right, bottom); + } + }; + + for (var r = 0; r < this.prop.facesByRow; r++) { + _loop(r); + } + } + + uvs.needsUpdate = true; + } + /** + * @summary Generates an material for errored tiles + * @return {external:THREE.MeshBasicMaterial} + * @private + */ + ; + + _proto.__getErrorMaterial = function __getErrorMaterial() { + if (!this.prop.errorMaterial) { + var canvas = document.createElement('canvas'); + canvas.width = this.prop.colSize; + canvas.height = this.prop.rowSize; + var ctx = canvas.getContext('2d'); + ctx.fillStyle = '#333'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.font = canvas.width / 5 + "px serif"; + ctx.fillStyle = '#a22'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.fillText('⚠', canvas.width / 2, canvas.height / 2); + var texture = new THREE.CanvasTexture(canvas); + this.prop.errorMaterial = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + map: texture + }); + } + + return this.prop.errorMaterial; + } + /** + * @summary Create the texture for the base image + * @param {HTMLImageElement} img + * @return {external:THREE.Texture} + * @private + */ + ; + + _proto.__createBaseTexture = function __createBaseTexture(img) { + if (img.width !== img.height * 2) { + photoSphereViewer.utils.logWarn('Invalid base image, the width should be twice the height'); + } + + if (this.config.baseBlur || img.width > photoSphereViewer.SYSTEM.maxTextureWidth) { + var ratio = Math.min(1, photoSphereViewer.SYSTEM.getMaxCanvasWidth() / img.width); + var buffer = document.createElement('canvas'); + buffer.width = img.width * ratio; + buffer.height = buffer.width / 2; + var ctx = buffer.getContext('2d'); + + if (this.config.baseBlur) { + ctx.filter = 'blur(1px)'; + } + + ctx.drawImage(img, 0, 0, buffer.width, buffer.height); + return photoSphereViewer.utils.createTexture(buffer); + } + + return photoSphereViewer.utils.createTexture(img); + }; + + return EquirectangularTilesAdapter; + }(photoSphereViewer.AbstractAdapter); + /* eslint-disable */ + + /** + * UNUSED : Returns the apparent size of a segment on the screen + * @private + */ + // function getSegmentSize() { + // const p1 = this.psv.prop.direction.clone(); + // const p2 = this.psv.prop.direction.clone(); + // + // const angle = Math.PI * 2 / SPHERE_SEGMENTS / 2; + // const dst = Math.atan(angle) * CONSTANTS.SPHERE_RADIUS; + // const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.psv.prop.direction).normalize(); + // + // p1.add(horizontalAxis.clone().multiplyScalar(dst)); + // p2.add(horizontalAxis.clone().multiplyScalar(-dst)); + // + // const p1a = this.psv.dataHelper.vector3ToViewerCoords(p1); + // const p2a = this.psv.dataHelper.vector3ToViewerCoords(p2); + // + // const segmentSize = p2a.x - p1a.x; + // } + + EquirectangularTilesAdapter.id = 'equirectangular-tiles'; + EquirectangularTilesAdapter.supportsTransition = false; + + exports.EquirectangularTilesAdapter = EquirectangularTilesAdapter; + + Object.defineProperty(exports, '__esModule', { value: true }); + +}))); +//# sourceMappingURL=equirectangular-tiles.js.map diff --git a/dist/adapters/equirectangular-tiles.js.map b/dist/adapters/equirectangular-tiles.js.map new file mode 100644 index 000000000..2e57be5ef --- /dev/null +++ b/dist/adapters/equirectangular-tiles.js.map @@ -0,0 +1 @@ +{"version":3,"file":"equirectangular-tiles.js","sources":["../../src/adapters/equirectangular-tiles/Task.js","../../src/adapters/equirectangular-tiles/Queue.js","../../src/adapters/equirectangular-tiles/index.js"],"sourcesContent":["/**\n * @summary Loading task\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @package\n */\nexport class Task {\n\n static STATUS = {\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.EquirectangularTilesAdapter\n * @package\n */\nexport class Queue {\n\n /**\n * @param {int} concurency\n */\n constructor(concurency) {\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 if (this.tasks[taskId]) {\n this.tasks[taskId].priority = priority;\n }\n }\n\n setAllPriorities(priority) {\n Object.values(this.tasks).forEach((task) => {\n task.priority = priority;\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 && task.priority > 0)\n .sort((a, b) => a.priority - b.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 { AbstractAdapter, CONSTANTS, PSVError, SYSTEM, utils } from '../..';\nimport { Queue } from './Queue';\nimport { Task } from './Task';\n\n/**\n * @callback TileUrl\n * @summary Function called to build a tile url\n * @memberOf PSV.adapters.EquirectangularTilesAdapter\n * @param {int} col\n * @param {int} row\n * @returns {string}\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama\n * @summary Configuration of a tiled panorama\n * @property {string} [baseUrl] - low resolution panorama loaded before tiles\n * @property {int} width - complete panorama width (height is always width/2)\n * @property {int} cols - number of vertical tiles\n * @property {int} rows - number of horizontal tiles\n * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options\n * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded\n * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama\n */\n\n/**\n * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile\n * @private\n * @property {int} col\n * @property {int} row\n * @property {int} angle\n */\n\nconst SPHERE_SEGMENTS = 64;\nconst NB_VERTICES = 3 * (SPHERE_SEGMENTS * 2 + (SPHERE_SEGMENTS / 2 - 2) * SPHERE_SEGMENTS * 2);\nconst NB_GROUPS = SPHERE_SEGMENTS * 2 + (SPHERE_SEGMENTS / 2 - 2) * SPHERE_SEGMENTS;\nconst QUEUE_CONCURENCY = 4;\n\nfunction tileId(tile) {\n return `${tile.col}x${tile.row}`;\n}\n\nfunction powerOfTwo(x) {\n return (Math.log(x) / Math.log(2)) % 1 === 0;\n}\n\n\n/**\n * @summary Adapter for tiled panoramas\n * @memberof PSV.adapters\n */\nexport class EquirectangularTilesAdapter extends AbstractAdapter {\n\n static id = 'equirectangular-tiles';\n static supportsTransition = false;\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Options}\n * @private\n */\n this.config = {\n showErrorTile: true,\n baseBlur : true,\n ...options,\n };\n\n /**\n * @member {external:THREE.MeshBasicMaterial[]}\n * @private\n */\n this.materials = [];\n\n /**\n * @member {PSV.adapters.EquirectangularTilesAdapter.Queue}\n * @private\n */\n this.queue = new Queue(QUEUE_CONCURENCY);\n\n /**\n * @type {Object}\n * @property {int} colSize - size in pixels of a column\n * @property {int} rowSize - size in pixels of a row\n * @property {int} facesByCol - number of mesh faces by column\n * @property {int} facesByRow - number of mesh faces by row\n * @property {Record} tiles - loaded tiles\n * @property {external:THREE.SphereGeometry} geom\n * @property {*} originalUvs\n * @property {external:THREE.MeshBasicMaterial} errorMaterial\n * @private\n */\n this.prop = {\n colSize : 0,\n rowSize : 0,\n facesByCol : 0,\n facesByRow : 0,\n tiles : {},\n geom : null,\n originalUvs : null,\n errorMaterial: null,\n };\n\n /**\n * @member {external:THREE.ImageLoader}\n * @private\n */\n this.loader = new THREE.ImageLoader();\n if (this.psv.config.withCredentials) {\n this.loader.setWithCredentials(true);\n }\n if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') {\n this.loader.setRequestHeader(this.psv.config.requestHeaders);\n }\n\n this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n }\n\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this);\n this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this);\n\n this.__cleanup();\n\n this.prop.errorMaterial?.map?.dispose();\n this.prop.errorMaterial?.dispose();\n\n delete this.queue;\n delete this.loader;\n delete this.prop.geom;\n delete this.prop.originalUvs;\n delete this.prop.errorMaterial;\n\n super.destroy();\n }\n\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n case CONSTANTS.EVENTS.POSITION_UPDATED:\n case CONSTANTS.EVENTS.ZOOM_UPDATED:\n this.__refresh();\n break;\n }\n /* eslint-enable */\n }\n\n /**\n * @summary Clears loading queue, dispose all materials\n * @private\n */\n __cleanup() {\n this.queue.clear();\n this.prop.tiles = {};\n\n this.materials.forEach((mat) => {\n mat?.map?.dispose();\n mat?.dispose();\n });\n this.materials.length = 0;\n }\n\n /**\n * @override\n * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama\n * @returns {Promise.}\n */\n loadTexture(panorama) {\n if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) {\n return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?'));\n }\n if (panorama.cols > SPHERE_SEGMENTS) {\n return Promise.reject(new PSVError(`Panorama cols must not be greater than ${SPHERE_SEGMENTS}.`));\n }\n if (panorama.rows > SPHERE_SEGMENTS / 2) {\n return Promise.reject(new PSVError(`Panorama rows must not be greater than ${SPHERE_SEGMENTS / 2}.`));\n }\n if (!powerOfTwo(panorama.cols) || !powerOfTwo(panorama.rows)) {\n return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.'));\n }\n\n panorama.height = panorama.width / 2;\n\n this.prop.colSize = panorama.width / panorama.cols;\n this.prop.rowSize = panorama.height / panorama.rows;\n this.prop.facesByCol = SPHERE_SEGMENTS / panorama.cols;\n this.prop.facesByRow = SPHERE_SEGMENTS / 2 / panorama.rows;\n\n this.__cleanup();\n\n if (this.prop.geom) {\n this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone());\n }\n\n const panoData = {\n fullWidth : panorama.width,\n fullHeight : panorama.height,\n croppedWidth : panorama.width,\n croppedHeight: panorama.height,\n croppedX : 0,\n croppedY : 0,\n };\n\n if (panorama.baseUrl) {\n return this.psv.textureLoader.loadImage(panorama.baseUrl, p => this.psv.loader.setProgress(p))\n .then((img) => {\n return {\n texture : this.__createBaseTexture(img),\n panoData: panoData,\n };\n });\n }\n else {\n return Promise.resolve({\n texture : null,\n panoData: panoData,\n });\n }\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n const geometry = new THREE.SphereGeometry(CONSTANTS.SPHERE_RADIUS * scale, SPHERE_SEGMENTS, SPHERE_SEGMENTS / 2, -Math.PI / 2)\n .toNonIndexed();\n\n let i = 0;\n let k = 0;\n\n // first row\n for (; i < SPHERE_SEGMENTS * 3; i += 3) {\n geometry.addGroup(i, 3, k++);\n }\n\n // second to before last rows\n for (; i < NB_VERTICES - SPHERE_SEGMENTS * 3; i += 6) {\n geometry.addGroup(i, 6, k++);\n }\n\n // last row\n for (; i < NB_VERTICES; i += 3) {\n geometry.addGroup(i, 3, k++);\n }\n\n this.prop.geom = geometry;\n this.prop.originalUvs = geometry.getAttribute('uv').clone();\n\n const mesh = new THREE.Mesh(geometry, this.materials);\n mesh.scale.set(-1, 1, 1);\n\n return mesh;\n }\n\n /**\n * @summary Applies the base texture and starts the loading of tiles\n * @override\n */\n setTexture(mesh, textureData) {\n if (textureData.texture) {\n const material = new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n map : textureData.texture,\n });\n\n for (let i = 0; i < NB_GROUPS; i++) {\n this.materials.push(material);\n }\n }\n\n setTimeout(() => this.__refresh());\n }\n\n /**\n * @summary Compute visible tiles and load them\n * @private\n */\n __refresh() {\n const viewerSize = this.psv.prop.size;\n const panorama = this.psv.config.panorama;\n\n const tilesToLoad = [];\n const tilePosition = new THREE.Vector3();\n\n for (let col = 0; col <= panorama.cols; col++) {\n for (let row = 0; row <= panorama.rows; row++) {\n // TODO prefilter with less complex math if possible\n const tileTexturePosition = { x: col * this.prop.colSize, y: row * this.prop.rowSize };\n this.psv.dataHelper.sphericalCoordsToVector3(this.psv.dataHelper.textureCoordsToSphericalCoords(tileTexturePosition), tilePosition);\n\n if (tilePosition.dot(this.psv.prop.direction) > 0) {\n const tileViewerPosition = this.psv.dataHelper.vector3ToViewerCoords(tilePosition);\n\n if (tileViewerPosition.x >= 0\n && tileViewerPosition.x <= viewerSize.width\n && tileViewerPosition.y >= 0\n && tileViewerPosition.y <= viewerSize.height) {\n const angle = tilePosition.angleTo(this.psv.prop.direction);\n\n this.__getAdjacentTiles(col, row)\n .forEach((tile) => {\n const existingTile = tilesToLoad.find(c => c.row === tile.row && c.col === tile.col);\n if (existingTile) {\n existingTile.angle = Math.min(existingTile.angle, angle);\n }\n else {\n tilesToLoad.push({ ...tile, angle });\n }\n });\n }\n }\n }\n }\n\n this.__loadTiles(tilesToLoad);\n }\n\n /**\n * @summary Get the 4 adjacent tiles\n * @private\n */\n __getAdjacentTiles(col, row) {\n const panorama = this.psv.config.panorama;\n\n return [\n { col: col - 1, row: row - 1 },\n { col: col, row: row - 1 },\n { col: col, row: row }, // eslint-disable-line object-shorthand\n { col: col - 1, row: row },\n ]\n .map((tile) => {\n // examples are for cols=16 and rows=8\n if (tile.row < 0) {\n // wrap on top\n tile.row = -tile.row - 1; // -1 => 0, -2 => 1\n tile.col += panorama.cols / 2; // change hemisphere\n }\n else if (tile.row >= panorama.rows) {\n // wrap on bottom\n tile.row = (panorama.rows - 1) - (tile.row - panorama.rows); // 8 => 7, 9 => 6\n tile.col += panorama.cols / 2; // change hemisphere\n }\n if (tile.col < 0) {\n // wrap on left\n tile.col += panorama.cols; // -1 => 15, -2 => 14\n }\n else if (tile.col >= panorama.cols) {\n // wrap on right\n tile.col -= panorama.cols; // 16 => 0, 17 => 1\n }\n\n return tile;\n });\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.setAllPriorities(0);\n\n tiles.forEach((tile) => {\n const id = tileId(tile);\n const priority = Math.PI / 2 - tile.angle;\n\n if (this.prop.tiles[id]) {\n this.queue.setPriority(id, priority);\n }\n else {\n this.prop.tiles[id] = true;\n this.queue.enqueue(new Task(id, priority, 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.EquirectangularTilesAdapter.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) => this.loader.load(url, resolve, undefined, reject))\n .then((image) => {\n if (!task.isCancelled()) {\n const material = new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n map : utils.createTexture(image),\n });\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n })\n .catch(() => {\n if (!task.isCancelled() && this.config.showErrorTile) {\n const material = this.__getErrorMaterial();\n this.__swapMaterial(tile.col, tile.row, material);\n this.psv.needsUpdate();\n }\n });\n }\n\n /**\n * @summary Applies a new texture to the faces\n * @param {int} col\n * @param {int} row\n * @param {external:THREE.MeshBasicMaterial} material\n * @private\n */\n __swapMaterial(col, row, material) {\n const uvs = this.prop.geom.getAttribute('uv');\n\n for (let c = 0; c < this.prop.facesByCol; c++) {\n for (let r = 0; r < this.prop.facesByRow; r++) {\n // position of the face (two triangles of the same square)\n const faceCol = col * this.prop.facesByCol + c;\n const faceRow = row * this.prop.facesByRow + r;\n const isFirstRow = faceRow === 0;\n const isLastRow = faceRow === SPHERE_SEGMENTS / 2 - 1;\n\n // first vertex for this face (3 or 6 vertices in total)\n let firstVertex;\n if (isFirstRow) {\n firstVertex = faceCol * 3;\n }\n else if (isLastRow) {\n firstVertex = NB_VERTICES - SPHERE_SEGMENTS * 3 + faceCol * 3;\n }\n else {\n firstVertex = 3 * (SPHERE_SEGMENTS + (faceRow - 1) * SPHERE_SEGMENTS * 2 + faceCol * 2);\n }\n\n // swap material\n const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex;\n this.materials[matIndex] = material;\n\n // define new uvs\n const top = 1 - r / this.prop.facesByRow;\n const bottom = 1 - (r + 1) / this.prop.facesByRow;\n const left = c / this.prop.facesByCol;\n const right = (c + 1) / this.prop.facesByCol;\n\n if (isFirstRow) {\n uvs.setXY(firstVertex, (left + right) / 2, top);\n uvs.setXY(firstVertex + 1, left, bottom);\n uvs.setXY(firstVertex + 2, right, bottom);\n }\n else if (isLastRow) {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, (left + right) / 2, bottom);\n }\n else {\n uvs.setXY(firstVertex, right, top);\n uvs.setXY(firstVertex + 1, left, top);\n uvs.setXY(firstVertex + 2, right, bottom);\n uvs.setXY(firstVertex + 3, left, top);\n uvs.setXY(firstVertex + 4, left, bottom);\n uvs.setXY(firstVertex + 5, right, bottom);\n }\n }\n }\n\n uvs.needsUpdate = true;\n }\n\n /**\n * @summary Generates an material for errored tiles\n * @return {external:THREE.MeshBasicMaterial}\n * @private\n */\n __getErrorMaterial() {\n if (!this.prop.errorMaterial) {\n const canvas = document.createElement('canvas');\n canvas.width = this.prop.colSize;\n canvas.height = this.prop.rowSize;\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 this.prop.errorMaterial = new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n map : texture,\n });\n }\n\n return this.prop.errorMaterial;\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 if (this.config.baseBlur || 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 = buffer.width / 2;\n\n const ctx = buffer.getContext('2d');\n if (this.config.baseBlur) {\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\n/* eslint-disable */\n\n/**\n * UNUSED : Returns the apparent size of a segment on the screen\n * @private\n */\n// function getSegmentSize() {\n// const p1 = this.psv.prop.direction.clone();\n// const p2 = this.psv.prop.direction.clone();\n//\n// const angle = Math.PI * 2 / SPHERE_SEGMENTS / 2;\n// const dst = Math.atan(angle) * CONSTANTS.SPHERE_RADIUS;\n// const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.psv.prop.direction).normalize();\n//\n// p1.add(horizontalAxis.clone().multiplyScalar(dst));\n// p2.add(horizontalAxis.clone().multiplyScalar(-dst));\n//\n// const p1a = this.psv.dataHelper.vector3ToViewerCoords(p1);\n// const p2a = this.psv.dataHelper.vector3ToViewerCoords(p2);\n//\n// const segmentSize = p2a.x - p1a.x;\n// }\n"],"names":["Task","id","priority","fn","status","STATUS","PENDING","start","RUNNING","then","DONE","ERROR","cancel","CANCELLED","isCancelled","Queue","concurency","runningTasks","tasks","enqueue","task","clear","Object","values","forEach","setPriority","taskId","setAllPriorities","keys","length","nextTask","filter","sort","a","b","pop","SPHERE_SEGMENTS","NB_VERTICES","NB_GROUPS","QUEUE_CONCURENCY","tileId","tile","col","row","powerOfTwo","x","Math","log","EquirectangularTilesAdapter","psv","options","config","showErrorTile","baseBlur","materials","queue","prop","colSize","rowSize","facesByCol","facesByRow","tiles","geom","originalUvs","errorMaterial","loader","THREE","ImageLoader","withCredentials","setWithCredentials","requestHeaders","setRequestHeader","on","CONSTANTS","EVENTS","POSITION_UPDATED","ZOOM_UPDATED","destroy","off","__cleanup","map","dispose","handleEvent","e","type","__refresh","mat","loadTexture","panorama","width","cols","rows","tileUrl","Promise","reject","PSVError","height","setAttribute","clone","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","baseUrl","textureLoader","loadImage","p","setProgress","img","texture","__createBaseTexture","resolve","createMesh","scale","geometry","SphereGeometry","SPHERE_RADIUS","PI","toNonIndexed","i","k","addGroup","getAttribute","mesh","Mesh","set","setTexture","textureData","material","MeshBasicMaterial","side","BackSide","push","setTimeout","viewerSize","size","tilesToLoad","tilePosition","Vector3","tileTexturePosition","y","dataHelper","sphericalCoordsToVector3","textureCoordsToSphericalCoords","dot","direction","tileViewerPosition","vector3ToViewerCoords","angle","angleTo","__getAdjacentTiles","existingTile","find","c","min","__loadTiles","__loadTile","url","load","undefined","image","utils","createTexture","__swapMaterial","needsUpdate","catch","__getErrorMaterial","uvs","r","faceCol","faceRow","isFirstRow","isLastRow","firstVertex","matIndex","groups","g","materialIndex","top","bottom","left","right","setXY","canvas","document","createElement","ctx","getContext","fillStyle","fillRect","font","textAlign","textBaseline","fillText","CanvasTexture","logWarn","SYSTEM","maxTextureWidth","ratio","getMaxCanvasWidth","buffer","drawImage","AbstractAdapter","supportsTransition"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;MACaA,IAAb;EAUE;EACF;EACA;EACA;EACA;EACE,gBAAYC,EAAZ,EAAgBC,QAAhB,EAA0BC,EAA1B,EAA8B;EAC5B,SAAKF,EAAL,GAAUA,EAAV;EACA,SAAKC,QAAL,GAAgBA,QAAhB;EACA,SAAKC,EAAL,GAAUA,EAAV;EACA,SAAKC,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYC,OAA1B;EACD;;EApBH;;EAAA,SAsBEC,KAtBF,GAsBE,iBAAQ;EAAA;;EACN,SAAKH,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYG,OAA1B;EACA,WAAO,KAAKL,EAAL,CAAQ,IAAR,EACJM,IADI,CACC,YAAM;EACV,MAAA,KAAI,CAACL,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYK,IAA1B;EACD,KAHI,EAGF,YAAM;EACP,MAAA,KAAI,CAACN,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYM,KAA1B;EACD,KALI,CAAP;EAMD,GA9BH;;EAAA,SAgCEC,MAhCF,GAgCE,kBAAS;EACP,SAAKR,MAAL,GAAcJ,IAAI,CAACK,MAAL,CAAYQ,SAA1B;EACD,GAlCH;;EAAA,SAoCEC,WApCF,GAoCE,uBAAc;EACZ,WAAO,KAAKV,MAAL,KAAgBJ,IAAI,CAACK,MAAL,CAAYQ,SAAnC;EACD,GAtCH;;EAAA;EAAA;EAAab,KAEJK,SAAS;EACdC,EAAAA,OAAO,EAAI,CADG;EAEdE,EAAAA,OAAO,EAAI,CA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;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EArgBa7J,4BAEJ/C,KAAK;EAFD+C,4BAGJ8J,qBAAqB;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index d9647e562..f32feef81 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.2.1 + * Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -169,11 +169,24 @@ transition: transform 200ms ease, -webkit-transform 200ms ease; } +.psv-button:not(.psv-button--disabled):focus-visible { + outline: 2px dotted currentColor; + outline-offset: -2px; +} + .psv-container:not(.psv--is-touch) .psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button-svg { -webkit-transform: scale(1.2); transform: scale(1.2); } +.psv-move-button + .psv-move-button { + margin-left: -10px; +} + +.psv-custom-button { + width: auto; +} + .psv-autorotate-button.psv-button { width: 25px; height: 25px; @@ -508,6 +521,11 @@ height: 100%; } +.psv-panel-menu-item:focus-visible { + outline: 1px dotted currentColor; + outline-offset: -1px; +} + .psv-panel-menu--stripped .psv-panel-menu-item:hover { background: rgba(255, 255, 255, 0.2); } diff --git a/dist/photo-sphere-viewer.css.map b/dist/photo-sphere-viewer.css.map index aecae12c5..df4006f74 100644 --- a/dist/photo-sphere-viewer.css.map +++ b/dist/photo-sphere-viewer.css.map @@ -1 +1 @@ -{"version":3,"sources":["","index.scss%23sass","index.scss"],"names":[],"mappings":"AAAA;;;;;GAAA;ACAA;EACE,WAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,kBAAA;EACA,mHAAA;EACA,gBAAA;ACCF;;ADCA;EACE,eAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,OAAA;ACEF;;ADAA;EACE,kBAAA;E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DAAA;EAAA,+CAAA;EAAA,uCAAA;EAAA,0DAAA;ACyIJ;;ADxII;EACE,uCAAA;AC2IN;;AD1IE;EACE,uCAAA;UAAA,+BAAA;EACA,UAAA;EACA,kCAAA;UAAA,0BAAA;AC6IJ","file":"photo-sphere-viewer.css","sourcesContent":[null,".psv-container {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n position: relative;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n overflow: hidden; }\n\n.psv-container--fullscreen {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.psv-canvas-container {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 0;\n transition: opacity linear 100ms; }\n\n.psv-canvas {\n display: block; }\n\n.psv-loader-container {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 80; }\n\n.psv-loader {\n position: relative;\n text-align: center;\n color: rgba(61, 61, 61, 0.7);\n width: 150px;\n height: 150px;\n border: 10px solid transparent; }\n .psv-loader::before {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle; }\n .psv-loader, .psv-loader-image, .psv-loader-text {\n display: inline-block;\n vertical-align: middle; }\n .psv-loader-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%; }\n .psv-loader-text {\n font: 14px sans-serif; }\n\n.psv-navbar {\n display: flex;\n position: absolute;\n z-index: 90;\n bottom: -40px;\n left: 0;\n width: 100%;\n height: 40px;\n background: rgba(61, 61, 61, 0.5);\n transition: bottom ease-in-out .1s; }\n .psv-navbar--open {\n bottom: 0; }\n .psv-navbar,\n .psv-navbar * {\n box-sizing: content-box; }\n\n.psv-caption {\n flex: 1 1 100%;\n color: rgba(255, 255, 255, 0.7);\n overflow: hidden;\n text-align: center; }\n .psv-caption-icon {\n height: 20px;\n width: 20px;\n cursor: pointer; }\n .psv-caption-icon * {\n fill: rgba(255, 255, 255, 0.7); }\n .psv-caption-content {\n display: inline-block;\n padding: 10px;\n font: 16px sans-serif;\n white-space: nowrap; }\n\n.psv-button {\n flex: 0 0 auto;\n padding: 10px;\n position: relative;\n cursor: pointer;\n height: 20px;\n width: 20px;\n background: transparent;\n color: rgba(255, 255, 255, 0.7); }\n .psv-button--active {\n background: rgba(255, 255, 255, 0.2); }\n .psv-button--disabled {\n pointer-events: none;\n opacity: 0.5; }\n .psv-button .psv-button-svg {\n width: 100%;\n transform: scale(1);\n transition: transform 200ms ease; }\n\n.psv-container:not(.psv--is-touch) .psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button-svg {\n transform: scale(1.2); }\n\n.psv-autorotate-button.psv-button {\n width: 25px;\n height: 25px;\n padding: 7.5px; }\n\n.psv-zoom-range.psv-button {\n width: 80px;\n height: 1px;\n margin: 10px 0;\n padding: 9.5px 0;\n max-width: 600px; }\n\n.psv-zoom-range-line {\n position: relative;\n width: 80px;\n height: 1px;\n background: rgba(255, 255, 255, 0.7);\n transition: all .3s ease; }\n\n.psv-zoom-range-handle {\n position: absolute;\n border-radius: 50%;\n top: -3px;\n width: 7px;\n height: 7px;\n background: rgba(255, 255, 255, 0.7);\n transform: scale(1);\n transition: transform .3s ease; }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-line {\n box-shadow: 0 0 2px rgba(255, 255, 255, 0.7); }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-handle {\n transform: scale(1.3); }\n\n.psv-notification {\n position: absolute;\n z-index: 100;\n bottom: -40px;\n display: flex;\n justify-content: center;\n box-sizing: border-box;\n width: 100%;\n padding: 0 2em;\n opacity: 0;\n transition-property: opacity, bottom;\n transition-timing-function: ease-in-out;\n transition-duration: 200ms; }\n .psv-notification-content {\n max-width: 50em;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n font: 14px sans-serif;\n color: white; }\n .psv-notification--visible {\n opacity: 100;\n bottom: 80px; }\n\n.psv-overlay {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: absolute;\n z-index: 110;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n color: black;\n opacity: 0.8; }\n .psv-overlay-image {\n margin-bottom: 4vh; }\n .psv-overlay-image svg {\n width: 50vw; }\n @media (orientation: landscape) {\n .psv-overlay-image svg {\n /* stylelint-disable-line scss/media-feature-value-dollar-variable */\n width: 25vw; } }\n .psv-overlay-text {\n font: 30px sans-serif;\n text-align: center; }\n .psv-overlay-subtext {\n font: 20px sans-serif;\n opacity: .8;\n text-align: center; }\n\n/* stylelint-disable scss/no-duplicate-dollar-variables */\n/* stylelint-enable */\n.psv-panel {\n position: absolute;\n z-index: 90;\n right: 0;\n height: 100%;\n width: 400px;\n max-width: calc(100% - 24px);\n background: rgba(10, 10, 10, 0.7);\n transform: translate3d(100%, 0, 0);\n opacity: 0;\n transition-property: opacity, transform;\n transition-timing-function: ease-in-out;\n transition-duration: .1s;\n cursor: default;\n margin-left: 9px; }\n .psv--has-navbar .psv-panel {\n height: calc(100% - 40px); }\n .psv-panel-close-button {\n display: none;\n position: absolute;\n top: 0;\n left: -24px;\n width: 24px;\n height: 24px;\n background: rgba(0, 0, 0, 0.9); }\n .psv-panel-close-button::before, .psv-panel-close-button::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 4px;\n width: 15px;\n height: 1px;\n background-color: #fff;\n transition: .2s ease-in-out;\n transition-property: width, left, transform; }\n .psv-panel-close-button::before {\n transform: rotate(45deg); }\n .psv-panel-close-button::after {\n transform: rotate(-45deg); }\n .psv-panel-close-button:hover::before, .psv-panel-close-button:hover::after {\n left: 0;\n width: 23px; }\n .psv-panel-close-button:hover::before {\n transform: rotate(135deg); }\n .psv-panel-close-button:hover::after {\n transform: rotate(45deg); }\n .psv-panel-resizer {\n display: none;\n position: absolute;\n top: 0;\n left: -9px;\n width: 9px;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.9);\n cursor: col-resize; }\n .psv-panel-resizer::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 1px;\n margin-top: -14.5px;\n width: 1px;\n height: 1px;\n box-shadow: 1px 0 #fff, 3px 0px #fff, 5px 0px #fff, 1px 2px #fff, 3px 2px #fff, 5px 2px #fff, 1px 4px #fff, 3px 4px #fff, 5px 4px #fff, 1px 6px #fff, 3px 6px #fff, 5px 6px #fff, 1px 8px #fff, 3px 8px #fff, 5px 8px #fff, 1px 10px #fff, 3px 10px #fff, 5px 10px #fff, 1px 12px #fff, 3px 12px #fff, 5px 12px #fff, 1px 14px #fff, 3px 14px #fff, 5px 14px #fff, 1px 16px #fff, 3px 16px #fff, 5px 16px #fff, 1px 18px #fff, 3px 18px #fff, 5px 18px #fff, 1px 20px #fff, 3px 20px #fff, 5px 20px #fff, 1px 22px #fff, 3px 22px #fff, 5px 22px #fff, 1px 24px #fff, 3px 24px #fff, 5px 24px #fff, 1px 26px #fff, 3px 26px #fff, 5px 26px #fff, 1px 28px #fff, 3px 28px #fff, 5px 28px #fff;\n background: transparent; }\n .psv-panel-content {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n color: gainsboro;\n font: 16px sans-serif;\n overflow: auto; }\n .psv-panel-content:not(.psv-panel-content--no-margin) {\n padding: 1em; }\n .psv-panel-content--no-interaction {\n user-select: none;\n pointer-events: none; }\n .psv-panel--open {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: .2s; }\n .psv-panel--open .psv-panel-close-button,\n .psv-panel--open .psv-panel-resizer {\n display: block; }\n\n.psv-panel-menu-title {\n display: flex;\n align-items: center;\n font: 24px sans-serif;\n margin: 24px 12px; }\n .psv-panel-menu-title svg {\n width: 24px;\n height: 24px;\n margin-right: 12px; }\n\n.psv-panel-menu-list {\n list-style: none;\n margin: 0;\n padding: 0;\n overflow: hidden; }\n\n.psv-panel-menu-item {\n min-height: 20px;\n padding: 0.5em 1em;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n transition: background .1s ease-in-out; }\n .psv-panel-menu-item-icon {\n flex: none;\n height: 20px;\n width: 20px;\n margin-right: 0.5em; }\n .psv-panel-menu-item-icon img {\n max-width: 100%;\n max-height: 100%; }\n .psv-panel-menu-item-icon svg {\n width: 100%;\n height: 100%; }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd)::before {\n background: rgba(255, 255, 255, 0.1); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even)::before {\n background: transparent; }\n\n.psv-container:not(.psv--is-touch) .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-tooltip {\n position: absolute;\n z-index: 50;\n box-sizing: border-box;\n max-width: 200px;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n opacity: 0;\n transition-property: opacity;\n transition-timing-function: ease-in-out;\n transition-duration: 100ms;\n outline: 5px solid transparent; }\n .psv-tooltip-content {\n color: white;\n font: 14px sans-serif;\n text-shadow: 0 1px #000; }\n .psv-tooltip-arrow {\n position: absolute;\n height: 0;\n width: 0;\n border: 7px solid transparent; }\n .psv-tooltip--bottom-center {\n box-shadow: 0 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-center .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-left {\n box-shadow: -3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-left .psv-tooltip-arrow {\n border-left-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-center {\n box-shadow: 0 -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-center .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-right {\n box-shadow: 3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(-5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-right .psv-tooltip-arrow {\n border-right-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-left {\n box-shadow: -3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-left .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-right {\n box-shadow: 3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-right .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-left {\n box-shadow: -3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-left .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-right {\n box-shadow: 3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-right .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--visible {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: 100ms; }\n",".psv-container {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n position: relative;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n overflow: hidden; }\n\n.psv-container--fullscreen {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.psv-canvas-container {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 0;\n transition: opacity linear 100ms; }\n\n.psv-canvas {\n display: block; }\n\n.psv-loader-container {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 80; }\n\n.psv-loader {\n position: relative;\n text-align: center;\n color: rgba(61, 61, 61, 0.7);\n width: 150px;\n height: 150px;\n border: 10px solid transparent; }\n .psv-loader::before {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle; }\n .psv-loader, .psv-loader-image, .psv-loader-text {\n display: inline-block;\n vertical-align: middle; }\n .psv-loader-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%; }\n .psv-loader-text {\n font: 14px sans-serif; }\n\n.psv-navbar {\n display: flex;\n position: absolute;\n z-index: 90;\n bottom: -40px;\n left: 0;\n width: 100%;\n height: 40px;\n background: rgba(61, 61, 61, 0.5);\n transition: bottom ease-in-out .1s; }\n .psv-navbar--open {\n bottom: 0; }\n .psv-navbar,\n .psv-navbar * {\n box-sizing: content-box; }\n\n.psv-caption {\n flex: 1 1 100%;\n color: rgba(255, 255, 255, 0.7);\n overflow: hidden;\n text-align: center; }\n .psv-caption-icon {\n height: 20px;\n width: 20px;\n cursor: pointer; }\n .psv-caption-icon * {\n fill: rgba(255, 255, 255, 0.7); }\n .psv-caption-content {\n display: inline-block;\n padding: 10px;\n font: 16px sans-serif;\n white-space: nowrap; }\n\n.psv-button {\n flex: 0 0 auto;\n padding: 10px;\n position: relative;\n cursor: pointer;\n height: 20px;\n width: 20px;\n background: transparent;\n color: rgba(255, 255, 255, 0.7); }\n .psv-button--active {\n background: rgba(255, 255, 255, 0.2); }\n .psv-button--disabled {\n pointer-events: none;\n opacity: 0.5; }\n .psv-button .psv-button-svg {\n width: 100%;\n transform: scale(1);\n transition: transform 200ms ease; }\n\n.psv-container:not(.psv--is-touch) .psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button-svg {\n transform: scale(1.2); }\n\n.psv-autorotate-button.psv-button {\n width: 25px;\n height: 25px;\n padding: 7.5px; }\n\n.psv-zoom-range.psv-button {\n width: 80px;\n height: 1px;\n margin: 10px 0;\n padding: 9.5px 0;\n max-width: 600px; }\n\n.psv-zoom-range-line {\n position: relative;\n width: 80px;\n height: 1px;\n background: rgba(255, 255, 255, 0.7);\n transition: all .3s ease; }\n\n.psv-zoom-range-handle {\n position: absolute;\n border-radius: 50%;\n top: -3px;\n width: 7px;\n height: 7px;\n background: rgba(255, 255, 255, 0.7);\n transform: scale(1);\n transition: transform .3s ease; }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-line {\n box-shadow: 0 0 2px rgba(255, 255, 255, 0.7); }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-handle {\n transform: scale(1.3); }\n\n.psv-notification {\n position: absolute;\n z-index: 100;\n bottom: -40px;\n display: flex;\n justify-content: center;\n box-sizing: border-box;\n width: 100%;\n padding: 0 2em;\n opacity: 0;\n transition-property: opacity, bottom;\n transition-timing-function: ease-in-out;\n transition-duration: 200ms; }\n .psv-notification-content {\n max-width: 50em;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n font: 14px sans-serif;\n color: white; }\n .psv-notification--visible {\n opacity: 100;\n bottom: 80px; }\n\n.psv-overlay {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: absolute;\n z-index: 110;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n color: black;\n opacity: 0.8; }\n .psv-overlay-image {\n margin-bottom: 4vh; }\n .psv-overlay-image svg {\n width: 50vw; }\n @media (orientation: landscape) {\n .psv-overlay-image svg {\n /* stylelint-disable-line scss/media-feature-value-dollar-variable */\n width: 25vw; } }\n .psv-overlay-text {\n font: 30px sans-serif;\n text-align: center; }\n .psv-overlay-subtext {\n font: 20px sans-serif;\n opacity: .8;\n text-align: center; }\n\n/* stylelint-disable scss/no-duplicate-dollar-variables */\n/* stylelint-enable */\n.psv-panel {\n position: absolute;\n z-index: 90;\n right: 0;\n height: 100%;\n width: 400px;\n max-width: calc(100% - 24px);\n background: rgba(10, 10, 10, 0.7);\n transform: translate3d(100%, 0, 0);\n opacity: 0;\n transition-property: opacity, transform;\n transition-timing-function: ease-in-out;\n transition-duration: .1s;\n cursor: default;\n margin-left: 9px; }\n .psv--has-navbar .psv-panel {\n height: calc(100% - 40px); }\n .psv-panel-close-button {\n display: none;\n position: absolute;\n top: 0;\n left: -24px;\n width: 24px;\n height: 24px;\n background: rgba(0, 0, 0, 0.9); }\n .psv-panel-close-button::before, .psv-panel-close-button::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 4px;\n width: 15px;\n height: 1px;\n background-color: #fff;\n transition: .2s ease-in-out;\n transition-property: width, left, transform; }\n .psv-panel-close-button::before {\n transform: rotate(45deg); }\n .psv-panel-close-button::after {\n transform: rotate(-45deg); }\n .psv-panel-close-button:hover::before, .psv-panel-close-button:hover::after {\n left: 0;\n width: 23px; }\n .psv-panel-close-button:hover::before {\n transform: rotate(135deg); }\n .psv-panel-close-button:hover::after {\n transform: rotate(45deg); }\n .psv-panel-resizer {\n display: none;\n position: absolute;\n top: 0;\n left: -9px;\n width: 9px;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.9);\n cursor: col-resize; }\n .psv-panel-resizer::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 1px;\n margin-top: -14.5px;\n width: 1px;\n height: 1px;\n box-shadow: 1px 0 #fff, 3px 0px #fff, 5px 0px #fff, 1px 2px #fff, 3px 2px #fff, 5px 2px #fff, 1px 4px #fff, 3px 4px #fff, 5px 4px #fff, 1px 6px #fff, 3px 6px #fff, 5px 6px #fff, 1px 8px #fff, 3px 8px #fff, 5px 8px #fff, 1px 10px #fff, 3px 10px #fff, 5px 10px #fff, 1px 12px #fff, 3px 12px #fff, 5px 12px #fff, 1px 14px #fff, 3px 14px #fff, 5px 14px #fff, 1px 16px #fff, 3px 16px #fff, 5px 16px #fff, 1px 18px #fff, 3px 18px #fff, 5px 18px #fff, 1px 20px #fff, 3px 20px #fff, 5px 20px #fff, 1px 22px #fff, 3px 22px #fff, 5px 22px #fff, 1px 24px #fff, 3px 24px #fff, 5px 24px #fff, 1px 26px #fff, 3px 26px #fff, 5px 26px #fff, 1px 28px #fff, 3px 28px #fff, 5px 28px #fff;\n background: transparent; }\n .psv-panel-content {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n color: gainsboro;\n font: 16px sans-serif;\n overflow: auto; }\n .psv-panel-content:not(.psv-panel-content--no-margin) {\n padding: 1em; }\n .psv-panel-content--no-interaction {\n user-select: none;\n pointer-events: none; }\n .psv-panel--open {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: .2s; }\n .psv-panel--open .psv-panel-close-button,\n .psv-panel--open .psv-panel-resizer {\n display: block; }\n\n.psv-panel-menu-title {\n display: flex;\n align-items: center;\n font: 24px sans-serif;\n margin: 24px 12px; }\n .psv-panel-menu-title svg {\n width: 24px;\n height: 24px;\n margin-right: 12px; }\n\n.psv-panel-menu-list {\n list-style: none;\n margin: 0;\n padding: 0;\n overflow: hidden; }\n\n.psv-panel-menu-item {\n min-height: 20px;\n padding: 0.5em 1em;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n transition: background .1s ease-in-out; }\n .psv-panel-menu-item-icon {\n flex: none;\n height: 20px;\n width: 20px;\n margin-right: 0.5em; }\n .psv-panel-menu-item-icon img {\n max-width: 100%;\n max-height: 100%; }\n .psv-panel-menu-item-icon svg {\n width: 100%;\n height: 100%; }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd)::before {\n background: rgba(255, 255, 255, 0.1); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even)::before {\n background: transparent; }\n\n.psv-container:not(.psv--is-touch) .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-tooltip {\n position: absolute;\n z-index: 50;\n box-sizing: border-box;\n max-width: 200px;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n opacity: 0;\n transition-property: opacity;\n transition-timing-function: ease-in-out;\n transition-duration: 100ms;\n outline: 5px solid transparent; }\n .psv-tooltip-content {\n color: white;\n font: 14px sans-serif;\n text-shadow: 0 1px #000; }\n .psv-tooltip-arrow {\n position: absolute;\n height: 0;\n width: 0;\n border: 7px solid transparent; }\n .psv-tooltip--bottom-center {\n box-shadow: 0 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-center .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-left {\n box-shadow: -3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-left .psv-tooltip-arrow {\n border-left-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-center {\n box-shadow: 0 -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-center .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-right {\n box-shadow: 3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(-5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-right .psv-tooltip-arrow {\n border-right-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-left {\n box-shadow: -3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-left .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-right {\n box-shadow: 3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-right .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-left {\n box-shadow: -3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-left .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-right {\n box-shadow: 3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-right .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--visible {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: 100ms; }\n"]} \ No newline at end of file +{"version":3,"sources":["","index.scss%23sass","index.scss"],"names":[],"mappings":"AAAA;;;;;GAAA;ACAA;EACE,WAAA;EACA,YAAA;EACA,SAAA;EACA,UAAA;EACA,kBAAA;EACA,mHAAA;EACA,gBAAA;ACCF;;ADCA;EACE,eAAA;EACA,MAAA;EACA,QAAA;EACA,SAAA;EACA,OAAA;ACEF;;ADAA;EACE,kBAAA;EACA,MAAA;EACA,OAAA;EACA,UAAA;ECGF,wCAAA;EAAA,gCAAA;AACA;;ADDA;EACE,cAAA;ACIF;;ADFA;EACE,oBAAA;EAAA,oBAAA;EAAA,aAA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uDAAA;EAAA,+CAAA;EAAA,uCAAA;EAAA,0DAAA;AC8IJ;;AD7II;EACE,uCAAA;ACgJN;;AD/IE;EACE,uCAAA;UAAA,+BAAA;EACA,UAAA;EACA,kCAAA;UAAA,0BAAA;ACkJJ","file":"photo-sphere-viewer.css","sourcesContent":[null,".psv-container {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n position: relative;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n overflow: hidden; }\n\n.psv-container--fullscreen {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.psv-canvas-container {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 0;\n transition: opacity linear 100ms; }\n\n.psv-canvas {\n display: block; }\n\n.psv-loader-container {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 80; }\n\n.psv-loader {\n position: relative;\n text-align: center;\n color: rgba(61, 61, 61, 0.7);\n width: 150px;\n height: 150px;\n border: 10px solid transparent; }\n .psv-loader::before {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle; }\n .psv-loader, .psv-loader-image, .psv-loader-text {\n display: inline-block;\n vertical-align: middle; }\n .psv-loader-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%; }\n .psv-loader-text {\n font: 14px sans-serif; }\n\n.psv-navbar {\n display: flex;\n position: absolute;\n z-index: 90;\n bottom: -40px;\n left: 0;\n width: 100%;\n height: 40px;\n background: rgba(61, 61, 61, 0.5);\n transition: bottom ease-in-out .1s; }\n .psv-navbar--open {\n bottom: 0; }\n .psv-navbar,\n .psv-navbar * {\n box-sizing: content-box; }\n\n.psv-caption {\n flex: 1 1 100%;\n color: rgba(255, 255, 255, 0.7);\n overflow: hidden;\n text-align: center; }\n .psv-caption-icon {\n height: 20px;\n width: 20px;\n cursor: pointer; }\n .psv-caption-icon * {\n fill: rgba(255, 255, 255, 0.7); }\n .psv-caption-content {\n display: inline-block;\n padding: 10px;\n font: 16px sans-serif;\n white-space: nowrap; }\n\n.psv-button {\n flex: 0 0 auto;\n padding: 10px;\n position: relative;\n cursor: pointer;\n height: 20px;\n width: 20px;\n background: transparent;\n color: rgba(255, 255, 255, 0.7); }\n .psv-button--active {\n background: rgba(255, 255, 255, 0.2); }\n .psv-button--disabled {\n pointer-events: none;\n opacity: 0.5; }\n .psv-button .psv-button-svg {\n width: 100%;\n transform: scale(1);\n transition: transform 200ms ease; }\n\n.psv-button:not(.psv-button--disabled):focus-visible {\n outline: 2px dotted currentColor;\n outline-offset: -2px; }\n\n.psv-container:not(.psv--is-touch) .psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button-svg {\n transform: scale(1.2); }\n\n.psv-move-button + .psv-move-button {\n margin-left: -10px; }\n\n.psv-custom-button {\n width: auto; }\n\n.psv-autorotate-button.psv-button {\n width: 25px;\n height: 25px;\n padding: 7.5px; }\n\n.psv-zoom-range.psv-button {\n width: 80px;\n height: 1px;\n margin: 10px 0;\n padding: 9.5px 0;\n max-width: 600px; }\n\n.psv-zoom-range-line {\n position: relative;\n width: 80px;\n height: 1px;\n background: rgba(255, 255, 255, 0.7);\n transition: all .3s ease; }\n\n.psv-zoom-range-handle {\n position: absolute;\n border-radius: 50%;\n top: -3px;\n width: 7px;\n height: 7px;\n background: rgba(255, 255, 255, 0.7);\n transform: scale(1);\n transition: transform .3s ease; }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-line {\n box-shadow: 0 0 2px rgba(255, 255, 255, 0.7); }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-handle {\n transform: scale(1.3); }\n\n.psv-notification {\n position: absolute;\n z-index: 100;\n bottom: -40px;\n display: flex;\n justify-content: center;\n box-sizing: border-box;\n width: 100%;\n padding: 0 2em;\n opacity: 0;\n transition-property: opacity, bottom;\n transition-timing-function: ease-in-out;\n transition-duration: 200ms; }\n .psv-notification-content {\n max-width: 50em;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n font: 14px sans-serif;\n color: white; }\n .psv-notification--visible {\n opacity: 100;\n bottom: 80px; }\n\n.psv-overlay {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: absolute;\n z-index: 110;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n color: black;\n opacity: 0.8; }\n .psv-overlay-image {\n margin-bottom: 4vh; }\n .psv-overlay-image svg {\n width: 50vw; }\n @media (orientation: landscape) {\n .psv-overlay-image svg {\n /* stylelint-disable-line scss/media-feature-value-dollar-variable */\n width: 25vw; } }\n .psv-overlay-text {\n font: 30px sans-serif;\n text-align: center; }\n .psv-overlay-subtext {\n font: 20px sans-serif;\n opacity: .8;\n text-align: center; }\n\n/* stylelint-disable scss/no-duplicate-dollar-variables */\n/* stylelint-enable */\n.psv-panel {\n position: absolute;\n z-index: 90;\n right: 0;\n height: 100%;\n width: 400px;\n max-width: calc(100% - 24px);\n background: rgba(10, 10, 10, 0.7);\n transform: translate3d(100%, 0, 0);\n opacity: 0;\n transition-property: opacity, transform;\n transition-timing-function: ease-in-out;\n transition-duration: .1s;\n cursor: default;\n margin-left: 9px; }\n .psv--has-navbar .psv-panel {\n height: calc(100% - 40px); }\n .psv-panel-close-button {\n display: none;\n position: absolute;\n top: 0;\n left: -24px;\n width: 24px;\n height: 24px;\n background: rgba(0, 0, 0, 0.9); }\n .psv-panel-close-button::before, .psv-panel-close-button::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 4px;\n width: 15px;\n height: 1px;\n background-color: #fff;\n transition: .2s ease-in-out;\n transition-property: width, left, transform; }\n .psv-panel-close-button::before {\n transform: rotate(45deg); }\n .psv-panel-close-button::after {\n transform: rotate(-45deg); }\n .psv-panel-close-button:hover::before, .psv-panel-close-button:hover::after {\n left: 0;\n width: 23px; }\n .psv-panel-close-button:hover::before {\n transform: rotate(135deg); }\n .psv-panel-close-button:hover::after {\n transform: rotate(45deg); }\n .psv-panel-resizer {\n display: none;\n position: absolute;\n top: 0;\n left: -9px;\n width: 9px;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.9);\n cursor: col-resize; }\n .psv-panel-resizer::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 1px;\n margin-top: -14.5px;\n width: 1px;\n height: 1px;\n box-shadow: 1px 0 #fff, 3px 0px #fff, 5px 0px #fff, 1px 2px #fff, 3px 2px #fff, 5px 2px #fff, 1px 4px #fff, 3px 4px #fff, 5px 4px #fff, 1px 6px #fff, 3px 6px #fff, 5px 6px #fff, 1px 8px #fff, 3px 8px #fff, 5px 8px #fff, 1px 10px #fff, 3px 10px #fff, 5px 10px #fff, 1px 12px #fff, 3px 12px #fff, 5px 12px #fff, 1px 14px #fff, 3px 14px #fff, 5px 14px #fff, 1px 16px #fff, 3px 16px #fff, 5px 16px #fff, 1px 18px #fff, 3px 18px #fff, 5px 18px #fff, 1px 20px #fff, 3px 20px #fff, 5px 20px #fff, 1px 22px #fff, 3px 22px #fff, 5px 22px #fff, 1px 24px #fff, 3px 24px #fff, 5px 24px #fff, 1px 26px #fff, 3px 26px #fff, 5px 26px #fff, 1px 28px #fff, 3px 28px #fff, 5px 28px #fff;\n background: transparent; }\n .psv-panel-content {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n color: gainsboro;\n font: 16px sans-serif;\n overflow: auto; }\n .psv-panel-content:not(.psv-panel-content--no-margin) {\n padding: 1em; }\n .psv-panel-content--no-interaction {\n user-select: none;\n pointer-events: none; }\n .psv-panel--open {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: .2s; }\n .psv-panel--open .psv-panel-close-button,\n .psv-panel--open .psv-panel-resizer {\n display: block; }\n\n.psv-panel-menu-title {\n display: flex;\n align-items: center;\n font: 24px sans-serif;\n margin: 24px 12px; }\n .psv-panel-menu-title svg {\n width: 24px;\n height: 24px;\n margin-right: 12px; }\n\n.psv-panel-menu-list {\n list-style: none;\n margin: 0;\n padding: 0;\n overflow: hidden; }\n\n.psv-panel-menu-item {\n min-height: 20px;\n padding: 0.5em 1em;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n transition: background .1s ease-in-out; }\n .psv-panel-menu-item-icon {\n flex: none;\n height: 20px;\n width: 20px;\n margin-right: 0.5em; }\n .psv-panel-menu-item-icon img {\n max-width: 100%;\n max-height: 100%; }\n .psv-panel-menu-item-icon svg {\n width: 100%;\n height: 100%; }\n .psv-panel-menu-item:focus-visible {\n outline: 1px dotted currentColor;\n outline-offset: -1px; }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd)::before {\n background: rgba(255, 255, 255, 0.1); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even)::before {\n background: transparent; }\n\n.psv-container:not(.psv--is-touch) .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-tooltip {\n position: absolute;\n z-index: 50;\n box-sizing: border-box;\n max-width: 200px;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n opacity: 0;\n transition-property: opacity;\n transition-timing-function: ease-in-out;\n transition-duration: 100ms;\n outline: 5px solid transparent; }\n .psv-tooltip-content {\n color: white;\n font: 14px sans-serif;\n text-shadow: 0 1px #000; }\n .psv-tooltip-arrow {\n position: absolute;\n height: 0;\n width: 0;\n border: 7px solid transparent; }\n .psv-tooltip--bottom-center {\n box-shadow: 0 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-center .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-left {\n box-shadow: -3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-left .psv-tooltip-arrow {\n border-left-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-center {\n box-shadow: 0 -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-center .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-right {\n box-shadow: 3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(-5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-right .psv-tooltip-arrow {\n border-right-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-left {\n box-shadow: -3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-left .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-right {\n box-shadow: 3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-right .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-left {\n box-shadow: -3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-left .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-right {\n box-shadow: 3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-right .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--visible {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: 100ms; }\n",".psv-container {\n width: 100%;\n height: 100%;\n margin: 0;\n padding: 0;\n position: relative;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n overflow: hidden; }\n\n.psv-container--fullscreen {\n position: fixed;\n top: 0;\n right: 0;\n bottom: 0;\n left: 0; }\n\n.psv-canvas-container {\n position: absolute;\n top: 0;\n left: 0;\n z-index: 0;\n transition: opacity linear 100ms; }\n\n.psv-canvas {\n display: block; }\n\n.psv-loader-container {\n display: flex;\n align-items: center;\n justify-content: center;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n z-index: 80; }\n\n.psv-loader {\n position: relative;\n text-align: center;\n color: rgba(61, 61, 61, 0.7);\n width: 150px;\n height: 150px;\n border: 10px solid transparent; }\n .psv-loader::before {\n content: '';\n display: inline-block;\n height: 100%;\n vertical-align: middle; }\n .psv-loader, .psv-loader-image, .psv-loader-text {\n display: inline-block;\n vertical-align: middle; }\n .psv-loader-canvas {\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%; }\n .psv-loader-text {\n font: 14px sans-serif; }\n\n.psv-navbar {\n display: flex;\n position: absolute;\n z-index: 90;\n bottom: -40px;\n left: 0;\n width: 100%;\n height: 40px;\n background: rgba(61, 61, 61, 0.5);\n transition: bottom ease-in-out .1s; }\n .psv-navbar--open {\n bottom: 0; }\n .psv-navbar,\n .psv-navbar * {\n box-sizing: content-box; }\n\n.psv-caption {\n flex: 1 1 100%;\n color: rgba(255, 255, 255, 0.7);\n overflow: hidden;\n text-align: center; }\n .psv-caption-icon {\n height: 20px;\n width: 20px;\n cursor: pointer; }\n .psv-caption-icon * {\n fill: rgba(255, 255, 255, 0.7); }\n .psv-caption-content {\n display: inline-block;\n padding: 10px;\n font: 16px sans-serif;\n white-space: nowrap; }\n\n.psv-button {\n flex: 0 0 auto;\n padding: 10px;\n position: relative;\n cursor: pointer;\n height: 20px;\n width: 20px;\n background: transparent;\n color: rgba(255, 255, 255, 0.7); }\n .psv-button--active {\n background: rgba(255, 255, 255, 0.2); }\n .psv-button--disabled {\n pointer-events: none;\n opacity: 0.5; }\n .psv-button .psv-button-svg {\n width: 100%;\n transform: scale(1);\n transition: transform 200ms ease; }\n\n.psv-button:not(.psv-button--disabled):focus-visible {\n outline: 2px dotted currentColor;\n outline-offset: -2px; }\n\n.psv-container:not(.psv--is-touch) .psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button-svg {\n transform: scale(1.2); }\n\n.psv-move-button + .psv-move-button {\n margin-left: -10px; }\n\n.psv-custom-button {\n width: auto; }\n\n.psv-autorotate-button.psv-button {\n width: 25px;\n height: 25px;\n padding: 7.5px; }\n\n.psv-zoom-range.psv-button {\n width: 80px;\n height: 1px;\n margin: 10px 0;\n padding: 9.5px 0;\n max-width: 600px; }\n\n.psv-zoom-range-line {\n position: relative;\n width: 80px;\n height: 1px;\n background: rgba(255, 255, 255, 0.7);\n transition: all .3s ease; }\n\n.psv-zoom-range-handle {\n position: absolute;\n border-radius: 50%;\n top: -3px;\n width: 7px;\n height: 7px;\n background: rgba(255, 255, 255, 0.7);\n transform: scale(1);\n transition: transform .3s ease; }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-line {\n box-shadow: 0 0 2px rgba(255, 255, 255, 0.7); }\n\n.psv-zoom-range:not(.psv-button--disabled):hover .psv-zoom-range-handle {\n transform: scale(1.3); }\n\n.psv-notification {\n position: absolute;\n z-index: 100;\n bottom: -40px;\n display: flex;\n justify-content: center;\n box-sizing: border-box;\n width: 100%;\n padding: 0 2em;\n opacity: 0;\n transition-property: opacity, bottom;\n transition-timing-function: ease-in-out;\n transition-duration: 200ms; }\n .psv-notification-content {\n max-width: 50em;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n font: 14px sans-serif;\n color: white; }\n .psv-notification--visible {\n opacity: 100;\n bottom: 80px; }\n\n.psv-overlay {\n display: flex;\n flex-direction: column;\n align-items: center;\n justify-content: center;\n position: absolute;\n z-index: 110;\n top: 0;\n left: 0;\n bottom: 0;\n right: 0;\n background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%);\n color: black;\n opacity: 0.8; }\n .psv-overlay-image {\n margin-bottom: 4vh; }\n .psv-overlay-image svg {\n width: 50vw; }\n @media (orientation: landscape) {\n .psv-overlay-image svg {\n /* stylelint-disable-line scss/media-feature-value-dollar-variable */\n width: 25vw; } }\n .psv-overlay-text {\n font: 30px sans-serif;\n text-align: center; }\n .psv-overlay-subtext {\n font: 20px sans-serif;\n opacity: .8;\n text-align: center; }\n\n/* stylelint-disable scss/no-duplicate-dollar-variables */\n/* stylelint-enable */\n.psv-panel {\n position: absolute;\n z-index: 90;\n right: 0;\n height: 100%;\n width: 400px;\n max-width: calc(100% - 24px);\n background: rgba(10, 10, 10, 0.7);\n transform: translate3d(100%, 0, 0);\n opacity: 0;\n transition-property: opacity, transform;\n transition-timing-function: ease-in-out;\n transition-duration: .1s;\n cursor: default;\n margin-left: 9px; }\n .psv--has-navbar .psv-panel {\n height: calc(100% - 40px); }\n .psv-panel-close-button {\n display: none;\n position: absolute;\n top: 0;\n left: -24px;\n width: 24px;\n height: 24px;\n background: rgba(0, 0, 0, 0.9); }\n .psv-panel-close-button::before, .psv-panel-close-button::after {\n content: '';\n position: absolute;\n top: 50%;\n left: 4px;\n width: 15px;\n height: 1px;\n background-color: #fff;\n transition: .2s ease-in-out;\n transition-property: width, left, transform; }\n .psv-panel-close-button::before {\n transform: rotate(45deg); }\n .psv-panel-close-button::after {\n transform: rotate(-45deg); }\n .psv-panel-close-button:hover::before, .psv-panel-close-button:hover::after {\n left: 0;\n width: 23px; }\n .psv-panel-close-button:hover::before {\n transform: rotate(135deg); }\n .psv-panel-close-button:hover::after {\n transform: rotate(45deg); }\n .psv-panel-resizer {\n display: none;\n position: absolute;\n top: 0;\n left: -9px;\n width: 9px;\n height: 100%;\n background-color: rgba(0, 0, 0, 0.9);\n cursor: col-resize; }\n .psv-panel-resizer::before {\n content: '';\n position: absolute;\n top: 50%;\n left: 1px;\n margin-top: -14.5px;\n width: 1px;\n height: 1px;\n box-shadow: 1px 0 #fff, 3px 0px #fff, 5px 0px #fff, 1px 2px #fff, 3px 2px #fff, 5px 2px #fff, 1px 4px #fff, 3px 4px #fff, 5px 4px #fff, 1px 6px #fff, 3px 6px #fff, 5px 6px #fff, 1px 8px #fff, 3px 8px #fff, 5px 8px #fff, 1px 10px #fff, 3px 10px #fff, 5px 10px #fff, 1px 12px #fff, 3px 12px #fff, 5px 12px #fff, 1px 14px #fff, 3px 14px #fff, 5px 14px #fff, 1px 16px #fff, 3px 16px #fff, 5px 16px #fff, 1px 18px #fff, 3px 18px #fff, 5px 18px #fff, 1px 20px #fff, 3px 20px #fff, 5px 20px #fff, 1px 22px #fff, 3px 22px #fff, 5px 22px #fff, 1px 24px #fff, 3px 24px #fff, 5px 24px #fff, 1px 26px #fff, 3px 26px #fff, 5px 26px #fff, 1px 28px #fff, 3px 28px #fff, 5px 28px #fff;\n background: transparent; }\n .psv-panel-content {\n width: 100%;\n height: 100%;\n box-sizing: border-box;\n color: gainsboro;\n font: 16px sans-serif;\n overflow: auto; }\n .psv-panel-content:not(.psv-panel-content--no-margin) {\n padding: 1em; }\n .psv-panel-content--no-interaction {\n user-select: none;\n pointer-events: none; }\n .psv-panel--open {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: .2s; }\n .psv-panel--open .psv-panel-close-button,\n .psv-panel--open .psv-panel-resizer {\n display: block; }\n\n.psv-panel-menu-title {\n display: flex;\n align-items: center;\n font: 24px sans-serif;\n margin: 24px 12px; }\n .psv-panel-menu-title svg {\n width: 24px;\n height: 24px;\n margin-right: 12px; }\n\n.psv-panel-menu-list {\n list-style: none;\n margin: 0;\n padding: 0;\n overflow: hidden; }\n\n.psv-panel-menu-item {\n min-height: 20px;\n padding: 0.5em 1em;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: flex-start;\n transition: background .1s ease-in-out; }\n .psv-panel-menu-item-icon {\n flex: none;\n height: 20px;\n width: 20px;\n margin-right: 0.5em; }\n .psv-panel-menu-item-icon img {\n max-width: 100%;\n max-height: 100%; }\n .psv-panel-menu-item-icon svg {\n width: 100%;\n height: 100%; }\n .psv-panel-menu-item:focus-visible {\n outline: 1px dotted currentColor;\n outline-offset: -1px; }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(odd)::before {\n background: rgba(255, 255, 255, 0.1); }\n\n.psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even), .psv-panel-menu--stripped .psv-panel-menu-item:nth-child(even)::before {\n background: transparent; }\n\n.psv-container:not(.psv--is-touch) .psv-panel-menu-item:hover {\n background: rgba(255, 255, 255, 0.2); }\n\n.psv-tooltip {\n position: absolute;\n z-index: 50;\n box-sizing: border-box;\n max-width: 200px;\n background-color: rgba(61, 61, 61, 0.8);\n border-radius: 4px;\n padding: 0.5em 1em;\n opacity: 0;\n transition-property: opacity;\n transition-timing-function: ease-in-out;\n transition-duration: 100ms;\n outline: 5px solid transparent; }\n .psv-tooltip-content {\n color: white;\n font: 14px sans-serif;\n text-shadow: 0 1px #000; }\n .psv-tooltip-arrow {\n position: absolute;\n height: 0;\n width: 0;\n border: 7px solid transparent; }\n .psv-tooltip--bottom-center {\n box-shadow: 0 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-center .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-left {\n box-shadow: -3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-left .psv-tooltip-arrow {\n border-left-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-center {\n box-shadow: 0 -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-center .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--center-right {\n box-shadow: 3px 0 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(-5px, 0, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--center-right .psv-tooltip-arrow {\n border-right-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-left {\n box-shadow: -3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-left .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--bottom-right {\n box-shadow: 3px 3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, -5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--bottom-right .psv-tooltip-arrow {\n border-bottom-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-left {\n box-shadow: -3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-left .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--top-right {\n box-shadow: 3px -3px 0 rgba(90, 90, 90, 0.7);\n transform: translate3d(0, 5px, 0);\n transition-property: opacity, transform; }\n .psv-tooltip--top-right .psv-tooltip-arrow {\n border-top-color: rgba(61, 61, 61, 0.8); }\n .psv-tooltip--visible {\n transform: translate3d(0, 0, 0);\n opacity: 1;\n transition-duration: 100ms; }\n"]} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.d.ts b/dist/photo-sphere-viewer.d.ts new file mode 100644 index 000000000..39dd3db0e --- /dev/null +++ b/dist/photo-sphere-viewer.d.ts @@ -0,0 +1,1326 @@ +import { Texture, Mesh, Vector3 } from 'three'; +import { EventEmitter, Event } from 'uevent'; + +/** + * @summary Property name added to viewer element + */ +declare const VIEWER_DATA: 'photoSphereViewer'; + +/** + * @summary Available actions + */ +declare const ACTIONS: { + ROTATE_LAT_UP: 'rotateLatitudeUp', + ROTATE_LAT_DOWN: 'rotateLatitudeDown', + ROTATE_LONG_RIGHT: 'rotateLongitudeRight', + ROTATE_LONG_LEFT: 'rotateLongitudeLeft', + ZOOM_IN: 'zoomIn', + ZOOM_OUT: 'zoomOut', + TOGGLE_AUTOROTATE: 'toggleAutorotate', +}; + +/** + * @summary Available events names + */ +declare const EVENTS: { + AUTOROTATE: 'autorotate', + BEFORE_RENDER: 'before-render', + BEFORE_ROTATE: 'before-rotate', + CLICK: 'click', + CLOSE_PANEL: 'close-panel', + CONFIG_CHANGED: 'config-changed', + DOUBLE_CLICK: 'dblclick', + FULLSCREEN_UPDATED: 'fullscreen-updated', + HIDE_NOTIFICATION: 'hide-notification', + HIDE_OVERLAY: 'hide-overlay', + HIDE_TOOLTIP: 'hide-tooltip', + OPEN_PANEL: 'open-panel', + PANORAMA_LOADED: 'panorama-loaded', + POSITION_UPDATED: 'position-updated', + READY: 'ready', + RENDER: 'render', + SHOW_NOTIFICATION: 'show-notification', + SHOW_OVERLAY: 'show-overlay', + SHOW_TOOLTIP: 'show-tooltip', + SIZE_UPDATED: 'size-updated', + STOP_ALL: 'stop-all', + ZOOM_UPDATED: 'zoom-updated', +}; + +/** + * @summary Available change events names + */ +declare const CHANGE_EVENTS: { + GET_ANIMATE_POSITION: 'get-animate-position', + GET_ROTATE_POSITION: 'get-rotate-position', +}; + +/** + * @summary Collection of easing functions + * @see {@link https://gist.github.com/frederickk/6165768} + */ +declare const EASINGS: { + linear: (t: number) => number, + + inQuad: (t: number) => number, + outQuad: (t: number) => number, + inOutQuad: (t: number) => number, + + inCubic: (t: number) => number, + outCubic: (t: number) => number, + inOutCubic: (t: number) => number, + + inQuart: (t: number) => number, + outQuart: (t: number) => number, + inOutQuart: (t: number) => number, + + inQuint: (t: number) => number, + outQuint: (t: number) => number, + inOutQuint: (t: number) => number, + + inSine: (t: number) => number, + outSine: (t: number) => number, + inOutSine: (t: number) => number, + + inExpo: (t: number) => number, + outExpo: (t: number) => number, + inOutExpo: (t: number) => number, + + inCirc: (t: number) => number, + outCirc: (t: number) => number, + inOutCirc: (t: number) => number, +}; + +/** + * @summary Subset of key codes + */ +declare const KEY_CODES: { + Enter : 'Enter', + Control : 'Control', + Escape : 'Escape', + Space : ' ', + PageUp : 'PageUp', + PageDown : 'PageDown', + ArrowLeft : 'ArrowLeft', + ArrowUp : 'ArrowUp', + ArrowRight: 'ArrowRight', + ArrowDown : 'ArrowDown', + Delete : 'Delete', + Plus : '+', + Minus : '-', +}; + +declare const constants_d_VIEWER_DATA: typeof VIEWER_DATA; +declare const constants_d_ACTIONS: typeof ACTIONS; +declare const constants_d_EVENTS: typeof EVENTS; +declare const constants_d_CHANGE_EVENTS: typeof CHANGE_EVENTS; +declare const constants_d_EASINGS: typeof EASINGS; +declare const constants_d_KEY_CODES: typeof KEY_CODES; +declare namespace constants_d { + export { + constants_d_VIEWER_DATA as VIEWER_DATA, + constants_d_ACTIONS as ACTIONS, + constants_d_EVENTS as EVENTS, + constants_d_CHANGE_EVENTS as CHANGE_EVENTS, + constants_d_EASINGS as EASINGS, + constants_d_KEY_CODES as KEY_CODES, + }; +} + +/** + * @summary Toggles a CSS class + */ +declare function toggleClass(element: HTMLElement | SVGElement, className: string, active?: boolean); + +/** + * @summary Adds one or several CSS classes to an element + */ +declare function addClasses(element: HTMLElement, className: string); + +/** + * @summary Removes one or several CSS classes to an element + */ +declare function removeClasses(element: HTMLElement, className: string); + +/** + * @summary Searches if an element has a particular parent at any level including itself + */ +declare function hasParent(el: HTMLElement, parent: HTMLElement): boolean; + +/** + * @summary Gets the closest parent (can by itself) + */ +declare function getClosest(el: HTMLElement | SVGElement, selector: string): HTMLElement; + +/** + * @summary Returns the key name of a KeyboardEvent + */ +declare function getEventKey(evt: KeyboardEvent): string; + +/** + * @summary Detects if fullscreen is enabled + */ +declare function isFullscreenEnabled(elt: HTMLElement): boolean; + +/** + * @summary Enters fullscreen mode + */ +declare function requestFullscreen(elt: HTMLElement); + +/** + * @summary Exits fullscreen mode + */ +declare function exitFullscreen(); + +/** + * @summary Gets an element style + */ +declare function getStyle(elt: HTMLElement, prop: string): any; + +/** + * @summary Normalize mousewheel values accross browsers + * @description From Facebook's Fixed Data Table + * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js} + * @copyright Facebook + */ +declare function normalizeWheel(event: WheelEvent): { spinX: number, spinY: number, pixelX: number, pixelY: number }; + +/** + * Object defining a point + */ +type Point = { + x: number; + y: number; +} + +/** + * Object defining a size + */ +type Size = { + width: number; + height: number; +} + +/** + * Object defining a size in CSS (px, % or auto) + */ +type CssSize = { + width: string; + height: string; +} + +type SphereCorrection = { + pan?: number; + tilt?: number; + roll?: number; +} + +/** + * Object defining a spherical position + */ +type Position = { + longitude: number; + latitude: number; +} + +/** + * Object defining a spherical or texture position + */ +type ExtendedPosition = Position | Point; + +/** + * Object defining animation options + */ +type AnimateOptions = ExtendedPosition & { + speed: string | number; + zoom?: number; +}; + +/** + * Crop information of the panorama + */ +type PanoData = { + fullWidth: number; + fullHeight: number; + croppedWidth: number; + croppedHeight: number; + croppedX: number; + croppedY: number; + poseHeading?: number; + posePitch?: number; + poseRoll?: number; +} + +/** + * Function to compute panorama data once the image is loaded + */ +type PanoDataProvider = (image: HTMLImageElement) => PanoData; + +/** + * Object defining panorama and animation options + */ +type PanoramaOptions = (ExtendedPosition | {}) & { + zoom?: number; + transition?: boolean | number; + showLoader?: boolean; + sphereCorrection?: SphereCorrection; + panoData?: PanoData | PanoDataProvider; +}; + +/** + * Result of the AbstractAdapter#loadTexture method + */ +type TextureData = { + texture: Texture | Texture[] | Record; + panoData?: PanoData; +}; + +/** + * Data of the `click` event + */ +type ClickData = { + rightclick: boolean; + clientX: number; + clientY: number; + viewerX: number; + viewerY: number; + longitude: number; + latitude: number; + textureX?: number; + textureY?: number; + marker?: any; +} + +/** + * Definition of a custom navbar button + */ +type NavbarCustomButton = { + id?: string; + title?: string; + content?: string; + className?: string; + onClick: () => void; + disabled?: boolean; + visible?: boolean; + collapsable?: boolean; +}; + +/** + * @summary Ensures that a number is in a given interval + */ +declare function bound(x: number, min: number, max: number): number; + +/** + * @summary Checks if a value is an integer + */ +declare function isInteger(value: any): boolean; + +/** + * @summary Computes the sum of an array + */ +declare function sum(array: number[]): number; + +/** + * @summary Computes the distance between two points + */ +declare function distance(p1: Point, p2: Point): number; + +/** + * @summary Compute the shortest offset between two longitudes + */ +declare function getShortestArc(from: number, to: number): number; + +/** + * @summary Computes the angle between the current position and a target position + */ +declare function getAngle(position1: Position, position2: Position): number; + +/** + * @summary Returns the distance between two points on a sphere of radius one + */ +declare function greatArcDistance(p1: number[], p2: number[]): number; + +/** + * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize} + */ + +declare function dasherize(str: string): string; + +/** + * @summary Returns a function, that, when invoked, will only be triggered at most once during a given window of time. + * @copyright underscore.js - modified by Clément Prévost {@link http://stackoverflow.com/a/27078401} + */ +declare function throttle(func: Function, wait: number): Function; + +/** + * @summary Test if an object is a plain object + * @description Test if an object is a plain object, i.e. is constructed + * by the built-in Object constructor and inherits directly from Object.prototype + * or null. Some built-in objects pass the test, e.g. Math which is a plain object + * and some host or exotic objects may pass also. + * {@link http://stackoverflow.com/a/5878101/1207670} + */ +declare function isPlainObject(obj: any): boolean; + +/** + * @summary Merges the enumerable attributes of two objects + * @description Replaces arrays and alters the target object. + * @copyright Nicholas Fisher + */ +declare function deepmerge(target: object, src: object): object; + +/** + * @summary Deeply clones an object + */ +declare function clone(src: object): object; + +/** + * @summery Test of an object is empty + */ +declare function isEmpty(obj: object): boolean; + +/** + * @summary Loops over enumerable properties of an object + */ +declare function each(object: object, callback: (value: any, key: string) => void); + +/** + * @summary Returns the intersection between two arrays + */ +declare function intersect(array1: T[], array2: T[]): T[]; + +/** + * @summary Returns if a valu is null or undefined + */ +declare function isNil(val: any): val is null | undefined; + +/** + * @summary Returns the first non null non undefined parameter + */ +declare function firstNonNull(...values: any[]): any; + +/** + * @summary Displays a warning in the console + */ +declare function logWarn(message: string); + +/** + * @summary Checks if an object is a {PSV.ExtendedPosition}, ie has x/y or longitude/latitude + */ +declare function isExtendedPosition(object: any): object is ExtendedPosition; + +/** + * @summary Returns the value of a given attribute in the panorama metadata + */ +declare function getXMPValue(data: string, attr: string): number | null; + +/** + * @summary Translate CSS values like "top center" or "10% 50%" as top and left positions + * @description The implementation is as close as possible to the "background-position" specification + * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position} + */ +declare function parsePosition(value: string | Point): Point; + +/** + * @summary Parses an speed + * @param speed - The speed, in radians/degrees/revolutions per second/minute + * @returns radians per second + * @throws {PSVError} when the speed cannot be parsed + */ +declare function parseSpeed(speed: string | number): number; + +/** + * @summary Parses an angle value in radians or degrees and returns a normalized value in radians + * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg + * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi + * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi + * @throws {PSVError} when the angle cannot be parsed + */ +declare function parseAngle(angle: string | number, zeroCenter?: boolean, halfCircle?: boolean): number; + +/** + * @summary Creates a THREE texture from an image + */ +declare function createTexture(img: HTMLImageElement | HTMLCanvasElement): Texture; + +declare const index_d_toggleClass: typeof toggleClass; +declare const index_d_addClasses: typeof addClasses; +declare const index_d_removeClasses: typeof removeClasses; +declare const index_d_hasParent: typeof hasParent; +declare const index_d_getClosest: typeof getClosest; +declare const index_d_getEventKey: typeof getEventKey; +declare const index_d_isFullscreenEnabled: typeof isFullscreenEnabled; +declare const index_d_requestFullscreen: typeof requestFullscreen; +declare const index_d_exitFullscreen: typeof exitFullscreen; +declare const index_d_getStyle: typeof getStyle; +declare const index_d_normalizeWheel: typeof normalizeWheel; +declare const index_d_bound: typeof bound; +declare const index_d_isInteger: typeof isInteger; +declare const index_d_sum: typeof sum; +declare const index_d_distance: typeof distance; +declare const index_d_getShortestArc: typeof getShortestArc; +declare const index_d_getAngle: typeof getAngle; +declare const index_d_greatArcDistance: typeof greatArcDistance; +declare const index_d_dasherize: typeof dasherize; +declare const index_d_throttle: typeof throttle; +declare const index_d_isPlainObject: typeof isPlainObject; +declare const index_d_deepmerge: typeof deepmerge; +declare const index_d_clone: typeof clone; +declare const index_d_isEmpty: typeof isEmpty; +declare const index_d_each: typeof each; +declare const index_d_intersect: typeof intersect; +declare const index_d_isNil: typeof isNil; +declare const index_d_firstNonNull: typeof firstNonNull; +declare const index_d_logWarn: typeof logWarn; +declare const index_d_isExtendedPosition: typeof isExtendedPosition; +declare const index_d_getXMPValue: typeof getXMPValue; +declare const index_d_parsePosition: typeof parsePosition; +declare const index_d_parseSpeed: typeof parseSpeed; +declare const index_d_parseAngle: typeof parseAngle; +declare const index_d_createTexture: typeof createTexture; +declare namespace index_d { + export { + index_d_toggleClass as toggleClass, + index_d_addClasses as addClasses, + index_d_removeClasses as removeClasses, + index_d_hasParent as hasParent, + index_d_getClosest as getClosest, + index_d_getEventKey as getEventKey, + index_d_isFullscreenEnabled as isFullscreenEnabled, + index_d_requestFullscreen as requestFullscreen, + index_d_exitFullscreen as exitFullscreen, + index_d_getStyle as getStyle, + index_d_normalizeWheel as normalizeWheel, + index_d_bound as bound, + index_d_isInteger as isInteger, + index_d_sum as sum, + index_d_distance as distance, + index_d_getShortestArc as getShortestArc, + index_d_getAngle as getAngle, + index_d_greatArcDistance as greatArcDistance, + index_d_dasherize as dasherize, + index_d_throttle as throttle, + index_d_isPlainObject as isPlainObject, + index_d_deepmerge as deepmerge, + index_d_clone as clone, + index_d_isEmpty as isEmpty, + index_d_each as each, + index_d_intersect as intersect, + index_d_isNil as isNil, + index_d_firstNonNull as firstNonNull, + index_d_logWarn as logWarn, + index_d_isExtendedPosition as isExtendedPosition, + index_d_getXMPValue as getXMPValue, + index_d_parsePosition as parsePosition, + index_d_parseSpeed as parseSpeed, + index_d_parseAngle as parseAngle, + index_d_createTexture as createTexture, + }; +} + +/** + * @summary Base adapters class + */ +declare abstract class AbstractAdapter { + + /** + * @summary Unique identifier of the adapter + */ + static id: string; + + /** + * @summary Indicates if the adapter supports transitions between panoramas + */ + static supportsTransition: boolean; + + constructor(parent: Viewer); + + /** + * @summary Destroys the adapter + */ + destroy(); + + /** + * @summary Loads the panorama texture(s) + */ + loadTexture(panorama: any, newPanoData?: PanoData | PanoDataProvider): Promise; + + /** + * @summary Creates the cube mesh + * @param {number} [scale=1] + */ + createMesh(scale?: number): Mesh; + + /** + * @summary Applies the texture to the mesh + */ + setTexture(mesh: Mesh, textureData: TextureData); + + /** + * @summary Changes the opacity of the mesh + */ + setTextureOpacity(mesh: Mesh, opacity: number); + +} + +type AdapterConstructor = new (psv: Viewer, options?: any) => T; + +type AnimationOptions = { + properties: { [K: string]: { start: number, end: number } }; + duration: number; + delay?: number; + easing?: string | ((progress: number) => number); + onTick: (properties: { [K: string]: number }, progress: number) => void; +}; + +/** + * @summary Interpolation helper for animations + * @description + * Implements the Promise API with an additional "cancel" and "finally" methods. + * The promise is resolved when the animation is complete and rejected if the animation is cancelled. + */ +declare class Animation implements Promise { + + constructor(options: AnimationOptions); + + // @ts-ignore + then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + // @ts-ignore + catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + // @ts-ignore + finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + cancel(); + + /** + * @summary Returns a resolved animation promise + */ + static resolve(): Animation; + +} + +/** + * @summary Base component class + */ +declare abstract class AbstractComponent { + + constructor(parent: Viewer | AbstractComponent, className?: string); + + /** + * @summary Displays the component + */ + show(options?: any); + + /** + * @summary Hides the component + */ + hide(options?: any); + + /** + * @summary Displays or hides the component + */ + toggle(); + + /** + * @summary Check if the component is visible + */ + isVisible(options?: any): boolean; + +} + +/** + * @summary Loader class + */ +declare class Loader extends AbstractComponent { + + /** + * @summary Sets the loader progression + * @param value + */ + setProgress(value: number); + +} + +/** + * @summary Base navbar button class + */ +declare abstract class AbstractButton extends AbstractComponent { + + /** + * @summary Unique identifier of the button + */ + static id: string; + + /** + * @summary SVG icon name injected in the button + */ + static icon?: string; + + /** + * @summary SVG icon name injected in the button when it is active + */ + static iconActive?: string; + + constructor(navbar: Navbar, className?: string, collapsable?: boolean); + + /** + * @summary Checks if the button can be displayed + */ + isSupported(): boolean | { initial: boolean, promise: Promise }; + + /** + * @summary Changes the active state of the button + */ + toggleActive(active?: boolean); + + /** + * @summary Disables the button + */ + disable(); + + /** + * @summary Enables the button + */ + enable(); + + /** + * @summary Collapses the button in the navbar menu + */ + collapse(); + + /** + * @summary Uncollapses the button from the navbar menu + */ + uncollapse(); + +} + +/** + * @summary Register a new button available for all viewers + */ +declare function registerButton(button: typeof AbstractButton); + +/** + * @summary Navigation bar class + */ +declare class Navbar extends AbstractComponent { + + /** + * @summary Change the buttons visible on the navbar + */ + setButtons(buttons: string | Array); + + /** + * @summary Sets the bar caption + */ + setCaption(html: string); + + /** + * @summary Returns a button by its identifier + */ + getButton(id: string): AbstractButton; + +} + +type NotificationOptions = { + content: string; + timeout?: number; +}; + +/** + * @summary Notification class + */ +declare class Notification extends AbstractComponent { + + show(config: string | NotificationOptions); + +} + +type OverlayOptions = { + id?: string; + image: string; + text: string; + subtext?: string; + dissmisable?: boolean; +}; + +/** + * @summary Overlay class + */ +declare class Overlay extends AbstractComponent { + + show(config: string | OverlayOptions); + + hide(id?: string); + + isVisible(id?: string): boolean; + +} + +type PanelOptions = { + id?: string; + content: string; + noMargin?: boolean; + width?: string; + clickHandler?: (e: MouseEvent) => {}; +}; + +/** + * @summary Panel class + */ +declare class Panel extends AbstractComponent { + + show(config: string | PanelOptions); + + hide(id?: string); + + isVisible(id?: string): boolean; + +} + +/** + * Object defining the tooltip position + */ +type TooltipPosition = { + top: number; + left: number; + position?: string | string[]; + box?: { width: number, height: number }; +}; + +/** + * Object defining the tooltip configuration + */ +type TooltipOptions = TooltipPosition & { + content: string; + className?: string; + data?: any; +}; + +declare class Tooltip extends AbstractComponent { + + /** + * Do not call this method directly, use {@link TooltipRenderer} instead. + */ + show(options: TooltipOptions); + + /** + * @summary Moves the tooltip to a new position + * @throws {PSVError} when the configuration is incorrect + */ + move(position: TooltipPosition); + +} + +/** + * @summary Base plugins class + */ +declare abstract class AbstractPlugin extends EventEmitter { + + /** + * @summary Unique identifier of the plugin + */ + static id: string; + + constructor(psv: Viewer); + + /** + * @summary Destroys the plugin + */ + destroy(); + +} + +type PluginConstructor = new (psv: Viewer, options?: any) => T; + +/** + * @summary Collections of data converters for the current viewer + */ +declare class DataHelper { + + /** + * @summary Converts vertical FOV to zoom level + */ + fovToZoomLevel(fov: number): number; + + /** + * @summary Converts zoom level to vertical FOV + */ + zoomLevelToFov(level: number): number; + + /** + * @summary Convert vertical FOV to horizontal FOV + */ + vFovToHFov(vFov: number): number; + + /** + * @summary Converts a speed into a duration from current position to a new position + */ + speedToDuration(value: string | number, angle: number): number; + + /** + * @summary Converts pixel texture coordinates to spherical radians coordinates + */ + textureCoordsToSphericalCoords(point: Point): Position; + + /** + * @summary Converts spherical radians coordinates to pixel texture coordinates + */ + sphericalCoordsToTextureCoords(position: Position): Point; + + /** + * @summary Converts spherical radians coordinates to a THREE.Vector3 + */ + sphericalCoordsToVector3(position: Position): Vector3; + + /** + * @summary Converts a THREE.Vector3 to spherical radians coordinates + */ + vector3ToSphericalCoords(vector: Vector3): Position; + + /** + * @summary Converts position on the viewer to a THREE.Vector3 + */ + viewerCoordsToVector3(point: Point): Vector3; + + /** + * @summary Converts a THREE.Vector3 to position on the viewer + */ + vector3ToViewerCoords(vector: Vector3): Point; + + /** + * @summary Converts spherical radians coordinates to position on the viewer + */ + sphericalCoordsToViewerCoords(position: Position): Point; + + /** + * @summary Converts x/y to latitude/longitude if present and ensure boundaries + */ + cleanPosition(position: ExtendedPosition): Position; + + /** + * @summary Ensure a SphereCorrection object is valid + */ + cleanSphereCorrection(sphere: SphereCorrection): SphereCorrection; + +} + +/** + * @summary Texture loader + */ +declare class TextureLoader { + + /** + * @summary Preload a panorama file without displaying it + */ + preloadPanorama(panorama: any): Promise; + +} + +/** + * @summary Tooltip renderer + */ +declare class TooltipRenderer extends AbstractComponent { + + /** + * @summary Displays a tooltip on the viewer + * @throws {PSVError} when the configuration is incorrect + */ + create(config: TooltipOptions): Tooltip; + +} + +/** + * @summary Viewer options, see {@link http://photo-sphere-viewer.js.org/guide/config.html} + */ +type ViewerOptions = { + container: HTMLElement | string; + panorama?: string; + adapter?: AdapterConstructor | [AdapterConstructor, any]; + caption?: string; + loadingImg?: string; + loadingTxt?: string; + size?: Size; + fisheye?: boolean; + minFov?: number; + maxFov?: number; + defaultZoomLvl?: number; + defaultLong?: number; + defaultLat?: number; + sphereCorrection?: { pan?: number, tilt?: number, roll?: number }, + moveSpeed?: number; + zoomSpeed?: number; + autorotateDelay?: null, + autorotateSpeed?: string | number; + autorotateLat?: number; + moveInertia?: boolean; + mousewheel?: boolean; + mousemove?: boolean; + captureCursor?: boolean; + mousewheelCtrlKey?: boolean; + touchmoveTwoFingers?: boolean; + useXmpData?: boolean; + panoData?: PanoData | PanoDataProvider; + requestHeaders?: Record | ((url: string) => Record); + canvasBackground?: string; + withCredentials?: boolean; + navbar?: string | Array, + lang?: Record, + keyboard?: Record, + plugins?: Array | [PluginConstructor, any]>, +}; + +/** + * Internal properties of the viewer + */ +type ViewerProps = { + ready: boolean; + uiRefresh: boolean; + needsUpdate: boolean; + fullscreen: boolean; + direction: Vector3; + vFov: number; + hFov: number; + aspect: number; + autorotateEnabled: boolean; + animationPromise: Animation; + loadingPromise: Promise; + startTimeout: any; + size: Size; + panoData: PanoData; +}; + +/** + * Main class + */ +declare class Viewer extends EventEmitter { + + /** + * Configuration holder + */ + readonly config: ViewerOptions; + + /** + * Internal properties + */ + prop: ViewerProps; + + /** + * Top most parent + */ + readonly parent: HTMLElement; + + /** + * Main container + */ + readonly container: HTMLElement; + + /** + * Textures loader + */ + readonly textureLoader: TextureLoader; + + /** + * Utilities to help converting data + */ + readonly dataHelper: DataHelper; + + readonly loader: Loader; + + readonly navbar: Navbar; + + readonly panel: Panel; + + readonly tooltip: TooltipRenderer; + + readonly notification: Notification; + + readonly overlay: Overlay; + + /** + * @throws {PSVError} when the configuration is incorrect + */ + constructor(options: ViewerOptions); + + /** + * @summary Destroys the viewer + * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible. + */ + destroy(); + + /** + * @summary Returns the instance of a plugin if it exists + */ + getPlugin(pluginId: string | PluginConstructor): T; + + /** + * @summary Returns the current position of the camera + */ + getPosition(): Position; + + /** + * @summary Returns the current zoom level + */ + getZoomLevel(): number; + + /** + * @summary Returns the current viewer size + */ + getSize(): Size; + + /** + * @summary Checks if the automatic rotation is enabled + */ + isAutorotateEnabled(): boolean; + + /** + * @summary Checks if the viewer is in fullscreen + */ + isFullscreenEnabled(): boolean; + + /** + * @summary Flags the view has changed for the next render + */ + needsUpdate(); + + /** + * @summary Resizes the canvas when the window is resized + */ + autoSize(); + + /** + * @summary Loads a new panorama file + * @description Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
+ * If the "options" parameter is not defined, the camera will not move and the ongoing animation will continue.
+ * If another loading is already in progress it will be aborted. + */ + setPanorama(panorama: any, options?: PanoramaOptions): Promise; + + /** + * @summary Update options + */ + setOptions(options: Partial); + + /** + * @summary Update options + */ + setOption(option: K, value: ViewerOptions[K]); + + /** + * @summary Starts the automatic rotation + */ + startAutorotate(); + + /** + * @summary Stops the automatic rotation + */ + stopAutorotate(); + + /** + * @summary Starts or stops the automatic rotation + */ + toggleAutorotate(); + + /** + * @summary Displays an error message + */ + showError(message: string); + + /** + * @summary Hides the error message + */ + hideError(); + + /** + * @summary Rotates the view to specific longitude and latitude + */ + rotate(position: ExtendedPosition); + + /** + * @summary Rotates and zooms the view with a smooth animation + */ + animate(options: AnimateOptions): Animation; + + /** + * @summary Stops the ongoing animation + * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously. + */ + stopAnimation(): Promise; + + /** + * @summary Zooms to a specific level between `max_fov` and `min_fov` + */ + zoom(level: number); + + /** + * @summary Increases the zoom level + * @param {number} [step=1] + */ + zoomIn(step?: number); + + /** + * @summary Decreases the zoom level + * @param {number} [step=1] + */ + zoomOut(step?: number); + + /** + * @summary Resizes the viewer + */ + resize(size: CssSize); + + /** + * @summary Enters the fullscreen mode + */ + enterFullscreen(); + + /** + * @summary Exits the fullscreen mode + */ + exitFullscreen(); + + /** + * @summary Enters or exits the fullscreen mode + */ + toggleFullscreen(); + + /** + * @summary Enables the keyboard controls (done automatically when entering fullscreen) + */ + startKeyboardControl(); + + /** + * @summary Disables the keyboard controls (done automatically when exiting fullscreen) + */ + stopKeyboardControl(); + + /** + * @summary Triggered when the automatic rotation is enabled/disabled + */ + on(e: 'autorotate', cb: (e: Event, enabled: true) => void): this; + /** + * @summary Triggered before a render, used to modify the view + */ + on(e: 'before-render', cb: (e: Event, timestamp: number, elapsed: number) => void): this; + /** + * @summary Triggered before a rotate operation, can be cancelled + */ + on(e: 'before-rotate', cb: (e: Event, position: ExtendedPosition) => void): this; + /** + * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel) + */ + on(e: 'click', cb: (e: Event, data: ClickData) => void): this; + /** + * @summary Trigered when the panel is closed + */ + on(e: 'close-panel', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Triggered after a call to setOption/setOptions + */ + on(e: 'config-changed', cb: (e: Event, options: string[]) => void): this; + /** + * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick` + */ + on(e: 'dblclick', cb: (e: Event, data: ClickData) => void): this; + /** + * @summary Triggered when the fullscreen mode is enabled/disabled + */ + on(e: 'fullscreen-updated', cb: (e: Event, enabled: true) => void): this; + /** + * @summary Called to alter the target position of an animation + */ + on(e: 'get-animate-position', cb: (e: Event, position: Position) => Position): this; + /** + * @summary Called to alter the target position of a rotation + */ + on(e: 'get-rotate-position', cb: (e: Event, position: Position) => Position): this; + /** + * @summary Triggered when the notification is hidden + */ + on(e: 'hide-notification', cb: (e: Event) => void): this; + /** + * @summary Triggered when the overlay is hidden + */ + on(e: 'hide-overlay', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Trigered when the tooltip is hidden + */ + on(e: 'hide-tooltip', cb: (e: Event, data: any) => void): this; + /** + * @summary Triggered when the panel is opened + */ + on(e: 'open-panel', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Triggered when a panorama image has been loaded + */ + on(e: 'panorama-loaded', cb: (e: Event) => void): this; + /** + * @summary Triggered when the view longitude and/or latitude changes + */ + on(e: 'position-updated', cb: (e: Event, position: Position) => void): this; + + /** + * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render + */ + once(e: 'ready', cb: (e: Event) => void): this; + + /** + * @summary Triggered on each viewer render, **this event is triggered very often** + */ + on(e: 'render', cb: (e: Event) => void): this; + /** + * @summary Trigered when the notification is shown + */ + on(e: 'show-notification', cb: (e: Event) => void): this; + /** + * @summary Trigered when the overlay is shown + */ + on(e: 'show-overlay', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Trigered when the tooltip is shown + */ + on(e: 'show-tooltip', cb: (e: Event, data: any, tooltip: Tooltip) => void): this; + /** + * @summary Triggered when the viewer size changes + */ + on(e: 'size-updated', cb: (e: Event, size: Size) => void): this; + /** + * @summary Triggered when all current animations are stopped + */ + on(e: 'stop-all', cb: (e: Event) => void): this; + /** + * @summary Triggered when the zoom level changes + */ + on(e: 'zoom-updated', cb: (e: Event, zoom: number) => void): this; + +} + +/** + * @summary Default options + */ +declare const DEFAULTS: ViewerOptions; + +/** + * @summary General information about the system + */ +declare const SYSTEM: { + loaded: boolean; + pixelRatio: number; + isWebGLSupported: boolean; + maxTextureWidth: number; + mouseWheelEvent: string; + fullscreenEvent: string; + getMaxCanvasWidth: () => number; + isTouchEnabled: Promise; +}; + +/** + * @summary Custom error used in the lib + */ +declare class PSVError extends Error { + name: 'PSVError'; +} + +export { ACTIONS, AbstractAdapter, AbstractButton, AbstractPlugin, AdapterConstructor, AnimateOptions, Animation, AnimationOptions, CHANGE_EVENTS, constants_d as CONSTANTS, ClickData, CssSize, DEFAULTS, DataHelper, EASINGS, EVENTS, ExtendedPosition, KEY_CODES, Loader, Navbar, NavbarCustomButton, Notification, NotificationOptions, Overlay, OverlayOptions, PSVError, Panel, PanelOptions, PanoData, PanoDataProvider, PanoramaOptions, PluginConstructor, Point, Position, SYSTEM, Size, SphereCorrection, TextureData, TextureLoader, Tooltip, TooltipOptions, TooltipPosition, TooltipRenderer, VIEWER_DATA, Viewer, ViewerOptions, ViewerProps, registerButton, index_d as utils }; diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index 33fb37ff8..ddf715e82 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) @@ -68,39 +68,7 @@ * @constant */ - var SPHERE_RADIUS = 100; - /** - * @summary Number of vertice of the THREE.SphereGeometry - * @memberOf PSV.constants - * @type {number} - * @constant - */ - - var SPHERE_VERTICES = 64; - /** - * @summary Number of vertices of each side of the THREE.BoxGeometry - * @memberOf PSV.constants - * @type {number} - * @constant - */ - - var CUBE_VERTICES = 8; - /** - * @summary Order of cube textures for arrays - * @memberOf PSV.constants - * @type {number[]} - * @constant - */ - - var CUBE_MAP = [0, 2, 4, 5, 3, 1]; - /** - * @summary Order of cube textures for maps - * @memberOf PSV.constants - * @type {string[]} - * @constant - */ - - var CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front']; + var SPHERE_RADIUS = 10; /** * @summary Property name added to viewer element * @memberOf PSV.constants @@ -146,6 +114,7 @@ * @memberof PSV * @summary Triggered before a render, used to modify the view * @param {number} timestamp - time provided by requestAnimationFrame + * @param {number} elapsed - time elapsed from the previous frame */ BEFORE_RENDER: 'before-render', @@ -425,6 +394,29 @@ /* eslint-enable */ + /** + * @summary Subset of key codes + * @memberOf PSV.constants + * @type {Object} + * @constant + */ + + var KEY_CODES = { + Enter: 'Enter', + Control: 'Control', + Escape: 'Escape', + Space: ' ', + PageUp: 'PageUp', + PageDown: 'PageDown', + ArrowLeft: 'ArrowLeft', + ArrowUp: 'ArrowUp', + ArrowRight: 'ArrowRight', + ArrowDown: 'ArrowDown', + Delete: 'Delete', + Plus: '+', + Minus: '-' + }; + var constants = /*#__PURE__*/Object.freeze({ __proto__: null, MOVE_THRESHOLD: MOVE_THRESHOLD, @@ -434,16 +426,13 @@ CTRLZOOM_TIMEOUT: CTRLZOOM_TIMEOUT, INERTIA_WINDOW: INERTIA_WINDOW, SPHERE_RADIUS: SPHERE_RADIUS, - SPHERE_VERTICES: SPHERE_VERTICES, - CUBE_VERTICES: CUBE_VERTICES, - CUBE_MAP: CUBE_MAP, - CUBE_HASHMAP: CUBE_HASHMAP, VIEWER_DATA: VIEWER_DATA, ACTIONS: ACTIONS, EVENTS: EVENTS, CHANGE_EVENTS: CHANGE_EVENTS, IDS: IDS, - EASINGS: EASINGS + EASINGS: EASINGS, + KEY_CODES: KEY_CODES }); /** @@ -708,9 +697,9 @@ pixelY *= LINE_HEIGHT; } // delta in PAGE units else { - pixelX *= PAGE_HEIGHT; - pixelY *= PAGE_HEIGHT; - } + pixelX *= PAGE_HEIGHT; + pixelY *= PAGE_HEIGHT; + } } // Fall-back if spin cannot be determined @@ -808,7 +797,7 @@ return Math.acos(Math.cos(position1.latitude) * Math.cos(position2.latitude) * Math.cos(position1.longitude - position2.longitude) + Math.sin(position1.latitude) * Math.sin(position2.latitude)); } /** - * Returns the distance between two points on a sphere of radius one + * @summary Returns the distance between two points on a sphere of radius one * @memberOf PSV.utils * @param {number[]} p1 * @param {number[]} p2 @@ -826,7 +815,7 @@ } /** - * @summary Transforms a string to dash-case{@link https://github.com/shahata/dasherize} + * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize} * @memberOf PSV.utils * @param {string} str * @returns {string} @@ -1017,6 +1006,7 @@ } /** * @summary Returns if a valu is null or undefined + * @memberOf PSV.utils * @param {*} val * @return {boolean} */ @@ -1067,6 +1057,27 @@ PSVError.prototype.name = 'PSVError'; PSVError.prototype.constructor = PSVError; + /** + * @summary Returns the plugin constructor from the imported object + * For retrocompatibility with previous default exports + * @memberOf PSV.utils + * @package + */ + + function pluginInterop(plugin, target) { + if (plugin) { + for (var _i = 0, _arr = [['_', plugin]].concat(Object.entries(plugin)); _i < _arr.length; _i++) { + var _arr$_i = _arr[_i], + p = _arr$_i[1]; + + if (p.prototype instanceof target) { + return p; + } + } + } + + return null; + } /** * @summary Displays a warning in the console * @memberOf PSV.utils @@ -1136,7 +1147,7 @@ * @memberOf PSV.utils * @description The implementation is as close as possible to the "background-position" specification * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position} - * @param {string|object} value + * @param {string|PSV.Point} value * @returns {PSV.Point} */ @@ -1305,6 +1316,20 @@ return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed; } + /** + * @summary Creates a THREE texture from an image + * @memberOf PSV.utils + * @param {HTMLImageElement | HTMLCanvasElement} img + * @return {external:THREE.Texture} + */ + + function createTexture(img) { + var texture = new THREE.Texture(img); + texture.needsUpdate = true; + texture.minFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + return texture; + } /** * @namespace PSV.utils @@ -1340,12 +1365,14 @@ intersect: intersect, isNil: isNil, firstNonNull: firstNonNull, + pluginInterop: pluginInterop, logWarn: logWarn, isExtendedPosition: isExtendedPosition, getXMPValue: getXMPValue, parsePosition: parsePosition, parseSpeed: parseSpeed, - parseAngle: parseAngle + parseAngle: parseAngle, + createTexture: createTexture }); /** @@ -1558,6 +1585,22 @@ return Animation; }(); + function _defineProperties(target, props) { + for (var i = 0; i < props.length; i++) { + var descriptor = props[i]; + descriptor.enumerable = descriptor.enumerable || false; + descriptor.configurable = true; + if ("value" in descriptor) descriptor.writable = true; + Object.defineProperty(target, descriptor.key, descriptor); + } + } + + function _createClass(Constructor, protoProps, staticProps) { + if (protoProps) _defineProperties(Constructor.prototype, protoProps); + if (staticProps) _defineProperties(Constructor, staticProps); + return Constructor; + } + function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { @@ -1579,7 +1622,17 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -1767,8 +1820,9 @@ * @param {PSV.components.Navbar} navbar * @param {string} [className] - Additional CSS classes * @param {boolean} [collapsable=false] - `true` if the button can be moved to menu when the navbar is too small + * @param {boolean} [tabbable=true] - `true` if the button is accessible with Tab key */ - function AbstractButton(navbar, className, collapsable) { + function AbstractButton(navbar, className, collapsable, tabbable) { var _this; if (className === void 0) { @@ -1779,6 +1833,10 @@ collapsable = false; } + if (tabbable === void 0) { + tabbable = true; + } + _this = _AbstractComponent.call(this, navbar, 'psv-button ' + className) || this; /** * @override @@ -1808,6 +1866,10 @@ _this.container.title = _this.psv.config.lang[_this.prop.id]; } + if (tabbable) { + _this.container.tabIndex = 0; + } + _this.container.addEventListener('click', function (e) { if (_this.prop.enabled) { _this.onClick(); @@ -1816,6 +1878,14 @@ e.stopPropagation(); }); + _this.container.addEventListener('keydown', function (e) { + if (getEventKey(e) === KEY_CODES.Enter && _this.prop.enabled) { + _this.onClick(); + + e.stopPropagation(); + } + }); + return _this; } /** @@ -2110,7 +2180,7 @@ _this.container.innerHTML = _this.config.content; } - _this.width = _this.container.offsetWidth; + _this.prop.width = _this.container.offsetWidth; if (_this.config.enabled === false) { _this.disable(); @@ -2411,7 +2481,7 @@ MenuButton.MENU_TEMPLATE = function (buttons, psv, dataKey) { return "\n
\n

" + menuIcon + " " + psv.config.lang.menu + "

\n
    \n " + buttons.map(function (button) { - return "\n
  • \n " + button.container.innerHTML + "\n " + button.container.title + "\n
  • \n "; + return "\n
  • \n " + button.container.innerHTML + "\n " + button.container.title + "\n
  • \n "; }).join('') + "\n
\n
\n"; }; @@ -2615,40 +2685,120 @@ } } + var arrow = "\n"; + /** - * @summary Navigation bar zoom button class + * @summary Helper for pressable things (buttons, keyboard) + * @description When the pressed thing goes up and was not pressed long enough, wait a bit more before execution + * @package + * @package + */ + var PressHandler = /*#__PURE__*/function () { + function PressHandler(delay) { + if (delay === void 0) { + delay = 200; + } + + this.delay = delay; + this.time = 0; + this.timeout = null; + } + + var _proto = PressHandler.prototype; + + _proto.down = function down() { + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = null; + } + + this.time = new Date().getTime(); + }; + + _proto.up = function up(cb) { + var _this = this; + + if (!this.time) { + return; + } + + var elapsed = new Date().getTime() - this.time; + + if (elapsed < this.delay) { + this.timeout = setTimeout(function () { + cb(); + _this.timeout = null; + _this.time = 0; + }, this.delay); + } else { + cb(); + this.time = 0; + } + }; + + return PressHandler; + }(); + + function getOrientedArrow(direction) { + var angle = 0; + + switch (direction) { + // @formatter:off + case 'up': + angle = 90; + break; + + case 'right': + angle = 180; + break; + + case 'down': + angle = -90; + break; + + default: + angle = 0; + break; + // @formatter:on + } + + return arrow.replace('rotate(0', "rotate(" + angle); + } + /** + * @summary Navigation bar move button class * @extends PSV.buttons.AbstractButton * @memberof PSV.buttons */ - var AbstractZoomButton = /*#__PURE__*/function (_AbstractButton) { - _inheritsLoose(AbstractZoomButton, _AbstractButton); + var AbstractMoveButton = /*#__PURE__*/function (_AbstractButton) { + _inheritsLoose(AbstractMoveButton, _AbstractButton); /** * @param {PSV.components.Navbar} navbar * @param {number} value */ - function AbstractZoomButton(navbar, value) { + function AbstractMoveButton(navbar, value) { var _this; - _this = _AbstractButton.call(this, navbar, 'psv-button--hover-scale psv-zoom-button') || this; + _this = _AbstractButton.call(this, navbar, 'psv-button--hover-scale psv-move-button') || this; + _this.container.title = _this.psv.config.lang.move; /** * @override - * @property {number} value - * @property {boolean} buttondown - * @property {*} longPressTimeout - * @property {PSV.Animation} longPressAnimation + * @property {{longitude: boolean, latitude: boolean}} value + * @property {PressHandler} handler */ _this.prop = _extends({}, _this.prop, { value: value, - buttondown: false, - longPressTimeout: null, - longPressAnimation: null + handler: new PressHandler() }); _this.container.addEventListener('mousedown', _assertThisInitialized(_this)); + _this.container.addEventListener('keydown', _assertThisInitialized(_this)); + + _this.container.addEventListener('keyup', _assertThisInitialized(_this)); + _this.psv.container.addEventListener('mouseup', _assertThisInitialized(_this)); _this.psv.container.addEventListener('touchend', _assertThisInitialized(_this)); @@ -2660,7 +2810,7 @@ */ - var _proto = AbstractZoomButton.prototype; + var _proto = AbstractMoveButton.prototype; _proto.destroy = function destroy() { this.__onMouseUp(); @@ -2695,6 +2845,14 @@ this.__onMouseUp(); break; + + case 'keydown': + getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); + break; + + case 'keyup': + getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); + break; // @formatter:on } /* eslint-enable */ @@ -2721,125 +2879,131 @@ _proto.onClick = function onClick() {// nothing } /** - * @summary Handles click events - * @description Zooms in and register long press timer * @private */ ; _proto.__onMouseDown = function __onMouseDown() { - var _this2 = this; - if (!this.prop.enabled) { return; } - this.prop.buttondown = true; - this.prop.longPressTimeout = setTimeout(function () { - return _this2.__startLongPressInterval(); - }, 100); + this.psv.__stopAll(); + + this.psv.dynamics.position.roll(this.prop.value); + this.prop.handler.down(); } /** - * @summary Continues zooming as long as the user presses the button * @private */ ; - _proto.__startLongPressInterval = function __startLongPressInterval() { - var _this3 = this; + _proto.__onMouseUp = function __onMouseUp() { + var _this2 = this; - if (!this.prop.buttondown) { + if (!this.prop.enabled) { return; } - var end = this.prop.value < 0 ? 0 : 100; - this.prop.longPressAnimation = new Animation({ - properties: { - zoom: { - start: this.psv.prop.zoomLvl, - end: end - } - }, - duration: 1500 * Math.abs(this.psv.prop.zoomLvl - end) / 100, - easing: 'linear', - onTick: function onTick(properties) { - _this3.psv.zoom(properties.zoom); - } - }).catch(function () {}); // ignore cancellation - } + this.prop.handler.up(function () { + return _this2.psv.dynamics.position.stop(); + }); + }; + + return AbstractMoveButton; + }(AbstractButton); + + /** + * @summary Navigation bar move down button class + * @extends PSV.buttons.AbstractMoveButton + * @memberof PSV.buttons + */ + + var MoveDownButton = /*#__PURE__*/function (_AbstractMoveButton) { + _inheritsLoose(MoveDownButton, _AbstractMoveButton); + /** - * @summary Handles mouse up events - * @private + * @param {PSV.components.Navbar} navbar */ - ; - - _proto.__onMouseUp = function __onMouseUp() { - if (!this.prop.enabled || !this.prop.buttondown) { - return; - } + function MoveDownButton(navbar) { + return _AbstractMoveButton.call(this, navbar, { + latitude: true + }) || this; + } - if (this.prop.longPressAnimation) { - this.prop.longPressAnimation.cancel(); - this.prop.longPressAnimation = null; - } else { - this.psv.zoom(this.psv.prop.zoomLvl + this.prop.value * this.psv.config.zoomButtonIncrement); - } + return MoveDownButton; + }(AbstractMoveButton); + MoveDownButton.id = 'moveDown'; + MoveDownButton.icon = getOrientedArrow('down'); - if (this.prop.longPressTimeout) { - clearTimeout(this.prop.longPressTimeout); - } + /** + * @summary Navigation bar move left button class + * @extends PSV.buttons.AbstractMoveButton + * @memberof PSV.buttons + */ - this.prop.buttondown = false; - }; + var MoveLeftButton = /*#__PURE__*/function (_AbstractMoveButton) { + _inheritsLoose(MoveLeftButton, _AbstractMoveButton); - return AbstractZoomButton; - }(AbstractButton); + /** + * @param {PSV.components.Navbar} navbar + */ + function MoveLeftButton(navbar) { + return _AbstractMoveButton.call(this, navbar, { + longitude: true + }) || this; + } - var zoomIn = "\n"; + return MoveLeftButton; + }(AbstractMoveButton); + MoveLeftButton.id = 'moveLeft'; + MoveLeftButton.icon = getOrientedArrow('left'); /** - * @summary Navigation bar zoom-in button class - * @extends PSV.buttons.AbstractZoomButton + * @summary Navigation bar move right button class + * @extends PSV.buttons.AbstractMoveButton * @memberof PSV.buttons */ - var ZoomInButton = /*#__PURE__*/function (_AbstractZoomButton) { - _inheritsLoose(ZoomInButton, _AbstractZoomButton); + var MoveRightButton = /*#__PURE__*/function (_AbstractMoveButton) { + _inheritsLoose(MoveRightButton, _AbstractMoveButton); /** * @param {PSV.components.Navbar} navbar */ - function ZoomInButton(navbar) { - return _AbstractZoomButton.call(this, navbar, 1) || this; + function MoveRightButton(navbar) { + return _AbstractMoveButton.call(this, navbar, { + longitude: false + }) || this; } - return ZoomInButton; - }(AbstractZoomButton); - ZoomInButton.id = 'zoomIn'; - ZoomInButton.icon = zoomIn; - - var zoomOut = "\n"; + return MoveRightButton; + }(AbstractMoveButton); + MoveRightButton.id = 'moveRight'; + MoveRightButton.icon = getOrientedArrow('right'); /** - * @summary Navigation bar zoom-out button class - * @extends PSV.buttons.AbstractZoomButton + * @summary Navigation bar move up button class + * @extends PSV.buttons.AbstractMoveButton * @memberof PSV.buttons */ - var ZoomOutButton = /*#__PURE__*/function (_AbstractZoomButton) { - _inheritsLoose(ZoomOutButton, _AbstractZoomButton); + var MoveUpButton = /*#__PURE__*/function (_AbstractMoveButton) { + _inheritsLoose(MoveUpButton, _AbstractMoveButton); /** * @param {PSV.components.Navbar} navbar */ - function ZoomOutButton(navbar) { - return _AbstractZoomButton.call(this, navbar, -1) || this; + function MoveUpButton(navbar) { + return _AbstractMoveButton.call(this, navbar, { + latitude: false + }) || this; } - return ZoomOutButton; - }(AbstractZoomButton); - ZoomOutButton.id = 'zoomOut'; - ZoomOutButton.icon = zoomOut; + return MoveUpButton; + }(AbstractMoveButton); + MoveUpButton.id = 'moveUp'; + MoveUpButton.icon = getOrientedArrow('up'); /** * @summary Navigation bar zoom button class @@ -2847,72 +3011,38 @@ * @memberof PSV.buttons */ - var ZoomRangeButton = /*#__PURE__*/function (_AbstractButton) { - _inheritsLoose(ZoomRangeButton, _AbstractButton); + var AbstractZoomButton = /*#__PURE__*/function (_AbstractButton) { + _inheritsLoose(AbstractZoomButton, _AbstractButton); /** * @param {PSV.components.Navbar} navbar + * @param {number} value */ - function ZoomRangeButton(navbar) { + function AbstractZoomButton(navbar, value) { var _this; - _this = _AbstractButton.call(this, navbar, 'psv-zoom-range') || this; + _this = _AbstractButton.call(this, navbar, 'psv-button--hover-scale psv-zoom-button') || this; /** * @override - * @property {boolean} mousedown - * @property {number} mediaMinWidth + * @property {boolean} value + * @property {PressHandler} handler */ _this.prop = _extends({}, _this.prop, { - mousedown: false, - mediaMinWidth: 0 + value: value, + handler: new PressHandler() }); - /** - * @member {HTMLElement} - * @readonly - * @private - */ - - _this.zoomRange = document.createElement('div'); - _this.zoomRange.className = 'psv-zoom-range-line'; - - _this.container.appendChild(_this.zoomRange); - /** - * @member {HTMLElement} - * @readonly - * @private - */ - - - _this.zoomValue = document.createElement('div'); - _this.zoomValue.className = 'psv-zoom-range-handle'; - - _this.zoomRange.appendChild(_this.zoomValue); - - _this.prop.mediaMinWidth = parseInt(getStyle(_this.container, 'maxWidth'), 10); _this.container.addEventListener('mousedown', _assertThisInitialized(_this)); - _this.container.addEventListener('touchstart', _assertThisInitialized(_this)); - - _this.psv.container.addEventListener('mousemove', _assertThisInitialized(_this)); + _this.container.addEventListener('keydown', _assertThisInitialized(_this)); - _this.psv.container.addEventListener('touchmove', _assertThisInitialized(_this)); + _this.container.addEventListener('keyup', _assertThisInitialized(_this)); _this.psv.container.addEventListener('mouseup', _assertThisInitialized(_this)); _this.psv.container.addEventListener('touchend', _assertThisInitialized(_this)); - _this.psv.on(EVENTS.ZOOM_UPDATED, _assertThisInitialized(_this)); - - if (_this.psv.prop.ready) { - _this.__moveZoomValue(_this.psv.prop.zoomLvl); - } else { - _this.psv.once(EVENTS.READY, _assertThisInitialized(_this)); - } - - _this.refreshUi(); - return _this; } /** @@ -2920,18 +3050,13 @@ */ - var _proto = ZoomRangeButton.prototype; + var _proto = AbstractZoomButton.prototype; _proto.destroy = function destroy() { - this.__stopZoomChange(); + this.__onMouseUp(); - this.psv.container.removeEventListener('mousemove', this); - this.psv.container.removeEventListener('touchmove', this); this.psv.container.removeEventListener('mouseup', this); this.psv.container.removeEventListener('touchend', this); - delete this.zoomRange; - delete this.zoomValue; - this.psv.off(EVENTS.ZOOM_UPDATED, this); _AbstractButton.prototype.destroy.call(this); } @@ -2947,28 +3072,259 @@ switch (e.type) { // @formatter:off case 'mousedown': - this.__initZoomChangeWithMouse(e); + this.__onMouseDown(); break; - case 'touchstart': - this.__initZoomChangeByTouch(e); + case 'mouseup': + this.__onMouseUp(); break; - case 'mousemove': - this.__changeZoomWithMouse(e); + case 'touchend': + this.__onMouseUp(); break; - case 'touchmove': - this.__changeZoomByTouch(e); - + case 'keydown': + getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break; - case 'mouseup': - this.__stopZoomChange(e); - + case 'keyup': + getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); + break; + // @formatter:on + } + /* eslint-enable */ + + } + /** + * @override + */ + ; + + _proto.isSupported = function isSupported() { + return { + initial: true, + promise: SYSTEM.isTouchEnabled.then(function (enabled) { + return !enabled; + }) + }; + } + /** + * @override + */ + ; + + _proto.onClick = function onClick() {// nothing + } + /** + * @private + */ + ; + + _proto.__onMouseDown = function __onMouseDown() { + if (!this.prop.enabled) { + return; + } + + this.psv.dynamics.zoom.roll(this.prop.value); + this.prop.handler.down(); + } + /** + * @private + */ + ; + + _proto.__onMouseUp = function __onMouseUp() { + var _this2 = this; + + if (!this.prop.enabled) { + return; + } + + this.prop.handler.up(function () { + return _this2.psv.dynamics.zoom.stop(); + }); + }; + + return AbstractZoomButton; + }(AbstractButton); + + var zoomIn = "\n"; + + /** + * @summary Navigation bar zoom-in button class + * @extends PSV.buttons.AbstractZoomButton + * @memberof PSV.buttons + */ + + var ZoomInButton = /*#__PURE__*/function (_AbstractZoomButton) { + _inheritsLoose(ZoomInButton, _AbstractZoomButton); + + /** + * @param {PSV.components.Navbar} navbar + */ + function ZoomInButton(navbar) { + return _AbstractZoomButton.call(this, navbar, false) || this; + } + + return ZoomInButton; + }(AbstractZoomButton); + ZoomInButton.id = 'zoomIn'; + ZoomInButton.icon = zoomIn; + + var zoomOut = "\n"; + + /** + * @summary Navigation bar zoom-out button class + * @extends PSV.buttons.AbstractZoomButton + * @memberof PSV.buttons + */ + + var ZoomOutButton = /*#__PURE__*/function (_AbstractZoomButton) { + _inheritsLoose(ZoomOutButton, _AbstractZoomButton); + + /** + * @param {PSV.components.Navbar} navbar + */ + function ZoomOutButton(navbar) { + return _AbstractZoomButton.call(this, navbar, true) || this; + } + + return ZoomOutButton; + }(AbstractZoomButton); + ZoomOutButton.id = 'zoomOut'; + ZoomOutButton.icon = zoomOut; + + /** + * @summary Navigation bar zoom button class + * @extends PSV.buttons.AbstractButton + * @memberof PSV.buttons + */ + + var ZoomRangeButton = /*#__PURE__*/function (_AbstractButton) { + _inheritsLoose(ZoomRangeButton, _AbstractButton); + + /** + * @param {PSV.components.Navbar} navbar + */ + function ZoomRangeButton(navbar) { + var _this; + + _this = _AbstractButton.call(this, navbar, 'psv-zoom-range', false, false) || this; + /** + * @override + * @property {boolean} mousedown + * @property {number} mediaMinWidth + */ + + _this.prop = _extends({}, _this.prop, { + mousedown: false, + mediaMinWidth: 0 + }); + /** + * @member {HTMLElement} + * @readonly + * @private + */ + + _this.zoomRange = document.createElement('div'); + _this.zoomRange.className = 'psv-zoom-range-line'; + + _this.container.appendChild(_this.zoomRange); + /** + * @member {HTMLElement} + * @readonly + * @private + */ + + + _this.zoomValue = document.createElement('div'); + _this.zoomValue.className = 'psv-zoom-range-handle'; + + _this.zoomRange.appendChild(_this.zoomValue); + + _this.prop.mediaMinWidth = parseInt(getStyle(_this.container, 'maxWidth'), 10); + + _this.container.addEventListener('mousedown', _assertThisInitialized(_this)); + + _this.container.addEventListener('touchstart', _assertThisInitialized(_this)); + + _this.psv.container.addEventListener('mousemove', _assertThisInitialized(_this)); + + _this.psv.container.addEventListener('touchmove', _assertThisInitialized(_this)); + + _this.psv.container.addEventListener('mouseup', _assertThisInitialized(_this)); + + _this.psv.container.addEventListener('touchend', _assertThisInitialized(_this)); + + _this.psv.on(EVENTS.ZOOM_UPDATED, _assertThisInitialized(_this)); + + if (_this.psv.prop.ready) { + _this.__moveZoomValue(_this.psv.getZoomLevel()); + } else { + _this.psv.once(EVENTS.READY, _assertThisInitialized(_this)); + } + + _this.refreshUi(); + + return _this; + } + /** + * @override + */ + + + var _proto = ZoomRangeButton.prototype; + + _proto.destroy = function destroy() { + this.__stopZoomChange(); + + this.psv.container.removeEventListener('mousemove', this); + this.psv.container.removeEventListener('touchmove', this); + this.psv.container.removeEventListener('mouseup', this); + this.psv.container.removeEventListener('touchend', this); + delete this.zoomRange; + delete this.zoomValue; + this.psv.off(EVENTS.ZOOM_UPDATED, this); + + _AbstractButton.prototype.destroy.call(this); + } + /** + * @summary Handles events + * @param {Event} e + * @private + */ + ; + + _proto.handleEvent = function handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + // @formatter:off + case 'mousedown': + this.__initZoomChangeWithMouse(e); + + break; + + case 'touchstart': + this.__initZoomChangeByTouch(e); + + break; + + case 'mousemove': + this.__changeZoomWithMouse(e); + + break; + + case 'touchmove': + this.__changeZoomByTouch(e); + + break; + + case 'mouseup': + this.__stopZoomChange(e); + break; case 'touchend': @@ -2982,7 +3338,7 @@ break; case EVENTS.READY: - this.__moveZoomValue(this.psv.prop.zoomLvl); + this.__moveZoomValue(this.psv.getZoomLevel()); break; // @formatter:on @@ -3128,49 +3484,434 @@ ZoomRangeButton.id = 'zoomRange'; /** - * @summary Default options - * @type {PSV.Options} - * @memberOf PSV - * @constant + * @namespace PSV.adapters */ - var DEFAULTS = { - panorama: null, - container: null, - caption: null, - loadingImg: null, - loadingTxt: 'Loading...', - size: null, - fisheye: false, - minFov: 30, - maxFov: 90, - defaultZoomLvl: 50, - defaultLong: 0, - defaultLat: 0, - sphereCorrection: null, - sphereCorrectionReorder: false, - moveSpeed: 1, - zoomButtonIncrement: 2, - autorotateDelay: null, - autorotateSpeed: '2rpm', - autorotateLat: null, - moveInertia: true, - mousewheel: true, - mousewheelSpeed: 1, - mousemove: true, - captureCursor: false, - mousewheelCtrlKey: false, - touchmoveTwoFingers: false, - useXmpData: true, - panoData: null, + /** + * @summary Base adapters class + * @memberof PSV.adapters + * @abstract + */ + + var AbstractAdapter = /*#__PURE__*/function () { + /** + * @summary Unique identifier of the adapter + * @member {string} + * @readonly + * @static + */ + + /** + * @summary Indicates if the adapter supports transitions between panoramas + * @member {boolean} + * @readonly + * @static + */ + + /** + * @param {PSV.Viewer} psv + */ + function AbstractAdapter(psv) { + /** + * @summary Reference to main controller + * @type {PSV.Viewer} + * @readonly + */ + this.psv = psv; + } + /** + * @summary Destroys the adapter + */ + + + var _proto = AbstractAdapter.prototype; + + _proto.destroy = function destroy() { + delete this.psv; + } + /** + * @abstract + * @summary Loads the panorama texture(s) + * @param {*} panorama + * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @returns {Promise.} + */ + ; + + _proto.loadTexture = function loadTexture(panorama, newPanoData) { + // eslint-disable-line no-unused-vars + throw new PSVError('loadTexture not implemented'); + } + /** + * @abstract + * @summary Creates the cube mesh + * @param {number} [scale=1] + * @returns {external:THREE.Mesh} + */ + ; + + _proto.createMesh = function createMesh(scale) { + + // eslint-disable-line no-unused-vars + throw new PSVError('createMesh not implemented'); + } + /** + * @abstract + * @summary Applies the texture to the mesh + * @param {external:THREE.Mesh} mesh + * @param {PSV.TextureData} textureData + */ + ; + + _proto.setTexture = function setTexture(mesh, textureData) { + // eslint-disable-line no-unused-vars + throw new PSVError('setTexture not implemented'); + } + /** + * @abstract + * @summary Changes the opacity of the mesh + * @param {external:THREE.Mesh} mesh + * @param {number} opacity + */ + ; + + _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { + // eslint-disable-line no-unused-vars + throw new PSVError('setTextureOpacity not implemented'); + }; + + return AbstractAdapter; + }(); + AbstractAdapter.id = null; + AbstractAdapter.supportsTransition = false; + + var SPHERE_SEGMENTS = 64; + /** + * @summary Adapter for equirectangular panoramas + * @memberof PSV.adapters + */ + + var EquirectangularAdapter = /*#__PURE__*/function (_AbstractAdapter) { + _inheritsLoose(EquirectangularAdapter, _AbstractAdapter); + + function EquirectangularAdapter() { + return _AbstractAdapter.apply(this, arguments) || this; + } + + var _proto = EquirectangularAdapter.prototype; + + /** + * @override + * @param {string} panorama + * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @returns {Promise.} + */ + _proto.loadTexture = function loadTexture(panorama, newPanoData) { + var _this = this; + + 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'); + } + + 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 _this.psv.loader.setProgress(p); + }).then(function (img) { + return { + img: img, + xmpPanoData: null + }; + }) : this.__loadXMP(panorama, function (p) { + return _this.psv.loader.setProgress(p); + }).then(function (xmpPanoData) { + return _this.psv.textureLoader.loadImage(panorama).then(function (img) { + return { + img: img, + xmpPanoData: xmpPanoData + }; + }); + })).then(function (_ref) { + var _newPanoData, _newPanoData2, _newPanoData3, _newPanoData4, _newPanoData5, _newPanoData6, _newPanoData7, _newPanoData8, _newPanoData9; + + var img = _ref.img, + xmpPanoData = _ref.xmpPanoData; + + if (typeof newPanoData === 'function') { + newPanoData = newPanoData(img); + } + + var panoData = { + fullWidth: firstNonNull((_newPanoData = newPanoData) == null ? void 0 : _newPanoData.fullWidth, xmpPanoData == null ? void 0 : xmpPanoData.fullWidth, img.width), + fullHeight: firstNonNull((_newPanoData2 = newPanoData) == null ? void 0 : _newPanoData2.fullHeight, xmpPanoData == null ? void 0 : xmpPanoData.fullHeight, img.height), + croppedWidth: firstNonNull((_newPanoData3 = newPanoData) == null ? void 0 : _newPanoData3.croppedWidth, xmpPanoData == null ? void 0 : xmpPanoData.croppedWidth, img.width), + croppedHeight: firstNonNull((_newPanoData4 = newPanoData) == null ? void 0 : _newPanoData4.croppedHeight, xmpPanoData == null ? void 0 : xmpPanoData.croppedHeight, img.height), + croppedX: firstNonNull((_newPanoData5 = newPanoData) == null ? void 0 : _newPanoData5.croppedX, xmpPanoData == null ? void 0 : xmpPanoData.croppedX, 0), + croppedY: firstNonNull((_newPanoData6 = newPanoData) == null ? void 0 : _newPanoData6.croppedY, xmpPanoData == null ? void 0 : xmpPanoData.croppedY, 0), + poseHeading: firstNonNull((_newPanoData7 = newPanoData) == null ? void 0 : _newPanoData7.poseHeading, xmpPanoData == null ? void 0 : xmpPanoData.poseHeading), + posePitch: firstNonNull((_newPanoData8 = newPanoData) == null ? void 0 : _newPanoData8.posePitch, xmpPanoData == null ? void 0 : xmpPanoData.posePitch), + poseRoll: firstNonNull((_newPanoData9 = newPanoData) == null ? void 0 : _newPanoData9.poseRoll, xmpPanoData == null ? void 0 : xmpPanoData.poseRoll) + }; + + if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) { + logWarn("Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image.\n panoData: " + panoData.croppedWidth + "x" + panoData.croppedHeight + ", image: " + img.width + "x" + img.height); + } + + if (panoData.fullWidth !== panoData.fullHeight * 2) { + logWarn('Invalid panoData, fullWidth should be twice fullHeight'); + } + + var texture = _this.__createEquirectangularTexture(img, panoData); + + return { + texture: texture, + panoData: panoData + }; + }); + } + /** + * @summary Loads the XMP data of an image + * @param {string} panorama + * @param {function(number)} [onProgress] + * @returns {Promise} + * @throws {PSV.PSVError} when the image cannot be loaded + * @private + */ + ; + + _proto.__loadXMP = function __loadXMP(panorama, onProgress) { + var _this2 = this; + + return this.psv.textureLoader.loadFile(panorama, onProgress).then(function (blob) { + return _this2.__loadBlobAsString(blob); + }).then(function (binary) { + var a = binary.indexOf(''); + var data = binary.substring(a, b); + + if (a !== -1 && b !== -1 && data.indexOf('GPano:') !== -1) { + return { + fullWidth: getXMPValue(data, 'FullPanoWidthPixels'), + fullHeight: getXMPValue(data, 'FullPanoHeightPixels'), + croppedWidth: getXMPValue(data, 'CroppedAreaImageWidthPixels'), + croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'), + croppedX: getXMPValue(data, 'CroppedAreaLeftPixels'), + croppedY: getXMPValue(data, 'CroppedAreaTopPixels'), + poseHeading: getXMPValue(data, 'PoseHeadingDegrees'), + posePitch: getXMPValue(data, 'PosePitchDegrees'), + poseRoll: getXMPValue(data, 'PoseRollDegrees') + }; + } + + return null; + }); + } + /** + * @summmary read a Blob as string + * @param {Blob} blob + * @returns {Promise} + * @private + */ + ; + + _proto.__loadBlobAsString = function __loadBlobAsString(blob) { + return new Promise(function (resolve, reject) { + var reader = new FileReader(); + + reader.onload = function () { + return resolve(reader.result); + }; + + reader.onerror = reject; + reader.readAsText(blob); + }); + } + /** + * @summary Creates the final texture from image and panorama data + * @param {Image} img + * @param {PSV.PanoData} panoData + * @returns {external:THREE.Texture} + * @private + */ + ; + + _proto.__createEquirectangularTexture = function __createEquirectangularTexture(img, panoData) { + var finalImage; // resize image / fill cropped parts with black + + if (panoData.fullWidth > SYSTEM.maxTextureWidth || panoData.croppedWidth !== panoData.fullWidth || panoData.croppedHeight !== panoData.fullHeight) { + var resizedPanoData = _extends({}, panoData); + + var ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth; + + if (ratio < 1) { + resizedPanoData.fullWidth *= ratio; + resizedPanoData.fullHeight *= ratio; + resizedPanoData.croppedWidth *= ratio; + resizedPanoData.croppedHeight *= ratio; + resizedPanoData.croppedX *= ratio; + resizedPanoData.croppedY *= ratio; + } + + var buffer = document.createElement('canvas'); + buffer.width = resizedPanoData.fullWidth; + buffer.height = resizedPanoData.fullHeight; + var ctx = buffer.getContext('2d'); + ctx.drawImage(img, resizedPanoData.croppedX, resizedPanoData.croppedY, resizedPanoData.croppedWidth, resizedPanoData.croppedHeight); + finalImage = buffer; + } else { + finalImage = img; + } + + return createTexture(finalImage); + } + /** + * @override + */ + ; + + _proto.createMesh = function createMesh(scale) { + if (scale === void 0) { + scale = 1; + } + + // The middle of the panorama is placed at longitude=0 + var geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, SPHERE_SEGMENTS, SPHERE_SEGMENTS / 2, -Math.PI / 2); + var material = new THREE.MeshBasicMaterial({ + side: THREE.BackSide + }); + var mesh = new THREE.Mesh(geometry, material); + mesh.scale.set(-1, 1, 1); + return mesh; + } + /** + * @override + */ + ; + + _proto.setTexture = function setTexture(mesh, textureData) { + var texture = textureData.texture; + + if (mesh.material.map) { + mesh.material.map.dispose(); + } + + mesh.material.map = texture; + } + /** + * @override + */ + ; + + _proto.setTextureOpacity = function setTextureOpacity(mesh, opacity) { + mesh.material.opacity = opacity; + mesh.material.transparent = opacity < 1; + }; + + return EquirectangularAdapter; + }(AbstractAdapter); + EquirectangularAdapter.id = 'equirectangular'; + EquirectangularAdapter.supportsTransition = true; + + /** + * @namespace PSV.plugins + */ + + /** + * @summary Base plugins class + * @memberof PSV.plugins + * @abstract + */ + + var AbstractPlugin = /*#__PURE__*/function (_EventEmitter) { + _inheritsLoose(AbstractPlugin, _EventEmitter); + + /** + * @summary Unique identifier of the plugin + * @member {string} + * @readonly + * @static + */ + + /** + * @param {PSV.Viewer} psv + */ + function AbstractPlugin(psv) { + var _this; + + _this = _EventEmitter.call(this) || this; + /** + * @summary Reference to main controller + * @type {PSV.Viewer} + * @readonly + */ + + _this.psv = psv; + return _this; + } + /** + * @summary Destroys the plugin + * @package + */ + + + var _proto = AbstractPlugin.prototype; + + _proto.destroy = function destroy() { + delete this.psv; + }; + + return AbstractPlugin; + }(uevent.EventEmitter); + AbstractPlugin.id = null; + + var _keyboard; + /** + * @summary Default options + * @type {PSV.Options} + * @memberOf PSV + * @constant + */ + + var DEFAULTS = { + panorama: null, + container: null, + adapter: null, + caption: null, + loadingImg: null, + loadingTxt: 'Loading...', + size: null, + fisheye: false, + minFov: 30, + maxFov: 90, + defaultZoomLvl: 50, + defaultLong: 0, + defaultLat: 0, + sphereCorrection: null, + moveSpeed: 1, + zoomSpeed: 1, + autorotateDelay: null, + autorotateSpeed: '2rpm', + autorotateLat: null, + moveInertia: true, + mousewheel: true, + mousemove: true, + captureCursor: false, + mousewheelCtrlKey: false, + touchmoveTwoFingers: false, + useXmpData: true, + panoData: null, + requestHeaders: null, canvasBackground: '#000', withCredentials: false, - navbar: ['autorotate', 'zoomOut', 'zoomRange', 'zoomIn', 'download', 'caption', 'fullscreen'], + navbar: ['autorotate', 'zoom', 'move', 'download', 'caption', 'fullscreen'], lang: { autorotate: 'Automatic rotation', zoom: 'Zoom', zoomOut: 'Zoom out', zoomIn: 'Zoom in', + move: 'Move', download: 'Download', fullscreen: 'Fullscreen', menu: 'Menu', @@ -3178,17 +3919,7 @@ ctrlZoom: 'Use ctrl + scroll to zoom the image', loadError: 'The panorama can\'t be loaded' }, - keyboard: { - 'ArrowUp': ACTIONS.ROTATE_LAT_UP, - 'ArrowDown': ACTIONS.ROTATE_LAT_DOWN, - 'ArrowRight': ACTIONS.ROTATE_LONG_RIGHT, - 'ArrowLeft': ACTIONS.ROTATE_LONG_LEFT, - 'PageUp': ACTIONS.ZOOM_IN, - 'PageDown': ACTIONS.ZOOM_OUT, - '+': ACTIONS.ZOOM_IN, - '-': ACTIONS.ZOOM_OUT, - ' ': ACTIONS.TOGGLE_AUTOROTATE - }, + keyboard: (_keyboard = {}, _keyboard[KEY_CODES.ArrowUp] = ACTIONS.ROTATE_LAT_UP, _keyboard[KEY_CODES.ArrowDown] = ACTIONS.ROTATE_LAT_DOWN, _keyboard[KEY_CODES.ArrowRight] = ACTIONS.ROTATE_LONG_RIGHT, _keyboard[KEY_CODES.ArrowLeft] = ACTIONS.ROTATE_LONG_LEFT, _keyboard[KEY_CODES.PageUp] = ACTIONS.ZOOM_IN, _keyboard[KEY_CODES.PageDown] = ACTIONS.ZOOM_OUT, _keyboard[KEY_CODES.Plus] = ACTIONS.ZOOM_IN, _keyboard[KEY_CODES.Minus] = ACTIONS.ZOOM_OUT, _keyboard[KEY_CODES.Space] = ACTIONS.TOGGLE_AUTOROTATE, _keyboard), plugins: [] }; /** @@ -3200,8 +3931,19 @@ panorama: 'Use setPanorama method to change the panorama', panoData: 'Use setPanorama method to change the panorama', container: 'Cannot change viewer container', + adapter: 'Cannot change adapter', plugins: 'Cannot change plugins' }; + /** + * @summary List of deprecated options and their warning messages + * @private + */ + + var DEPRECATED_OPTIONS = { + zoomButtonIncrement: 'zoomButtonIncrement is deprecated, use zoomSpeed', + mousewheelSpeed: 'mousewheelSpeed is deprecated, use zoomSpeed', + sphereCorrectionReorder: 'sphereCorrectionReorder is deprecated' + }; /** * @summary Parsers/validators for each option * @private @@ -3215,6 +3957,15 @@ return _container; }, + adapter: function adapter(_adapter) { + if (!_adapter) { + return [EquirectangularAdapter]; + } else if (Array.isArray(_adapter)) { + return [pluginInterop(_adapter[0], AbstractAdapter), _adapter[1]]; + } else { + return [pluginInterop(_adapter, AbstractAdapter)]; + } + }, defaultLong: function defaultLong(_defaultLong) { // defaultLat is between 0 and PI return parseAngle(_defaultLong); @@ -3226,8 +3977,7 @@ minFov: function minFov(_minFov, config) { // minFov and maxFov must be ordered if (config.maxFov < _minFov) { - logWarn('maxFov cannot be lower than minFov'); // eslint-disable-next-line no-param-reassign - + logWarn('maxFov cannot be lower than minFov'); _minFov = config.maxFov; } // minFov between 1 and 179 @@ -3237,7 +3987,6 @@ maxFov: function maxFov(_maxFov, config) { // minFov and maxFov must be ordered if (_maxFov < config.minFov) { - // eslint-disable-next-line no-param-reassign _maxFov = config.minFov; } // maxFov between 1 and 179 @@ -3252,13 +4001,13 @@ return _extends({}, DEFAULTS.lang, _lang); }, - keyboard: function keyboard(_keyboard) { + keyboard: function keyboard(_keyboard2) { // keyboard=true becomes the default map - if (_keyboard === true) { + if (_keyboard2 === true) { return clone(DEFAULTS.keyboard); } - return _keyboard; + return _keyboard2; }, autorotateLat: function autorotateLat(_autorotateLat, config) { // default autorotateLat is defaultLat @@ -3266,8 +4015,8 @@ return parseAngle(config.defaultLat, true); } // autorotateLat is between -PI/2 and PI/2 else { - return parseAngle(_autorotateLat, true); - } + return parseAngle(_autorotateLat, true); + } }, autorotateSpeed: function autorotateSpeed(_autorotateSpeed) { return parseSpeed(_autorotateSpeed); @@ -3285,9 +4034,9 @@ plugins: function plugins(_plugins) { return _plugins.map(function (plugin) { if (Array.isArray(plugin)) { - return plugin; + return [pluginInterop(plugin[0], AbstractPlugin), plugin[1]]; } else { - return [plugin]; + return [pluginInterop(plugin, AbstractPlugin)]; } }).filter(function (plugin) { return !!plugin[0]; @@ -3307,6 +4056,11 @@ deepmerge(tempConfig, options); var config = {}; each(tempConfig, function (value, key) { + if (DEPRECATED_OPTIONS[key]) { + logWarn(DEPRECATED_OPTIONS[key]); + return; + } + if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) { throw new PSVError("Unknown option " + key); } @@ -3530,7 +4284,7 @@ AVAILABLE_BUTTONS[button.id] = button; } - [AutorotateButton, ZoomInButton, ZoomRangeButton, ZoomOutButton, DownloadButton, FullscreenButton].forEach(registerButton); + [AutorotateButton, ZoomInButton, ZoomRangeButton, ZoomOutButton, DownloadButton, FullscreenButton, MoveRightButton, MoveLeftButton, MoveUpButton, MoveDownButton].forEach(registerButton); /** * @summary Navigation bar class * @extends PSV.components.AbstractComponent @@ -3591,6 +4345,11 @@ new ZoomOutButton(_this2); new ZoomRangeButton(_this2); new ZoomInButton(_this2); + } else if (button === 'move') { + new MoveLeftButton(_this2); + new MoveRightButton(_this2); + new MoveUpButton(_this2); + new MoveDownButton(_this2); } else { throw new PSVError('Unknown button ' + button); } @@ -3728,67 +4487,15 @@ return clone(DEFAULTS.navbar); } // can be a space or coma separated list else if (typeof buttons === 'string') { - return buttons.split(/[ ,]/); - } else { - return buttons || []; - } + return buttons.split(/[ ,]/); + } else { + return buttons || []; + } }; return Navbar; }(AbstractComponent); - /** - * @namespace PSV.plugins - */ - - /** - * @summary Base plugins class - * @memberof PSV.plugins - * @abstract - */ - - var AbstractPlugin = /*#__PURE__*/function (_EventEmitter) { - _inheritsLoose(AbstractPlugin, _EventEmitter); - - /** - * @summary Unique identifier of the plugin - * @member {string} - * @readonly - * @static - */ - - /** - * @param {PSV.Viewer} psv - */ - function AbstractPlugin(psv) { - var _this; - - _this = _EventEmitter.call(this) || this; - /** - * @summary Reference to main controller - * @type {PSV.Viewer} - * @readonly - */ - - _this.psv = psv; - return _this; - } - /** - * @summary Destroys the plugin - * @package - */ - - - var _proto = AbstractPlugin.prototype; - - _proto.destroy = function destroy() { - delete this.psv; - }; - - return AbstractPlugin; - }(uevent.EventEmitter); - AbstractPlugin.id = null; - /** * @summary Loader class * @extends PSV.components.AbstractComponent @@ -3993,7 +4700,7 @@ if (typeof config === 'string') { config = { content: config - }; // eslint-disable-line no-param-reassign + }; } this.content.innerHTML = config.content; @@ -4086,13 +4793,9 @@ _this.container.appendChild(_this.subtext); - _this.container.addEventListener('mouseup', function (e) { - e.stopPropagation(); + _this.container.addEventListener('mouseup', _assertThisInitialized(_this)); - if (_this.prop.dissmisable) { - _this.hide(); - } - }, true); + document.addEventListener('keydown', _assertThisInitialized(_this)); _AbstractComponent.prototype.hide.call(_assertThisInitialized(_this)); @@ -4106,12 +4809,36 @@ var _proto = Overlay.prototype; _proto.destroy = function destroy() { + document.removeEventListener('keydown', this); delete this.image; delete this.text; delete this.subtext; _AbstractComponent.prototype.destroy.call(this); } + /** + * @summary Handles events + * @param {Event} e + * @private + */ + ; + + _proto.handleEvent = function handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + // @formatter:off + case 'mouseup': + this.prop.dissmisable && this.hide(); + break; + + case 'keydown': + getEventKey(e) === KEY_CODES.Escape && this.prop.dissmisable && this.hide(); + break; + // @formatter:on + } + /* eslint-enable */ + + } /** * @override * @param {string} [id] @@ -4145,7 +4872,7 @@ if (typeof config === 'string') { config = { text: config - }; // eslint-disable-line no-param-reassign + }; } this.prop.contentId = config.id; @@ -4210,6 +4937,7 @@ * @property {number} mouseY * @property {boolean} mousedown * @property {function} clickHandler + * @property {function} keyHandler */ _this.prop = _extends({}, _this.prop, { @@ -4219,6 +4947,7 @@ mouseY: 0, mousedown: false, clickHandler: null, + keyHandler: null, width: {} }); var resizer = document.createElement('div'); @@ -4241,7 +4970,7 @@ _this.content = document.createElement('div'); _this.content.className = 'psv-panel-content'; - _this.container.appendChild(_this.content); // Stop wheel event bubling from panel + _this.container.appendChild(_this.content); // Stop wheel event bubbling from panel _this.container.addEventListener(SYSTEM.mouseWheelEvent, function (e) { @@ -4263,6 +4992,7 @@ _this.psv.container.addEventListener('touchmove', _assertThisInitialized(_this)); + document.addEventListener('keydown', _assertThisInitialized(_this)); return _this; } /** @@ -4277,6 +5007,7 @@ this.psv.container.removeEventListener('touchmove', this); this.psv.container.removeEventListener('mouseup', this); this.psv.container.removeEventListener('touchend', this); + document.removeEventListener('keydown', this); delete this.prop; delete this.content; @@ -4322,6 +5053,10 @@ this.__onMouseUp(e); break; + + case 'keydown': + getEventKey(e) === KEY_CODES.Escape && this.hide(); + break; // @formatter:on } /* eslint-enable */ @@ -4351,16 +5086,18 @@ * @param {string} config.content - HTML content of the panel * @param {boolean} [config.noMargin=false] - remove the default margins * @param {string} [config.width] - initial width, if not specified the default width will be used - * @param {Function} [config.clickHandler] - called when the user clicks inside the panel + * @param {Function} [config.clickHandler] - called when the user clicks inside the panel or presses the Enter key while an element focused * @fires PSV.open-panel */ ; _proto.show = function show(config) { + var _this2 = this; + if (typeof config === 'string') { config = { content: config - }; // eslint-disable-line no-param-reassign + }; } this.prop.contentId = config.id; @@ -4368,7 +5105,9 @@ if (this.prop.clickHandler) { this.content.removeEventListener('click', this.prop.clickHandler); + this.content.removeEventListener('keydown', this.prop.keyHandler); this.prop.clickHandler = null; + this.prop.keyHandler = null; } if (config.id && this.prop.width[config.id]) { @@ -4386,7 +5125,21 @@ if (config.clickHandler) { this.prop.clickHandler = config.clickHandler; - this.content.addEventListener('click', config.clickHandler); + + this.prop.keyHandler = function (e) { + if (getEventKey(e) === KEY_CODES.Enter) { + config.clickHandler(e); + } + }; + + this.content.addEventListener('click', this.prop.clickHandler); + this.content.addEventListener('keydown', this.prop.keyHandler); // focus the first element if possible, after animation ends + + setTimeout(function () { + var _this2$content$queryS; + + (_this2$content$queryS = _this2.content.querySelector('a,button,[tabindex]')) == null ? void 0 : _this2$content$queryS.focus(); + }, 300); } this.psv.trigger(EVENTS.OPEN_PANEL, config.id); @@ -4568,6 +5321,8 @@ return AbstractService; }(); + var vector2 = new THREE.Vector2(); + var vector3 = new THREE.Vector3(); /** * @summary Collections of data converters for the current viewer * @extends PSV.services.AbstractService @@ -4642,11 +5397,12 @@ ; _proto.textureCoordsToSphericalCoords = function textureCoordsToSphericalCoords(point) { - if (this.prop.isCubemap) { - throw new PSVError('Unable to use texture coords with cubemap.'); + var panoData = this.prop.panoData; + + if (!panoData) { + throw new PSVError('Current adapter does not support texture coordinates.'); } - var panoData = this.prop.panoData; var relativeX = (point.x + panoData.croppedX) / panoData.fullWidth * Math.PI * 2; var relativeY = (point.y + panoData.croppedY) / panoData.fullHeight * Math.PI; return { @@ -4662,11 +5418,12 @@ ; _proto.sphericalCoordsToTextureCoords = function sphericalCoordsToTextureCoords(position) { - if (this.prop.isCubemap) { - throw new PSVError('Unable to use texture coords with cubemap.'); + var panoData = this.prop.panoData; + + if (!panoData) { + throw new PSVError('Current adapter does not support texture coordinates.'); } - var panoData = this.prop.panoData; var relativeLong = position.longitude / Math.PI / 2 * panoData.fullWidth; var relativeLat = position.latitude / Math.PI * panoData.fullHeight; return { @@ -4677,12 +5434,20 @@ /** * @summary Converts spherical radians coordinates to a THREE.Vector3 * @param {PSV.Position} position + * @param {external:THREE.Vector3} [vector] * @returns {external:THREE.Vector3} */ ; - _proto.sphericalCoordsToVector3 = function sphericalCoordsToVector3(position) { - return new THREE.Vector3(SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude), SPHERE_RADIUS * Math.sin(position.latitude), SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude)); + _proto.sphericalCoordsToVector3 = function sphericalCoordsToVector3(position, vector) { + if (!vector) { + vector = new THREE.Vector3(); + } + + vector.x = SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude); + vector.y = SPHERE_RADIUS * Math.sin(position.latitude); + vector.z = SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude); + return vector; } /** * @summary Converts a THREE.Vector3 to spherical radians coordinates @@ -4707,8 +5472,9 @@ ; _proto.viewerCoordsToVector3 = function viewerCoordsToVector3(viewerPoint) { - var screen = new THREE.Vector2(2 * viewerPoint.x / this.prop.size.width - 1, -2 * viewerPoint.y / this.prop.size.height + 1); - this.psv.renderer.raycaster.setFromCamera(screen, this.psv.renderer.camera); + vector2.x = 2 * viewerPoint.x / this.prop.size.width - 1; + vector2.y = -2 * viewerPoint.y / this.prop.size.height + 1; + this.psv.renderer.raycaster.setFromCamera(vector2, this.psv.renderer.camera); var intersects = this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true); if (intersects.length === 1) { @@ -4732,6 +5498,16 @@ y: Math.round((1 - vectorClone.y) / 2 * this.prop.size.height) }; } + /** + * @summary Converts spherical radians coordinates to position on the viewer + * @param {PSV.Position} position + * @returns {PSV.Point} + */ + ; + + _proto.sphericalCoordsToViewerCoords = function sphericalCoordsToViewerCoords(position) { + return this.vector3ToViewerCoords(this.sphericalCoordsToVector3(position, vector3)); + } /** * @summary Converts x/y to latitude/longitude if present and ensure boundaries * @param {PSV.ExtendedPosition} position @@ -4798,6 +5574,7 @@ * @property {number} mouseY - current y position of the cursor * @property {number[][]} mouseHistory - list of latest positions of the cursor, [time, x, y] * @property {number} pinchDist - distance between fingers when zooming + * @property {PressHandler} keyHandler * @property {boolean} ctrlKeyDown - when the Ctrl key is pressed * @property {PSV.ClickData} dblclickData - temporary storage of click data between two clicks * @property {number} dblclickTimeout - timeout id for double click @@ -4816,6 +5593,7 @@ mouseY: 0, mouseHistory: [], pinchDist: 0, + keyHandler: new PressHandler(), ctrlKeyDown: false, dblclickData: null, dblclickTimeout: null, @@ -5009,7 +5787,7 @@ var key = getEventKey(evt); if (this.config.mousewheelCtrlKey) { - this.state.ctrlKeyDown = key === 'Control'; + this.state.ctrlKeyDown = key === KEY_CODES.Control; if (this.state.ctrlKeyDown) { clearTimeout(this.state.ctrlZoomTimeout); @@ -5021,52 +5799,49 @@ return; } - var dLong = 0; - var dLat = 0; - var dZoom = 0; - /* eslint-disable */ - - switch (this.config.keyboard[key]) { - // @formatter:off - case ACTIONS.ROTATE_LAT_UP: - dLat = 0.01; - break; - - case ACTIONS.ROTATE_LAT_DOWN: - dLat = -0.01; - break; + if (this.config.keyboard[key] === ACTIONS.TOGGLE_AUTOROTATE) { + this.psv.toggleAutorotate(); + } else if (this.config.keyboard[key] && !this.state.keyHandler.time) { + /* eslint-disable */ + switch (this.config.keyboard[key]) { + // @formatter:off + case ACTIONS.ROTATE_LAT_UP: + this.psv.dynamics.position.roll({ + latitude: false + }); + break; - case ACTIONS.ROTATE_LONG_RIGHT: - dLong = 0.01; - break; + case ACTIONS.ROTATE_LAT_DOWN: + this.psv.dynamics.position.roll({ + latitude: true + }); + break; - case ACTIONS.ROTATE_LONG_LEFT: - dLong = -0.01; - break; + case ACTIONS.ROTATE_LONG_RIGHT: + this.psv.dynamics.position.roll({ + longitude: false + }); + break; - case ACTIONS.ZOOM_IN: - dZoom = 1; - break; + case ACTIONS.ROTATE_LONG_LEFT: + this.psv.dynamics.position.roll({ + longitude: true + }); + break; - case ACTIONS.ZOOM_OUT: - dZoom = -1; - break; + case ACTIONS.ZOOM_IN: + this.psv.dynamics.zoom.roll(false); + break; - case ACTIONS.TOGGLE_AUTOROTATE: - this.psv.toggleAutorotate(); - break; - // @formatter:on - } - /* eslint-enable */ + case ACTIONS.ZOOM_OUT: + this.psv.dynamics.zoom.roll(true); + break; + // @formatter:on + } + /* eslint-enable */ - if (dZoom !== 0) { - this.psv.zoom(this.prop.zoomLvl + dZoom * this.config.zoomButtonIncrement); - } else if (dLat !== 0 || dLong !== 0) { - this.psv.rotate({ - longitude: this.prop.position.longitude + dLong * this.prop.moveSpeed * this.prop.hFov, - latitude: this.prop.position.latitude + dLat * this.prop.moveSpeed * this.prop.vFov - }); + this.state.keyHandler.down(); } } /** @@ -5076,7 +5851,19 @@ ; _proto.__onKeyUp = function __onKeyUp() { + var _this2 = this; + this.state.ctrlKeyDown = false; + + if (!this.state.keyboardEnabled) { + return; + } + + this.state.keyHandler.up(function () { + _this2.psv.dynamics.position.stop(); + + _this2.psv.dynamics.zoom.stop(); + }); } /** * @summary Handles mouse down events @@ -5162,7 +5949,7 @@ ; _proto.__onTouchStart = function __onTouchStart(evt) { - var _this2 = this; + var _this3 = this; if (!this.config.mousemove) { return; @@ -5177,9 +5964,9 @@ if (!this.prop.longtouchTimeout) { this.prop.longtouchTimeout = setTimeout(function () { - _this2.__click(evt.touches[0], true); + _this3.__click(evt.touches[0], true); - _this2.prop.longtouchTimeout = null; + _this3.prop.longtouchTimeout = null; }, LONGTOUCH_DELAY); } } else if (evt.touches.length === 2) { @@ -5224,7 +6011,7 @@ ; _proto.__onTouchMove = function __onTouchMove(evt) { - var _this3 = this; + var _this4 = this; if (!this.config.mousemove) { return; @@ -5234,10 +6021,10 @@ if (this.config.touchmoveTwoFingers) { if (!this.prop.twofingersTimeout) { this.prop.twofingersTimeout = setTimeout(function () { - _this3.psv.overlay.show({ + _this4.psv.overlay.show({ id: IDS.TWO_FINGERS, image: gestureIcon, - text: _this3.config.lang.twoFingers + text: _this4.config.lang.twoFingers }); }, TWOFINGERSOVERLAY_DELAY); } @@ -5288,7 +6075,7 @@ ; _proto.__onMouseWheel = function __onMouseWheel(evt) { - var _this4 = this; + var _this5 = this; if (!this.config.mousewheel) { return; @@ -5302,17 +6089,17 @@ }); clearTimeout(this.state.ctrlZoomTimeout); this.state.ctrlZoomTimeout = setTimeout(function () { - return _this4.psv.overlay.hide(IDS.CTRL_ZOOM); + return _this5.psv.overlay.hide(IDS.CTRL_ZOOM); }, CTRLZOOM_TIMEOUT); return; } evt.preventDefault(); evt.stopPropagation(); - var delta = normalizeWheel(evt).spinY * 5; + var delta = normalizeWheel(evt).spinY * 5 * this.config.zoomSpeed; if (delta !== 0) { - this.psv.zoom(this.prop.zoomLvl - delta * this.config.mousewheelSpeed); + this.psv.dynamics.zoom.step(-delta, 5); } } /** @@ -5344,19 +6131,19 @@ ; _proto.__startMove = function __startMove(evt) { - var _this5 = this; + var _this6 = this; this.psv.stopAutorotate(); this.psv.stopAnimation().then(function () { - _this5.state.mouseX = evt.clientX; - _this5.state.mouseY = evt.clientY; - _this5.state.startMouseX = _this5.state.mouseX; - _this5.state.startMouseY = _this5.state.mouseY; - _this5.state.moving = true; - _this5.state.zooming = false; - _this5.state.mouseHistory.length = 0; - - _this5.__logMouseMove(evt); + _this6.state.mouseX = evt.clientX; + _this6.state.mouseY = evt.clientY; + _this6.state.startMouseX = _this6.state.mouseX; + _this6.state.startMouseY = _this6.state.mouseY; + _this6.state.moving = true; + _this6.state.zooming = false; + _this6.state.mouseHistory.length = 0; + + _this6.__logMouseMove(evt); }); } /** @@ -5406,12 +6193,12 @@ this.state.moving = false; } // inertia animation else if (this.config.moveInertia) { - this.__logMouseMove(evt); + this.__logMouseMove(evt); - this.__stopMoveInertia(evt); - } else { - this.state.moving = false; - } + this.__stopMoveInertia(evt); + } else { + this.state.moving = false; + } this.state.mouseHistory.length = 0; } @@ -5435,7 +6222,7 @@ ; _proto.__stopMoveInertia = function __stopMoveInertia(evt) { - var _this6 = this; + var _this7 = this; var direction = { x: evt.clientX - this.state.mouseHistory[0][1], @@ -5456,10 +6243,10 @@ duration: norm * INERTIA_WINDOW / 100, easing: 'outCirc', onTick: function onTick(properties) { - _this6.__move(properties, false); + _this7.__move(properties, false); } }).finally(function () { - _this6.state.moving = false; + _this7.state.moving = false; }); } /** @@ -5473,7 +6260,7 @@ ; _proto.__click = function __click(evt, longtouch) { - var _this7 = this; + var _this8 = this; if (longtouch === void 0) { longtouch = false; @@ -5500,20 +6287,23 @@ if (intersect) { var sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(intersect); data.longitude = sphericalCoords.longitude; - data.latitude = sphericalCoords.latitude; // TODO: for cubemap, computes texture's index and coordinates + data.latitude = sphericalCoords.latitude; - if (!this.prop.isCubemap) { + try { var textureCoords = this.psv.dataHelper.sphericalCoordsToTextureCoords(data); data.textureX = textureCoords.x; data.textureY = textureCoords.y; + } catch (e) { + data.textureX = NaN; + data.textureY = NaN; } if (!this.state.dblclickTimeout) { this.psv.trigger(EVENTS.CLICK, data); this.state.dblclickData = clone(data); this.state.dblclickTimeout = setTimeout(function () { - _this7.state.dblclickTimeout = null; - _this7.state.dblclickData = null; + _this8.state.dblclickTimeout = null; + _this8.state.dblclickData = null; }, DBLCLICK_DELAY); } else { if (Math.abs(this.state.dblclickData.clientX - data.clientX) < MOVE_THRESHOLD && Math.abs(this.state.dblclickData.clientY - data.clientY) < MOVE_THRESHOLD) { @@ -5539,12 +6329,13 @@ var x = evt.clientX; var y = evt.clientY; var rotation = { - longitude: (x - this.state.mouseX) / this.prop.size.width * this.prop.moveSpeed * this.prop.hFov * SYSTEM.pixelRatio, - latitude: (y - this.state.mouseY) / this.prop.size.height * this.prop.moveSpeed * this.prop.vFov * SYSTEM.pixelRatio + longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * THREE.Math.degToRad(this.prop.hFov), + latitude: (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.Math.degToRad(this.prop.vFov) }; + var currentPosition = this.psv.getPosition(); this.psv.rotate({ - longitude: this.prop.position.longitude - rotation.longitude, - latitude: this.prop.position.latitude + rotation.latitude + longitude: currentPosition.longitude - rotation.longitude, + latitude: currentPosition.latitude + rotation.latitude }); this.state.mouseX = x; this.state.mouseY = y; @@ -5564,10 +6355,10 @@ _proto.__moveAbsolute = function __moveAbsolute(evt) { if (this.state.moving) { var containerRect = this.psv.container.getBoundingClientRect(); - this.psv.rotate({ + this.psv.dynamics.position.goto({ longitude: ((evt.clientX - containerRect.left) / containerRect.width - 0.5) * Math.PI * 2, latitude: -((evt.clientY - containerRect.top) / containerRect.height - 0.5) * Math.PI - }); + }, 10); } } /** @@ -5588,8 +6379,8 @@ y: evt.touches[1].clientY }; var p = distance(p1, p2); - var delta = 80 * (p - this.state.pinchDist) / this.prop.size.width; - this.psv.zoom(this.prop.zoomLvl + delta); + var delta = 80 * (p - this.state.pinchDist) / this.prop.size.width * this.config.zoomSpeed; + this.psv.zoom(this.psv.getZoomLevel() + delta); this.__move({ clientX: (p1.x + p2.x) / 2, @@ -5694,6 +6485,12 @@ */ _this.raycaster = null; + /** + * @member {number} + * @private + */ + + _this.timestamp = null; /** * @member {HTMLElement} * @readonly @@ -5777,7 +6574,12 @@ _proto.__renderLoop = function __renderLoop(timestamp) { var _this2 = this; - this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp); + var elapsed = this.timestamp !== null ? timestamp - this.timestamp : 0; + this.timestamp = timestamp; + this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp, elapsed); + each(this.psv.dynamics, function (d) { + return d.update(elapsed); + }); if (this.prop.needsUpdate) { this.render(); @@ -5797,7 +6599,6 @@ ; _proto.render = function render() { - this.prop.direction = this.psv.dataHelper.sphericalCoordsToVector3(this.prop.position); this.camera.position.set(0, 0, 0); this.camera.lookAt(this.prop.direction); @@ -5805,12 +6606,23 @@ this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate(); } - this.camera.aspect = this.prop.aspect; - this.camera.fov = this.prop.vFov; - this.camera.updateProjectionMatrix(); + this.updateCameraMatrix(); this.renderer.render(this.scene, this.camera); this.psv.trigger(EVENTS.RENDER); } + /** + * @summary Updates the camera matrix + * @package + */ + ; + + _proto.updateCameraMatrix = function updateCameraMatrix() { + if (this.camera) { + this.camera.aspect = this.prop.aspect; + this.camera.fov = this.prop.vFov; + this.camera.updateProjectionMatrix(); + } + } /** * @summary Applies the texture to the scene, creates the scene if needed * @param {PSV.TextureData} textureData @@ -5820,30 +6632,12 @@ ; _proto.setTexture = function setTexture(textureData) { - var texture = textureData.texture, - panoData = textureData.panoData; - this.prop.panoData = panoData; - if (!this.scene) { this.__createScene(); } - if (this.prop.isCubemap) { - for (var i = 0; i < 6; i++) { - if (this.mesh.material[i].map) { - this.mesh.material[i].map.dispose(); - } - - this.mesh.material[i].map = texture[i]; - } - } else { - if (this.mesh.material.map) { - this.mesh.material.map.dispose(); - } - - this.mesh.material.map = texture; - } - + this.prop.panoData = textureData.panoData; + this.psv.adapter.setTexture(this.mesh, textureData); this.psv.needsUpdate(); this.psv.trigger(EVENTS.PANORAMA_LOADED); } @@ -5883,99 +6677,35 @@ if (sphereCorrection) { var cleanCorrection = this.psv.dataHelper.cleanSphereCorrection(sphereCorrection); - - if (!this.config.sphereCorrectionReorder) { - var nonZeros = (cleanCorrection.tilt !== 0) + (cleanCorrection.pan !== 0) + (cleanCorrection.roll !== 0); - - if (nonZeros > 1) { - logWarn("\"sphereCorrection\" computation will change in a future version. \n Please set \"sphereCorrectionReorder: true\" and modify your correction accordingly."); - } - } - - mesh.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, this.config.sphereCorrectionReorder ? 'ZXY' : 'XYZ'); + mesh.rotation.set(cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, 'ZXY'); } else { mesh.rotation.set(0, 0, 0); } } /** - * @summary Creates the 3D scene and GUI components - * @private - */ - ; - - _proto.__createScene = function __createScene() { - this.raycaster = new THREE.Raycaster(); - this.renderer = new THREE.WebGLRenderer({ - alpha: true - }); - this.renderer.setSize(this.prop.size.width, this.prop.size.height); - this.renderer.setPixelRatio(SYSTEM.pixelRatio); - this.camera = new THREE.PerspectiveCamera(this.prop.vFov, this.prop.size.width / this.prop.size.height, 1, 3 * SPHERE_RADIUS); - this.camera.position.set(0, 0, 0); - this.scene = new THREE.Scene(); - this.scene.add(this.camera); - - if (this.prop.isCubemap) { - this.mesh = this.__createCubemap(); - } else { - this.mesh = this.__createSphere(); - } - - this.meshContainer = new THREE.Group(); - this.meshContainer.add(this.mesh); - this.scene.add(this.meshContainer); // create canvas container - - this.renderer.domElement.className = 'psv-canvas'; - this.canvasContainer.appendChild(this.renderer.domElement); - } - /** - * @summary Creates the sphere mesh - * @param {number} [scale=1] - * @returns {external:THREE.Mesh} - * @private - */ - ; - - _proto.__createSphere = function __createSphere(scale) { - if (scale === void 0) { - scale = 1; - } - - // The middle of the panorama is placed at longitude=0 - var geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, SPHERE_VERTICES, SPHERE_VERTICES, -Math.PI / 2); - var material = new THREE.MeshBasicMaterial({ - side: THREE.BackSide - }); - var mesh = new THREE.Mesh(geometry, material); - mesh.scale.set(-1, 1, 1); - return mesh; - } - /** - * @summary Creates the cube mesh - * @param {number} [scale=1] - * @returns {external:THREE.Mesh} + * @summary Creates the 3D scene and GUI components * @private */ ; - _proto.__createCubemap = function __createCubemap(scale) { - if (scale === void 0) { - scale = 1; - } - - var cubeSize = SPHERE_RADIUS * 2 * scale; - var geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_VERTICES, CUBE_VERTICES, CUBE_VERTICES); - var materials = []; - - for (var i = 0; i < 6; i++) { - materials.push(new THREE.MeshBasicMaterial({ - side: THREE.BackSide - })); - } + _proto.__createScene = function __createScene() { + this.raycaster = new THREE.Raycaster(); + this.renderer = new THREE.WebGLRenderer({ + alpha: true + }); + this.renderer.setSize(this.prop.size.width, this.prop.size.height); + this.renderer.setPixelRatio(SYSTEM.pixelRatio); + this.camera = new THREE.PerspectiveCamera(this.prop.vFov, this.prop.size.width / this.prop.size.height, 1, 2 * SPHERE_RADIUS); + this.camera.position.set(0, 0, 0); + this.scene = new THREE.Scene(); + this.scene.add(this.camera); + this.mesh = this.psv.adapter.createMesh(); + this.meshContainer = new THREE.Group(); + this.meshContainer.add(this.mesh); + this.scene.add(this.meshContainer); // create canvas container - var mesh = new THREE.Mesh(geometry, materials); - mesh.scale.set(1, 1, -1); - return mesh; + this.renderer.domElement.className = 'psv-canvas'; + this.canvasContainer.appendChild(this.renderer.domElement); } /** * @summary Performs transition between the current and a new texture @@ -5989,49 +6719,24 @@ _proto.transition = function transition(textureData, options) { var _this3 = this; - var texture = textureData.texture, - panoData = textureData.panoData; var positionProvided = isExtendedPosition(options); var zoomProvided = ('zoom' in options); var group = new THREE.Group(); - var mesh; - - if (this.prop.isCubemap) { - if (positionProvided) { - logWarn('cannot perform cubemap transition to different position'); - positionProvided = false; - } - - mesh = this.__createCubemap(0.9); - mesh.material.forEach(function (material, i) { - material.map = texture[i]; - material.transparent = true; - material.opacity = 0; - }); - } else { - mesh = this.__createSphere(0.9); - mesh.material.map = texture; - mesh.material.transparent = true; - mesh.material.opacity = 0; - this.setPanoramaPose(panoData, mesh); - this.setSphereCorrection(options.sphereCorrection, group); - } // rotate the new sphere to make the target position face the camera - + var mesh = this.psv.adapter.createMesh(0.5); + this.psv.adapter.setTexture(mesh, textureData); + this.psv.adapter.setTextureOpacity(mesh, 0); + this.setPanoramaPose(options.panoData, mesh); + this.setSphereCorrection(options.sphereCorrection, group); // rotate the new sphere to make the target position face the camera if (positionProvided) { - var cleanPosition = this.psv.dataHelper.cleanPosition(options); // Longitude rotation along the vertical axis + 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); - group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - this.prop.position.longitude); // Latitude rotation along the camera horizontal axis + 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(); - group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - this.prop.position.latitude); // TODO: find a better way to handle ranges - - if (this.config.latitudeRange || this.config.longitudeRange) { - this.config.longitudeRange = null; - this.config.latitudeRange = null; - logWarn('trying to perform transition with longitudeRange and/or latitudeRange, ranges cleared'); - } + group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - currentPosition.latitude); } group.add(mesh); @@ -6044,20 +6749,14 @@ end: 1.0 }, zoom: zoomProvided ? { - start: this.prop.zoomLvl, + start: this.psv.getZoomLevel(), end: options.zoom } : undefined }, duration: options.transition, easing: 'outCubic', onTick: function onTick(properties) { - if (_this3.prop.isCubemap) { - for (var i = 0; i < 6; i++) { - mesh.material[i].opacity = properties.opacity; - } - } else { - mesh.material.opacity = properties.opacity; - } + _this3.psv.adapter.setTextureOpacity(mesh, properties.opacity); if (zoomProvided) { _this3.psv.zoom(properties.zoom); @@ -6069,17 +6768,14 @@ // remove temp sphere and transfer the texture to the main sphere _this3.setTexture(textureData); - _this3.scene.remove(group); - - mesh.geometry.dispose(); - mesh.geometry = null; + _this3.setPanoramaPose(options.panoData); - if (!_this3.prop.isCubemap) { - _this3.setPanoramaPose(panoData); + _this3.setSphereCorrection(options.sphereCorrection); - _this3.setSphereCorrection(options.sphereCorrection); - } // actually rotate the camera + _this3.scene.remove(group); + mesh.geometry.dispose(); + mesh.geometry = null; // actually rotate the camera if (positionProvided) { _this3.psv.rotate(options); @@ -6155,6 +6851,24 @@ */ _this.requests = []; + /** + * @summary THREE file loader + * @type {external:THREE:FileLoader} + * @private + */ + + _this.loader = new THREE.FileLoader(); + + _this.loader.setResponseType('blob'); + + if (_this.config.withCredentials) { + _this.loader.setWithCredentials(true); + } + + if (_this.config.requestHeaders && typeof _this.config.requestHeaders === 'object') { + _this.loader.setRequestHeader(_this.config.requestHeaders); + } + return _this; } /** @@ -6171,7 +6885,7 @@ } /** * @summary Loads the panorama texture(s) - * @param {string|string[]|PSV.Cubemap} panorama + * @param {*} panorama * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] * @returns {Promise.} * @throws {PSV.PSVError} when the image cannot be loaded @@ -6180,34 +6894,7 @@ ; _proto.loadTexture = function loadTexture(panorama, newPanoData) { - var tempPanorama = []; - - if (Array.isArray(panorama)) { - if (panorama.length !== 6) { - throw new PSVError('Must provide exactly 6 image paths when using cubemap.'); - } // reorder images - - - for (var i = 0; i < 6; i++) { - tempPanorama[i] = panorama[CUBE_MAP[i]]; - } - - return this.__loadCubemapTexture(tempPanorama); - } else if (typeof panorama === 'object') { - if (!CUBE_HASHMAP.every(function (side) { - return !!panorama[side]; - })) { - throw new PSVError('Must provide exactly left, front, right, back, top, bottom when using cubemap.'); - } // transform into array - - - CUBE_HASHMAP.forEach(function (side, i) { - tempPanorama[i] = panorama[side]; - }); - return this.__loadCubemapTexture(tempPanorama); - } else { - return this.__loadEquirectangularTexture(panorama, newPanoData); - } + return this.psv.adapter.loadTexture(panorama, newPanoData); } /** * @summary Cancels current HTTP requests @@ -6225,24 +6912,21 @@ * @param {string} url * @param {function(number)} [onProgress] * @returns {Promise} - * @private */ ; - _proto.__loadFile = function __loadFile(url, onProgress) { + _proto.loadFile = function loadFile(url, onProgress) { var _this2 = this; + if (this.config.requestHeaders && typeof this.config.requestHeaders === 'function') { + this.loader.setRequestHeader(this.config.requestHeaders(url)); + } + return new Promise(function (resolve, reject) { var progress = 0; onProgress && onProgress(progress); - var loader = new THREE.FileLoader(); - - if (_this2.config.withCredentials) { - loader.setWithCredentials(true); - } - loader.setResponseType('blob'); - var request = loader.load(url, function (result) { + var request = _this2.loader.load(url, function (result) { var rIdx = _this2.requests.indexOf(request); if (rIdx !== -1) _this2.requests.splice(rIdx, 1); @@ -6265,6 +6949,7 @@ reject(err); }); // when we hit the cache, the result is the cache value + if (request instanceof XMLHttpRequest) { _this2.requests.push(request); } @@ -6274,274 +6959,34 @@ * @summary Loads an Image using FileLoader to have progress events * @param {string} url * @param {function(number)} [onProgress] - * @returns {Promise} - * @private + * @returns {Promise} */ ; - _proto.__loadImage = function __loadImage(url, onProgress) { - return this.__loadFile(url, onProgress).then(function (result) { + _proto.loadImage = function loadImage(url, onProgress) { + return this.loadFile(url, onProgress).then(function (result) { return new Promise(function (resolve, reject) { var img = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); img.onload = function () { URL.revokeObjectURL(img.src); resolve(img); - }; - - img.onerror = reject; - img.src = URL.createObjectURL(result); - }); - }); - } - /** - * @summmary read a Blob as string - * @param {Blob} blob - * @returns {Promise} - * @private - */ - ; - - _proto.__loadBlobAsString = function __loadBlobAsString(blob) { - return new Promise(function (resolve, reject) { - var reader = new FileReader(); - - reader.onload = function () { - return resolve(reader.result); - }; - - reader.onerror = reject; - reader.readAsText(blob); - }); - } - /** - * @summary Loads the sphere texture - * @param {string} panorama - * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] - * @returns {Promise.} - * @throws {PSV.PSVError} when the image cannot be loaded - * @private - */ - ; - - _proto.__loadEquirectangularTexture = function __loadEquirectangularTexture(panorama, newPanoData) { - var _this3 = this; - - if (this.prop.isCubemap === true) { - throw new PSVError('The viewer was initialized with an cubemap, cannot switch to equirectangular panorama.'); - } - - this.prop.isCubemap = false; - return (!this.config.useXmpData ? this.__loadImage(panorama, function (p) { - return _this3.psv.loader.setProgress(p); - }).then(function (img) { - return { - img: img, - xmpPanoData: null - }; - }) : this.__loadXMP(panorama, function (p) { - return _this3.psv.loader.setProgress(p); - }).then(function (xmpPanoData) { - return _this3.__loadImage(panorama).then(function (img) { - return { - img: img, - xmpPanoData: xmpPanoData - }; - }); - })).then(function (_ref) { - var _newPanoData, _newPanoData2, _newPanoData3, _newPanoData4, _newPanoData5, _newPanoData6, _newPanoData7, _newPanoData8, _newPanoData9; - - var img = _ref.img, - xmpPanoData = _ref.xmpPanoData; - - if (typeof newPanoData === 'function') { - // eslint-disable-next-line no-param-reassign - newPanoData = newPanoData(img); - } - - var panoData = { - fullWidth: firstNonNull((_newPanoData = newPanoData) == null ? void 0 : _newPanoData.fullWidth, xmpPanoData == null ? void 0 : xmpPanoData.fullWidth, img.width), - fullHeight: firstNonNull((_newPanoData2 = newPanoData) == null ? void 0 : _newPanoData2.fullHeight, xmpPanoData == null ? void 0 : xmpPanoData.fullHeight, img.height), - croppedWidth: firstNonNull((_newPanoData3 = newPanoData) == null ? void 0 : _newPanoData3.croppedWidth, xmpPanoData == null ? void 0 : xmpPanoData.croppedWidth, img.width), - croppedHeight: firstNonNull((_newPanoData4 = newPanoData) == null ? void 0 : _newPanoData4.croppedHeight, xmpPanoData == null ? void 0 : xmpPanoData.croppedHeight, img.height), - croppedX: firstNonNull((_newPanoData5 = newPanoData) == null ? void 0 : _newPanoData5.croppedX, xmpPanoData == null ? void 0 : xmpPanoData.croppedX, 0), - croppedY: firstNonNull((_newPanoData6 = newPanoData) == null ? void 0 : _newPanoData6.croppedY, xmpPanoData == null ? void 0 : xmpPanoData.croppedY, 0), - poseHeading: firstNonNull((_newPanoData7 = newPanoData) == null ? void 0 : _newPanoData7.poseHeading, xmpPanoData == null ? void 0 : xmpPanoData.poseHeading), - posePitch: firstNonNull((_newPanoData8 = newPanoData) == null ? void 0 : _newPanoData8.posePitch, xmpPanoData == null ? void 0 : xmpPanoData.posePitch), - poseRoll: firstNonNull((_newPanoData9 = newPanoData) == null ? void 0 : _newPanoData9.poseRoll, xmpPanoData == null ? void 0 : xmpPanoData.poseRoll) - }; - - if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) { - 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); - } - - var texture = _this3.__createEquirectangularTexture(img, panoData); - - return { - texture: texture, - panoData: panoData - }; - }); - } - /** - * @summary Loads the XMP data of an image - * @param {string} panorama - * @param {function(number)} [onProgress] - * @returns {Promise} - * @throws {PSV.PSVError} when the image cannot be loaded - * @private - */ - ; - - _proto.__loadXMP = function __loadXMP(panorama, onProgress) { - var _this4 = this; - - return this.__loadFile(panorama, onProgress).then(function (blob) { - return _this4.__loadBlobAsString(blob); - }).then(function (binary) { - var a = binary.indexOf(''); - var data = binary.substring(a, b); - - if (a !== -1 && b !== -1 && data.indexOf('GPano:') !== -1) { - return { - fullWidth: getXMPValue(data, 'FullPanoWidthPixels'), - fullHeight: getXMPValue(data, 'FullPanoHeightPixels'), - croppedWidth: getXMPValue(data, 'CroppedAreaImageWidthPixels'), - croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'), - croppedX: getXMPValue(data, 'CroppedAreaLeftPixels'), - croppedY: getXMPValue(data, 'CroppedAreaTopPixels'), - poseHeading: getXMPValue(data, 'PoseHeadingDegrees'), - posePitch: getXMPValue(data, 'PosePitchDegrees'), - poseRoll: getXMPValue(data, 'PoseRollDegrees') - }; - } - - return null; - }); - } - /** - * @summary Creates the final texture from image and panorama data - * @param {Image} img - * @param {PSV.PanoData} panoData - * @returns {external:THREE.Texture} - * @private - */ - ; - - _proto.__createEquirectangularTexture = function __createEquirectangularTexture(img, panoData) { - var texture; // resize image / fill cropped parts with black - - if (panoData.fullWidth > SYSTEM.maxTextureWidth || panoData.croppedWidth !== panoData.fullWidth || panoData.croppedHeight !== panoData.fullHeight) { - var resizedPanoData = _extends({}, panoData); - - var ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth; - - if (ratio < 1) { - resizedPanoData.fullWidth *= ratio; - resizedPanoData.fullHeight *= ratio; - resizedPanoData.croppedWidth *= ratio; - resizedPanoData.croppedHeight *= ratio; - resizedPanoData.croppedX *= ratio; - resizedPanoData.croppedY *= ratio; - } - - var buffer = document.createElement('canvas'); - buffer.width = resizedPanoData.fullWidth; - buffer.height = resizedPanoData.fullHeight; - var ctx = buffer.getContext('2d'); - ctx.drawImage(img, resizedPanoData.croppedX, resizedPanoData.croppedY, resizedPanoData.croppedWidth, resizedPanoData.croppedHeight); - texture = new THREE.Texture(buffer); - } else { - texture = new THREE.Texture(img); - } - - texture.needsUpdate = true; - texture.minFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - return texture; - } - /** - * @summary Load the six textures of the cube - * @param {string[]} panorama - * @returns {Promise.} - * @throws {PSV.PSVError} when the image cannot be loaded - * @private - */ - ; - - _proto.__loadCubemapTexture = function __loadCubemapTexture(panorama) { - var _this5 = this; - - if (this.prop.isCubemap === false) { - throw new PSVError('The viewer was initialized with an equirectangular panorama, cannot switch to cubemap.'); - } - - if (this.config.fisheye) { - logWarn('fisheye effect with cubemap texture can generate distorsion'); - } - - this.prop.isCubemap = true; - var promises = []; - var progress = [0, 0, 0, 0, 0, 0]; - - var _loop = function _loop(i) { - promises.push(_this5.__loadImage(panorama[i], function (p) { - progress[i] = p; - - _this5.psv.loader.setProgress(sum(progress) / 6); - }).then(function (img) { - return _this5.__createCubemapTexture(img); - })); - }; - - for (var i = 0; i < 6; i++) { - _loop(i); - } - - return Promise.all(promises).then(function (texture) { - return { - texture: texture - }; - }); - } - /** - * @summary Creates the final texture from image - * @param {Image} img - * @returns {external:THREE.Texture} - * @private - */ - ; - - _proto.__createCubemapTexture = function __createCubemapTexture(img) { - var texture; // resize image - - if (img.width > SYSTEM.maxTextureWidth) { - var buffer = document.createElement('canvas'); - var ratio = SYSTEM.getMaxCanvasWidth() / img.width; - buffer.width = img.width * ratio; - buffer.height = img.height * ratio; - var ctx = buffer.getContext('2d'); - ctx.drawImage(img, 0, 0, buffer.width, buffer.height); - texture = new THREE.Texture(buffer); - } else { - texture = new THREE.Texture(img); - } + }; - texture.needsUpdate = true; - texture.minFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - return texture; + img.onerror = reject; + img.src = URL.createObjectURL(result); + }); + }); } /** * @summary Preload a panorama file without displaying it - * @param {string|string[]|PSV.Cubemap} panorama + * @param {*} panorama * @returns {Promise} */ ; _proto.preloadPanorama = function preloadPanorama(panorama) { - return this.loadTexture(panorama); + return this.psv.adapter.loadTexture(panorama); }; return TextureLoader; @@ -6805,176 +7250,569 @@ } } /** - * @summary Hides the tooltip - * @fires PSV.hide-tooltip + * @summary Hides the tooltip + * @fires PSV.hide-tooltip + */ + ; + + _proto.hide = function hide() { + this.container.classList.remove('psv-tooltip--visible'); + this.prop.state = STATE.HIDING; + this.psv.trigger(EVENTS.HIDE_TOOLTIP, this.prop.data); + } + /** + * @summary Finalize transition + * @param {TransitionEvent} e + * @private + */ + ; + + _proto.__onTransitionEnd = function __onTransitionEnd(e) { + if (e.propertyName === 'transform') { + switch (this.prop.state) { + case STATE.SHOWING: + this.container.classList.add('psv-tooltip--visible'); + this.prop.state = STATE.READY; + break; + + case STATE.HIDING: + this.prop.state = STATE.NONE; + this.destroy(); + break; + + } + } + } + /** + * @summary Computes the position of the tooltip and its arrow + * @param {Object} style + * @param {Object} config + * @private + */ + ; + + _proto.__computeTooltipPosition = function __computeTooltipPosition(style, config) { + var topBottom = false; + + if (!config.box) { + config.box = { + width: 0, + height: 0 + }; + } + + switch (style.posClass[0]) { + case 'bottom': + style.top = config.top + config.box.height + this.prop.offset + this.prop.arrow; + style.arrowTop = -this.prop.arrow * 2; + topBottom = true; + break; + + case 'center': + style.top = config.top + config.box.height / 2 - style.height / 2; + style.arrowTop = style.height / 2 - this.prop.arrow; + break; + + case 'top': + style.top = config.top - style.height - this.prop.offset - this.prop.arrow; + style.arrowTop = style.height; + topBottom = true; + break; + // no default + } + + switch (style.posClass[1]) { + case 'right': + if (topBottom) { + style.left = config.left + config.box.width / 2 - this.prop.offset - this.prop.arrow; + style.arrowLeft = this.prop.offset; + } else { + style.left = config.left + config.box.width + this.prop.offset + this.prop.arrow; + style.arrowLeft = -this.prop.arrow * 2; + } + + break; + + case 'center': + style.left = config.left + config.box.width / 2 - style.width / 2; + style.arrowLeft = style.width / 2 - this.prop.arrow; + break; + + case 'left': + if (topBottom) { + style.left = config.left - style.width + config.box.width / 2 + this.prop.offset + this.prop.arrow; + style.arrowLeft = style.width - this.prop.offset - this.prop.arrow * 2; + } else { + style.left = config.left - style.width - this.prop.offset - this.prop.arrow; + style.arrowLeft = style.width; + } + + break; + // no default + } + }; + + return Tooltip; + }(AbstractComponent); + + /** + * @summary Tooltip renderer + * @extends PSV.services.AbstractService + * @memberof PSV.services + */ + + var TooltipRenderer = /*#__PURE__*/function (_AbstractService) { + _inheritsLoose(TooltipRenderer, _AbstractService); + + /** + * @param {PSV.Viewer} psv + */ + function TooltipRenderer(psv) { + var _this; + + _this = _AbstractService.call(this, psv) || this; + var testTooltip = new Tooltip(_this.psv); + /** + * @summary Computed static sizes + * @member {Object} + * @package + * @property {number} arrowSize + * @property {number} offset + */ + + _this.size = { + arrow: parseInt(getStyle(testTooltip.arrow, 'borderTopWidth'), 10), + offset: parseInt(getStyle(testTooltip.container, 'outlineWidth'), 10) + }; + testTooltip.destroy(); + return _this; + } + /** + * @override + */ + + + var _proto = TooltipRenderer.prototype; + + _proto.destroy = function destroy() { + delete this.size; + + _AbstractService.prototype.destroy.call(this); + } + /** + * @summary Displays a tooltip on the viewer + * @param {PSV.components.Tooltip.Config} config + * @returns {PSV.components.Tooltip} + * + * @fires PSV.show-tooltip + * @throws {PSV.PSVError} when the configuration is incorrect + * + * @example + * viewer.tooltip.create({ content: 'Hello world', top: 200, left: 450, position: 'center bottom'}) + */ + ; + + _proto.create = function create(config) { + var tooltip = new Tooltip(this.psv, this.size); + tooltip.show(config); + return tooltip; + }; + + return TooltipRenderer; + }(AbstractService); + + /** + * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame) + * @memberOf PSV + * @package + */ + + var Dynamic = /*#__PURE__*/function () { + /** + * @param {Function} fn Callback function + * @param {number} [min] Minimum position + * @param {number} [max] Maximum position + */ + function Dynamic(fn, min, max) { + if (min === void 0) { + min = -Infinity; + } + + if (max === void 0) { + max = Infinity; + } + + /** + * @type {Function} + * @private + * @readonly + */ + this.fn = fn; + /** + * @type {number} + * @private + */ + + this.mode = Dynamic.STOP; + /** + * @type {number} + * @private + */ + + this.speed = 0; + /** + * @type {number} + * @private + */ + + this.speedMult = 1; + /** + * @type {number} + * @private + */ + + this.currentSpeed = 0; + /** + * @type {number} + * @private + */ + + this.target = 0; + /** + * @type {number} + * @readonly + */ + + this.current = 0; + /** + * @type {number} + * @private + */ + + this.min = min; + /** + * @type {number} + * @private + */ + + this.max = max; + } + /** + * Changes base speed + * @param {number} speed + */ + + + var _proto = Dynamic.prototype; + + _proto.setSpeed = function setSpeed(speed) { + this.speed = speed; + } + /** + * Defines the target position + * @param {number} position + * @param {number} [speedMult=1] + */ + ; + + _proto.goto = function goto(position, speedMult) { + if (speedMult === void 0) { + speedMult = 1; + } + + this.mode = Dynamic.POSITION; + this.target = bound(position, this.min, this.max); + this.speedMult = speedMult; + } + /** + * Increase/decrease the target position + * @param {number} step + * @param {number} [speedMult=1] + */ + ; + + _proto.step = function step(_step, speedMult) { + if (speedMult === void 0) { + speedMult = 1; + } + + if (this.mode !== Dynamic.POSITION) { + this.target = this.current; + } + + this.goto(this.target + _step, speedMult); + } + /** + * Starts infinite movement + * @param {boolean} [invert=false] + * @param {number} [speedMult=1] + */ + ; + + _proto.roll = function roll(invert, speedMult) { + if (invert === void 0) { + invert = false; + } + + if (speedMult === void 0) { + speedMult = 1; + } + + this.mode = Dynamic.INFINITE; + this.target = invert ? -Infinity : Infinity; + this.speedMult = speedMult; + } + /** + * Stops movement */ ; - _proto.hide = function hide() { - this.container.classList.remove('psv-tooltip--visible'); - this.prop.state = STATE.HIDING; - this.psv.trigger(EVENTS.HIDE_TOOLTIP, this.prop.data); + _proto.stop = function stop() { + this.mode = Dynamic.STOP; } /** - * @summary Finalize transition - * @param {TransitionEvent} e - * @private + * Defines the current position and immediately stops movement + * @param {number} values */ ; - _proto.__onTransitionEnd = function __onTransitionEnd(e) { - if (e.propertyName === 'transform') { - switch (this.prop.state) { - case STATE.SHOWING: - this.container.classList.add('psv-tooltip--visible'); - this.prop.state = STATE.READY; - break; + _proto.setValue = function setValue(values) { + var next = bound(values, this.min, this.max); + this.target = next; + this.mode = Dynamic.STOP; - case STATE.HIDING: - this.prop.state = STATE.NONE; - this.destroy(); - break; + if (next !== this.current) { + this.current = next; + if (this.fn) { + this.fn(this.current); } + + return true; } + + return false; } /** - * @summary Computes the position of the tooltip and its arrow - * @param {Object} style - * @param {Object} config - * @private + * @package */ ; - _proto.__computeTooltipPosition = function __computeTooltipPosition(style, config) { - var topBottom = false; + _proto.update = function update(elapsed) { + // in position mode switch to stop mode when in the decceleration window + if (this.mode === Dynamic.POSITION) { + var dstStop = this.currentSpeed * this.currentSpeed / (this.speed * this.speedMult * 4); - if (!config.box) { - config.box = { - width: 0, - height: 0 - }; - } + if (Math.abs(this.target - this.current) <= dstStop) { + this.mode = Dynamic.STOP; + } + } // compute speed - switch (style.posClass[0]) { - case 'bottom': - style.top = config.top + config.box.height + this.prop.offset + this.prop.arrow; - style.arrowTop = -this.prop.arrow * 2; - topBottom = true; - break; - case 'center': - style.top = config.top + config.box.height / 2 - style.height / 2; - style.arrowTop = style.height / 2 - this.prop.arrow; - break; + var targetSpeed = this.mode === Dynamic.STOP ? 0 : this.speed * this.speedMult; - case 'top': - style.top = config.top - style.height - this.prop.offset - this.prop.arrow; - style.arrowTop = style.height; - topBottom = true; - break; - // no default + if (this.target < this.current) { + targetSpeed = -targetSpeed; } - switch (style.posClass[1]) { - case 'right': - if (topBottom) { - style.left = config.left + config.box.width / 2 - this.prop.offset - this.prop.arrow; - style.arrowLeft = this.prop.offset; - } else { - style.left = config.left + config.box.width + this.prop.offset + this.prop.arrow; - style.arrowLeft = -this.prop.arrow * 2; - } + if (this.currentSpeed < targetSpeed) { + this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsed / 1000 * this.speed * this.speedMult * 2); + } else if (this.currentSpeed > targetSpeed) { + this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsed / 1000 * this.speed * this.speedMult * 2); + } // compute new position - break; - case 'center': - style.left = config.left + config.box.width / 2 - style.width / 2; - style.arrowLeft = style.width / 2 - this.prop.arrow; - break; + var next = null; - case 'left': - if (topBottom) { - style.left = config.left - style.width + config.box.width / 2 + this.prop.offset + this.prop.arrow; - style.arrowLeft = style.width - this.prop.offset - this.prop.arrow * 2; - } else { - style.left = config.left - style.width - this.prop.offset - this.prop.arrow; - style.arrowLeft = style.width; + if (this.current > this.target && this.currentSpeed) { + next = Math.max(this.target, this.current + this.currentSpeed * elapsed / 1000); + } else if (this.current < this.target && this.currentSpeed) { + next = Math.min(this.target, this.current + this.currentSpeed * elapsed / 1000); + } // apply value + + + if (next !== null) { + next = bound(next, this.min, this.max); + + if (next !== this.current) { + this.current = next; + + if (this.fn) { + this.fn(this.current); } - break; - // no default + return true; + } } + + return false; }; - return Tooltip; - }(AbstractComponent); + return Dynamic; + }(); + Dynamic.STOP = 0; + Dynamic.INFINITE = 1; + Dynamic.POSITION = 2; /** - * @summary Tooltip renderer - * @extends PSV.services.AbstractService - * @memberof PSV.services + * @summary Wrapper for multiple {@link PSV.Dynamic} evolving together + * @memberOf PSV + * @package */ - var TooltipRenderer = /*#__PURE__*/function (_AbstractService) { - _inheritsLoose(TooltipRenderer, _AbstractService); - + var MultiDynamic = /*#__PURE__*/function () { /** - * @param {PSV.Viewer} psv + * @param {Record} dynamics + * @param {Function} fn Callback function */ - function TooltipRenderer(psv) { - var _this; - - _this = _AbstractService.call(this, psv) || this; - var testTooltip = new Tooltip(_this.psv); + function MultiDynamic(dynamics, fn) { /** - * @summary Computed static sizes - * @member {Object} - * @package - * @property {number} arrowSize - * @property {number} offset + * @type {Function} + * @private + * @readonly + */ + this.fn = fn; + /** + * @type {Record} + * @private + * @readonly */ - _this.size = { - arrow: parseInt(getStyle(testTooltip.arrow, 'borderTopWidth'), 10), - offset: parseInt(getStyle(testTooltip.container, 'outlineWidth'), 10) - }; - testTooltip.destroy(); - return _this; + this.dynamics = dynamics; } /** - * @override + * Changes base speed + * @param {number} speed */ - var _proto = TooltipRenderer.prototype; + var _proto = MultiDynamic.prototype; - _proto.destroy = function destroy() { - delete this.size; + _proto.setSpeed = function setSpeed(speed) { + each(this.dynamics, function (d) { + d.setSpeed(speed); + }); + } + /** + * Defines the target positions + * @param {Record} positions + * @param {number} [speedMult=1] + */ + ; - _AbstractService.prototype.destroy.call(this); + _proto.goto = function goto(positions, speedMult) { + var _this = this; + + if (speedMult === void 0) { + speedMult = 1; + } + + each(positions, function (position, name) { + _this.dynamics[name].goto(position, speedMult); + }); } /** - * @summary Displays a tooltip on the viewer - * @param {PSV.components.Tooltip.Config} config - * @returns {PSV.components.Tooltip} - * - * @fires PSV.show-tooltip - * @throws {PSV.PSVError} when the configuration is incorrect - * - * @example - * viewer.tooltip.create({ content: 'Hello world', top: 200, left: 450, position: 'center bottom'}) + * Increase/decrease the target positions + * @param {Record} steps + * @param {number} [speedMult=1] */ ; - _proto.create = function create(config) { - var tooltip = new Tooltip(this.psv, this.size); - tooltip.show(config); - return tooltip; + _proto.step = function step(steps, speedMult) { + var _this2 = this; + + if (speedMult === void 0) { + speedMult = 1; + } + + each(steps, function (step, name) { + _this2.dynamics[name].step(step, speedMult); + }); + } + /** + * Starts infinite movements + * @param {Record} rolls + * @param {number} [speedMult=1] + */ + ; + + _proto.roll = function roll(rolls, speedMult) { + var _this3 = this; + + if (speedMult === void 0) { + speedMult = 1; + } + + each(rolls, function (roll, name) { + _this3.dynamics[name].roll(roll, speedMult); + }); + } + /** + * Stops movements + */ + ; + + _proto.stop = function stop() { + each(this.dynamics, function (d) { + return d.stop(); + }); + } + /** + * Defines the current positions and immediately stops movements + * @param {Record} values + */ + ; + + _proto.setValue = function setValue(values) { + var _this4 = this; + + var hasUpdates = false; + each(values, function (value, name) { + hasUpdates |= _this4.dynamics[name].setValue(value); + }); + + if (hasUpdates && this.fn) { + this.fn(this.current); + } + + return hasUpdates; + } + /** + * @package + */ + ; + + _proto.update = function update(elapsed) { + var hasUpdates = false; + each(this.dynamics, function (dynamic) { + hasUpdates |= dynamic.update(elapsed); + }); + + if (hasUpdates && this.fn) { + this.fn(this.current); + } + + return hasUpdates; }; - return TooltipRenderer; - }(AbstractService); + _createClass(MultiDynamic, [{ + key: "current", + get: + /** + * @type {Object} + * @readonly + */ + function get() { + var values = {}; + each(this.dynamics, function (dynamic, name) { + values[name] = dynamic.current; + }); + return values; + } + }]); + + return MultiDynamic; + }(); THREE.Cache.enabled = true; /** @@ -7010,15 +7848,11 @@ * @protected * @property {boolean} ready - when all components are loaded * @property {boolean} needsUpdate - if the view needs to be renderer - * @property {boolean} isCubemap - if the panorama is a cubemap - * @property {PSV.Position} position - current direction of the camera * @property {external:THREE.Vector3} direction - direction of the camera - * @property {number} zoomLvl - current zoom level * @property {number} vFov - vertical FOV * @property {number} hFov - horizontal FOV * @property {number} aspect - viewer aspect ratio - * @property {number} moveSpeed - move speed (computed with pixel ratio and configuration moveSpeed) - * @property {Function} autorotateCb - update callback of the automatic rotation + * @property {boolean} autorotateEnabled - automatic rotation is enabled * @property {PSV.Animation} animationPromise - promise of the current animation (either go to position or image transition) * @property {Promise} loadingPromise - promise of the setPanorama method * @property startTimeout - timeout id of the automatic rotation delay @@ -7032,18 +7866,11 @@ uiRefresh: false, needsUpdate: false, fullscreen: false, - isCubemap: undefined, - position: { - longitude: 0, - latitude: 0 - }, - direction: null, - zoomLvl: null, + direction: new THREE.Vector3(0, 0, SPHERE_RADIUS), vFov: null, hFov: null, aspect: null, - moveSpeed: 0.1, - autorotateCb: null, + autorotateEnabled: false, animationPromise: null, loadingPromise: null, startTimeout: null, @@ -7086,6 +7913,16 @@ _this.container.classList.add('psv-container'); _this.parent.appendChild(_this.container); + /** + * @summary Render adapter + * @type {PSV.adapters.AbstractAdapter} + * @readonly + * @package + */ + + + _this.adapter = new _this.config.adapter[0](_assertThisInitialized(_this), _this.config.adapter[1]); // eslint-disable-line new-cap + /** * @summary All child components * @type {PSV.components.AbstractComponent[]} @@ -7093,7 +7930,6 @@ * @package */ - _this.children = []; /** * @summary All plugins @@ -7167,6 +8003,33 @@ */ _this.overlay = new Overlay(_assertThisInitialized(_this)); + /** + * @member {Record} + * @package + */ + + _this.dynamics = { + zoom: new Dynamic(function (value) { + _this.prop.vFov = _this.dataHelper.zoomLevelToFov(value); + _this.prop.hFov = _this.dataHelper.vFovToHFov(_this.prop.vFov); + + _this.needsUpdate(); + + _this.trigger(EVENTS.ZOOM_UPDATED, value); + }, 0, 100), + position: new MultiDynamic({ + longitude: new Dynamic(null), + latitude: new Dynamic(null, -Math.PI / 2, Math.PI / 2) + }, function (position) { + _this.dataHelper.sphericalCoordsToVector3(position, _this.prop.direction); + + _this.needsUpdate(); + + _this.trigger(EVENTS.POSITION_UPDATED, position); + }) + }; + + _this.__updateSpeeds(); _this.eventsHandler.init(); @@ -7174,11 +8037,9 @@ return _this.refreshUi('resize'); }, 500); // apply container size - _this.resize(_this.config.size); // actual move speed depends on pixel-ratio + _this.resize(_this.config.size); // init plugins - _this.prop.moveSpeed = THREE.Math.degToRad(_this.config.moveSpeed / SYSTEM.pixelRatio); // init plugins - _this.config.plugins.forEach(function (_ref) { var plugin = _ref[0], opts = _ref[1]; @@ -7238,6 +8099,7 @@ this.renderer.destroy(); this.textureLoader.destroy(); this.dataHelper.destroy(); + this.adapter.destroy(); this.children.slice().forEach(function (child) { return child.destroy(); }); @@ -7297,7 +8159,12 @@ ; _proto.getPlugin = function getPlugin(pluginId) { - return pluginId ? this.plugins[typeof pluginId === 'function' ? pluginId.id : pluginId] : null; + if (typeof pluginId === 'string') { + return this.plugins[pluginId]; + } else { + var pluginCtor = pluginInterop(pluginId, AbstractPlugin); + return pluginCtor ? this.plugins[pluginCtor.id] : undefined; + } } /** * @summary Returns the current position of the camera @@ -7306,10 +8173,7 @@ ; _proto.getPosition = function getPosition() { - return { - longitude: this.prop.position.longitude, - latitude: this.prop.position.latitude - }; + return this.dynamics.position.current; } /** * @summary Returns the current zoom level @@ -7318,7 +8182,7 @@ ; _proto.getZoomLevel = function getZoomLevel() { - return this.prop.zoomLvl; + return this.dynamics.zoom.current; } /** * @summary Returns the current viewer size @@ -7339,7 +8203,7 @@ ; _proto.isAutorotateEnabled = function isAutorotateEnabled() { - return !!this.prop.autorotateCb; + return this.prop.autorotateEnabled; } /** * @summary Checks if the viewer is in fullscreen @@ -7378,6 +8242,7 @@ this.prop.size.height = Math.round(this.container.clientHeight); this.prop.aspect = this.prop.size.width / this.prop.size.height; this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov); + this.renderer.updateCameraMatrix(); this.needsUpdate(); this.trigger(EVENTS.SIZE_UPDATED, this.getSize()); @@ -7389,7 +8254,7 @@ * @description Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
* If the "options" parameter is not defined, the camera will not move and the ongoing animation will continue.
* If another loading is already in progress it will be aborted. - * @param {string|string[]|PSV.Cubemap} path - URL of the new panorama file + * @param {*} path - URL of the new panorama file * @param {PSV.PanoramaOptions} [options] * @returns {Promise} */ @@ -7408,11 +8273,11 @@ if (!this.prop.ready) { - if (!('longitude' in options) && !this.prop.isCubemap) { + if (!('longitude' in options)) { options.longitude = this.config.defaultLong; } - if (!('latitude' in options) && !this.prop.isCubemap) { + if (!('latitude' in options)) { options.latitude = this.config.defaultLat; } @@ -7469,12 +8334,12 @@ } }; - if (!options.transition || !this.prop.ready) { + if (!options.transition || !this.prop.ready || !this.adapter.constructor.supportsTransition) { if (options.showLoader || !this.prop.ready) { this.loader.show(); } - this.prop.loadingPromise = this.textureLoader.loadTexture(this.config.panorama, options.panoData).then(function (textureData) { + this.prop.loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData).then(function (textureData) { _this3.renderer.setTexture(textureData); _this3.renderer.setPanoramaPose(textureData.panoData); @@ -7494,7 +8359,7 @@ this.loader.show(); } - this.prop.loadingPromise = this.textureLoader.loadTexture(this.config.panorama, options.panoData).then(function (textureData) { + this.prop.loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData).then(function (textureData) { _this3.loader.hide(); return _this3.renderer.transition(textureData, options); @@ -7514,6 +8379,11 @@ var _this4 = this; each(options, function (value, key) { + if (DEPRECATED_OPTIONS[key]) { + logWarn(DEPRECATED_OPTIONS[key]); + return; + } + if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) { throw new PSVError("Unknown option " + key); } @@ -7551,12 +8421,14 @@ break; case 'moveSpeed': - _this4.prop.moveSpeed = THREE.Math.degToRad(value / SYSTEM.pixelRatio); + case 'zoomSpeed': + _this4.__updateSpeeds(); + break; case 'minFov': case 'maxFov': - _this4.prop.zoomLvl = _this4.dataHelper.fovToZoomLevel(_this4.prop.vFov); + _this4.dynamics.zoom.setValue(_this4.dataHelper.fovToZoomLevel(_this4.prop.vFov)); _this4.trigger(EVENTS.ZOOM_UPDATED, _this4.getZoomLevel()); @@ -7591,25 +8463,15 @@ ; _proto.startAutorotate = function startAutorotate() { - var _this5 = this; - this.__stopAll(); - this.prop.autorotateCb = function () { - var last; - var elapsed; - return function (e, timestamp) { - elapsed = last === undefined ? 0 : timestamp - last; - last = timestamp; - - _this5.rotate({ - longitude: _this5.prop.position.longitude + _this5.config.autorotateSpeed * elapsed / 1000, - latitude: _this5.prop.position.latitude - (_this5.prop.position.latitude - _this5.config.autorotateLat) / 200 - }); - }; - }(); - - this.on(EVENTS.BEFORE_RENDER, this.prop.autorotateCb); + this.dynamics.position.roll({ + longitude: this.config.autorotateSpeed < 0 + }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed)); + this.dynamics.position.goto({ + latitude: this.config.autorotateLat + }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed)); + this.prop.autorotateEnabled = true; this.trigger(EVENTS.AUTOROTATE, true); } /** @@ -7625,8 +8487,8 @@ } if (this.isAutorotateEnabled()) { - this.off(EVENTS.BEFORE_RENDER, this.prop.autorotateCb); - this.prop.autorotateCb = null; + this.dynamics.position.stop(); + this.prop.autorotateEnabled = false; this.trigger(EVENTS.AUTOROTATE, false); } } @@ -7681,13 +8543,7 @@ } var cleanPosition = this.change(CHANGE_EVENTS.GET_ROTATE_POSITION, this.dataHelper.cleanPosition(position)); - - if (this.prop.position.longitude !== cleanPosition.longitude || this.prop.position.latitude !== cleanPosition.latitude) { - this.prop.position.longitude = cleanPosition.longitude; - this.prop.position.latitude = cleanPosition.latitude; - this.needsUpdate(); - this.trigger(EVENTS.POSITION_UPDATED, this.getPosition()); - } + this.dynamics.position.setValue(cleanPosition); } /** * @summary Rotates and zooms the view with a smooth animation @@ -7697,7 +8553,7 @@ ; _proto.animate = function animate(options) { - var _this6 = this; + var _this5 = this; this.__stopAll(); @@ -7707,25 +8563,26 @@ var duration; // clean/filter position and compute duration if (positionProvided) { - var cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options)); // longitude offset for shortest arc + var cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options)); + var currentPosition = this.getPosition(); // longitude offset for shortest arc - var tOffset = getShortestArc(this.prop.position.longitude, cleanPosition.longitude); + var tOffset = getShortestArc(currentPosition.longitude, cleanPosition.longitude); animProperties.longitude = { - start: this.prop.position.longitude, - end: this.prop.position.longitude + tOffset + start: currentPosition.longitude, + end: currentPosition.longitude + tOffset }; animProperties.latitude = { - start: this.prop.position.latitude, + start: currentPosition.latitude, end: cleanPosition.latitude }; - duration = this.dataHelper.speedToDuration(options.speed, getAngle(this.prop.position, cleanPosition)); + duration = this.dataHelper.speedToDuration(options.speed, getAngle(currentPosition, cleanPosition)); } // clean/filter zoom and compute duration if (zoomProvided) { - var dZoom = Math.abs(options.zoom - this.prop.zoomLvl); + var dZoom = Math.abs(options.zoom - this.getZoomLevel()); animProperties.zoom = { - start: this.prop.zoomLvl, + start: this.getZoomLevel(), end: options.zoom }; @@ -7754,11 +8611,11 @@ easing: 'inOutSine', onTick: function onTick(properties) { if (positionProvided) { - _this6.rotate(properties); + _this5.rotate(properties); } if (zoomProvided) { - _this6.zoom(properties.zoom); + _this5.zoom(properties.zoom); } } }); @@ -7772,15 +8629,15 @@ ; _proto.stopAnimation = function stopAnimation() { - var _this7 = this; + var _this6 = this; if (this.prop.animationPromise) { return new Promise(function (resolve) { - _this7.prop.animationPromise.finally(resolve); + _this6.prop.animationPromise.finally(resolve); - _this7.prop.animationPromise.cancel(); + _this6.prop.animationPromise.cancel(); - _this7.prop.animationPromise = null; + _this6.prop.animationPromise = null; }); } else { return Promise.resolve(); @@ -7794,32 +8651,33 @@ ; _proto.zoom = function zoom(level) { - var newZoomLvl = bound(level, 0, 100); - - if (this.prop.zoomLvl !== newZoomLvl) { - this.prop.zoomLvl = newZoomLvl; - this.prop.vFov = this.dataHelper.zoomLevelToFov(this.prop.zoomLvl); - this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov); - this.needsUpdate(); - this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel()); - this.rotate(this.prop.position); - } + this.dynamics.zoom.setValue(level); } /** - * @summary Increases the zoom level by 1 + * @summary Increases the zoom level + * @param {number} [step=1] */ ; - _proto.zoomIn = function zoomIn() { - this.zoom(this.prop.zoomLvl + this.config.zoomButtonIncrement); + _proto.zoomIn = function zoomIn(step) { + if (step === void 0) { + step = 1; + } + + this.dynamics.zoom.step(step); } /** - * @summary Decreases the zoom level by 1 + * @summary Decreases the zoom level + * @param {number} [step=1] */ ; - _proto.zoomOut = function zoomOut() { - this.zoom(this.prop.zoomLvl - this.config.zoomButtonIncrement); + _proto.zoomOut = function zoomOut(step) { + if (step === void 0) { + step = 1; + } + + this.dynamics.zoom.step(-step); } /** * @summary Resizes the viewer @@ -7828,7 +8686,7 @@ ; _proto.resize = function resize(size) { - var _this8 = this; + var _this7 = this; ['width', 'height'].forEach(function (dim) { if (size && size[dim]) { @@ -7836,7 +8694,7 @@ size[dim] += 'px'; } - _this8.parent.style[dim] = size[dim]; + _this7.parent.style[dim] = size[dim]; } }); this.autoSize(); @@ -7906,7 +8764,7 @@ } /** * @summary Stops all current animations - * @private + * @package */ ; @@ -7914,11 +8772,22 @@ this.stopAutorotate(); this.stopAnimation(); this.trigger(EVENTS.STOP_ALL); + } + /** + * @summary Recomputes dynamics speeds + * @private + */ + ; + + _proto.__updateSpeeds = function __updateSpeeds() { + this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50); + this.dynamics.position.setSpeed(THREE.Math.degToRad(this.config.moveSpeed * 50)); }; return Viewer; }(uevent.EventEmitter); + exports.AbstractAdapter = AbstractAdapter; exports.AbstractButton = AbstractButton; exports.AbstractPlugin = AbstractPlugin; exports.Animation = Animation; diff --git a/dist/photo-sphere-viewer.js.map b/dist/photo-sphere-viewer.js.map index 91ee36619..4a7198675 100644 --- a/dist/photo-sphere-viewer.js.map +++ b/dist/photo-sphere-viewer.js.map @@ -1 +1 @@ -{"version":3,"file":"photo-sphere-viewer.js","sources":["../src/data/constants.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/PSVError.js","../src/utils/psv.js","../src/utils/index.js","../src/Animation.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/data/system.js","../src/buttons/AbstractZoomButton.js","../src/buttons/ZoomInButton.js","../src/buttons/ZoomOutButton.js","../src/buttons/ZoomRangeButton.js","../src/data/config.js","../src/buttons/CaptionButton.js","../src/components/NavbarCaption.js","../src/components/Navbar.js","../src/plugins/AbstractPlugin.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 * @namespace PSV.constants\n */\n\n/**\n * @summary Number of pixels bellow which a mouse move will be considered as a click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const MOVE_THRESHOLD = 4;\n\n/**\n * @summary Delay in milliseconds between two clicks to consider a double click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DBLCLICK_DELAY = 300;\n\n/**\n * @summary Delay in milliseconds to emulate a long touch\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const LONGTOUCH_DELAY = 500;\n\n/**\n * @summary Delay in milliseconds to for the two fingers overlay to appear\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const TWOFINGERSOVERLAY_DELAY = 100;\n\n/**\n * @summary Duration in milliseconds of the \"ctrl zoom\" overlay\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const CTRLZOOM_TIMEOUT = 2000;\n\n/**\n * @summary Time size of the mouse position history used to compute inertia\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const INERTIA_WINDOW = 300;\n\n/**\n * @summary Radius of the THREE.SphereGeometry, Half-length of the THREE.BoxGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const SPHERE_RADIUS = 100;\n\n/**\n * @summary Number of vertice of the THREE.SphereGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const SPHERE_VERTICES = 64;\n\n/**\n * @summary Number of vertices of each side of the THREE.BoxGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const CUBE_VERTICES = 8;\n\n/**\n * @summary Order of cube textures for arrays\n * @memberOf PSV.constants\n * @type {number[]}\n * @constant\n */\nexport const CUBE_MAP = [0, 2, 4, 5, 3, 1];\n\n/**\n * @summary Order of cube textures for maps\n * @memberOf PSV.constants\n * @type {string[]}\n * @constant\n */\nexport const CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front'];\n\n/**\n * @summary Property name added to viewer element\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const VIEWER_DATA = 'photoSphereViewer';\n\n/**\n * @summary Available actions\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const ACTIONS = {\n ROTATE_LAT_UP : 'rotateLatitudeUp',\n ROTATE_LAT_DOWN : 'rotateLatitudeDown',\n ROTATE_LONG_RIGHT: 'rotateLongitudeRight',\n ROTATE_LONG_LEFT : 'rotateLongitudeLeft',\n ZOOM_IN : 'zoomIn',\n ZOOM_OUT : 'zoomOut',\n TOGGLE_AUTOROTATE: 'toggleAutorotate',\n};\n\n/**\n * @summary Available events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event autorotate\n * @memberof PSV\n * @summary Triggered when the automatic rotation is enabled/disabled\n * @param {boolean} enabled\n */\n AUTOROTATE : 'autorotate',\n /**\n * @event before-render\n * @memberof PSV\n * @summary Triggered before a render, used to modify the view\n * @param {number} timestamp - time provided by requestAnimationFrame\n */\n BEFORE_RENDER : 'before-render',\n /**\n * @event before-rotate\n * @memberOf PSV\n * @summary Triggered before a rotate operation, can be cancelled\n * @param {PSV.ExtendedPosition}\n */\n BEFORE_ROTATE : 'before-rotate',\n /**\n * @event click\n * @memberof PSV\n * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel)\n * @param {PSV.ClickData} data\n */\n CLICK : 'click',\n /**\n * @event close-panel\n * @memberof PSV\n * @summary Triggered when the panel is closed\n * @param {string} [id]\n */\n CLOSE_PANEL : 'close-panel',\n /**\n * @event config-changed\n * @memberOf PSV\n * @summary Triggered after a call to setOption/setOptions\n * @param {string[]} name of changed options\n */\n CONFIG_CHANGED : 'config-changed',\n /**\n * @event dblclick\n * @memberof PSV\n * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick`\n * @param {PSV.ClickData} data\n */\n DOUBLE_CLICK : 'dblclick',\n /**\n * @event fullscreen-updated\n * @memberof PSV\n * @summary Triggered when the fullscreen mode is enabled/disabled\n * @param {boolean} enabled\n */\n FULLSCREEN_UPDATED: 'fullscreen-updated',\n /**\n * @event hide-notification\n * @memberof PSV\n * @summary Triggered when the notification is hidden\n */\n HIDE_NOTIFICATION : 'hide-notification',\n /**\n * @event hide-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is hidden\n * @param {string} [id]\n */\n HIDE_OVERLAY : 'hide-overlay',\n /**\n * @event hide-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is hidden\n * @param {*} Data associated to this tooltip\n */\n HIDE_TOOLTIP : 'hide-tooltip',\n /**\n * @event open-panel\n * @memberof PSV\n * @summary Triggered when the panel is opened\n * @param {string} [id]\n */\n OPEN_PANEL : 'open-panel',\n /**\n * @event panorama-loaded\n * @memberof PSV\n * @summary Triggered when a panorama image has been loaded\n */\n PANORAMA_LOADED : 'panorama-loaded',\n /**\n * @event position-updated\n * @memberof PSV\n * @summary Triggered when the view longitude and/or latitude changes\n * @param {PSV.Position} position\n */\n POSITION_UPDATED : 'position-updated',\n /**\n * @event ready\n * @memberof PSV\n * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render\n */\n READY : 'ready',\n /**\n * @event render\n * @memberof PSV\n * @summary Triggered on each viewer render, **this event is triggered very often**\n */\n RENDER : 'render',\n /**\n * @event show-notification\n * @memberof PSV\n * @summary Triggered when the notification is shown\n */\n SHOW_NOTIFICATION : 'show-notification',\n /**\n * @event show-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is shown\n * @param {string} [id]\n */\n SHOW_OVERLAY : 'show-overlay',\n /**\n * @event show-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is shown\n * @param {*} Data associated to this tooltip\n * @param {PSV.components.Tooltip} Instance of the tooltip\n */\n SHOW_TOOLTIP : 'show-tooltip',\n /**\n * @event size-updated\n * @memberof PSV\n * @summary Triggered when the viewer size changes\n * @param {PSV.Size} size\n */\n SIZE_UPDATED : 'size-updated',\n /**\n * @event stop-all\n * @memberof PSV\n * @summary Triggered when all current animations are stopped\n */\n STOP_ALL : 'stop-all',\n /**\n * @event zoom-updated\n * @memberof PSV\n * @summary Triggered when the zoom level changes\n * @param {number} zoomLevel\n */\n ZOOM_UPDATED : 'zoom-updated',\n};\n\n/**\n * @summary Available change events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const CHANGE_EVENTS = {\n /**\n * @event get-animate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of an animation\n */\n GET_ANIMATE_POSITION: 'get-animate-position',\n /**\n * @event get-rotate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of a rotation\n */\n GET_ROTATE_POSITION : 'get-rotate-position',\n};\n\n/**\n * @summary Internal identifiers for various stuff\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const IDS = {\n MENU : 'menu',\n TWO_FINGERS: 'twoFingers',\n CTRL_ZOOM : 'ctrlZoom',\n ERROR : 'error',\n};\n\n/* eslint-disable */\n// @formatter:off\n/**\n * @summary Collection of easing functions\n * @memberOf PSV.constants\n * @see {@link https://gist.github.com/frederickk/6165768}\n * @type {Object}\n * @constant\n */\nexport const EASINGS = {\n linear : (t) => t,\n\n inQuad : (t) => t*t,\n outQuad : (t) => t*(2-t),\n inOutQuad : (t) => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\n inCubic : (t) => t*t*t,\n outCubic : (t) => (--t)*t*t+1,\n inOutCubic: (t) => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\n inQuart : (t) => t*t*t*t,\n outQuart : (t) => 1-(--t)*t*t*t,\n inOutQuart: (t) => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\n inQuint : (t) => t*t*t*t*t,\n outQuint : (t) => 1+(--t)*t*t*t*t,\n inOutQuint: (t) => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t,\n\n inSine : (t) => 1-Math.cos(t*(Math.PI/2)),\n outSine : (t) => Math.sin(t*(Math.PI/2)),\n inOutSine : (t) => .5-.5*Math.cos(Math.PI*t),\n\n inExpo : (t) => Math.pow(2, 10*(t-1)),\n outExpo : (t) => 1-Math.pow(2, -10*t),\n inOutExpo : (t) => (t=t*2-1)<0 ? .5*Math.pow(2, 10*t) : 1-.5*Math.pow(2, -10*t),\n\n inCirc : (t) => 1-Math.sqrt(1-t*t),\n outCirc : (t) => Math.sqrt(1-(t-1)*(t-1)),\n inOutCirc : (t) => (t*=2)<1 ? .5-.5*Math.sqrt(1-t*t) : .5+.5*Math.sqrt(1-(t-=2)*t)\n};\n// @formatter:on\n/* eslint-enable */\n","/**\n * @summary Toggles a CSS class\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} element\n * @param {string} className\n * @param {boolean} [active] - forced state\n */\nexport function toggleClass(element, className, active) {\n // manual implementation for IE11 and SVGElement\n if (!element.classList) {\n let currentClassName = element.getAttribute('class') || '';\n const currentActive = currentClassName.indexOf(className) !== -1;\n const regex = new RegExp('(?:^|\\\\s)' + className + '(?:\\\\s|$)');\n\n if ((active === undefined || active) && !currentActive) {\n currentClassName += currentClassName.length > 0 ? ' ' + className : className;\n }\n else if (!active) {\n currentClassName = currentClassName.replace(regex, ' ');\n }\n\n element.setAttribute('class', currentClassName);\n }\n else if (active === undefined) {\n element.classList.toggle(className);\n }\n else if (active && !element.classList.contains(className)) {\n element.classList.add(className);\n }\n else if (!active) {\n element.classList.remove(className);\n }\n}\n\n/**\n * @summary Adds one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function addClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, true);\n });\n }\n}\n\n/**\n * @summary Removes one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function removeClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, false);\n });\n }\n}\n\n/**\n * @summary Searches if an element has a particular parent at any level including itself\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @returns {boolean}\n */\nexport function hasParent(el, parent) {\n let test = el;\n\n do {\n if (test === parent) {\n return true;\n }\n test = test.parentNode;\n } while (test);\n\n return false;\n}\n\n/**\n * @summary Gets the closest parent (can by itself)\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} el\n * @param {string} selector\n * @returns {HTMLElement}\n */\nexport function getClosest(el, selector) {\n const matches = el.matches || el.msMatchesSelector;\n let test = el;\n // When el is document or window, the matches does not exist\n if (!matches) {\n return null;\n }\n\n do {\n if (matches.bind(test)(selector)) {\n return test;\n }\n test = test instanceof SVGElement ? test.parentNode : test.parentElement;\n } while (test);\n\n return null;\n}\n\n/**\n * @summary Map between keyboard events `keyCode|which` and `key`\n * @memberOf PSV.utils\n * @type {Object}\n * @readonly\n * @private\n */\nconst KEYMAP = {\n 13 : 'Enter',\n 17 : 'Control',\n 27 : 'Escape',\n 32 : ' ',\n 33 : 'PageUp',\n 34 : 'PageDown',\n 37 : 'ArrowLeft',\n 38 : 'ArrowUp',\n 39 : 'ArrowRight',\n 40 : 'ArrowDown',\n 46 : 'Delete',\n 107: '+',\n 109: '-',\n};\n\n/**\n * @summary Map for non standard keyboard events `key` for IE and Edge\n * @see https://github.com/shvaikalesh/shim-keyboard-event-key\n * @type {Object}\n * @readonly\n * @private\n */\nconst MS_KEYMAP = {\n Add : '+',\n Del : 'Delete',\n Down : 'ArrowDown',\n Esc : 'Escape',\n Left : 'ArrowLeft',\n Right : 'ArrowRight',\n Spacebar: ' ',\n Subtract: '-',\n Up : 'ArrowUp',\n};\n\n/**\n * @summary Returns the key name of a KeyboardEvent\n * @memberOf PSV.utils\n * @param {KeyboardEvent} evt\n * @returns {string}\n */\nexport function getEventKey(evt) {\n let key = evt.key || KEYMAP[evt.keyCode || evt.which];\n\n if (key && MS_KEYMAP[key]) {\n key = MS_KEYMAP[key];\n }\n\n return key;\n}\n\n/**\n * @summary Detects if fullscreen is enabled\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @returns {boolean}\n */\nexport function isFullscreenEnabled(elt) {\n /* eslint-disable-next-line max-len */\n return (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n /* eslint-disable-next-line max-len */\n (elt.requestFullscreen || elt.mozRequestFullScreen || elt.webkitRequestFullscreen || elt.msRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n /* eslint-disable-next-line max-len */\n (document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen).call(document);\n}\n\n/**\n * @summary Gets an element style\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @param {string} prop\n * @returns {*}\n */\nexport function getStyle(elt, prop) {\n return window.getComputedStyle(elt, null)[prop];\n}\n\n/**\n * @summary Normalize mousewheel values accross browsers\n * @memberOf PSV.utils\n * @description From Facebook's Fixed Data Table\n * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js}\n * @copyright Facebook\n * @param {WheelEvent} event\n * @returns {{spinX: number, spinY: number, pixelX: number, pixelY: number}}\n */\nexport function normalizeWheel(event) {\n const PIXEL_STEP = 10;\n const LINE_HEIGHT = 40;\n const PAGE_HEIGHT = 800;\n\n let spinX = 0;\n let spinY = 0;\n let pixelX = 0;\n let pixelY = 0;\n\n // Legacy\n if ('detail' in event) {\n spinY = event.detail;\n }\n if ('wheelDelta' in event) {\n spinY = -event.wheelDelta / 120;\n }\n if ('wheelDeltaY' in event) {\n spinY = -event.wheelDeltaY / 120;\n }\n if ('wheelDeltaX' in event) {\n spinX = -event.wheelDeltaX / 120;\n }\n\n // side scrolling on FF with DOMMouseScroll\n if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {\n spinX = spinY;\n spinY = 0;\n }\n\n pixelX = spinX * PIXEL_STEP;\n pixelY = spinY * PIXEL_STEP;\n\n if ('deltaY' in event) {\n pixelY = event.deltaY;\n }\n if ('deltaX' in event) {\n pixelX = event.deltaX;\n }\n\n if ((pixelX || pixelY) && event.deltaMode) {\n // delta in LINE units\n if (event.deltaMode === 1) {\n pixelX *= LINE_HEIGHT;\n pixelY *= LINE_HEIGHT;\n }\n // delta in PAGE units\n else {\n pixelX *= PAGE_HEIGHT;\n pixelY *= PAGE_HEIGHT;\n }\n }\n\n // Fall-back if spin cannot be determined\n if (pixelX && !spinX) {\n spinX = (pixelX < 1) ? -1 : 1;\n }\n if (pixelY && !spinY) {\n spinY = (pixelY < 1) ? -1 : 1;\n }\n\n return { spinX, spinY, pixelX, pixelY };\n}\n","/**\n * @summary Ensures that a number is in a given interval\n * @memberOf PSV.utils\n * @param {number} x\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport function bound(x, min, max) {\n return Math.max(min, Math.min(max, x));\n}\n\n/**\n * @summary Checks if a value is an integer\n * @memberOf PSV.utils\n * @param {*} value\n * @returns {boolean}\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value;\n}\n\n\n/**\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 * Returns the distance between two points on a sphere of radius one\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 the intersection between two arrays\n * @memberOf PSV.utils\n * @template T\n * @param {T[]} array1\n * @param {T[]} array2\n * @returns {T[]}\n */\nexport function intersect(array1, array2) {\n return array1.filter(value => array2.indexOf(value) !== -1);\n}\n\n/**\n * @summary Returns if a valu is null or undefined\n * @param {*} val\n * @return {boolean}\n */\nexport function isNil(val) {\n return val === null || val === undefined;\n}\n\n/**\n * @summary Returns the first non null non undefined parameter\n * @memberOf PSV.utils\n * @param {*} values\n * @return {*}\n */\nexport function firstNonNull(...values) {\n for (const val of values) {\n if (!isNil(val)) {\n return val;\n }\n }\n\n return undefined;\n}\n","/**\n * @summary Custom error used in the lib\n * @param {string} message\n * @constructor\n * @memberOf PSV\n */\nfunction PSVError(message) {\n this.message = message;\n\n // Use V8's native method if available, otherwise fallback\n if ('captureStackTrace' in Error) {\n Error.captureStackTrace(this, PSVError);\n }\n else {\n this.stack = (new Error()).stack;\n }\n}\n\nPSVError.prototype = Object.create(Error.prototype);\nPSVError.prototype.name = 'PSVError';\nPSVError.prototype.constructor = PSVError;\n\nexport { PSVError };\n","import * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound } from './math';\n\n/**\n * @summary 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|object} 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 * @summary Parses an speed\n * @memberOf PSV.utils\n * @param {string|number} speed - The speed, in radians/degrees/revolutions per second/minute\n * @returns {number} radians per second\n * @throws {PSV.PSVError} when the speed cannot be parsed\n */\nexport function parseSpeed(speed) {\n let parsed;\n\n if (typeof speed === 'string') {\n const speedStr = speed.toString().trim();\n\n // Speed extraction\n let speedValue = parseFloat(speedStr.replace(/^(-?[0-9]+(?:\\.[0-9]*)?).*$/, '$1'));\n const speedUnit = speedStr.replace(/^-?[0-9]+(?:\\.[0-9]*)?(.*)$/, '$1').trim();\n\n // \"per minute\" -> \"per second\"\n if (speedUnit.match(/(pm|per minute)$/)) {\n speedValue /= 60;\n }\n\n // Which unit?\n switch (speedUnit) {\n // Degrees per minute / second\n case 'dpm':\n case 'degrees per minute':\n case 'dps':\n case 'degrees per second':\n parsed = THREE.Math.degToRad(speedValue);\n break;\n\n // Radians per minute / second\n case 'rdpm':\n case 'radians per minute':\n case 'rdps':\n case 'radians per second':\n parsed = speedValue;\n break;\n\n // Revolutions per minute / second\n case 'rpm':\n case 'revolutions per minute':\n case 'rps':\n case 'revolutions per second':\n parsed = speedValue * Math.PI * 2;\n break;\n\n // Unknown unit\n default:\n throw new PSVError('Unknown speed unit \"' + speedUnit + '\"');\n }\n }\n else {\n parsed = speed;\n }\n\n return parsed;\n}\n\n/**\n * @summary Parses an angle value in radians or degrees and returns a normalized value in radians\n * @memberOf PSV.utils\n * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg\n * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi\n * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi\n * @returns {number}\n * @throws {PSV.PSVError} when the angle cannot be parsed\n */\nexport function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) {\n let parsed;\n\n if (typeof angle === 'string') {\n const match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\\.[0-9]*)?)(.*)$/);\n\n if (!match) {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n const value = parseFloat(match[1]);\n const unit = match[2];\n\n if (unit) {\n switch (unit) {\n case 'deg':\n case 'degs':\n parsed = THREE.Math.degToRad(value);\n break;\n case 'rad':\n case 'rads':\n parsed = value;\n break;\n default:\n throw new PSVError('Unknown angle unit \"' + unit + '\"');\n }\n }\n else {\n parsed = value;\n }\n }\n else if (typeof angle === 'number' && !isNaN(angle)) {\n parsed = angle;\n }\n else {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n parsed = (zeroCenter ? parsed + Math.PI : parsed) % (Math.PI * 2);\n\n if (parsed < 0) {\n parsed += Math.PI * 2;\n }\n\n return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed;\n}\n","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser.js';\nexport * from './math.js';\nexport * from './misc.js';\nexport * from './psv.js';\n","import { EASINGS } from './data/constants';\nimport { each } from './utils';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.Animation\n * @param {Object.} properties - current values\n * @param {float} progress - 0 to 1\n */\n\n/**\n * @summary Interpolation helper for animations\n * @memberOf PSV\n * @description\n * Implements the Promise API with an additional \"cancel\" and \"finally\" methods.\n * The promise is resolved when the animation is complete and rejected if the animation is cancelled.\n * @example\n * new Animation({\n * properties: {\n * width: {start: 100, end: 200}\n * },\n * duration: 5000,\n * onTick: (properties) => element.style.width = `${properties.width}px`;\n * })\n */\nexport class Animation {\n\n /**\n * @param {Object} options\n * @param {Object.} options.properties\n * @param {number} options.properties[].start\n * @param {number} options.properties[].end\n * @param {number} options.duration\n * @param {number} [options.delay=0]\n * @param {string} [options.easing='linear']\n * @param {PSV.Animation.OnTick} options.onTick - called on each frame\n */\n constructor(options) {\n this.__cancelled = false;\n this.__resolved = false;\n\n this.__promise = new Promise((resolve, reject) => {\n this.__resolve = resolve;\n this.__reject = reject;\n });\n\n if (options) {\n if (!options.easing || typeof options.easing === 'string') {\n options.easing = EASINGS[options.easing || 'linear'];\n }\n this.__start = null;\n this.options = options;\n\n if (options.delay) {\n this.__delayTimeout = setTimeout(() => {\n this.__delayTimeout = null;\n window.requestAnimationFrame(t => this.__run(t));\n }, options.delay);\n }\n else {\n window.requestAnimationFrame(t => this.__run(t));\n }\n }\n }\n\n /**\n * @summary Main loop for the animation\n * @param {number} timestamp\n * @private\n */\n __run(timestamp) {\n // the animation has been cancelled\n if (this.__cancelled) {\n return;\n }\n\n // first iteration\n if (this.__start === null) {\n this.__start = timestamp;\n }\n\n // compute progress\n const progress = (timestamp - this.__start) / this.options.duration;\n const current = {};\n\n if (progress < 1.0) {\n // interpolate properties\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.start + (prop.end - prop.start) * this.options.easing(progress);\n }\n });\n\n this.options.onTick(current, progress);\n\n window.requestAnimationFrame(t => this.__run(t));\n }\n else {\n // call onTick one last time with final values\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.end;\n }\n });\n\n this.options.onTick(current, 1.0);\n\n window.requestAnimationFrame(() => {\n this.__resolved = true;\n this.__resolve();\n });\n }\n }\n\n /**\n * @summary Animation chaining\n * @param {Function} [onFulfilled] - Called when the animation is complete, can return a new animation\n * @param {Function} [onRejected] - Called when the animation is cancelled\n * @returns {PSV.Animation}\n */\n then(onFulfilled = null, onRejected = null) {\n const p = new Animation();\n\n // Allow cancellation to climb up the promise chain\n p.__promise.then(null, () => this.cancel());\n\n this.__promise.then(\n () => p.__resolve(onFulfilled ? onFulfilled() : undefined),\n () => p.__reject(onRejected ? onRejected() : undefined)\n );\n\n return p;\n }\n\n /**\n * @summary Alias to `.then(null, onRejected)`\n * @param {Function} onRejected - Called when the animation has been cancelled\n * @returns {PSV.Animation}\n */\n catch(onRejected) {\n return this.then(undefined, onRejected);\n }\n\n /**\n * @summary Alias to `.then(onFinally, onFinally)`\n * @param {Function} onFinally - Called when the animation is either complete or cancelled\n * @returns {PSV.Animation}\n */\n finally(onFinally) {\n return this.then(onFinally, onFinally);\n }\n\n /**\n * @summary Cancels the animation\n */\n cancel() {\n if (!this.__cancelled && !this.__resolved) {\n this.__cancelled = true;\n this.__reject();\n\n if (this.__delayTimeout) {\n window.cancelAnimationFrame(this.__delayTimeout);\n this.__delayTimeout = null;\n }\n }\n }\n\n /**\n * @summary Returns a resolved animation promise\n * @returns {PSV.Animation}\n */\n static resolve() {\n const p = Promise.resolve();\n p.cancel = () => {\n };\n p.finally = (onFinally) => {\n return p.then(onFinally, onFinally);\n };\n return p;\n }\n\n}\n","/**\n * @namespace PSV.components\n */\n\n/**\n * @summary Base component class\n * @memberof PSV.components\n * @abstract\n */\nexport class AbstractComponent {\n\n /**\n * @param {PSV.Viewer | PSV.components.AbstractComponent} parent\n * @param {string} className - CSS class added to the component's container\n */\n constructor(parent, className) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = parent.psv || parent;\n\n /**\n * @member {PSV.Viewer|PSV.components.AbstractComponent}\n * @readonly\n */\n this.parent = parent;\n this.parent.children.push(this);\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} visible - Visibility of the component\n */\n this.prop = {\n visible: true,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = className;\n this.parent.container.appendChild(this.container);\n }\n\n /**\n * @summary Destroys the component\n * @protected\n */\n destroy() {\n this.parent.container.removeChild(this.container);\n\n const childIdx = this.parent.children.indexOf(this);\n if (childIdx !== -1) {\n this.parent.children.splice(childIdx, 1);\n }\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n delete this.container;\n delete this.parent;\n delete this.psv;\n delete this.prop;\n }\n\n /**\n * @summary Refresh UI\n * @description Must be be a very lightweight operation\n * @package\n */\n refreshUi() {\n this.children.every((child) => {\n child.refreshUi();\n return this.psv.prop.uiRefresh === true;\n });\n }\n\n /**\n * @summary Displays or hides the component\n */\n toggle() {\n if (this.isVisible()) {\n this.hide();\n }\n else {\n this.show();\n }\n }\n\n /**\n * @summary Hides the component\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Displays the component\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Check 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 { 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 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 */\n constructor(navbar, className = '', collapsable = false) {\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 this.container.addEventListener('click', (e) => {\n if (this.prop.enabled) {\n this.onClick();\n }\n e.stopPropagation();\n });\n }\n\n /**\n * @package\n */\n checkSupported() {\n const supportedOrObject = this.isSupported();\n if (isPlainObject(supportedOrObject)) {\n if (supportedOrObject.initial === false) {\n this.hide();\n this.prop.supported = false;\n }\n\n supportedOrObject.promise.then((supported) => {\n if (!this.prop) {\n return; // the component has been destroyed\n }\n this.prop.supported = supported;\n if (!supported && this.prop.visible) {\n this.hide();\n }\n else if (supported && !this.prop.visible) {\n this.show();\n }\n });\n }\n else if (!supportedOrObject) {\n this.hide();\n this.prop.supported = false;\n }\n }\n\n /**\n * @summary Checks if the button can be displayed\n * @returns {boolean|{initial: boolean, promise: Promise}}\n */\n isSupported() {\n return true;\n }\n\n /**\n * @summary Changes the active state of the button\n * @param {boolean} [active] - forced state\n */\n toggleActive(active) {\n this.prop.active = active !== undefined ? active : !this.prop.active;\n toggleClass(this.container, 'psv-button--active', this.prop.active);\n\n if (this.constructor.iconActive) {\n this.__setIcon(this.prop.active ? this.constructor.iconActive : this.constructor.icon);\n }\n }\n\n /**\n * @override\n */\n show(refresh = true) {\n if (!this.isVisible()) {\n this.prop.visible = true;\n if (!this.prop.collapsed) {\n this.container.style.display = '';\n }\n if (refresh) {\n this.psv.refreshUi(`show button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @override\n */\n hide(refresh = true) {\n if (this.isVisible()) {\n this.prop.visible = false;\n this.container.style.display = 'none';\n if (refresh) {\n this.psv.refreshUi(`hide button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @summary Disables the button\n */\n disable() {\n this.container.classList.add('psv-button--disabled');\n this.prop.enabled = false;\n }\n\n /**\n * @summary Enables the button\n */\n enable() {\n this.container.classList.remove('psv-button--disabled');\n this.prop.enabled = true;\n }\n\n /**\n * @summary Collapses the button in the navbar menu\n */\n collapse() {\n this.prop.collapsed = true;\n this.container.style.display = 'none';\n }\n\n /**\n * @summary Uncollapses the button from the navbar menu\n */\n uncollapse() {\n this.prop.collapsed = false;\n if (this.prop.visible) {\n this.container.style.display = '';\n }\n }\n\n /**\n * @summary Set the button icon\n * @param {string} icon SVG\n * @param {HTMLElement} [container] - default is the main button container\n * @private\n */\n __setIcon(icon, container = this.container) {\n if (icon) {\n container.innerHTML = icon;\n // classList not supported on IE11, className is read-only !!!!\n container.querySelector('svg').setAttribute('class', 'psv-button-svg');\n }\n else {\n container.innerHTML = '';\n }\n }\n\n /**\n * @summary Action when the button is clicked\n * @private\n * @abstract\n */\n onClick() {\n throw new PSVError(`onClick not implemented for button \"${this.prop.id}\".`);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport playActive from '../icons/play-active.svg';\nimport play from '../icons/play.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar autorotate button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AutorotateButton extends AbstractButton {\n\n static id = 'autorotate';\n static icon = play;\n static iconActive = playActive;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-autorotate-button', true);\n\n this.psv.on(EVENTS.AUTOROTATE, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.AUTOROTATE, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.AUTOROTATE: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles autorotate\n */\n onClick() {\n this.psv.toggleAutorotate();\n }\n\n}\n","import { addClasses } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar custom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CustomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {PSV.NavbarCustomButton} config\n */\n constructor(navbar, config) {\n super(navbar, 'psv-custom-button', config.collapsable !== false);\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.width = this.container.offsetWidth;\n\n if (this.config.enabled === false) {\n this.disable();\n }\n\n if (this.config.visible === false) {\n this.hide();\n }\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.config;\n\n super.destroy();\n }\n\n /**\n * @override\n * @description Calls user method\n */\n onClick() {\n if (this.config.onClick) {\n this.config.onClick.apply(this.psv);\n }\n }\n\n}\n","import { AbstractButton } from './AbstractButton';\nimport download from '../icons/download.svg';\n\n/**\n * @summary Navigation bar download button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DownloadButton extends AbstractButton {\n\n static id = 'download';\n static icon = download;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-download-button', true);\n }\n\n /**\n * @override\n * @description Asks the browser to download the panorama source file\n */\n onClick() {\n const link = document.createElement('a');\n link.href = this.psv.config.panorama;\n link.download = this.psv.config.panorama;\n this.psv.container.appendChild(link);\n link.click();\n\n setTimeout(() => {\n this.psv.container.removeChild(link);\n }, 100);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport fullscreenIn from '../icons/fullscreen-in.svg';\nimport fullscreenOut from '../icons/fullscreen-out.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar fullscreen button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class FullscreenButton extends AbstractButton {\n\n static id = 'fullscreen';\n static icon = fullscreenIn;\n static iconActive = fullscreenOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-fullscreen-button');\n\n this.psv.on(EVENTS.FULLSCREEN_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.FULLSCREEN_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * Handle events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.FULLSCREEN_UPDATED: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles fullscreen\n */\n onClick() {\n this.psv.toggleFullscreen();\n }\n\n}\n","import { EVENTS, IDS } from '../data/constants';\nimport menuIcon from '../icons/menu.svg';\nimport { dasherize, getClosest } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar menu button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MenuButton extends AbstractButton {\n\n static id = 'menu';\n static icon = menuIcon;\n\n /**\n * @summary Property name added to buttons list\n * @type {string}\n * @constant\n */\n static BUTTON_DATA = 'psvButton';\n\n /**\n * @summary Menu template\n * @param {AbstractButton[]} buttons\n * @param {PSV.Viewer} psv\n * @param {string} dataKey\n * @returns {string}\n */\n static MENU_TEMPLATE = (buttons, psv, dataKey) => `\n
\n

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

\n
    \n ${buttons.map(button => `\n
  • \n ${button.container.innerHTML}\n ${button.container.title}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-menu-button');\n\n this.psv.on(EVENTS.OPEN_PANEL, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.OPEN_PANEL, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === IDS.MENU); break;\n case EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n this.__hideMenu();\n }\n\n /**\n * @override\n */\n show(refresh) {\n super.show(refresh);\n\n if (this.prop.active) {\n this.__showMenu();\n }\n }\n\n /**\n * @override\n * @description Toggles menu\n */\n onClick() {\n if (this.prop.active) {\n this.__hideMenu();\n }\n else {\n this.__showMenu();\n }\n }\n\n __showMenu() {\n this.psv.panel.show({\n id : IDS.MENU,\n content : MenuButton.MENU_TEMPLATE(this.parent.collapsed, this.psv, dasherize(MenuButton.BUTTON_DATA)),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? getClosest(e.target, 'li') : undefined;\n const buttonId = li ? li.dataset[MenuButton.BUTTON_DATA] : undefined;\n\n if (buttonId) {\n this.parent.getButton(buttonId).onClick();\n this.__hideMenu();\n }\n },\n });\n }\n\n __hideMenu() {\n if (this.psv.panel) {\n this.psv.panel.hide(IDS.MENU);\n }\n }\n\n}\n","import { PSVError } from '../PSVError';\n\n/**\n * @summary General information about the system\n * @constant\n * @memberOf PSV\n * @property {boolean} loaded - Indicates if the system has been loaded yet\n * @property {Function} load - Loads the system if not already loaded\n * @property {number} pixelRatio\n * @property {boolean} isWebGLSupported\n * @property {number} maxCanvasWidth\n * @property {string} mouseWheelEvent\n * @property {string} fullscreenEvent\n * @property {Function} getMaxCanvasWidth - Returns the max width of a canvas allowed by the browser\n * @property {Promise} isTouchEnabled\n */\nexport const SYSTEM = {\n loaded : false,\n pixelRatio : 1,\n isWebGLSupported: false,\n isTouchEnabled : null,\n maxTextureWidth : 0,\n mouseWheelEvent : null,\n fullscreenEvent : null,\n};\n\n/**\n * @summary Loads the system if not already loaded\n */\nSYSTEM.load = () => {\n if (!SYSTEM.loaded) {\n const ctx = getWebGLCtx();\n\n SYSTEM.loaded = true;\n SYSTEM.pixelRatio = window.devicePixelRatio || 1;\n SYSTEM.isWebGLSupported = ctx != null;\n SYSTEM.isTouchEnabled = isTouchEnabled();\n SYSTEM.maxTextureWidth = getMaxTextureWidth(ctx);\n SYSTEM.mouseWheelEvent = getMouseWheelEvent();\n SYSTEM.fullscreenEvent = getFullscreenEvent();\n }\n};\n\nlet maxCanvasWidth = null;\nSYSTEM.getMaxCanvasWidth = () => {\n if (maxCanvasWidth === null) {\n maxCanvasWidth = getMaxCanvasWidth(SYSTEM.maxTextureWidth);\n }\n return maxCanvasWidth;\n};\n\n/**\n * @summary Tries to return a canvas webgl context\n * @returns {WebGLRenderingContext}\n * @private\n */\nfunction getWebGLCtx() {\n const canvas = document.createElement('canvas');\n const names = ['webgl', 'experimental-webgl', 'moz-webgl', 'webkit-3d'];\n let context = null;\n\n if (!canvas.getContext) {\n return null;\n }\n\n if (names.some((name) => {\n try {\n context = canvas.getContext(name);\n return context !== null;\n }\n catch (e) {\n return false;\n }\n })) {\n return context;\n }\n else {\n return null;\n }\n}\n\n/**\n * @summary Detects if the user is using a touch screen\n * @returns {Promise}\n * @private\n */\nfunction isTouchEnabled() {\n return new Promise((resolve) => {\n const listener = (e) => {\n if (e) {\n resolve(true);\n }\n else {\n resolve(false);\n }\n\n window.removeEventListener('touchstart', listener);\n };\n\n window.addEventListener('touchstart', listener, false);\n\n // after 10 secs auto-reject the promise\n setTimeout(listener, 10000);\n });\n}\n\n/**\n * @summary Gets max texture width in WebGL context\n * @returns {number}\n * @private\n */\nfunction getMaxTextureWidth(ctx) {\n if (ctx !== null) {\n return ctx.getParameter(ctx.MAX_TEXTURE_SIZE);\n }\n else {\n return 0;\n }\n}\n\n/**\n * @summary Gets max canvas width supported by the browser.\n * We only test powers of 2 and height = width / 2 because that's what we need to generate WebGL textures\n * @param maxWidth\n * @return {number}\n * @private\n */\nfunction getMaxCanvasWidth(maxWidth) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = maxWidth;\n canvas.height = maxWidth / 2;\n\n while (canvas.width > 1024) {\n ctx.fillStyle = 'white';\n ctx.fillRect(0, 0, 1, 1);\n\n try {\n if (ctx.getImageData(0, 0, 1, 1).data[0] === 255) {\n return canvas.width;\n }\n }\n catch (e) {\n // continue\n }\n\n canvas.width /= 2;\n canvas.height /= 2;\n }\n\n throw new PSVError('Unable to detect system capabilities');\n}\n\n/**\n * @summary Gets the event name for mouse wheel\n * @returns {string}\n * @private\n */\nfunction getMouseWheelEvent() {\n if ('onwheel' in document.createElement('div')) { // Modern browsers support \"wheel\"\n return 'wheel';\n }\n else if (document.onmousewheel !== undefined) { // Webkit and IE support at least \"mousewheel\"\n return 'mousewheel';\n }\n else { // let's assume that remaining browsers are older Firefox\n return 'DOMMouseScroll';\n }\n}\n\n/**\n * @summary Map between fullsceen method and fullscreen event name\n * @type {Object}\n * @readonly\n * @private\n */\nconst FULLSCREEN_EVT_MAP = {\n exitFullscreen : 'fullscreenchange',\n webkitExitFullscreen: 'webkitfullscreenchange',\n mozCancelFullScreen : 'mozfullscreenchange',\n msExitFullscreen : 'MSFullscreenChange',\n};\n\n\n/**\n * @summary Gets the event name for fullscreen\n * @returns {string}\n * @private\n */\nfunction getFullscreenEvent() {\n const validExits = Object.keys(FULLSCREEN_EVT_MAP).filter(exit => exit in document);\n\n if (validExits.length) {\n return FULLSCREEN_EVT_MAP[validExits[0]];\n }\n else {\n return null;\n }\n}\n","import { Animation } from '../Animation';\nimport { SYSTEM } from '../data/system';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractZoomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-zoom-button');\n\n /**\n * @override\n * @property {number} value\n * @property {boolean} buttondown\n * @property {*} longPressTimeout\n * @property {PSV.Animation} longPressAnimation\n */\n this.prop = {\n ...this.prop,\n value : value,\n buttondown : false,\n longPressTimeout : null,\n longPressAnimation: null,\n };\n\n this.container.addEventListener('mousedown', 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 // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @summary Handles click events\n * @description Zooms in and register long press timer\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.buttondown = true;\n this.prop.longPressTimeout = setTimeout(() => this.__startLongPressInterval(), 100);\n }\n\n /**\n * @summary Continues zooming as long as the user presses the button\n * @private\n */\n __startLongPressInterval() {\n if (!this.prop.buttondown) {\n return;\n }\n\n const end = this.prop.value < 0 ? 0 : 100;\n\n this.prop.longPressAnimation = new Animation({\n properties: {\n zoom: { start: this.psv.prop.zoomLvl, end: end },\n },\n duration : 1500 * Math.abs(this.psv.prop.zoomLvl - end) / 100,\n easing : 'linear',\n onTick : (properties) => {\n this.psv.zoom(properties.zoom);\n },\n })\n .catch(() => {}); // ignore cancellation\n }\n\n /**\n * @summary Handles mouse up events\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled || !this.prop.buttondown) {\n return;\n }\n\n if (this.prop.longPressAnimation) {\n this.prop.longPressAnimation.cancel();\n this.prop.longPressAnimation = null;\n }\n else {\n this.psv.zoom(this.psv.prop.zoomLvl + this.prop.value * this.psv.config.zoomButtonIncrement);\n }\n\n if (this.prop.longPressTimeout) {\n clearTimeout(this.prop.longPressTimeout);\n }\n\n this.prop.buttondown = false;\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, 1);\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, -1);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { getStyle } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class ZoomRangeButton extends AbstractButton {\n\n static id = 'zoomRange';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-zoom-range');\n\n /**\n * @override\n * @property {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mousedown : false,\n mediaMinWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomRange = document.createElement('div');\n this.zoomRange.className = 'psv-zoom-range-line';\n this.container.appendChild(this.zoomRange);\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomValue = document.createElement('div');\n this.zoomValue.className = 'psv-zoom-range-handle';\n this.zoomRange.appendChild(this.zoomValue);\n\n this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n\n if (this.psv.prop.ready) {\n this.__moveZoomValue(this.psv.prop.zoomLvl);\n }\n else {\n this.psv.once(EVENTS.READY, this);\n }\n\n this.refreshUi();\n }\n\n /**\n * @override\n */\n destroy() {\n this.__stopZoomChange();\n\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n delete this.zoomRange;\n delete this.zoomValue;\n\n this.psv.off(EVENTS.ZOOM_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__initZoomChangeWithMouse(e); break;\n case 'touchstart': this.__initZoomChangeByTouch(e); break;\n case 'mousemove': this.__changeZoomWithMouse(e); break;\n case 'touchmove': this.__changeZoomByTouch(e); break;\n case 'mouseup': this.__stopZoomChange(e); break;\n case 'touchend': this.__stopZoomChange(e); break;\n case EVENTS.ZOOM_UPDATED: this.__moveZoomValue(e.args[0]); break;\n case EVENTS.READY: this.__moveZoomValue(this.psv.prop.zoomLvl); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.supported) {\n if (this.psv.prop.size.width <= this.prop.mediaMinWidth && this.prop.visible) {\n this.hide();\n }\n else if (this.psv.prop.size.width > this.prop.mediaMinWidth && !this.prop.visible) {\n this.show();\n }\n }\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @summary Moves the zoom cursor\n * @param {number} level\n * @private\n */\n __moveZoomValue(level) {\n this.zoomValue.style.left = (level / 100 * this.zoomRange.offsetWidth - this.zoomValue.offsetWidth / 2) + 'px';\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __initZoomChangeWithMouse(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __initZoomChangeByTouch(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Handles mouse up events\n * @private\n */\n __stopZoomChange() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = false;\n this.prop.buttondown = false;\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __changeZoomWithMouse(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n\n evt.preventDefault();\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __changeZoomByTouch(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Zoom change\n * @param {number} x - mouse/touch position\n * @private\n */\n __changeZoom(x) {\n const userInput = x - this.zoomRange.getBoundingClientRect().left;\n const zoomLevel = userInput / this.zoomRange.offsetWidth * 100;\n this.psv.zoom(zoomLevel);\n }\n\n}\n","import { PSVError } from '../PSVError';\nimport { bound, clone, deepmerge, each, logWarn, parseAngle, parseSpeed } from '../utils';\nimport { ACTIONS } 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 caption : null,\n loadingImg : null,\n loadingTxt : 'Loading...',\n size : null,\n fisheye : false,\n minFov : 30,\n maxFov : 90,\n defaultZoomLvl : 50,\n defaultLong : 0,\n defaultLat : 0,\n sphereCorrection : null,\n sphereCorrectionReorder: false,\n moveSpeed : 1,\n zoomButtonIncrement: 2,\n autorotateDelay : null,\n autorotateSpeed : '2rpm',\n autorotateLat : null,\n moveInertia : true,\n mousewheel : true,\n mousewheelSpeed : 1,\n mousemove : true,\n captureCursor : false,\n mousewheelCtrlKey : false,\n touchmoveTwoFingers: false,\n useXmpData : true,\n panoData : null,\n canvasBackground : '#000',\n withCredentials : false,\n navbar : [\n 'autorotate',\n 'zoomOut',\n 'zoomRange',\n 'zoomIn',\n 'download',\n 'caption',\n 'fullscreen',\n ],\n lang : {\n autorotate: 'Automatic rotation',\n zoom : 'Zoom',\n zoomOut : 'Zoom out',\n zoomIn : 'Zoom in',\n 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 'ArrowUp' : ACTIONS.ROTATE_LAT_UP,\n 'ArrowDown' : ACTIONS.ROTATE_LAT_DOWN,\n 'ArrowRight': ACTIONS.ROTATE_LONG_RIGHT,\n 'ArrowLeft' : ACTIONS.ROTATE_LONG_LEFT,\n 'PageUp' : ACTIONS.ZOOM_IN,\n 'PageDown' : ACTIONS.ZOOM_OUT,\n '+' : ACTIONS.ZOOM_IN,\n '-' : ACTIONS.ZOOM_OUT,\n ' ' : ACTIONS.TOGGLE_AUTOROTATE,\n },\n plugins : [],\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 plugins : 'Cannot change plugins',\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 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 // eslint-disable-next-line no-param-reassign\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 // eslint-disable-next-line no-param-reassign\n maxFov = config.minFov;\n }\n // maxFov between 1 and 179\n return bound(maxFov, 1, 179);\n },\n lang : (lang) => {\n if (Array.isArray(lang.twoFingers)) {\n logWarn('lang.twoFingers must not be an array');\n lang.twoFingers = lang.twoFingers[0];\n }\n return {\n ...DEFAULTS.lang,\n ...lang,\n };\n },\n keyboard : (keyboard) => {\n // keyboard=true becomes the default map\n if (keyboard === true) {\n return clone(DEFAULTS.keyboard);\n }\n return keyboard;\n },\n autorotateLat : (autorotateLat, config) => {\n // default autorotateLat is defaultLat\n if (autorotateLat === null) {\n return parseAngle(config.defaultLat, true);\n }\n // autorotateLat is between -PI/2 and PI/2\n else {\n return parseAngle(autorotateLat, true);\n }\n },\n autorotateSpeed: (autorotateSpeed) => {\n return parseSpeed(autorotateSpeed);\n },\n fisheye : (fisheye) => {\n // translate boolean fisheye to amount\n if (fisheye === true) {\n return 1;\n }\n else if (fisheye === false) {\n return 0;\n }\n return fisheye;\n },\n plugins : (plugins) => {\n return plugins\n .map((plugin) => {\n if (Array.isArray(plugin)) {\n return plugin;\n }\n else {\n return [plugin];\n }\n })\n .filter(plugin => !!plugin[0]);\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 (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (CONFIG_PARSERS[key]) {\n config[key] = CONFIG_PARSERS[key](value, tempConfig);\n }\n else {\n config[key] = value;\n }\n });\n\n return config;\n}\n","import { AbstractButton } from './AbstractButton';\nimport { EVENTS } from '../data/constants';\nimport info from '../icons/info.svg';\n\n/**\n * @summary Navigation bar caption button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CaptionButton extends AbstractButton {\n\n static id = 'caption';\n static icon = info;\n\n /**\n * @param {PSV.components.NavbarCaption} caption\n */\n constructor(caption) {\n super(caption, 'psv-button--hover-scale psv-caption-button');\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.HIDE_NOTIFICATION: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.psv.notification.prop.visible) {\n this.psv.notification.hide();\n }\n else {\n this.psv.notification.show(this.parent.prop.caption);\n this.toggleActive(true);\n }\n }\n\n}\n","import { CaptionButton } from '../buttons/CaptionButton';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Navbar caption class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class NavbarCaption extends AbstractComponent {\n\n static id = 'caption';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} caption\n */\n constructor(navbar, caption) {\n super(navbar, 'psv-caption');\n\n /**\n * @member {PSV.buttons.CaptionButton}\n * @readonly\n * @private\n */\n this.button = new CaptionButton(this);\n this.button.hide();\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {string} caption\n * @property {boolean} contentVisible - if the content is visible in the navbar\n * @property {number} contentWidth - with of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : this.button.prop.width,\n caption : '',\n contentVisible: true,\n contentWidth : 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-caption-content';\n this.container.appendChild(this.content);\n\n this.setCaption(caption);\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.button;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n this.prop.caption = html || '';\n this.content.innerHTML = this.prop.caption;\n\n if (html) {\n this.show(false);\n\n this.content.style.display = '';\n this.prop.contentWidth = this.content.offsetWidth;\n\n this.refreshUi();\n }\n else {\n this.hide();\n }\n }\n\n /**\n * @summary Toggles content and icon depending on available space\n * @private\n */\n refreshUi() {\n const availableWidth = this.container.offsetWidth;\n if (availableWidth >= this.prop.contentWidth && !this.prop.contentVisible) {\n this.content.style.display = '';\n this.prop.contentVisible = true;\n this.button.hide(false);\n }\n else if (availableWidth < this.prop.contentWidth && this.prop.contentVisible) {\n this.content.style.display = 'none';\n this.prop.contentVisible = false;\n this.button.show(false);\n }\n }\n\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\nimport { DownloadButton } from '../buttons/DownloadButton';\nimport { FullscreenButton } from '../buttons/FullscreenButton';\nimport { MenuButton } from '../buttons/MenuButton';\nimport { ZoomInButton } from '../buttons/ZoomInButton';\nimport { ZoomOutButton } from '../buttons/ZoomOutButton';\nimport { ZoomRangeButton } from '../buttons/ZoomRangeButton';\nimport { DEFAULTS } from '../data/config';\nimport { PSVError } from '../PSVError';\nimport { clone, logWarn } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { NavbarCaption } from './NavbarCaption';\n\n/**\n * @summary List of available buttons\n * @type {Object>}\n * @private\n */\nconst AVAILABLE_BUTTONS = {};\n\n/**\n * @summary Register a new button available for all viewers\n * @param {Class} button\n * @memberOf PSV\n */\nexport function registerButton(button) {\n if (!button.id) {\n throw new PSVError('Button ID is required');\n }\n\n AVAILABLE_BUTTONS[button.id] = button;\n}\n\n[\n AutorotateButton,\n ZoomInButton,\n ZoomRangeButton,\n ZoomOutButton,\n DownloadButton,\n FullscreenButton,\n].forEach(registerButton);\n\n/**\n * @summary Navigation bar class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Navbar extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-navbar');\n\n /**\n * @summary List of buttons of the navbar\n * @member {PSV.buttons.AbstractButton[]}\n * @override\n */\n this.children = [];\n\n /**\n * @summary List of collapsed buttons\n * @member {PSV.buttons.AbstractButton[]}\n * @private\n */\n this.collapsed = [];\n }\n\n /**\n * @summary Change the buttons visible on the navbar\n * @param {string|Array} buttons\n */\n setButtons(buttons) {\n this.children.slice().forEach(item => item.destroy());\n this.children.length = 0;\n\n /* eslint-disable no-new */\n this.__cleanButtons(buttons).forEach((button) => {\n if (typeof button === 'object') {\n new CustomButton(this, button);\n }\n else if (AVAILABLE_BUTTONS[button]) {\n new AVAILABLE_BUTTONS[button](this);\n }\n else if (button === 'caption') {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else if (button === 'zoom') {\n new ZoomOutButton(this);\n new ZoomRangeButton(this);\n new ZoomInButton(this);\n }\n else {\n throw new PSVError('Unknown button ' + button);\n }\n });\n\n new MenuButton(this);\n /* eslint-enable no-new */\n\n this.children.forEach((item) => {\n if (typeof item.checkSupported === 'function') {\n item.checkSupported();\n }\n });\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n const caption = this.getButton('caption', false);\n\n if (!caption) {\n throw new PSVError('Cannot set caption, the navbar caption container is not initialized.');\n }\n\n caption.setCaption(html);\n }\n\n /**\n * @summary Returns a button by its identifier\n * @param {string} id\n * @param {boolean} [warnNotFound=true]\n * @returns {PSV.buttons.AbstractButton}\n */\n getButton(id, warnNotFound = true) {\n let button = null;\n\n this.children.some((item) => {\n if (item.prop.id === id) {\n button = item;\n return true;\n }\n else {\n return false;\n }\n });\n\n if (!button && warnNotFound) {\n logWarn(`button \"${id}\" not found in the navbar`);\n }\n\n return button;\n }\n\n /**\n * @summary Shows the navbar\n */\n show() {\n this.container.classList.add('psv-navbar--open');\n this.prop.visible = true;\n }\n\n /**\n * @summary Hides the navbar\n */\n hide() {\n this.container.classList.remove('psv-navbar--open');\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n refreshUi() {\n super.refreshUi();\n\n if (this.psv.prop.uiRefresh === true) {\n const availableWidth = this.container.offsetWidth;\n\n let totalWidth = 0;\n const visibleButtons = [];\n const collapsableButtons = [];\n\n this.children.forEach((item) => {\n if (item.prop.visible) {\n totalWidth += item.prop.width;\n visibleButtons.push(item);\n if (item.prop.collapsable) {\n collapsableButtons.push(item);\n }\n }\n });\n\n if (!visibleButtons.length) {\n return;\n }\n\n if (availableWidth < totalWidth && collapsableButtons.length > 0) {\n collapsableButtons.forEach(item => item.collapse());\n this.collapsed = collapsableButtons;\n\n this.getButton(MenuButton.id).show(false);\n }\n else if (availableWidth >= totalWidth && this.collapsed.length > 0) {\n this.collapsed.forEach(item => item.uncollapse());\n this.collapsed = [];\n\n this.getButton(MenuButton.id).hide(false);\n }\n\n const caption = this.getButton(NavbarCaption.id, false);\n if (caption) {\n caption.refreshUi();\n }\n }\n }\n\n /**\n * @summary Ensure the buttons configuration is correct\n * @private\n */\n __cleanButtons(buttons) {\n // true becomes the default array\n if (buttons === true) {\n return clone(DEFAULTS.navbar);\n }\n // can be a space or coma separated list\n else if (typeof buttons === 'string') {\n return buttons.split(/[ ,]/);\n }\n else {\n return buttons || [];\n }\n }\n\n}\n","import { 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 Destroys the plugin\n * @package\n */\n destroy() {\n delete this.psv;\n }\n\n}\n","import { SYSTEM } from '../data/system';\nimport { bound, getStyle } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Loader class\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\n}\n","import { EVENTS } from '../data/constants';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Notification class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Notification extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-notification');\n\n /**\n * @override\n * @property {*} timeout\n */\n this.prop = {\n ...this.prop,\n visible: false,\n timeout: null,\n };\n\n /**\n * Notification content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-notification-content';\n this.container.appendChild(this.content);\n\n this.content.addEventListener('click', () => this.hide());\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Displays a notification on the viewer\n * @param {Object|string} config\n * @param {string} config.content\n * @param {number} [config.timeout]\n * @fires PSV.show-notification\n *\n * @example\n * viewer.showNotification({ content: 'Hello world', timeout: 5000 })\n * @example\n * viewer.showNotification('Hello world')\n */\n show(config) {\n if (this.prop.timeout) {\n clearTimeout(this.prop.timeout);\n this.prop.timeout = null;\n }\n\n if (typeof config === 'string') {\n config = { content: config }; // eslint-disable-line no-param-reassign\n }\n\n this.content.innerHTML = config.content;\n this.prop.visible = true;\n\n this.container.classList.add('psv-notification--visible');\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @fires PSV.hide-notification\n */\n hide() {\n if (this.prop.visible) {\n this.container.classList.remove('psv-notification--visible');\n\n this.prop.visible = false;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION);\n }\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { AbstractComponent } from './AbstractComponent';\nimport { PSVError } from '../PSVError';\n\n/**\n * @summary Overlay class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Overlay extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-overlay');\n\n /**\n * @override\n * @property {string} contentId\n * @property {boolean} dissmisable\n */\n this.prop = {\n ...this.prop,\n contentId : undefined,\n dissmisable: true,\n };\n\n /**\n * Image container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.image = document.createElement('div');\n this.image.className = 'psv-overlay-image';\n this.container.appendChild(this.image);\n\n /**\n * Text container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.text = document.createElement('div');\n this.text.className = 'psv-overlay-text';\n this.container.appendChild(this.text);\n\n /**\n * Subtext container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.subtext = document.createElement('div');\n this.subtext.className = 'psv-overlay-subtext';\n this.container.appendChild(this.subtext);\n\n this.container.addEventListener('mouseup', (e) => {\n e.stopPropagation();\n if (this.prop.dissmisable) {\n this.hide();\n }\n }, true);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.image;\n delete this.text;\n delete this.subtext;\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 */\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 }; // eslint-disable-line no-param-reassign\n }\n\n this.prop.contentId = config.id;\n this.prop.dissmisable = config.dissmisable !== false;\n this.image.innerHTML = config.image || '';\n this.text.innerHTML = config.text || '';\n this.subtext.innerHTML = config.subtext || '';\n\n super.show();\n\n this.psv.trigger(EVENTS.SHOW_OVERLAY, config.id);\n }\n\n /**\n * @summary Hides the overlay\n * @param {string} [id]\n * @fires PSV.hide-overlay\n */\n hide(id) {\n if (this.isVisible() && (!id || !this.prop.contentId || this.prop.contentId === id)) {\n const contentId = this.prop.contentId;\n\n super.hide();\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_OVERLAY, contentId);\n }\n }\n\n}\n","import { EVENTS } 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 class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Panel extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-panel');\n\n /**\n * @override\n * @property {string} contentId\n * @property {number} mouseX\n * @property {number} mouseY\n * @property {boolean} mousedown\n * @property {function} clickHandler\n */\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 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 bubling 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\n /**\n * @override\n */\n destroy() {\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n 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 // @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 */\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, if not specified the default width will be used\n * @param {Function} [config.clickHandler] - called when the user clicks inside the panel\n * @fires PSV.open-panel\n */\n show(config) {\n if (typeof config === 'string') {\n config = { content: config }; // eslint-disable-line no-param-reassign\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.prop.clickHandler = 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.content.addEventListener('click', config.clickHandler);\n }\n\n this.psv.trigger(EVENTS.OPEN_PANEL, config.id);\n }\n\n /**\n * @summary Hides the panel\n * @param {string} [id]\n * @fires PSV.close-panel\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.prop.visible = false;\n this.prop.contentId = undefined;\n\n this.content.innerHTML = null;\n this.container.classList.remove('psv-panel--open');\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.prop.clickHandler = null;\n }\n\n this.psv.trigger(EVENTS.CLOSE_PANEL, contentId);\n }\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n evt.stopPropagation();\n this.__startResize(evt);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n evt.stopPropagation();\n this.__startResize(evt.changedTouches[0]);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.prop.mousedown = false;\n this.content.classList.remove('psv-panel-content--no-interaction');\n }\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.__resize(evt);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown) {\n this.__resize(evt.touches[0]);\n }\n }\n\n /**\n * @summary Initializes the panel resize\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startResize(evt) {\n this.prop.mouseX = evt.clientX;\n this.prop.mouseY = evt.clientY;\n this.prop.mousedown = true;\n this.content.classList.add('psv-panel-content--no-interaction');\n }\n\n /**\n * @summary Resizes the panel\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __resize(evt) {\n const x = evt.clientX;\n const y = evt.clientY;\n const width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px';\n\n if (this.prop.contentId) {\n this.prop.width[this.prop.contentId] = width;\n }\n\n this.container.style.width = width;\n\n this.prop.mouseX = x;\n this.prop.mouseY = y;\n }\n\n}\n","/**\n * @namespace PSV.services\n */\n\n/**\n * @summary Base services class\n * @memberof PSV.services\n * @abstract\n */\nexport class AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = psv.config;\n\n /**\n * @summary Properties holder\n * @type {Object}\n * @readonly\n */\n this.prop = psv.prop;\n }\n\n /**\n * @summary Destroys the service\n */\n destroy() {\n delete this.psv;\n delete this.config;\n delete this.prop;\n }\n\n}\n","import * as THREE from 'three';\nimport { SPHERE_RADIUS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { parseAngle, parseSpeed } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Collections of data converters for the current viewer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class DataHelper extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n }\n\n /**\n * @summary Converts vertical FOV to zoom level\n * @param {number} fov\n * @returns {number}\n */\n fovToZoomLevel(fov) {\n const temp = Math.round((fov - this.config.minFov) / (this.config.maxFov - this.config.minFov) * 100);\n return temp - 2 * (temp - 50);\n }\n\n /**\n * @summary Converts zoom level to vertical FOV\n * @param {number} level\n * @returns {number}\n */\n zoomLevelToFov(level) {\n return this.config.maxFov + (level / 100) * (this.config.minFov - this.config.maxFov);\n }\n\n /**\n * @summary Convert vertical FOV to horizontal FOV\n * @param {number} vFov\n * @returns {number}\n */\n vFovToHFov(vFov) {\n return THREE.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.degToRad(vFov) / 2) * this.prop.aspect));\n }\n\n /**\n * @summary Converts a speed into a duration from current position to a new position\n * @param {string|number} value\n * @param {number} angle\n * @returns {number}\n */\n speedToDuration(value, angle) {\n if (!value || typeof value !== 'number') {\n // desired radial speed\n const speed = value ? parseSpeed(value) : this.config.autorotateSpeed;\n // compute duration\n return angle / Math.abs(speed) * 1000;\n }\n else {\n return Math.abs(value);\n }\n }\n\n /**\n * @summary Converts pixel texture coordinates to spherical radians coordinates\n * @param {PSV.Point} point\n * @returns {PSV.Position}\n */\n textureCoordsToSphericalCoords(point) {\n if (this.prop.isCubemap) {\n throw new PSVError('Unable to use texture coords with cubemap.');\n }\n\n const panoData = this.prop.panoData;\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 return {\n longitude: relativeX >= Math.PI ? relativeX - Math.PI : relativeX + Math.PI,\n latitude : Math.PI / 2 - relativeY,\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to pixel texture coordinates\n * @param {PSV.Position} position\n * @returns {PSV.Point}\n */\n sphericalCoordsToTextureCoords(position) {\n if (this.prop.isCubemap) {\n throw new PSVError('Unable to use texture coords with cubemap.');\n }\n\n const panoData = this.prop.panoData;\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 * @returns {external:THREE.Vector3}\n */\n sphericalCoordsToVector3(position) {\n return new THREE.Vector3(\n SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude),\n SPHERE_RADIUS * Math.sin(position.latitude),\n SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude)\n );\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 screen = new THREE.Vector2(\n 2 * viewerPoint.x / this.prop.size.width - 1,\n -2 * viewerPoint.y / this.prop.size.height + 1\n );\n\n this.psv.renderer.raycaster.setFromCamera(screen, this.psv.renderer.camera);\n\n const intersects = this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true);\n\n if (intersects.length === 1) {\n return intersects[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 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 ('x' in position && 'y' in position) {\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","import { Animation } from '../Animation';\nimport {\n ACTIONS,\n CTRLZOOM_TIMEOUT,\n DBLCLICK_DELAY,\n EVENTS,\n IDS,\n INERTIA_WINDOW,\n LONGTOUCH_DELAY,\n TWOFINGERSOVERLAY_DELAY,\n MOVE_THRESHOLD\n} from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport gestureIcon from '../icons/gesture.svg';\nimport mousewheelIcon from '../icons/mousewheel.svg';\nimport { clone, distance, getClosest, getEventKey, isFullscreenEnabled, normalizeWheel, throttle } from '../utils';\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 {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 {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 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 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 window.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchstart', this);\n window.addEventListener('touchend', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', 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 window.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchstart', this);\n window.removeEventListener('touchend', this);\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.removeEventListener(SYSTEM.fullscreenEvent, this);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n clearTimeout(this.state.longtouchTimeout);\n clearTimeout(this.state.twofingersTimeout);\n clearTimeout(this.state.ctrlZoomTimeout);\n\n delete this.state;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'resize': this.__onResize(); break;\n case 'keydown': this.__onKeyDown(evt); break;\n case 'keyup': this.__onKeyUp(); break;\n case 'mouseup': this.__onMouseUp(evt); break;\n case 'touchend': this.__onTouchEnd(evt); break;\n case SYSTEM.fullscreenEvent: this.__fullscreenToggled(); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n if (!getClosest(evt.target, '.psv-navbar') && !getClosest(evt.target, '.psv-panel')) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(evt); break;\n case 'mouseenter': this.__onMouseEnter(evt); break;\n case 'touchstart': this.__onTouchStart(evt); break;\n case 'mouseleave': this.__onMouseLeave(evt); break;\n case 'mousemove': this.__onMouseMove(evt); break;\n case 'touchmove': this.__onTouchMove(evt); break;\n case SYSTEM.mouseWheelEvent: this.__onMouseWheel(evt); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n }\n\n /**\n * @summary Enables the keyboard controls\n * @protected\n */\n enableKeyboard() {\n this.state.keyboardEnabled = true;\n }\n\n /**\n * @summary Disables the keyboard controls\n * @protected\n */\n disableKeyboard() {\n this.state.keyboardEnabled = false;\n }\n\n /**\n * @summary Handles keyboard events\n * @param {KeyboardEvent} evt\n * @private\n */\n __onKeyDown(evt) {\n const key = getEventKey(evt);\n\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = key === 'Control';\n\n if (this.state.ctrlKeyDown) {\n clearTimeout(this.state.ctrlZoomTimeout);\n this.psv.overlay.hide(IDS.CTRL_ZOOM);\n }\n }\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n let dLong = 0;\n let dLat = 0;\n let dZoom = 0;\n\n /* eslint-disable */\n switch (this.config.keyboard[key]) {\n // @formatter:off\n case ACTIONS.ROTATE_LAT_UP : dLat = 0.01; break;\n case ACTIONS.ROTATE_LAT_DOWN : dLat = -0.01; break;\n case ACTIONS.ROTATE_LONG_RIGHT: dLong = 0.01; break;\n case ACTIONS.ROTATE_LONG_LEFT : dLong = -0.01; break;\n case ACTIONS.ZOOM_IN : dZoom = 1; break;\n case ACTIONS.ZOOM_OUT : dZoom = -1; break;\n case ACTIONS.TOGGLE_AUTOROTATE: this.psv.toggleAutorotate(); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n if (dZoom !== 0) {\n this.psv.zoom(this.prop.zoomLvl + dZoom * this.config.zoomButtonIncrement);\n }\n else if (dLat !== 0 || dLong !== 0) {\n this.psv.rotate({\n longitude: this.prop.position.longitude + dLong * this.prop.moveSpeed * this.prop.hFov,\n latitude : this.prop.position.latitude + dLat * this.prop.moveSpeed * this.prop.vFov,\n });\n }\n }\n\n /**\n * @summary Handles keyboard events\n * @private\n */\n __onKeyUp() {\n this.state.ctrlKeyDown = false;\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 return;\n }\n\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 /**\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.__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\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 if (this.config.touchmoveTwoFingers) {\n this.__cancelTwoFingersOverlay();\n this.psv.overlay.hide(IDS.TWO_FINGERS);\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 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 if (this.config.touchmoveTwoFingers) {\n this.__cancelTwoFingersOverlay();\n }\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 }\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;\n\n if (delta !== 0) {\n this.psv.zoom(this.prop.zoomLvl - delta * this.config.mousewheelSpeed);\n }\n }\n\n /**\n * @summary Handles fullscreen events\n * @param {boolean} [force] force state\n * @fires PSV.fullscreen-updated\n * @package\n */\n __fullscreenToggled(force) {\n this.prop.fullscreen = force !== undefined ? force : isFullscreenEnabled(this.psv.container);\n\n if (this.config.keyboard) {\n if (this.prop.fullscreen) {\n this.psv.startKeyboardControl();\n }\n else {\n this.psv.stopKeyboardControl();\n }\n }\n\n this.psv.trigger(EVENTS.FULLSCREEN_UPDATED, this.prop.fullscreen);\n }\n\n /**\n * @summary Initializes the movement\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startMove(evt) {\n this.psv.stopAutorotate();\n this.psv.stopAnimation()\n .then(() => {\n this.state.mouseX = evt.clientX;\n this.state.mouseY = evt.clientY;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = false;\n\n this.state.mouseHistory.length = 0;\n this.__logMouseMove(evt);\n });\n }\n\n /**\n * @summary Initializes the combines move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __startMoveZoom(evt) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n this.state.pinchDist = distance(p1, p2);\n this.state.mouseX = (p1.x + p2.x) / 2;\n this.state.mouseY = (p1.y + p2.y) / 2;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = true;\n }\n\n /**\n * @summary Stops the movement\n * @description If the move threshold was not reached a click event is triggered, otherwise an animation is launched to simulate inertia\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMove(evt) {\n if (!getClosest(evt.target, '.psv-container')) {\n this.state.moving = false;\n this.state.mouseHistory.length = 0;\n return;\n }\n\n if (this.state.moving) {\n // move threshold to trigger a click\n if (Math.abs(evt.clientX - this.state.startMouseX) < MOVE_THRESHOLD && Math.abs(evt.clientY - this.state.startMouseY) < MOVE_THRESHOLD) {\n this.__click(evt);\n this.state.moving = false;\n }\n // inertia animation\n else if (this.config.moveInertia) {\n this.__logMouseMove(evt);\n this.__stopMoveInertia(evt);\n }\n else {\n this.state.moving = false;\n }\n\n this.state.mouseHistory.length = 0;\n }\n }\n\n /**\n * @summary Stops the combined move and zoom\n * @private\n */\n __stopMoveZoom() {\n this.state.mouseHistory.length = 0;\n this.state.moving = false;\n this.state.zooming = false;\n }\n\n /**\n * @summary Performs an animation to simulate inertia when the movement stops\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMoveInertia(evt) {\n const direction = {\n x: evt.clientX - this.state.mouseHistory[0][1],\n y: evt.clientY - this.state.mouseHistory[0][2],\n };\n\n const norm = Math.sqrt(direction.x * direction.x + direction.y * direction.y);\n\n this.prop.animationPromise = new Animation({\n properties: {\n clientX: { start: evt.clientX, end: evt.clientX + direction.x },\n clientY: { start: evt.clientY, end: evt.clientY + direction.y },\n },\n duration : norm * INERTIA_WINDOW / 100,\n easing : 'outCirc',\n onTick : (properties) => {\n this.__move(properties, false);\n },\n })\n .finally(() => {\n this.state.moving = false;\n });\n }\n\n /**\n * @summary Triggers an event with all coordinates when a simple click is performed\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [longtouch=false]\n * @fires PSV.click\n * @fires PSV.dblclick\n * @private\n */\n __click(evt, longtouch = false) {\n const boundingRect = this.psv.container.getBoundingClientRect();\n\n /**\n * @type {PSV.ClickData}\n */\n const data = {\n rightclick: longtouch || evt.button === 2,\n target : evt.target,\n clientX : evt.clientX,\n clientY : evt.clientY,\n viewerX : evt.clientX - boundingRect.left,\n viewerY : evt.clientY - boundingRect.top,\n };\n\n const intersect = this.psv.dataHelper.viewerCoordsToVector3({\n x: data.viewerX,\n y: data.viewerY,\n });\n\n if (intersect) {\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(intersect);\n data.longitude = sphericalCoords.longitude;\n data.latitude = sphericalCoords.latitude;\n\n // TODO: for cubemap, computes texture's index and coordinates\n if (!this.prop.isCubemap) {\n const textureCoords = this.psv.dataHelper.sphericalCoordsToTextureCoords(data);\n data.textureX = textureCoords.x;\n data.textureY = textureCoords.y;\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) < MOVE_THRESHOLD\n && Math.abs(this.state.dblclickData.clientY - data.clientY) < MOVE_THRESHOLD) {\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.prop.moveSpeed * this.prop.hFov * SYSTEM.pixelRatio,\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.prop.moveSpeed * this.prop.vFov * SYSTEM.pixelRatio,\n };\n\n this.psv.rotate({\n longitude: this.prop.position.longitude - rotation.longitude,\n latitude : this.prop.position.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.rotate({\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 });\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;\n\n this.psv.zoom(this.prop.zoomLvl + delta);\n\n this.__move({\n clientX: (p1.x + p2.x) / 2,\n clientY: (p1.y + p2.y) / 2,\n });\n\n this.state.pinchDist = p;\n }\n }\n\n /**\n * @summary Stores each mouse position during a mouse move\n * @description Positions older than \"INERTIA_WINDOW\" are removed
\n * Positions before a pause of \"INERTIA_WINDOW\" / 10 are removed\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __logMouseMove(evt) {\n const now = Date.now();\n this.state.mouseHistory.push([now, evt.clientX, evt.clientY]);\n\n let previous = null;\n\n for (let i = 0; i < this.state.mouseHistory.length;) {\n if (this.state.mouseHistory[0][i] < now - INERTIA_WINDOW) {\n this.state.mouseHistory.splice(i, 1);\n }\n else if (previous && this.state.mouseHistory[0][i] - previous > INERTIA_WINDOW / 10) {\n this.state.mouseHistory.splice(0, i);\n i = 0;\n previous = this.state.mouseHistory[0][i];\n }\n else {\n i++;\n previous = this.state.mouseHistory[0][i];\n }\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { Animation } from '../Animation';\nimport { CUBE_VERTICES, EVENTS, SPHERE_RADIUS, SPHERE_VERTICES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { isExtendedPosition, isNil, logWarn } 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 {number}\n * @private\n */\n this.mainReqid = undefined;\n\n /**\n * @member {external:THREE.WebGLRenderer}\n * @readonly\n * @protected\n */\n this.renderer = null;\n\n /**\n * @member {external:THREE.Scene}\n * @readonly\n * @protected\n */\n this.scene = null;\n\n /**\n * @member {external:THREE.PerspectiveCamera}\n * @readonly\n * @protected\n */\n this.camera = null;\n\n /**\n * @member {external:THREE.Mesh}\n * @readonly\n * @protected\n */\n this.mesh = null;\n\n /**\n * @member {external:THREE.Group}\n * @readonly\n * @private\n */\n this.meshContainer = null;\n\n /**\n * @member {external:THREE.Raycaster}\n * @readonly\n * @protected\n */\n this.raycaster = null;\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.psv.container.appendChild(this.canvasContainer);\n\n psv.on(EVENTS.SIZE_UPDATED, (e, size) => {\n if (this.renderer) {\n this.renderer.setSize(size.width, size.height);\n }\n });\n\n psv.on(EVENTS.CONFIG_CHANGED, () => {\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n });\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n // cancel render loop\n if (this.mainReqid) {\n window.cancelAnimationFrame(this.mainReqid);\n }\n\n // destroy ThreeJS view\n if (this.scene) {\n this.__cleanTHREEScene(this.scene);\n }\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 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 Main event loop, calls {@link render} if `prop.needsUpdate` is true\n * @param {number} timestamp\n * @fires PSV.before-render\n * @package\n */\n __renderLoop(timestamp) {\n this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp);\n\n if (this.prop.needsUpdate) {\n this.render();\n this.prop.needsUpdate = false;\n }\n\n this.mainReqid = window.requestAnimationFrame(t => this.__renderLoop(t));\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.prop.direction = this.psv.dataHelper.sphericalCoordsToVector3(this.prop.position);\n this.camera.position.set(0, 0, 0);\n this.camera.lookAt(this.prop.direction);\n\n if (this.config.fisheye) {\n this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate();\n }\n\n this.camera.aspect = this.prop.aspect;\n this.camera.fov = this.prop.vFov;\n this.camera.updateProjectionMatrix();\n\n this.renderer.render(this.scene, this.camera);\n\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 const { texture, panoData } = textureData;\n this.prop.panoData = panoData;\n\n if (!this.scene) {\n this.__createScene();\n }\n\n if (this.prop.isCubemap) {\n for (let i = 0; i < 6; i++) {\n if (this.mesh.material[i].map) {\n this.mesh.material[i].map.dispose();\n }\n\n this.mesh.material[i].map = texture[i];\n }\n }\n else {\n if (this.mesh.material.map) {\n this.mesh.material.map.dispose();\n }\n\n this.mesh.material.map = texture;\n }\n\n this.psv.needsUpdate();\n\n this.psv.trigger(EVENTS.PANORAMA_LOADED);\n }\n\n /**\n * @summary Apply a panorama data pose to a Mesh\n * @param {PSV.PanoData} [panoData]\n * @param {external:THREE.Mesh} [mesh=this.mesh]\n * @package\n */\n setPanoramaPose(panoData, mesh = this.mesh) {\n if (!isNil(panoData?.poseHeading) || !isNil(panoData?.posePitch) || !isNil(panoData?.poseRoll)) {\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 mesh.rotation.set(\n -THREE.Math.degToRad(panoData?.posePitch || 0),\n -THREE.Math.degToRad(panoData?.poseHeading || 0),\n -THREE.Math.degToRad(panoData?.poseRoll || 0),\n 'ZXY'\n );\n }\n else {\n mesh.rotation.set(0, 0, 0);\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 if (sphereCorrection) {\n const cleanCorrection = this.psv.dataHelper.cleanSphereCorrection(sphereCorrection);\n\n if (!this.config.sphereCorrectionReorder) {\n const nonZeros = (cleanCorrection.tilt !== 0) + (cleanCorrection.pan !== 0) + (cleanCorrection.roll !== 0);\n if (nonZeros > 1) {\n logWarn(`\"sphereCorrection\" computation will change in a future version. \n Please set \"sphereCorrectionReorder: true\" and modify your correction accordingly.`);\n }\n }\n\n mesh.rotation.set(\n cleanCorrection.tilt,\n cleanCorrection.pan,\n cleanCorrection.roll,\n this.config.sphereCorrectionReorder ? 'ZXY' : 'XYZ'\n );\n }\n else {\n mesh.rotation.set(0, 0, 0);\n }\n }\n\n /**\n * @summary Creates the 3D scene and GUI components\n * @private\n */\n __createScene() {\n this.raycaster = new THREE.Raycaster();\n\n this.renderer = new THREE.WebGLRenderer({ alpha: true });\n this.renderer.setSize(this.prop.size.width, this.prop.size.height);\n this.renderer.setPixelRatio(SYSTEM.pixelRatio);\n\n this.camera = new THREE.PerspectiveCamera(this.prop.vFov, this.prop.size.width / this.prop.size.height, 1, 3 * SPHERE_RADIUS);\n this.camera.position.set(0, 0, 0);\n\n this.scene = new THREE.Scene();\n this.scene.add(this.camera);\n\n if (this.prop.isCubemap) {\n this.mesh = this.__createCubemap();\n }\n else {\n this.mesh = this.__createSphere();\n }\n\n this.meshContainer = new THREE.Group();\n this.meshContainer.add(this.mesh);\n this.scene.add(this.meshContainer);\n\n // create canvas container\n this.renderer.domElement.className = 'psv-canvas';\n this.canvasContainer.appendChild(this.renderer.domElement);\n }\n\n /**\n * @summary Creates the sphere mesh\n * @param {number} [scale=1]\n * @returns {external:THREE.Mesh}\n * @private\n */\n __createSphere(scale = 1) {\n // The middle of the panorama is placed at longitude=0\n const geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, SPHERE_VERTICES, SPHERE_VERTICES, -Math.PI / 2);\n\n const material = new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n });\n\n const mesh = new THREE.Mesh(geometry, material);\n mesh.scale.set(-1, 1, 1);\n\n return mesh;\n }\n\n /**\n * @summary Creates the cube mesh\n * @param {number} [scale=1]\n * @returns {external:THREE.Mesh}\n * @private\n */\n __createCubemap(scale = 1) {\n const cubeSize = SPHERE_RADIUS * 2 * scale;\n const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_VERTICES, CUBE_VERTICES, CUBE_VERTICES);\n\n const materials = [];\n for (let i = 0; i < 6; i++) {\n materials.push(new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n }));\n }\n\n const mesh = new THREE.Mesh(geometry, materials);\n mesh.scale.set(1, 1, -1);\n\n return mesh;\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 { texture, panoData } = textureData;\n\n let positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n const group = new THREE.Group();\n let mesh;\n\n if (this.prop.isCubemap) {\n if (positionProvided) {\n logWarn('cannot perform cubemap transition to different position');\n positionProvided = false;\n }\n\n mesh = this.__createCubemap(0.9);\n\n mesh.material.forEach((material, i) => {\n material.map = texture[i];\n material.transparent = true;\n material.opacity = 0;\n });\n }\n else {\n mesh = this.__createSphere(0.9);\n\n mesh.material.map = texture;\n mesh.material.transparent = true;\n mesh.material.opacity = 0;\n\n this.setPanoramaPose(panoData, mesh);\n this.setSphereCorrection(options.sphereCorrection, group);\n }\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\n // Longitude rotation along the vertical axis\n const verticalAxis = new THREE.Vector3(0, 1, 0);\n group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - this.prop.position.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 - this.prop.position.latitude);\n\n // TODO: find a better way to handle ranges\n if (this.config.latitudeRange || this.config.longitudeRange) {\n this.config.longitudeRange = null;\n this.config.latitudeRange = null;\n logWarn('trying to perform transition with longitudeRange and/or latitudeRange, ranges cleared');\n }\n }\n\n group.add(mesh);\n this.scene.add(group);\n this.psv.needsUpdate();\n\n return new Animation({\n properties: {\n opacity: { start: 0.0, end: 1.0 },\n zoom : zoomProvided ? { start: this.prop.zoomLvl, end: options.zoom } : undefined,\n },\n duration : options.transition,\n easing : 'outCubic',\n onTick : (properties) => {\n if (this.prop.isCubemap) {\n for (let i = 0; i < 6; i++) {\n mesh.material[i].opacity = properties.opacity;\n }\n }\n else {\n mesh.material.opacity = properties.opacity;\n }\n\n if (zoomProvided) {\n this.psv.zoom(properties.zoom);\n }\n\n this.psv.needsUpdate();\n },\n })\n .then(() => {\n // remove temp sphere and transfer the texture to the main sphere\n this.setTexture(textureData);\n this.scene.remove(group);\n\n mesh.geometry.dispose();\n mesh.geometry = null;\n\n if (!this.prop.isCubemap) {\n this.setPanoramaPose(panoData);\n this.setSphereCorrection(options.sphereCorrection);\n }\n\n // actually rotate the camera\n if (positionProvided) {\n this.psv.rotate(options);\n }\n });\n }\n\n /**\n * @summary Calls `dispose` on all objects and textures\n * @param {external:THREE.Object3D} object\n * @private\n */\n __cleanTHREEScene(object) {\n object.traverse((item) => {\n if (item.geometry) {\n item.geometry.dispose();\n }\n\n if (item.material) {\n if (Array.isArray(item.material)) {\n item.material.forEach((material) => {\n if (material.map) {\n material.map.dispose();\n }\n\n material.dispose();\n });\n }\n else {\n if (item.material.map) {\n item.material.map.dispose();\n }\n\n item.material.dispose();\n }\n }\n\n if (item.dispose && !(item instanceof THREE.Scene)) {\n item.dispose();\n }\n\n if (item !== object) {\n this.__cleanTHREEScene(item);\n }\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { CUBE_HASHMAP, CUBE_MAP } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PSVError } from '../PSVError';\nimport { firstNonNull, getXMPValue, logWarn, sum } from '../utils';\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 Current HTTP requests\n * @type {XMLHttpRequest[]}\n * @private\n */\n this.requests = [];\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 {string|string[]|PSV.Cubemap} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @package\n */\n loadTexture(panorama, newPanoData) {\n const tempPanorama = [];\n\n if (Array.isArray(panorama)) {\n if (panorama.length !== 6) {\n throw 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 tempPanorama[i] = panorama[CUBE_MAP[i]];\n }\n\n return this.__loadCubemapTexture(tempPanorama);\n }\n else if (typeof panorama === 'object') {\n if (!CUBE_HASHMAP.every(side => !!panorama[side])) {\n throw 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 tempPanorama[i] = panorama[side];\n });\n\n return this.__loadCubemapTexture(tempPanorama);\n }\n else {\n return this.__loadEquirectangularTexture(panorama, newPanoData);\n }\n }\n\n /**\n * @summary Cancels current HTTP requests\n * @package\n */\n abortLoading() {\n [...this.requests].forEach(r => r.abort());\n }\n\n /**\n * @summary Loads a Blob with FileLoader\n * @param {string} url\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n * @private\n */\n __loadFile(url, onProgress) {\n return new Promise((resolve, reject) => {\n let progress = 0;\n onProgress && onProgress(progress);\n\n const loader = new THREE.FileLoader();\n\n if (this.config.withCredentials) {\n loader.setWithCredentials(true);\n }\n\n loader.setResponseType('blob');\n\n const request = loader.load(\n url,\n (result) => {\n const rIdx = this.requests.indexOf(request);\n if (rIdx !== -1) this.requests.splice(rIdx, 1);\n\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 const rIdx = this.requests.indexOf(request);\n if (rIdx !== -1) this.requests.splice(rIdx, 1);\n\n reject(err);\n }\n );\n\n // when we hit the cache, the result is the cache value\n if (request instanceof XMLHttpRequest) {\n this.requests.push(request);\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 * @private\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 * @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 Loads the sphere texture\n * @param {string} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @private\n */\n __loadEquirectangularTexture(panorama, newPanoData) {\n if (this.prop.isCubemap === true) {\n throw new PSVError('The viewer was initialized with an cubemap, cannot switch to equirectangular panorama.');\n }\n\n this.prop.isCubemap = false;\n\n return (\n !this.config.useXmpData\n ? this.__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.__loadImage(panorama).then(img => ({ img, xmpPanoData })))\n )\n .then(({ img, xmpPanoData }) => {\n if (typeof newPanoData === 'function') {\n // eslint-disable-next-line no-param-reassign\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),\n posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch),\n poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll),\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\n const texture = this.__createEquirectangularTexture(img, panoData);\n\n return { 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.__loadFile(panorama, onProgress)\n .then(blob => this.__loadBlobAsString(blob))\n .then((binary) => {\n const a = binary.indexOf('');\n const data = binary.substring(a, b);\n\n if (a !== -1 && b !== -1 && data.indexOf('GPano:') !== -1) {\n return {\n fullWidth : getXMPValue(data, 'FullPanoWidthPixels'),\n fullHeight : getXMPValue(data, 'FullPanoHeightPixels'),\n croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'),\n croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'),\n croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'),\n croppedY : getXMPValue(data, 'CroppedAreaTopPixels'),\n poseHeading : getXMPValue(data, 'PoseHeadingDegrees'),\n posePitch : getXMPValue(data, 'PosePitchDegrees'),\n poseRoll : getXMPValue(data, 'PoseRollDegrees'),\n };\n }\n\n return null;\n });\n }\n\n /**\n * @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 let texture;\n\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 resizedPanoData = { ...panoData };\n\n const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth;\n\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 texture = new THREE.Texture(buffer);\n }\n else {\n texture = new THREE.Texture(img);\n }\n\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n\n return texture;\n }\n\n /**\n * @summary Load the six textures of the cube\n * @param {string[]} panorama\n * @returns {Promise.}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @private\n */\n __loadCubemapTexture(panorama) {\n if (this.prop.isCubemap === false) {\n throw new PSVError('The viewer was initialized with an equirectangular panorama, cannot switch to cubemap.');\n }\n\n if (this.config.fisheye) {\n logWarn('fisheye effect with cubemap texture can generate distorsion');\n }\n\n this.prop.isCubemap = true;\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.__loadImage(panorama[i], (p) => {\n progress[i] = p;\n this.psv.loader.setProgress(sum(progress) / 6);\n })\n .then(img => this.__createCubemapTexture(img))\n );\n }\n\n return Promise.all(promises)\n .then(texture => ({ texture }));\n }\n\n /**\n * @summary Creates the final texture from image\n * @param {Image} img\n * @returns {external:THREE.Texture}\n * @private\n */\n __createCubemapTexture(img) {\n let texture;\n\n // resize image\n if (img.width > SYSTEM.maxTextureWidth) {\n const buffer = document.createElement('canvas');\n const ratio = SYSTEM.getMaxCanvasWidth() / img.width;\n\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 texture = new THREE.Texture(buffer);\n }\n else {\n texture = new THREE.Texture(img);\n }\n\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n\n return texture;\n }\n\n /**\n * @summary Preload a panorama file without displaying it\n * @param {string|string[]|PSV.Cubemap} panorama\n * @returns {Promise}\n */\n preloadPanorama(panorama) {\n return this.loadTexture(panorama);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { addClasses, parsePosition } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\nconst LEFT_MAP = { 0: 'left', 0.5: 'center', 1: 'right' };\nconst TOP_MAP = { 0: 'top', 0.5: 'center', 1: 'bottom' };\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 class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Tooltip extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n * @param {{arrow: number, offset: number}} size\n */\n constructor(psv, size) {\n super(psv, 'psv-tooltip');\n\n /**\n * @override\n * @property {number} arrow\n * @property {number} offset\n * @property {number} width\n * @property {number} height\n * @property {string} pos\n * @property {string} state\n * @property {*} data\n */\n this.prop = {\n ...this.prop,\n ...size,\n state : STATE.NONE,\n width : 0,\n height: 0,\n pos : '',\n data : null,\n };\n\n /**\n * Tooltip content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-tooltip-content';\n this.container.appendChild(this.content);\n\n /**\n * Tooltip arrow\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.arrow = document.createElement('div');\n this.arrow.className = 'psv-tooltip-arrow';\n this.container.appendChild(this.arrow);\n\n this.container.addEventListener('transitionend', this);\n\n this.container.style.top = '-1000px';\n this.container.style.left = '-1000px';\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.arrow;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'transitionend': this.__onTransitionEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n toggle() {\n throw new PSVError('Tooltip cannot be toggled');\n }\n\n /**\n * @summary Displays the tooltip on the viewer\n * Do not call this method directly, use {@link PSV.services.TooltipRenderer} instead.\n * @param {PSV.components.Tooltip.Config} config\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @package\n */\n show(config) {\n if (this.prop.state !== STATE.NONE) {\n throw new PSVError('Initialized tooltip cannot be re-initialized');\n }\n\n if (config.className) {\n addClasses(this.container, config.className);\n }\n\n this.content.innerHTML = config.content;\n\n const rect = this.container.getBoundingClientRect();\n this.prop.width = rect.right - rect.left;\n this.prop.height = rect.bottom - rect.top;\n\n this.prop.state = STATE.READY;\n\n this.move(config);\n\n this.prop.data = config.data;\n this.prop.state = STATE.SHOWING;\n\n this.psv.trigger(EVENTS.SHOW_TOOLTIP, this.prop.data, this);\n }\n\n /**\n * @summary Moves the tooltip to a new position\n * @param {PSV.components.Tooltip.Position} config\n *\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n move(config) {\n if (this.prop.state !== STATE.SHOWING && this.prop.state !== STATE.READY) {\n throw new PSVError('Uninitialized tooltip cannot be moved');\n }\n\n const t = this.container;\n const a = this.arrow;\n\n if (!config.position) {\n config.position = ['top', 'center'];\n }\n\n // parse position\n if (typeof config.position === 'string') {\n const tempPos = parsePosition(config.position);\n\n if (!(tempPos.x in LEFT_MAP) || !(tempPos.y in TOP_MAP)) {\n throw new PSVError(`Unable to parse tooltip position \"${config.position}\"`);\n }\n\n config.position = [TOP_MAP[tempPos.y], LEFT_MAP[tempPos.x]];\n }\n\n if (config.position[0] === 'center' && config.position[1] === 'center') {\n throw new PSVError('Unable to parse tooltip position \"center center\"');\n }\n\n // compute size\n const style = {\n posClass : config.position.slice(),\n width : this.prop.width,\n height : this.prop.height,\n top : 0,\n left : 0,\n arrowTop : 0,\n arrowLeft: 0,\n };\n\n // set initial position\n this.__computeTooltipPosition(style, config);\n\n // correct position if overflow\n let refresh = false;\n if (style.top < this.prop.offset) {\n style.posClass[0] = 'bottom';\n refresh = true;\n }\n else if (style.top + style.height > this.psv.prop.size.height - this.prop.offset) {\n style.posClass[0] = 'top';\n refresh = true;\n }\n if (style.left < this.prop.offset) {\n style.posClass[1] = 'right';\n refresh = true;\n }\n else if (style.left + style.width > this.psv.prop.size.width - this.prop.offset) {\n style.posClass[1] = 'left';\n refresh = true;\n }\n if (refresh) {\n this.__computeTooltipPosition(style, config);\n }\n\n // apply position\n t.style.top = style.top + 'px';\n t.style.left = style.left + 'px';\n\n a.style.top = style.arrowTop + 'px';\n a.style.left = style.arrowLeft + 'px';\n\n const newPos = style.posClass.join('-');\n if (newPos !== this.prop.pos) {\n t.classList.remove(`psv-tooltip--${this.prop.pos}`);\n\n this.prop.pos = newPos;\n t.classList.add(`psv-tooltip--${this.prop.pos}`);\n }\n }\n\n /**\n * @summary Hides the tooltip\n * @fires PSV.hide-tooltip\n */\n hide() {\n this.container.classList.remove('psv-tooltip--visible');\n this.prop.state = STATE.HIDING;\n\n this.psv.trigger(EVENTS.HIDE_TOOLTIP, this.prop.data);\n }\n\n /**\n * @summary Finalize transition\n * @param {TransitionEvent} e\n * @private\n */\n __onTransitionEnd(e) {\n if (e.propertyName === 'transform') {\n switch (this.prop.state) {\n case STATE.SHOWING:\n this.container.classList.add('psv-tooltip--visible');\n this.prop.state = STATE.READY;\n break;\n\n case STATE.HIDING:\n this.prop.state = STATE.NONE;\n this.destroy();\n break;\n\n default:\n // nothing\n }\n }\n }\n\n /**\n * @summary Computes the position of the tooltip and its arrow\n * @param {Object} style\n * @param {Object} config\n * @private\n */\n __computeTooltipPosition(style, config) {\n let topBottom = false;\n\n if (!config.box) {\n config.box = {\n width : 0,\n height: 0,\n };\n }\n\n switch (style.posClass[0]) {\n case 'bottom':\n style.top = config.top + config.box.height + this.prop.offset + this.prop.arrow;\n style.arrowTop = -this.prop.arrow * 2;\n topBottom = true;\n break;\n\n case 'center':\n style.top = config.top + config.box.height / 2 - style.height / 2;\n style.arrowTop = style.height / 2 - this.prop.arrow;\n break;\n\n case 'top':\n style.top = config.top - style.height - this.prop.offset - this.prop.arrow;\n style.arrowTop = style.height;\n topBottom = true;\n break;\n\n // no default\n }\n\n switch (style.posClass[1]) {\n case 'right':\n if (topBottom) {\n style.left = config.left + config.box.width / 2 - this.prop.offset - this.prop.arrow;\n style.arrowLeft = this.prop.offset;\n }\n else {\n style.left = config.left + config.box.width + this.prop.offset + this.prop.arrow;\n style.arrowLeft = -this.prop.arrow * 2;\n }\n break;\n\n case 'center':\n style.left = config.left + config.box.width / 2 - style.width / 2;\n style.arrowLeft = style.width / 2 - this.prop.arrow;\n break;\n\n case 'left':\n if (topBottom) {\n style.left = config.left - style.width + config.box.width / 2 + this.prop.offset + this.prop.arrow;\n style.arrowLeft = style.width - this.prop.offset - this.prop.arrow * 2;\n }\n else {\n style.left = config.left - style.width - this.prop.offset - this.prop.arrow;\n style.arrowLeft = style.width;\n }\n break;\n\n // no default\n }\n }\n\n}\n","import { Tooltip } from '../components/Tooltip';\nimport { getStyle } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Tooltip renderer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TooltipRenderer extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n const testTooltip = new Tooltip(this.psv);\n\n /**\n * @summary Computed static sizes\n * @member {Object}\n * @package\n * @property {number} arrowSize\n * @property {number} offset\n */\n this.size = {\n arrow : parseInt(getStyle(testTooltip.arrow, 'borderTopWidth'), 10),\n offset: parseInt(getStyle(testTooltip.container, 'outlineWidth'), 10),\n };\n\n testTooltip.destroy();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.size;\n\n super.destroy();\n }\n\n /**\n * @summary Displays a tooltip on the viewer\n * @param {PSV.components.Tooltip.Config} config\n * @returns {PSV.components.Tooltip}\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @example\n * viewer.tooltip.create({ content: 'Hello world', top: 200, left: 450, position: 'center bottom'})\n */\n create(config) {\n const tooltip = new Tooltip(this.psv, this.size);\n tooltip.show(config);\n\n return tooltip;\n }\n\n}\n","import * as THREE from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Animation } from './Animation';\nimport { Loader } from './components/Loader';\nimport { Navbar } from './components/Navbar';\nimport { Notification } from './components/Notification';\nimport { Overlay } from './components/Overlay';\nimport { Panel } from './components/Panel';\nimport { CONFIG_PARSERS, DEFAULTS, getConfig, READONLY_OPTIONS } from './data/config';\nimport { CHANGE_EVENTS, EVENTS, IDS, VIEWER_DATA } from './data/constants';\nimport { SYSTEM } from './data/system';\nimport errorIcon from './icons/error.svg';\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 bound,\n each,\n exitFullscreen,\n getAngle,\n getShortestArc,\n isExtendedPosition,\n isFullscreenEnabled,\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} needsUpdate - if the view needs to be renderer\n * @property {boolean} isCubemap - if the panorama is a cubemap\n * @property {PSV.Position} position - current direction of the camera\n * @property {external:THREE.Vector3} direction - direction of the camera\n * @property {number} zoomLvl - current zoom level\n * @property {number} vFov - vertical FOV\n * @property {number} hFov - horizontal FOV\n * @property {number} aspect - viewer aspect ratio\n * @property {number} moveSpeed - move speed (computed with pixel ratio and configuration moveSpeed)\n * @property {Function} autorotateCb - update callback of the automatic rotation\n * @property {PSV.Animation} animationPromise - promise of the current animation (either go to position or image transition)\n * @property {Promise} loadingPromise - promise of the setPanorama method\n * @property startTimeout - timeout id of the automatic rotation delay\n * @property {PSV.Size} size - size of the container\n * @property {PSV.PanoData} panoData - panorama metadata\n */\n this.prop = {\n ready : false,\n uiRefresh : false,\n needsUpdate : false,\n fullscreen : false,\n isCubemap : undefined,\n position : {\n longitude: 0,\n latitude : 0,\n },\n direction : null,\n zoomLvl : null,\n vFov : null,\n hFov : null,\n aspect : null,\n moveSpeed : 0.1,\n autorotateCb : null,\n animationPromise: null,\n loadingPromise : null,\n startTimeout : null,\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 },\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 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 * @summary Main render controller\n * @type {PSV.services.Renderer}\n * @readonly\n */\n this.renderer = new Renderer(this);\n\n /**\n * @summary Textures loader\n * @type {PSV.services.TextureLoader}\n * @readonly\n */\n this.textureLoader = new TextureLoader(this);\n\n /**\n * @summary Main event handler\n * @type {PSV.services.EventsHandler}\n * @readonly\n */\n this.eventsHandler = new EventsHandler(this);\n\n /**\n * @summary Utilities to help converting data\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 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 // actual move speed depends on pixel-ratio\n this.prop.moveSpeed = THREE.Math.degToRad(this.config.moveSpeed / SYSTEM.pixelRatio);\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\n // init buttons\n this.navbar.setButtons(this.config.navbar);\n\n // load panorama\n if (this.config.panorama) {\n this.setPanorama(this.config.panorama);\n }\n\n SYSTEM.isTouchEnabled.then(enabled => toggleClass(this.container, 'psv--is-touch', enabled));\n\n // enable GUI after first render\n this.once(EVENTS.RENDER, () => {\n if (this.config.navbar) {\n this.container.classList.add('psv--has-navbar');\n this.navbar.show();\n }\n\n // Queue autorotate\n if (this.config.autorotateDelay) {\n this.prop.startTimeout = setTimeout(() => this.startAutorotate(), this.config.autorotateDelay);\n }\n\n this.prop.ready = true;\n\n setTimeout(() => {\n this.refreshUi('init');\n\n this.trigger(EVENTS.READY);\n }, 0);\n });\n }\n\n /**\n * @summary Destroys the viewer\n * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.\n */\n destroy() {\n this.__stopAll();\n this.stopKeyboardControl();\n this.exitFullscreen();\n\n this.eventsHandler.destroy();\n this.renderer.destroy();\n this.textureLoader.destroy();\n this.dataHelper.destroy();\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n each(this.plugins, plugin => plugin.destroy());\n delete this.plugins;\n\n this.parent.removeChild(this.container);\n delete this.parent[VIEWER_DATA];\n\n delete this.parent;\n delete this.container;\n\n delete this.loader;\n delete this.navbar;\n delete this.panel;\n delete this.tooltip;\n delete this.notification;\n delete this.overlay;\n\n delete this.config;\n }\n\n /**\n * @summary Refresh UI\n * @package\n */\n refreshUi(reason) {\n if (!this.prop.ready) {\n return;\n }\n\n if (!this.prop.uiRefresh) {\n // console.log(`PhotoSphereViewer: UI Refresh, ${reason}`);\n\n this.prop.uiRefresh = true;\n\n this.children.every((child) => {\n child.refreshUi();\n return this.prop.uiRefresh === true;\n });\n\n this.prop.uiRefresh = false;\n }\n else if (this.prop.uiRefresh !== 'new') {\n this.prop.uiRefresh = 'new';\n\n // wait for current refresh to cancel\n setTimeout(() => {\n this.prop.uiRefresh = false;\n this.refreshUi(reason);\n });\n }\n }\n\n /**\n * @summary Returns the instance of a plugin if it exists\n * @param {Class|string} pluginId\n * @returns {PSV.plugins.AbstractPlugin}\n */\n getPlugin(pluginId) {\n return pluginId ? this.plugins[typeof pluginId === 'function' ? pluginId.id : pluginId] : null;\n }\n\n /**\n * @summary Returns the current position of the camera\n * @returns {PSV.Position}\n */\n getPosition() {\n return {\n longitude: this.prop.position.longitude,\n latitude : this.prop.position.latitude,\n };\n }\n\n /**\n * @summary Returns the current zoom level\n * @returns {number}\n */\n getZoomLevel() {\n return this.prop.zoomLvl;\n }\n\n /**\n * @summary Returns the current viewer size\n * @returns {PSV.Size}\n */\n getSize() {\n return {\n width : this.prop.size.width,\n height: this.prop.size.height,\n };\n }\n\n /**\n * @summary Checks if the automatic rotation is enabled\n * @returns {boolean}\n */\n isAutorotateEnabled() {\n return !!this.prop.autorotateCb;\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 if (!this.renderer.mainReqid && this.renderer.renderer) {\n this.renderer.__renderLoop(+new Date());\n }\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.needsUpdate();\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 {string|string[]|PSV.Cubemap} path - URL of the new panorama file\n * @param {PSV.PanoramaOptions} [options]\n * @returns {Promise}\n */\n setPanorama(path, options = {}) {\n if (this.prop.loadingPromise !== null) {\n this.textureLoader.abortLoading();\n }\n\n // apply default parameters on first load\n if (!this.prop.ready) {\n if (!('longitude' in options) && !this.prop.isCubemap) {\n options.longitude = this.config.defaultLong;\n }\n if (!('latitude' in options) && !this.prop.isCubemap) {\n options.latitude = this.config.defaultLat;\n }\n if (!('zoom' in options)) {\n options.zoom = this.config.defaultZoomLvl;\n }\n if (!('sphereCorrection' in options)) {\n options.sphereCorrection = this.config.sphereCorrection;\n }\n if (!('panoData' in options)) {\n options.panoData = this.config.panoData;\n }\n }\n\n if (options.transition === undefined || options.transition === true) {\n options.transition = 1500;\n }\n if (options.showLoader === undefined) {\n options.showLoader = true;\n }\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n if (positionProvided || zoomProvided) {\n this.__stopAll();\n }\n\n this.hideError();\n\n this.config.panorama = path;\n\n const done = (err) => {\n if (err && err.type === 'abort') {\n console.warn(err);\n }\n else if (err) {\n this.showError(this.config.lang.loadError);\n console.error(err);\n }\n\n this.loader.hide();\n this.renderer.show();\n\n this.prop.loadingPromise = null;\n\n if (err) {\n return Promise.reject(err);\n }\n else {\n return true;\n }\n };\n\n if (!options.transition || !this.prop.ready) {\n if (options.showLoader || !this.prop.ready) {\n this.loader.show();\n }\n\n this.prop.loadingPromise = this.textureLoader.loadTexture(this.config.panorama, options.panoData)\n .then((textureData) => {\n this.renderer.setTexture(textureData);\n this.renderer.setPanoramaPose(textureData.panoData);\n this.renderer.setSphereCorrection(options.sphereCorrection);\n\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n if (positionProvided) {\n this.rotate(options);\n }\n })\n .then(done, done);\n }\n else {\n if (options.showLoader) {\n this.loader.show();\n }\n\n this.prop.loadingPromise = this.textureLoader.loadTexture(this.config.panorama, options.panoData)\n .then((textureData) => {\n this.loader.hide();\n\n return this.renderer.transition(textureData, options);\n })\n .then(done, done);\n }\n\n return this.prop.loadingPromise;\n }\n\n /**\n * @summary Update options\n * @param {PSV.Options} options\n * @fires PSV.config-changed\n */\n setOptions(options) {\n each(options, (value, key) => {\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (READONLY_OPTIONS[key]) {\n throw new PSVError(READONLY_OPTIONS[key]);\n }\n\n if (CONFIG_PARSERS[key]) {\n this.config[key] = CONFIG_PARSERS[key](value, options);\n }\n else {\n this.config[key] = value;\n }\n\n switch (key) {\n case 'caption':\n this.navbar.setCaption(value);\n break;\n\n case 'size':\n this.resize(value);\n break;\n\n case 'sphereCorrection':\n this.renderer.setSphereCorrection(value);\n break;\n\n case 'navbar':\n case 'lang':\n this.navbar.setButtons(this.config.navbar);\n break;\n\n case 'moveSpeed':\n this.prop.moveSpeed = THREE.Math.degToRad(value / SYSTEM.pixelRatio);\n break;\n\n case 'minFov':\n case 'maxFov':\n this.prop.zoomLvl = this.dataHelper.fovToZoomLevel(this.prop.vFov);\n this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel());\n break;\n\n case 'canvasBackground':\n this.renderer.canvasContainer.style.background = this.config.canvasBackground;\n break;\n\n default:\n break;\n }\n });\n\n this.needsUpdate();\n this.refreshUi('set options');\n\n this.trigger(EVENTS.CONFIG_CHANGED, Object.keys(options));\n }\n\n /**\n * @summary Update options\n * @param {string} option\n * @param {any} value\n * @fires PSV.config-changed\n */\n setOption(option, value) {\n this.setOptions({ [option]: value });\n }\n\n /**\n * @summary Starts the automatic rotation\n * @fires PSV.autorotate\n */\n startAutorotate() {\n this.__stopAll();\n\n this.prop.autorotateCb = (() => {\n let last;\n let elapsed;\n\n return (e, timestamp) => {\n elapsed = last === undefined ? 0 : timestamp - last;\n last = timestamp;\n\n this.rotate({\n longitude: this.prop.position.longitude + this.config.autorotateSpeed * elapsed / 1000,\n latitude : this.prop.position.latitude - (this.prop.position.latitude - this.config.autorotateLat) / 200,\n });\n };\n })();\n\n this.on(EVENTS.BEFORE_RENDER, this.prop.autorotateCb);\n\n this.trigger(EVENTS.AUTOROTATE, true);\n }\n\n /**\n * @summary Stops the automatic rotation\n * @fires PSV.autorotate\n */\n stopAutorotate() {\n if (this.prop.startTimeout) {\n clearTimeout(this.prop.startTimeout);\n this.prop.startTimeout = null;\n }\n\n if (this.isAutorotateEnabled()) {\n this.off(EVENTS.BEFORE_RENDER, this.prop.autorotateCb);\n this.prop.autorotateCb = null;\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\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\n if (this.prop.position.longitude !== cleanPosition.longitude || this.prop.position.latitude !== cleanPosition.latitude) {\n this.prop.position.longitude = cleanPosition.longitude;\n this.prop.position.latitude = cleanPosition.latitude;\n\n this.needsUpdate();\n\n this.trigger(EVENTS.POSITION_UPDATED, this.getPosition());\n }\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\n // longitude offset for shortest arc\n const tOffset = getShortestArc(this.prop.position.longitude, cleanPosition.longitude);\n\n animProperties.longitude = { start: this.prop.position.longitude, end: this.prop.position.longitude + tOffset };\n animProperties.latitude = { start: this.prop.position.latitude, end: cleanPosition.latitude };\n\n duration = this.dataHelper.speedToDuration(options.speed, getAngle(this.prop.position, cleanPosition));\n }\n\n // clean/filter zoom and compute duration\n if (zoomProvided) {\n const dZoom = Math.abs(options.zoom - this.prop.zoomLvl);\n\n animProperties.zoom = { start: this.prop.zoomLvl, end: options.zoom };\n\n if (!duration) {\n // if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration\n duration = this.dataHelper.speedToDuration(options.speed, Math.PI / 4 * dZoom / 100);\n }\n }\n\n // if no animation needed\n if (!duration) {\n if (positionProvided) {\n this.rotate(options);\n }\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n\n return Animation.resolve();\n }\n\n this.prop.animationPromise = new Animation({\n properties: animProperties,\n duration : duration,\n easing : 'inOutSine',\n onTick : (properties) => {\n if (positionProvided) {\n this.rotate(properties);\n }\n if (zoomProvided) {\n this.zoom(properties.zoom);\n }\n },\n });\n\n return this.prop.animationPromise;\n }\n\n /**\n * @summary Stops the ongoing animation\n * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously.\n * @returns {Promise} Resolved when the animation has ben cancelled\n */\n stopAnimation() {\n if (this.prop.animationPromise) {\n return new Promise((resolve) => {\n this.prop.animationPromise.finally(resolve);\n this.prop.animationPromise.cancel();\n this.prop.animationPromise = null;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * @summary Zooms to a specific level between `max_fov` and `min_fov`\n * @param {number} level - new zoom level from 0 to 100\n * @fires PSV.zoom-updated\n */\n zoom(level) {\n const newZoomLvl = bound(level, 0, 100);\n\n if (this.prop.zoomLvl !== newZoomLvl) {\n this.prop.zoomLvl = newZoomLvl;\n this.prop.vFov = this.dataHelper.zoomLevelToFov(this.prop.zoomLvl);\n this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov);\n\n this.needsUpdate();\n this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel());\n this.rotate(this.prop.position);\n }\n }\n\n /**\n * @summary Increases the zoom level by 1\n */\n zoomIn() {\n this.zoom(this.prop.zoomLvl + this.config.zoomButtonIncrement);\n }\n\n /**\n * @summary Decreases the zoom level by 1\n */\n zoomOut() {\n this.zoom(this.prop.zoomLvl - this.config.zoomButtonIncrement);\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 Stops all current animations\n * @private\n */\n __stopAll() {\n this.stopAutorotate();\n this.stopAnimation();\n\n this.trigger(EVENTS.STOP_ALL);\n }\n\n}\n"],"names":["MOVE_THRESHOLD","DBLCLICK_DELAY","LONGTOUCH_DELAY","TWOFINGERSOVERLAY_DELAY","CTRLZOOM_TIMEOUT","INERTIA_WINDOW","SPHERE_RADIUS","SPHERE_VERTICES","CUBE_VERTICES","CUBE_MAP","CUBE_HASHMAP","VIEWER_DATA","ACTIONS","ROTATE_LAT_UP","ROTATE_LAT_DOWN","ROTATE_LONG_RIGHT","ROTATE_LONG_LEFT","ZOOM_IN","ZOOM_OUT","TOGGLE_AUTOROTATE","EVENTS","AUTOROTATE","BEFORE_RENDER","BEFORE_ROTATE","CLICK","CLOSE_PANEL","CONFIG_CHANGED","DOUBLE_CLICK","FULLSCREEN_UPDATED","HIDE_NOTIFICATION","HIDE_OVERLAY","HIDE_TOOLTIP","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","IDS","MENU","TWO_FINGERS","CTRL_ZOOM","ERROR","EASINGS","linear","t","inQuad","outQuad","inOutQuad","inCubic","outCubic","inOutCubic","inQuart","outQuart","inOutQuart","inQuint","outQuint","inOutQuint","inSine","Math","cos","PI","outSine","sin","inOutSine","inExpo","pow","outExpo","inOutExpo","inCirc","sqrt","outCirc","inOutCirc","toggleClass","element","className","active","classList","currentClassName","getAttribute","currentActive","indexOf","regex","RegExp","undefined","length","replace","setAttribute","toggle","contains","add","remove","addClasses","split","forEach","name","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","msMatchesSelector","bind","SVGElement","parentElement","KEYMAP","MS_KEYMAP","Add","Del","Down","Esc","Left","Right","Spacebar","Subtract","Up","getEventKey","evt","key","keyCode","which","isFullscreenEnabled","elt","document","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","call","exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","getStyle","prop","window","getComputedStyle","normalizeWheel","event","PIXEL_STEP","LINE_HEIGHT","PAGE_HEIGHT","spinX","spinY","pixelX","pixelY","detail","wheelDelta","wheelDeltaY","wheelDeltaX","axis","HORIZONTAL_AXIS","deltaY","deltaX","deltaMode","bound","x","min","max","isInteger","value","Number","isFinite","floor","sum","array","reduce","a","b","distance","p1","p2","y","getShortestArc","from","to","tCandidates","candidate","newCandidate","abs","Infinity","getAngle","position1","position2","acos","latitude","longitude","greatArcDistance","λ1","φ1","λ2","φ2","dasherize","str","s","i","toLowerCase","throttle","func","wait","self","args","result","timeout","previous","later","Date","now","apply","remaining","arguments","clearTimeout","setTimeout","isPlainObject","obj","Object","getPrototypeOf","proto","prototype","toString","deepmerge","target","src","first","merge","Array","isArray","e","keys","clone","isEmpty","constructor","each","object","callback","intersect","array1","array2","filter","isNil","val","firstNonNull","values","PSVError","message","Error","captureStackTrace","stack","create","logWarn","console","warn","isExtendedPosition","some","key1","key2","getXMPValue","data","attr","match","parseInt","isNaN","CSS_POSITIONS","top","bottom","left","right","center","parsePosition","tokens","toLocaleLowerCase","slice","xFirst","map","token","reverse","parsed","join","parseFloat","parseSpeed","speed","speedStr","trim","speedValue","speedUnit","THREE","degToRad","parseAngle","angle","zeroCenter","halfCircle","unit","Animation","options","__cancelled","__resolved","__promise","Promise","resolve","reject","__resolve","__reject","easing","__start","delay","__delayTimeout","requestAnimationFrame","__run","timestamp","progress","duration","current","properties","start","end","onTick","then","onFulfilled","onRejected","p","cancel","catch","finally","onFinally","cancelAnimationFrame","AbstractComponent","psv","children","push","visible","container","createElement","appendChild","destroy","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","id","enabled","supported","collapsed","width","offsetWidth","icon","__setIcon","config","lang","title","addEventListener","onClick","stopPropagation","checkSupported","supportedOrObject","isSupported","initial","promise","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","AutorotateButton","on","off","handleEvent","type","toggleAutorotate","play","playActive","CustomButton","random","substr","content","DownloadButton","link","href","panorama","download","click","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","panel","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","getButton","menuIcon","buttons","dataKey","menu","button","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","names","context","getContext","listener","removeEventListener","getParameter","MAX_TEXTURE_SIZE","maxWidth","height","fillStyle","fillRect","getImageData","onmousewheel","FULLSCREEN_EVT_MAP","validExits","exit","AbstractZoomButton","buttondown","longPressTimeout","longPressAnimation","__onMouseUp","__onMouseDown","__startLongPressInterval","zoom","zoomLvl","zoomButtonIncrement","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mousedown","mediaMinWidth","zoomRange","zoomValue","ready","__moveZoomValue","once","__stopZoomChange","__initZoomChangeWithMouse","__initZoomChangeByTouch","__changeZoomWithMouse","__changeZoomByTouch","size","level","__changeZoom","clientX","changedTouches","preventDefault","userInput","getBoundingClientRect","zoomLevel","DEFAULTS","caption","loadingImg","loadingTxt","fisheye","minFov","maxFov","defaultZoomLvl","defaultLong","defaultLat","sphereCorrection","sphereCorrectionReorder","moveSpeed","autorotateDelay","autorotateSpeed","autorotateLat","moveInertia","mousewheel","mousewheelSpeed","mousemove","captureCursor","mousewheelCtrlKey","touchmoveTwoFingers","useXmpData","panoData","canvasBackground","withCredentials","autorotate","fullscreen","twoFingers","ctrlZoom","loadError","keyboard","plugins","READONLY_OPTIONS","CONFIG_PARSERS","plugin","getConfig","tempConfig","hasOwnProperty","CaptionButton","notification","info","NavbarCaption","contentVisible","contentWidth","setCaption","html","availableWidth","AVAILABLE_BUTTONS","registerButton","Navbar","setButtons","item","__cleanButtons","warnNotFound","totalWidth","visibleButtons","collapsableButtons","AbstractPlugin","EventEmitter","Loader","loader","clientWidth","tickness","lastChild","inner","round","maxHeight","setProgress","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","Notification","trigger","Overlay","contentId","dissmisable","image","text","subtext","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","resizer","closeBtn","__onTouchStart","__onMouseMove","__onTouchMove","scrollTop","__startResize","__resize","touches","clientY","AbstractService","DataHelper","fovToZoomLevel","fov","temp","zoomLevelToFov","vFovToHFov","vFov","radToDeg","atan","tan","aspect","speedToDuration","textureCoordsToSphericalCoords","point","isCubemap","relativeX","croppedX","fullWidth","relativeY","croppedY","fullHeight","sphericalCoordsToTextureCoords","position","relativeLong","relativeLat","sphericalCoordsToVector3","vector3ToSphericalCoords","vector","phi","z","theta","atan2","viewerCoordsToVector3","viewerPoint","screen","renderer","raycaster","setFromCamera","camera","intersects","intersectObjects","scene","vector3ToViewerCoords","vectorClone","project","cleanPosition","cleanSphereCorrection","pan","tilt","roll","EventsHandler","state","keyboardEnabled","moving","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","init","__onKeyDown","__onKeyUp","__onTouchEnd","__fullscreenToggled","__onMouseEnter","__onMouseLeave","__onMouseWheel","enableKeyboard","disableKeyboard","overlay","dLong","dLat","dZoom","rotate","hFov","__startMove","__stopMove","__move","__moveAbsolute","__click","__cancelLongTouch","__startMoveZoom","__stopMoveZoom","__cancelTwoFingersOverlay","gestureIcon","__moveZoom","mousewheelIcon","delta","force","startKeyboardControl","stopKeyboardControl","stopAutorotate","stopAnimation","__logMouseMove","__stopMoveInertia","direction","norm","animationPromise","longtouch","boundingRect","rightclick","viewerX","viewerY","dataHelper","sphericalCoords","textureCoords","textureX","textureY","log","rotation","containerRect","Renderer","mainReqid","mesh","meshContainer","canvasContainer","background","cursor","setSize","__cleanTHREEScene","opacity","__renderLoop","needsUpdate","render","set","lookAt","copy","multiplyScalar","negate","updateProjectionMatrix","setTexture","textureData","texture","__createScene","material","dispose","setPanoramaPose","poseHeading","posePitch","poseRoll","setSphereCorrection","cleanCorrection","nonZeros","alpha","setPixelRatio","__createCubemap","__createSphere","domElement","scale","geometry","side","cubeSize","materials","transition","positionProvided","zoomProvided","group","transparent","verticalAxis","rotateOnWorldAxis","horizontalAxis","cross","getWorldDirection","normalize","latitudeRange","longitudeRange","traverse","TextureLoader","requests","abortLoading","loadTexture","newPanoData","tempPanorama","__loadCubemapTexture","__loadEquirectangularTexture","r","abort","__loadFile","url","onProgress","setWithCredentials","setResponseType","request","rIdx","lengthComputable","newProgress","total","err","XMLHttpRequest","__loadImage","img","createElementNS","onload","URL","revokeObjectURL","onerror","createObjectURL","__loadBlobAsString","blob","reader","FileReader","readAsText","xmpPanoData","__loadXMP","croppedWidth","croppedHeight","__createEquirectangularTexture","binary","substring","resizedPanoData","ratio","buffer","drawImage","minFilter","generateMipmaps","promises","__createCubemapTexture","all","preloadPanorama","LEFT_MAP","TOP_MAP","STATE","NONE","SHOWING","HIDING","Tooltip","pos","arrow","__onTransitionEnd","rect","move","tempPos","posClass","arrowTop","arrowLeft","__computeTooltipPosition","offset","newPos","propertyName","topBottom","box","TooltipRenderer","testTooltip","tooltip","Viewer","autorotateCb","loadingPromise","startTimeout","getElementById","textureLoader","eventsHandler","__resizeRefresh","resize","opts","setPanorama","startAutorotate","__stopAll","reason","getPlugin","pluginId","getPosition","getZoomLevel","getSize","isAutorotateEnabled","clientHeight","path","showLoader","hideError","done","showError","error","setOptions","setOption","option","last","elapsed","errorIcon","isDefaultPrevented","change","animate","animProperties","tOffset","newZoomLvl","dim","enterFullscreen"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACO,IAAMA,cAAc,GAAG,CAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,eAAe,GAAG,GAAxB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,uBAAuB,GAAG,GAAhC;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,gBAAgB,GAAG,IAAzB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,aAAa,GAAG,GAAtB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,eAAe,GAAG,EAAxB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,aAAa,GAAG,CAAtB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,QAAQ,GAAG,CAAC,CAAD,EAAI,CAAJ,EAAO,CAAP,EAAU,CAAV,EAAa,CAAb,EAAgB,CAAhB,CAAjB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,YAAY,GAAG,CAAC,MAAD,EAAS,OAAT,EAAkB,KAAlB,EAAyB,QAAzB,EAAmC,MAAnC,EAA2C,OAA3C,CAArB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,WAAW,GAAG,mBAApB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,OAAO,GAAG;EACrBC,EAAAA,aAAa,EAAM,kBADE;EAErBC,EAAAA,eAAe,EAAI,oBAFE;EAGrBC,EAAAA,iBAAiB,EAAE,sBAHE;EAIrBC,EAAAA,gBAAgB,EAAG,qBAJE;EAKrBC,EAAAA,OAAO,EAAY,QALE;EAMrBC,EAAAA,QAAQ,EAAW,SANE;EAOrBC,EAAAA,iBAAiB,EAAE;EAPE,CAAhB;EAUP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YAPA;;EAQpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eAdA;;EAepB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eArBA;;EAsBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OA5BA;;EA6BpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAS,aAnCA;;EAoCpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,cAAc,EAAM,gBA1CA;;EA2CpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,UAjDA;;EAkDpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,kBAAkB,EAAE,oBAxDA;;EAyDpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBA9DA;;EA+DpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cArEA;;EAsEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA5EA;;EA6EpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YAnFA;;EAoFpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAK,iBAzFA;;EA0FpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAI,kBAhGA;;EAiGpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OAtGA;;EAuGpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,MAAM,EAAc,QA5GA;;EA6GpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBAlHA;;EAmHpB;EACF;EACA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B;EACD;EAED;EACF;EACA;EACA;EAp2BA;;EAAA,SAq2BE4L,SAr2BF,GAq2BE,qBAAY;EACV,SAAKrK,cAAL;EACA,SAAKC,aAAL;EAEA,SAAK1H,OAAL,CAAa/iB,MAAM,CAACqB,QAApB;EACD,GA12BH;;EAAA;EAAA,EAA4BygB,mBAA5B;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"photo-sphere-viewer.js","sources":["../src/data/constants.js","../src/utils/browser.js","../src/utils/math.js","../src/utils/misc.js","../src/PSVError.js","../src/utils/psv.js","../src/utils/index.js","../src/Animation.js","../src/components/AbstractComponent.js","../src/buttons/AbstractButton.js","../src/buttons/AutorotateButton.js","../src/buttons/CustomButton.js","../src/buttons/DownloadButton.js","../src/buttons/FullscreenButton.js","../src/buttons/MenuButton.js","../src/data/system.js","../src/utils/PressHandler.js","../src/buttons/AbstractMoveButton.js","../src/buttons/MoveDownButton.js","../src/buttons/MoveLeftButton.js","../src/buttons/MoveRightButton.js","../src/buttons/MoveUpButton.js","../src/buttons/AbstractZoomButton.js","../src/buttons/ZoomInButton.js","../src/buttons/ZoomOutButton.js","../src/buttons/ZoomRangeButton.js","../src/adapters/AbstractAdapter.js","../src/adapters/equirectangular/index.js","../src/plugins/AbstractPlugin.js","../src/data/config.js","../src/buttons/CaptionButton.js","../src/components/NavbarCaption.js","../src/components/Navbar.js","../src/components/Loader.js","../src/components/Notification.js","../src/components/Overlay.js","../src/components/Panel.js","../src/services/AbstractService.js","../src/services/DataHelper.js","../src/services/EventsHandler.js","../src/services/Renderer.js","../src/services/TextureLoader.js","../src/components/Tooltip.js","../src/services/TooltipRenderer.js","../src/utils/Dynamic.js","../src/utils/MultiDynamic.js","../src/Viewer.js"],"sourcesContent":["/**\n * @namespace PSV.constants\n */\n\n/**\n * @summary Number of pixels bellow which a mouse move will be considered as a click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const MOVE_THRESHOLD = 4;\n\n/**\n * @summary Delay in milliseconds between two clicks to consider a double click\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const DBLCLICK_DELAY = 300;\n\n/**\n * @summary Delay in milliseconds to emulate a long touch\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const LONGTOUCH_DELAY = 500;\n\n/**\n * @summary Delay in milliseconds to for the two fingers overlay to appear\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const TWOFINGERSOVERLAY_DELAY = 100;\n\n/**\n * @summary Duration in milliseconds of the \"ctrl zoom\" overlay\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const CTRLZOOM_TIMEOUT = 2000;\n\n/**\n * @summary Time size of the mouse position history used to compute inertia\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const INERTIA_WINDOW = 300;\n\n/**\n * @summary Radius of the THREE.SphereGeometry, Half-length of the THREE.BoxGeometry\n * @memberOf PSV.constants\n * @type {number}\n * @constant\n */\nexport const SPHERE_RADIUS = 10;\n\n/**\n * @summary Property name added to viewer element\n * @memberOf PSV.constants\n * @type {string}\n * @constant\n */\nexport const VIEWER_DATA = 'photoSphereViewer';\n\n/**\n * @summary Available actions\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const ACTIONS = {\n ROTATE_LAT_UP : 'rotateLatitudeUp',\n ROTATE_LAT_DOWN : 'rotateLatitudeDown',\n ROTATE_LONG_RIGHT: 'rotateLongitudeRight',\n ROTATE_LONG_LEFT : 'rotateLongitudeLeft',\n ZOOM_IN : 'zoomIn',\n ZOOM_OUT : 'zoomOut',\n TOGGLE_AUTOROTATE: 'toggleAutorotate',\n};\n\n/**\n * @summary Available events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const EVENTS = {\n /**\n * @event autorotate\n * @memberof PSV\n * @summary Triggered when the automatic rotation is enabled/disabled\n * @param {boolean} enabled\n */\n AUTOROTATE : 'autorotate',\n /**\n * @event before-render\n * @memberof PSV\n * @summary Triggered before a render, used to modify the view\n * @param {number} timestamp - time provided by requestAnimationFrame\n * @param {number} elapsed - time elapsed from the previous frame\n */\n BEFORE_RENDER : 'before-render',\n /**\n * @event before-rotate\n * @memberOf PSV\n * @summary Triggered before a rotate operation, can be cancelled\n * @param {PSV.ExtendedPosition}\n */\n BEFORE_ROTATE : 'before-rotate',\n /**\n * @event click\n * @memberof PSV\n * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel)\n * @param {PSV.ClickData} data\n */\n CLICK : 'click',\n /**\n * @event close-panel\n * @memberof PSV\n * @summary Triggered when the panel is closed\n * @param {string} [id]\n */\n CLOSE_PANEL : 'close-panel',\n /**\n * @event config-changed\n * @memberOf PSV\n * @summary Triggered after a call to setOption/setOptions\n * @param {string[]} name of changed options\n */\n CONFIG_CHANGED : 'config-changed',\n /**\n * @event dblclick\n * @memberof PSV\n * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick`\n * @param {PSV.ClickData} data\n */\n DOUBLE_CLICK : 'dblclick',\n /**\n * @event fullscreen-updated\n * @memberof PSV\n * @summary Triggered when the fullscreen mode is enabled/disabled\n * @param {boolean} enabled\n */\n FULLSCREEN_UPDATED: 'fullscreen-updated',\n /**\n * @event hide-notification\n * @memberof PSV\n * @summary Triggered when the notification is hidden\n */\n HIDE_NOTIFICATION : 'hide-notification',\n /**\n * @event hide-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is hidden\n * @param {string} [id]\n */\n HIDE_OVERLAY : 'hide-overlay',\n /**\n * @event hide-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is hidden\n * @param {*} Data associated to this tooltip\n */\n HIDE_TOOLTIP : 'hide-tooltip',\n /**\n * @event open-panel\n * @memberof PSV\n * @summary Triggered when the panel is opened\n * @param {string} [id]\n */\n OPEN_PANEL : 'open-panel',\n /**\n * @event panorama-loaded\n * @memberof PSV\n * @summary Triggered when a panorama image has been loaded\n */\n PANORAMA_LOADED : 'panorama-loaded',\n /**\n * @event position-updated\n * @memberof PSV\n * @summary Triggered when the view longitude and/or latitude changes\n * @param {PSV.Position} position\n */\n POSITION_UPDATED : 'position-updated',\n /**\n * @event ready\n * @memberof PSV\n * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render\n */\n READY : 'ready',\n /**\n * @event render\n * @memberof PSV\n * @summary Triggered on each viewer render, **this event is triggered very often**\n */\n RENDER : 'render',\n /**\n * @event show-notification\n * @memberof PSV\n * @summary Triggered when the notification is shown\n */\n SHOW_NOTIFICATION : 'show-notification',\n /**\n * @event show-overlay\n * @memberof PSV\n * @summary Triggered when the overlay is shown\n * @param {string} [id]\n */\n SHOW_OVERLAY : 'show-overlay',\n /**\n * @event show-tooltip\n * @memberof PSV\n * @summary Triggered when the tooltip is shown\n * @param {*} Data associated to this tooltip\n * @param {PSV.components.Tooltip} Instance of the tooltip\n */\n SHOW_TOOLTIP : 'show-tooltip',\n /**\n * @event size-updated\n * @memberof PSV\n * @summary Triggered when the viewer size changes\n * @param {PSV.Size} size\n */\n SIZE_UPDATED : 'size-updated',\n /**\n * @event stop-all\n * @memberof PSV\n * @summary Triggered when all current animations are stopped\n */\n STOP_ALL : 'stop-all',\n /**\n * @event zoom-updated\n * @memberof PSV\n * @summary Triggered when the zoom level changes\n * @param {number} zoomLevel\n */\n ZOOM_UPDATED : 'zoom-updated',\n};\n\n/**\n * @summary Available change events names\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const CHANGE_EVENTS = {\n /**\n * @event get-animate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of an animation\n */\n GET_ANIMATE_POSITION: 'get-animate-position',\n /**\n * @event get-rotate-position\n * @memberof PSV\n * @param {Position} position\n * @returns {Position}\n * @summary Called to alter the target position of a rotation\n */\n GET_ROTATE_POSITION : 'get-rotate-position',\n};\n\n/**\n * @summary Internal identifiers for various stuff\n * @memberOf PSV.constants\n * @enum {string}\n * @constant\n */\nexport const IDS = {\n MENU : 'menu',\n TWO_FINGERS: 'twoFingers',\n CTRL_ZOOM : 'ctrlZoom',\n ERROR : 'error',\n};\n\n/* eslint-disable */\n// @formatter:off\n/**\n * @summary Collection of easing functions\n * @memberOf PSV.constants\n * @see {@link https://gist.github.com/frederickk/6165768}\n * @type {Object}\n * @constant\n */\nexport const EASINGS = {\n linear : (t) => t,\n\n inQuad : (t) => t*t,\n outQuad : (t) => t*(2-t),\n inOutQuad : (t) => t<.5 ? 2*t*t : -1+(4-2*t)*t,\n\n inCubic : (t) => t*t*t,\n outCubic : (t) => (--t)*t*t+1,\n inOutCubic: (t) => t<.5 ? 4*t*t*t : (t-1)*(2*t-2)*(2*t-2)+1,\n\n inQuart : (t) => t*t*t*t,\n outQuart : (t) => 1-(--t)*t*t*t,\n inOutQuart: (t) => t<.5 ? 8*t*t*t*t : 1-8*(--t)*t*t*t,\n\n inQuint : (t) => t*t*t*t*t,\n outQuint : (t) => 1+(--t)*t*t*t*t,\n inOutQuint: (t) => t<.5 ? 16*t*t*t*t*t : 1+16*(--t)*t*t*t*t,\n\n inSine : (t) => 1-Math.cos(t*(Math.PI/2)),\n outSine : (t) => Math.sin(t*(Math.PI/2)),\n inOutSine : (t) => .5-.5*Math.cos(Math.PI*t),\n\n inExpo : (t) => Math.pow(2, 10*(t-1)),\n outExpo : (t) => 1-Math.pow(2, -10*t),\n inOutExpo : (t) => (t=t*2-1)<0 ? .5*Math.pow(2, 10*t) : 1-.5*Math.pow(2, -10*t),\n\n inCirc : (t) => 1-Math.sqrt(1-t*t),\n outCirc : (t) => Math.sqrt(1-(t-1)*(t-1)),\n inOutCirc : (t) => (t*=2)<1 ? .5-.5*Math.sqrt(1-t*t) : .5+.5*Math.sqrt(1-(t-=2)*t)\n};\n// @formatter:on\n/* eslint-enable */\n\n/**\n * @summary Subset of key codes\n * @memberOf PSV.constants\n * @type {Object}\n * @constant\n */\nexport const KEY_CODES = {\n Enter : 'Enter',\n Control : 'Control',\n Escape : 'Escape',\n Space : ' ',\n PageUp : 'PageUp',\n PageDown : 'PageDown',\n ArrowLeft : 'ArrowLeft',\n ArrowUp : 'ArrowUp',\n ArrowRight: 'ArrowRight',\n ArrowDown : 'ArrowDown',\n Delete : 'Delete',\n Plus : '+',\n Minus : '-',\n};\n","/**\n * @summary Toggles a CSS class\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} element\n * @param {string} className\n * @param {boolean} [active] - forced state\n */\nexport function toggleClass(element, className, active) {\n // manual implementation for IE11 and SVGElement\n if (!element.classList) {\n let currentClassName = element.getAttribute('class') || '';\n const currentActive = currentClassName.indexOf(className) !== -1;\n const regex = new RegExp('(?:^|\\\\s)' + className + '(?:\\\\s|$)');\n\n if ((active === undefined || active) && !currentActive) {\n currentClassName += currentClassName.length > 0 ? ' ' + className : className;\n }\n else if (!active) {\n currentClassName = currentClassName.replace(regex, ' ');\n }\n\n element.setAttribute('class', currentClassName);\n }\n else if (active === undefined) {\n element.classList.toggle(className);\n }\n else if (active && !element.classList.contains(className)) {\n element.classList.add(className);\n }\n else if (!active) {\n element.classList.remove(className);\n }\n}\n\n/**\n * @summary Adds one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function addClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, true);\n });\n }\n}\n\n/**\n * @summary Removes one or several CSS classes to an element\n * @memberOf PSV.utils\n * @param {HTMLElement} element\n * @param {string} className\n */\nexport function removeClasses(element, className) {\n if (className) {\n className.split(' ').forEach((name) => {\n toggleClass(element, name, false);\n });\n }\n}\n\n/**\n * @summary Searches if an element has a particular parent at any level including itself\n * @memberOf PSV.utils\n * @param {HTMLElement} el\n * @param {HTMLElement} parent\n * @returns {boolean}\n */\nexport function hasParent(el, parent) {\n let test = el;\n\n do {\n if (test === parent) {\n return true;\n }\n test = test.parentNode;\n } while (test);\n\n return false;\n}\n\n/**\n * @summary Gets the closest parent (can by itself)\n * @memberOf PSV.utils\n * @param {HTMLElement|SVGElement} el\n * @param {string} selector\n * @returns {HTMLElement}\n */\nexport function getClosest(el, selector) {\n const matches = el.matches || el.msMatchesSelector;\n let test = el;\n // When el is document or window, the matches does not exist\n if (!matches) {\n return null;\n }\n\n do {\n if (matches.bind(test)(selector)) {\n return test;\n }\n test = test instanceof SVGElement ? test.parentNode : test.parentElement;\n } while (test);\n\n return null;\n}\n\n/**\n * @summary Map between keyboard events `keyCode|which` and `key`\n * @memberOf PSV.utils\n * @type {Object}\n * @readonly\n * @private\n */\nconst KEYMAP = {\n 13 : 'Enter',\n 17 : 'Control',\n 27 : 'Escape',\n 32 : ' ',\n 33 : 'PageUp',\n 34 : 'PageDown',\n 37 : 'ArrowLeft',\n 38 : 'ArrowUp',\n 39 : 'ArrowRight',\n 40 : 'ArrowDown',\n 46 : 'Delete',\n 107: '+',\n 109: '-',\n};\n\n/**\n * @summary Map for non standard keyboard events `key` for IE and Edge\n * @see https://github.com/shvaikalesh/shim-keyboard-event-key\n * @type {Object}\n * @readonly\n * @private\n */\nconst MS_KEYMAP = {\n Add : '+',\n Del : 'Delete',\n Down : 'ArrowDown',\n Esc : 'Escape',\n Left : 'ArrowLeft',\n Right : 'ArrowRight',\n Spacebar: ' ',\n Subtract: '-',\n Up : 'ArrowUp',\n};\n\n/**\n * @summary Returns the key name of a KeyboardEvent\n * @memberOf PSV.utils\n * @param {KeyboardEvent} evt\n * @returns {string}\n */\nexport function getEventKey(evt) {\n let key = evt.key || KEYMAP[evt.keyCode || evt.which];\n\n if (key && MS_KEYMAP[key]) {\n key = MS_KEYMAP[key];\n }\n\n return key;\n}\n\n/**\n * @summary Detects if fullscreen is enabled\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @returns {boolean}\n */\nexport function isFullscreenEnabled(elt) {\n /* eslint-disable-next-line max-len */\n return (document.fullscreenElement || document.mozFullScreenElement || document.webkitFullscreenElement || document.msFullscreenElement) === elt;\n}\n\n/**\n * @summary Enters fullscreen mode\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n */\nexport function requestFullscreen(elt) {\n /* eslint-disable-next-line max-len */\n (elt.requestFullscreen || elt.mozRequestFullScreen || elt.webkitRequestFullscreen || elt.msRequestFullscreen).call(elt);\n}\n\n/**\n * @summary Exits fullscreen mode\n * @memberOf PSV.utils\n */\nexport function exitFullscreen() {\n /* eslint-disable-next-line max-len */\n (document.exitFullscreen || document.mozCancelFullScreen || document.webkitExitFullscreen || document.msExitFullscreen).call(document);\n}\n\n/**\n * @summary Gets an element style\n * @memberOf PSV.utils\n * @param {HTMLElement} elt\n * @param {string} prop\n * @returns {*}\n */\nexport function getStyle(elt, prop) {\n return window.getComputedStyle(elt, null)[prop];\n}\n\n/**\n * @summary Normalize mousewheel values accross browsers\n * @memberOf PSV.utils\n * @description From Facebook's Fixed Data Table\n * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js}\n * @copyright Facebook\n * @param {WheelEvent} event\n * @returns {{spinX: number, spinY: number, pixelX: number, pixelY: number}}\n */\nexport function normalizeWheel(event) {\n const PIXEL_STEP = 10;\n const LINE_HEIGHT = 40;\n const PAGE_HEIGHT = 800;\n\n let spinX = 0;\n let spinY = 0;\n let pixelX = 0;\n let pixelY = 0;\n\n // Legacy\n if ('detail' in event) {\n spinY = event.detail;\n }\n if ('wheelDelta' in event) {\n spinY = -event.wheelDelta / 120;\n }\n if ('wheelDeltaY' in event) {\n spinY = -event.wheelDeltaY / 120;\n }\n if ('wheelDeltaX' in event) {\n spinX = -event.wheelDeltaX / 120;\n }\n\n // side scrolling on FF with DOMMouseScroll\n if ('axis' in event && event.axis === event.HORIZONTAL_AXIS) {\n spinX = spinY;\n spinY = 0;\n }\n\n pixelX = spinX * PIXEL_STEP;\n pixelY = spinY * PIXEL_STEP;\n\n if ('deltaY' in event) {\n pixelY = event.deltaY;\n }\n if ('deltaX' in event) {\n pixelX = event.deltaX;\n }\n\n if ((pixelX || pixelY) && event.deltaMode) {\n // delta in LINE units\n if (event.deltaMode === 1) {\n pixelX *= LINE_HEIGHT;\n pixelY *= LINE_HEIGHT;\n }\n // delta in PAGE units\n else {\n pixelX *= PAGE_HEIGHT;\n pixelY *= PAGE_HEIGHT;\n }\n }\n\n // Fall-back if spin cannot be determined\n if (pixelX && !spinX) {\n spinX = (pixelX < 1) ? -1 : 1;\n }\n if (pixelY && !spinY) {\n spinY = (pixelY < 1) ? -1 : 1;\n }\n\n return { spinX, spinY, pixelX, pixelY };\n}\n","/**\n * @summary Ensures that a number is in a given interval\n * @memberOf PSV.utils\n * @param {number} x\n * @param {number} min\n * @param {number} max\n * @returns {number}\n */\nexport function bound(x, min, max) {\n return Math.max(min, Math.min(max, x));\n}\n\n/**\n * @summary Checks if a value is an integer\n * @memberOf PSV.utils\n * @param {*} value\n * @returns {boolean}\n */\nexport function isInteger(value) {\n if (Number.isInteger) {\n return Number.isInteger(value);\n }\n return typeof value === 'number' && Number.isFinite(value) && Math.floor(value) === value;\n}\n\n\n/**\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 * @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 the intersection between two arrays\n * @memberOf PSV.utils\n * @template T\n * @param {T[]} array1\n * @param {T[]} array2\n * @returns {T[]}\n */\nexport function intersect(array1, array2) {\n return array1.filter(value => array2.indexOf(value) !== -1);\n}\n\n/**\n * @summary Returns if a valu is null or undefined\n * @memberOf PSV.utils\n * @param {*} val\n * @return {boolean}\n */\nexport function isNil(val) {\n return val === null || val === undefined;\n}\n\n/**\n * @summary Returns the first non null non undefined parameter\n * @memberOf PSV.utils\n * @param {*} values\n * @return {*}\n */\nexport function firstNonNull(...values) {\n for (const val of values) {\n if (!isNil(val)) {\n return val;\n }\n }\n\n return undefined;\n}\n","/**\n * @summary Custom error used in the lib\n * @param {string} message\n * @constructor\n * @memberOf PSV\n */\nfunction PSVError(message) {\n this.message = message;\n\n // Use V8's native method if available, otherwise fallback\n if ('captureStackTrace' in Error) {\n Error.captureStackTrace(this, PSVError);\n }\n else {\n this.stack = (new Error()).stack;\n }\n}\n\nPSVError.prototype = Object.create(Error.prototype);\nPSVError.prototype.name = 'PSVError';\nPSVError.prototype.constructor = PSVError;\n\nexport { PSVError };\n","import * as THREE from 'three';\nimport { PSVError } from '../PSVError';\nimport { bound } from './math';\n\n/**\n * @summary Returns the plugin constructor from the imported object\n * For retrocompatibility with previous default exports\n * @memberOf PSV.utils\n * @package\n */\nexport function pluginInterop(plugin, target) {\n if (plugin) {\n for (const [, p] of [['_', plugin], ...Object.entries(plugin)]) {\n if (p.prototype instanceof target) {\n return p;\n }\n }\n }\n return null;\n}\n\n/**\n * @summary 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 * @summary Parses an speed\n * @memberOf PSV.utils\n * @param {string|number} speed - The speed, in radians/degrees/revolutions per second/minute\n * @returns {number} radians per second\n * @throws {PSV.PSVError} when the speed cannot be parsed\n */\nexport function parseSpeed(speed) {\n let parsed;\n\n if (typeof speed === 'string') {\n const speedStr = speed.toString().trim();\n\n // Speed extraction\n let speedValue = parseFloat(speedStr.replace(/^(-?[0-9]+(?:\\.[0-9]*)?).*$/, '$1'));\n const speedUnit = speedStr.replace(/^-?[0-9]+(?:\\.[0-9]*)?(.*)$/, '$1').trim();\n\n // \"per minute\" -> \"per second\"\n if (speedUnit.match(/(pm|per minute)$/)) {\n speedValue /= 60;\n }\n\n // Which unit?\n switch (speedUnit) {\n // Degrees per minute / second\n case 'dpm':\n case 'degrees per minute':\n case 'dps':\n case 'degrees per second':\n parsed = THREE.Math.degToRad(speedValue);\n break;\n\n // Radians per minute / second\n case 'rdpm':\n case 'radians per minute':\n case 'rdps':\n case 'radians per second':\n parsed = speedValue;\n break;\n\n // Revolutions per minute / second\n case 'rpm':\n case 'revolutions per minute':\n case 'rps':\n case 'revolutions per second':\n parsed = speedValue * Math.PI * 2;\n break;\n\n // Unknown unit\n default:\n throw new PSVError('Unknown speed unit \"' + speedUnit + '\"');\n }\n }\n else {\n parsed = speed;\n }\n\n return parsed;\n}\n\n/**\n * @summary Parses an angle value in radians or degrees and returns a normalized value in radians\n * @memberOf PSV.utils\n * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg\n * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi\n * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi\n * @returns {number}\n * @throws {PSV.PSVError} when the angle cannot be parsed\n */\nexport function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) {\n let parsed;\n\n if (typeof angle === 'string') {\n const match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\\.[0-9]*)?)(.*)$/);\n\n if (!match) {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n const value = parseFloat(match[1]);\n const unit = match[2];\n\n if (unit) {\n switch (unit) {\n case 'deg':\n case 'degs':\n parsed = THREE.Math.degToRad(value);\n break;\n case 'rad':\n case 'rads':\n parsed = value;\n break;\n default:\n throw new PSVError('Unknown angle unit \"' + unit + '\"');\n }\n }\n else {\n parsed = value;\n }\n }\n else if (typeof angle === 'number' && !isNaN(angle)) {\n parsed = angle;\n }\n else {\n throw new PSVError('Unknown angle \"' + angle + '\"');\n }\n\n parsed = (zeroCenter ? parsed + Math.PI : parsed) % (Math.PI * 2);\n\n if (parsed < 0) {\n parsed += Math.PI * 2;\n }\n\n return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed;\n}\n\n/**\n * @summary Creates a THREE texture from an image\n * @memberOf PSV.utils\n * @param {HTMLImageElement | HTMLCanvasElement} img\n * @return {external:THREE.Texture}\n */\nexport function createTexture(img) {\n const texture = new THREE.Texture(img);\n texture.needsUpdate = true;\n texture.minFilter = THREE.LinearFilter;\n texture.generateMipmaps = false;\n return texture;\n}\n","/**\n * @namespace PSV.utils\n */\n\nexport * from './browser';\nexport * from './math';\nexport * from './misc';\nexport * from './psv';\n","import { EASINGS } from './data/constants';\nimport { each } from './utils';\n\n/**\n * @callback OnTick\n * @summary Function called for each animation frame with computed properties\n * @memberOf PSV.Animation\n * @param {Object.} properties - current values\n * @param {float} progress - 0 to 1\n */\n\n/**\n * @summary Interpolation helper for animations\n * @memberOf PSV\n * @description\n * Implements the Promise API with an additional \"cancel\" and \"finally\" methods.\n * The promise is resolved when the animation is complete and rejected if the animation is cancelled.\n * @example\n * new Animation({\n * properties: {\n * width: {start: 100, end: 200}\n * },\n * duration: 5000,\n * onTick: (properties) => element.style.width = `${properties.width}px`;\n * })\n */\nexport class Animation {\n\n /**\n * @param {Object} options\n * @param {Object.} options.properties\n * @param {number} options.properties[].start\n * @param {number} options.properties[].end\n * @param {number} options.duration\n * @param {number} [options.delay=0]\n * @param {string} [options.easing='linear']\n * @param {PSV.Animation.OnTick} options.onTick - called on each frame\n */\n constructor(options) {\n this.__cancelled = false;\n this.__resolved = false;\n\n this.__promise = new Promise((resolve, reject) => {\n this.__resolve = resolve;\n this.__reject = reject;\n });\n\n if (options) {\n if (!options.easing || typeof options.easing === 'string') {\n options.easing = EASINGS[options.easing || 'linear'];\n }\n this.__start = null;\n this.options = options;\n\n if (options.delay) {\n this.__delayTimeout = setTimeout(() => {\n this.__delayTimeout = null;\n window.requestAnimationFrame(t => this.__run(t));\n }, options.delay);\n }\n else {\n window.requestAnimationFrame(t => this.__run(t));\n }\n }\n }\n\n /**\n * @summary Main loop for the animation\n * @param {number} timestamp\n * @private\n */\n __run(timestamp) {\n // the animation has been cancelled\n if (this.__cancelled) {\n return;\n }\n\n // first iteration\n if (this.__start === null) {\n this.__start = timestamp;\n }\n\n // compute progress\n const progress = (timestamp - this.__start) / this.options.duration;\n const current = {};\n\n if (progress < 1.0) {\n // interpolate properties\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.start + (prop.end - prop.start) * this.options.easing(progress);\n }\n });\n\n this.options.onTick(current, progress);\n\n window.requestAnimationFrame(t => this.__run(t));\n }\n else {\n // call onTick one last time with final values\n each(this.options.properties, (prop, name) => {\n if (prop) {\n current[name] = prop.end;\n }\n });\n\n this.options.onTick(current, 1.0);\n\n window.requestAnimationFrame(() => {\n this.__resolved = true;\n this.__resolve();\n });\n }\n }\n\n /**\n * @summary Animation chaining\n * @param {Function} [onFulfilled] - Called when the animation is complete, can return a new animation\n * @param {Function} [onRejected] - Called when the animation is cancelled\n * @returns {PSV.Animation}\n */\n then(onFulfilled = null, onRejected = null) {\n const p = new Animation();\n\n // Allow cancellation to climb up the promise chain\n p.__promise.then(null, () => this.cancel());\n\n this.__promise.then(\n () => p.__resolve(onFulfilled ? onFulfilled() : undefined),\n () => p.__reject(onRejected ? onRejected() : undefined)\n );\n\n return p;\n }\n\n /**\n * @summary Alias to `.then(null, onRejected)`\n * @param {Function} onRejected - Called when the animation has been cancelled\n * @returns {PSV.Animation}\n */\n catch(onRejected) {\n return this.then(undefined, onRejected);\n }\n\n /**\n * @summary Alias to `.then(onFinally, onFinally)`\n * @param {Function} onFinally - Called when the animation is either complete or cancelled\n * @returns {PSV.Animation}\n */\n finally(onFinally) {\n return this.then(onFinally, onFinally);\n }\n\n /**\n * @summary Cancels the animation\n */\n cancel() {\n if (!this.__cancelled && !this.__resolved) {\n this.__cancelled = true;\n this.__reject();\n\n if (this.__delayTimeout) {\n window.cancelAnimationFrame(this.__delayTimeout);\n this.__delayTimeout = null;\n }\n }\n }\n\n /**\n * @summary Returns a resolved animation promise\n * @returns {PSV.Animation}\n */\n static resolve() {\n const p = Promise.resolve();\n p.cancel = () => {\n };\n p.finally = (onFinally) => {\n return p.then(onFinally, onFinally);\n };\n return p;\n }\n\n}\n","/**\n * @namespace PSV.components\n */\n\n/**\n * @summary Base component class\n * @memberof PSV.components\n * @abstract\n */\nexport class AbstractComponent {\n\n /**\n * @param {PSV.Viewer | PSV.components.AbstractComponent} parent\n * @param {string} className - CSS class added to the component's container\n */\n constructor(parent, className) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = parent.psv || parent;\n\n /**\n * @member {PSV.Viewer|PSV.components.AbstractComponent}\n * @readonly\n */\n this.parent = parent;\n this.parent.children.push(this);\n\n /**\n * @summary All child components\n * @type {PSV.components.AbstractComponent[]}\n * @readonly\n * @package\n */\n this.children = [];\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} visible - Visibility of the component\n */\n this.prop = {\n visible: true,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n */\n this.container = document.createElement('div');\n this.container.className = className;\n this.parent.container.appendChild(this.container);\n }\n\n /**\n * @summary Destroys the component\n * @protected\n */\n destroy() {\n this.parent.container.removeChild(this.container);\n\n const childIdx = this.parent.children.indexOf(this);\n if (childIdx !== -1) {\n this.parent.children.splice(childIdx, 1);\n }\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n delete this.container;\n delete this.parent;\n delete this.psv;\n delete this.prop;\n }\n\n /**\n * @summary Refresh UI\n * @description Must be be a very lightweight operation\n * @package\n */\n refreshUi() {\n this.children.every((child) => {\n child.refreshUi();\n return this.psv.prop.uiRefresh === true;\n });\n }\n\n /**\n * @summary Displays or hides the component\n */\n toggle() {\n if (this.isVisible()) {\n this.hide();\n }\n else {\n this.show();\n }\n }\n\n /**\n * @summary Hides the component\n */\n hide() {\n this.container.style.display = 'none';\n this.prop.visible = false;\n }\n\n /**\n * @summary Displays the component\n */\n show() {\n this.container.style.display = '';\n this.prop.visible = true;\n }\n\n /**\n * @summary Check if the component is visible\n * @returns {boolean}\n */\n isVisible() {\n return this.prop.visible;\n }\n\n}\n","import { AbstractComponent } from '../components/AbstractComponent';\nimport { KEY_CODES } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { getEventKey, isPlainObject, toggleClass } from '../utils';\n\n/**\n * @namespace PSV.buttons\n */\n\n/**\n * @summary Base navbar button class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.buttons\n * @abstract\n */\nexport class AbstractButton extends AbstractComponent {\n\n /**\n * @summary Unique identifier of the button\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary SVG icon name injected in the button\n * @member {string}\n * @readonly\n * @static\n */\n static icon = null;\n\n /**\n * @summary SVG icon name injected in the button when it is active\n * @member {string}\n * @readonly\n * @static\n */\n static iconActive = null;\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} [className] - Additional CSS classes\n * @param {boolean} [collapsable=false] - `true` if the button can be moved to menu when the navbar is too small\n * @param {boolean} [tabbable=true] - `true` if the button is accessible with Tab key\n */\n constructor(navbar, className = '', collapsable = false, tabbable = true) {\n super(navbar, 'psv-button ' + className);\n\n /**\n * @override\n * @property {string} id - Unique identifier of the button\n * @property {boolean} enabled\n * @property {boolean} supported\n * @property {boolean} collapsed\n * @property {boolean} active\n * @property {number} width\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable: collapsable,\n enabled : true,\n supported : true,\n collapsed : false,\n active : false,\n width : this.container.offsetWidth,\n };\n\n if (this.constructor.icon) {\n this.__setIcon(this.constructor.icon);\n }\n\n if (this.prop.id && this.psv.config.lang[this.prop.id]) {\n this.container.title = this.psv.config.lang[this.prop.id];\n }\n\n if (tabbable) {\n this.container.tabIndex = 0;\n }\n\n this.container.addEventListener('click', (e) => {\n if (this.prop.enabled) {\n this.onClick();\n }\n e.stopPropagation();\n });\n\n this.container.addEventListener('keydown', (e) => {\n if (getEventKey(e) === KEY_CODES.Enter && this.prop.enabled) {\n this.onClick();\n e.stopPropagation();\n }\n });\n }\n\n /**\n * @package\n */\n checkSupported() {\n const supportedOrObject = this.isSupported();\n if (isPlainObject(supportedOrObject)) {\n if (supportedOrObject.initial === false) {\n this.hide();\n this.prop.supported = false;\n }\n\n supportedOrObject.promise.then((supported) => {\n if (!this.prop) {\n return; // the component has been destroyed\n }\n this.prop.supported = supported;\n if (!supported && this.prop.visible) {\n this.hide();\n }\n else if (supported && !this.prop.visible) {\n this.show();\n }\n });\n }\n else if (!supportedOrObject) {\n this.hide();\n this.prop.supported = false;\n }\n }\n\n /**\n * @summary Checks if the button can be displayed\n * @returns {boolean|{initial: boolean, promise: Promise}}\n */\n isSupported() {\n return true;\n }\n\n /**\n * @summary Changes the active state of the button\n * @param {boolean} [active] - forced state\n */\n toggleActive(active) {\n this.prop.active = active !== undefined ? active : !this.prop.active;\n toggleClass(this.container, 'psv-button--active', this.prop.active);\n\n if (this.constructor.iconActive) {\n this.__setIcon(this.prop.active ? this.constructor.iconActive : this.constructor.icon);\n }\n }\n\n /**\n * @override\n */\n show(refresh = true) {\n if (!this.isVisible()) {\n this.prop.visible = true;\n if (!this.prop.collapsed) {\n this.container.style.display = '';\n }\n if (refresh) {\n this.psv.refreshUi(`show button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @override\n */\n hide(refresh = true) {\n if (this.isVisible()) {\n this.prop.visible = false;\n this.container.style.display = 'none';\n if (refresh) {\n this.psv.refreshUi(`hide button ${this.prop.id}`);\n }\n }\n }\n\n /**\n * @summary Disables the button\n */\n disable() {\n this.container.classList.add('psv-button--disabled');\n this.prop.enabled = false;\n }\n\n /**\n * @summary Enables the button\n */\n enable() {\n this.container.classList.remove('psv-button--disabled');\n this.prop.enabled = true;\n }\n\n /**\n * @summary Collapses the button in the navbar menu\n */\n collapse() {\n this.prop.collapsed = true;\n this.container.style.display = 'none';\n }\n\n /**\n * @summary Uncollapses the button from the navbar menu\n */\n uncollapse() {\n this.prop.collapsed = false;\n if (this.prop.visible) {\n this.container.style.display = '';\n }\n }\n\n /**\n * @summary Set the button icon\n * @param {string} icon SVG\n * @param {HTMLElement} [container] - default is the main button container\n * @private\n */\n __setIcon(icon, container = this.container) {\n if (icon) {\n container.innerHTML = icon;\n // classList not supported on IE11, className is read-only !!!!\n container.querySelector('svg').setAttribute('class', 'psv-button-svg');\n }\n else {\n container.innerHTML = '';\n }\n }\n\n /**\n * @summary Action when the button is clicked\n * @private\n * @abstract\n */\n onClick() {\n throw new PSVError(`onClick not implemented for button \"${this.prop.id}\".`);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport playActive from '../icons/play-active.svg';\nimport play from '../icons/play.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar autorotate button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AutorotateButton extends AbstractButton {\n\n static id = 'autorotate';\n static icon = play;\n static iconActive = playActive;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-autorotate-button', true);\n\n this.psv.on(EVENTS.AUTOROTATE, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.AUTOROTATE, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.AUTOROTATE: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles autorotate\n */\n onClick() {\n this.psv.toggleAutorotate();\n }\n\n}\n","import { addClasses } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar custom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CustomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {PSV.NavbarCustomButton} config\n */\n constructor(navbar, config) {\n super(navbar, 'psv-custom-button', config.collapsable !== false);\n\n /**\n * @member {Object}\n * @readonly\n * @private\n */\n this.config = config;\n\n if (this.config.id) {\n this.prop.id = this.config.id;\n }\n else {\n this.prop.id = 'psvButton-' + Math.random().toString(36).substr(2, 9);\n }\n\n if (this.config.className) {\n addClasses(this.container, this.config.className);\n }\n\n if (this.config.title) {\n this.container.title = this.config.title;\n }\n\n if (this.config.content) {\n this.container.innerHTML = this.config.content;\n }\n\n this.prop.width = this.container.offsetWidth;\n\n if (this.config.enabled === false) {\n this.disable();\n }\n\n if (this.config.visible === false) {\n this.hide();\n }\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.config;\n\n super.destroy();\n }\n\n /**\n * @override\n * @description Calls user method\n */\n onClick() {\n if (this.config.onClick) {\n this.config.onClick.apply(this.psv);\n }\n }\n\n}\n","import { AbstractButton } from './AbstractButton';\nimport download from '../icons/download.svg';\n\n/**\n * @summary Navigation bar download button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class DownloadButton extends AbstractButton {\n\n static id = 'download';\n static icon = download;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-download-button', true);\n }\n\n /**\n * @override\n * @description Asks the browser to download the panorama source file\n */\n onClick() {\n const link = document.createElement('a');\n link.href = this.psv.config.panorama;\n link.download = this.psv.config.panorama;\n this.psv.container.appendChild(link);\n link.click();\n\n setTimeout(() => {\n this.psv.container.removeChild(link);\n }, 100);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport fullscreenIn from '../icons/fullscreen-in.svg';\nimport fullscreenOut from '../icons/fullscreen-out.svg';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar fullscreen button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class FullscreenButton extends AbstractButton {\n\n static id = 'fullscreen';\n static icon = fullscreenIn;\n static iconActive = fullscreenOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-fullscreen-button');\n\n this.psv.on(EVENTS.FULLSCREEN_UPDATED, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.FULLSCREEN_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * Handle events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.FULLSCREEN_UPDATED: this.toggleActive(e.args[0]); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles fullscreen\n */\n onClick() {\n this.psv.toggleFullscreen();\n }\n\n}\n","import { EVENTS, IDS } from '../data/constants';\nimport menuIcon from '../icons/menu.svg';\nimport { dasherize, getClosest } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar menu button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class MenuButton extends AbstractButton {\n\n static id = 'menu';\n static icon = menuIcon;\n\n /**\n * @summary Property name added to buttons list\n * @type {string}\n * @constant\n */\n static BUTTON_DATA = 'psvButton';\n\n /**\n * @summary Menu template\n * @param {AbstractButton[]} buttons\n * @param {PSV.Viewer} psv\n * @param {string} dataKey\n * @returns {string}\n */\n static MENU_TEMPLATE = (buttons, psv, dataKey) => `\n
\n

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

\n
    \n ${buttons.map(button => `\n
  • \n ${button.container.innerHTML}\n ${button.container.title}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-menu-button');\n\n this.psv.on(EVENTS.OPEN_PANEL, this);\n this.psv.on(EVENTS.CLOSE_PANEL, this);\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.OPEN_PANEL, this);\n this.psv.off(EVENTS.CLOSE_PANEL, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === IDS.MENU); break;\n case EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n hide(refresh) {\n super.hide(refresh);\n this.__hideMenu();\n }\n\n /**\n * @override\n */\n show(refresh) {\n super.show(refresh);\n\n if (this.prop.active) {\n this.__showMenu();\n }\n }\n\n /**\n * @override\n * @description Toggles menu\n */\n onClick() {\n if (this.prop.active) {\n this.__hideMenu();\n }\n else {\n this.__showMenu();\n }\n }\n\n __showMenu() {\n this.psv.panel.show({\n id : IDS.MENU,\n content : MenuButton.MENU_TEMPLATE(this.parent.collapsed, this.psv, dasherize(MenuButton.BUTTON_DATA)),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? getClosest(e.target, 'li') : undefined;\n const buttonId = li ? li.dataset[MenuButton.BUTTON_DATA] : undefined;\n\n if (buttonId) {\n this.parent.getButton(buttonId).onClick();\n this.__hideMenu();\n }\n },\n });\n }\n\n __hideMenu() {\n if (this.psv.panel) {\n this.psv.panel.hide(IDS.MENU);\n }\n }\n\n}\n","import { PSVError } from '../PSVError';\n\n/**\n * @summary General information about the system\n * @constant\n * @memberOf PSV\n * @property {boolean} loaded - Indicates if the system has been loaded yet\n * @property {Function} load - Loads the system if not already loaded\n * @property {number} pixelRatio\n * @property {boolean} isWebGLSupported\n * @property {number} maxCanvasWidth\n * @property {string} mouseWheelEvent\n * @property {string} fullscreenEvent\n * @property {Function} getMaxCanvasWidth - Returns the max width of a canvas allowed by the browser\n * @property {Promise} isTouchEnabled\n */\nexport const SYSTEM = {\n loaded : false,\n pixelRatio : 1,\n isWebGLSupported: false,\n isTouchEnabled : null,\n maxTextureWidth : 0,\n mouseWheelEvent : null,\n fullscreenEvent : null,\n};\n\n/**\n * @summary Loads the system if not already loaded\n */\nSYSTEM.load = () => {\n if (!SYSTEM.loaded) {\n const ctx = getWebGLCtx();\n\n SYSTEM.loaded = true;\n SYSTEM.pixelRatio = window.devicePixelRatio || 1;\n SYSTEM.isWebGLSupported = ctx != null;\n SYSTEM.isTouchEnabled = isTouchEnabled();\n SYSTEM.maxTextureWidth = getMaxTextureWidth(ctx);\n SYSTEM.mouseWheelEvent = getMouseWheelEvent();\n SYSTEM.fullscreenEvent = getFullscreenEvent();\n }\n};\n\nlet maxCanvasWidth = null;\nSYSTEM.getMaxCanvasWidth = () => {\n if (maxCanvasWidth === null) {\n maxCanvasWidth = getMaxCanvasWidth(SYSTEM.maxTextureWidth);\n }\n return maxCanvasWidth;\n};\n\n/**\n * @summary Tries to return a canvas webgl context\n * @returns {WebGLRenderingContext}\n * @private\n */\nfunction getWebGLCtx() {\n const canvas = document.createElement('canvas');\n const names = ['webgl', 'experimental-webgl', 'moz-webgl', 'webkit-3d'];\n let context = null;\n\n if (!canvas.getContext) {\n return null;\n }\n\n if (names.some((name) => {\n try {\n context = canvas.getContext(name);\n return context !== null;\n }\n catch (e) {\n return false;\n }\n })) {\n return context;\n }\n else {\n return null;\n }\n}\n\n/**\n * @summary Detects if the user is using a touch screen\n * @returns {Promise}\n * @private\n */\nfunction isTouchEnabled() {\n return new Promise((resolve) => {\n const listener = (e) => {\n if (e) {\n resolve(true);\n }\n else {\n resolve(false);\n }\n\n window.removeEventListener('touchstart', listener);\n };\n\n window.addEventListener('touchstart', listener, false);\n\n // after 10 secs auto-reject the promise\n setTimeout(listener, 10000);\n });\n}\n\n/**\n * @summary Gets max texture width in WebGL context\n * @returns {number}\n * @private\n */\nfunction getMaxTextureWidth(ctx) {\n if (ctx !== null) {\n return ctx.getParameter(ctx.MAX_TEXTURE_SIZE);\n }\n else {\n return 0;\n }\n}\n\n/**\n * @summary Gets max canvas width supported by the browser.\n * We only test powers of 2 and height = width / 2 because that's what we need to generate WebGL textures\n * @param maxWidth\n * @return {number}\n * @private\n */\nfunction getMaxCanvasWidth(maxWidth) {\n const canvas = document.createElement('canvas');\n const ctx = canvas.getContext('2d');\n canvas.width = maxWidth;\n canvas.height = maxWidth / 2;\n\n while (canvas.width > 1024) {\n ctx.fillStyle = 'white';\n ctx.fillRect(0, 0, 1, 1);\n\n try {\n if (ctx.getImageData(0, 0, 1, 1).data[0] === 255) {\n return canvas.width;\n }\n }\n catch (e) {\n // continue\n }\n\n canvas.width /= 2;\n canvas.height /= 2;\n }\n\n throw new PSVError('Unable to detect system capabilities');\n}\n\n/**\n * @summary Gets the event name for mouse wheel\n * @returns {string}\n * @private\n */\nfunction getMouseWheelEvent() {\n if ('onwheel' in document.createElement('div')) { // Modern browsers support \"wheel\"\n return 'wheel';\n }\n else if (document.onmousewheel !== undefined) { // Webkit and IE support at least \"mousewheel\"\n return 'mousewheel';\n }\n else { // let's assume that remaining browsers are older Firefox\n return 'DOMMouseScroll';\n }\n}\n\n/**\n * @summary Map between fullsceen method and fullscreen event name\n * @type {Object}\n * @readonly\n * @private\n */\nconst FULLSCREEN_EVT_MAP = {\n exitFullscreen : 'fullscreenchange',\n webkitExitFullscreen: 'webkitfullscreenchange',\n mozCancelFullScreen : 'mozfullscreenchange',\n msExitFullscreen : 'MSFullscreenChange',\n};\n\n\n/**\n * @summary Gets the event name for fullscreen\n * @returns {string}\n * @private\n */\nfunction getFullscreenEvent() {\n const validExits = Object.keys(FULLSCREEN_EVT_MAP).filter(exit => exit in document);\n\n if (validExits.length) {\n return FULLSCREEN_EVT_MAP[validExits[0]];\n }\n else {\n return null;\n }\n}\n","/**\n * @summary Helper for pressable things (buttons, keyboard)\n * @description When the pressed thing goes up and was not pressed long enough, wait a bit more before execution\n * @package\n * @package\n */\nexport class PressHandler {\n\n constructor(delay = 200) {\n this.delay = delay;\n this.time = 0;\n this.timeout = null;\n }\n\n down() {\n if (this.timeout) {\n clearTimeout(this.timeout);\n this.timeout = null;\n }\n\n this.time = new Date().getTime();\n }\n\n up(cb) {\n if (!this.time) {\n return;\n }\n\n const elapsed = new Date().getTime() - this.time;\n if (elapsed < this.delay) {\n this.timeout = setTimeout(() => {\n cb();\n this.timeout = null;\n this.time = 0;\n }, this.delay);\n }\n else {\n cb();\n this.time = 0;\n }\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport arrow from '../icons/arrow.svg';\nimport { getEventKey } from '../utils';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\nexport function getOrientedArrow(direction) {\n let angle = 0;\n switch (direction) {\n // @formatter:off\n case 'up': angle = 90; break;\n case 'right': angle = 180; break;\n case 'down': angle = -90; break;\n default: angle = 0; break;\n // @formatter:on\n }\n\n return arrow.replace('rotate(0', `rotate(${angle}`);\n}\n\n/**\n * @summary Navigation bar move button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractMoveButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-move-button');\n\n this.container.title = this.psv.config.lang.move;\n\n /**\n * @override\n * @property {{longitude: boolean, latitude: boolean}} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.__stopAll();\n this.psv.dynamics.position.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => this.psv.dynamics.position.stop());\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move down button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveDownButton extends AbstractMoveButton {\n\n static id = 'moveDown';\n static icon = getOrientedArrow('down');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move left button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveLeftButton extends AbstractMoveButton {\n\n static id = 'moveLeft';\n static icon = getOrientedArrow('left');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: true });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move right button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveRightButton extends AbstractMoveButton {\n\n static id = 'moveRight';\n static icon = getOrientedArrow('right');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { longitude: false });\n }\n\n}\n","import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton';\n\n/**\n * @summary Navigation bar move up button class\n * @extends PSV.buttons.AbstractMoveButton\n * @memberof PSV.buttons\n */\nexport class MoveUpButton extends AbstractMoveButton {\n\n static id = 'moveUp';\n static icon = getOrientedArrow('up');\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, { latitude: false });\n }\n\n}\n","import { KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { getEventKey } from '../utils';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class AbstractZoomButton extends AbstractButton {\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {number} value\n */\n constructor(navbar, value) {\n super(navbar, 'psv-button--hover-scale psv-zoom-button');\n\n /**\n * @override\n * @property {boolean} value\n * @property {PressHandler} handler\n */\n this.prop = {\n ...this.prop,\n value : value,\n handler: new PressHandler(),\n };\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('keydown', this);\n this.container.addEventListener('keyup', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.__onMouseUp();\n\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(); break;\n case 'mouseup': this.__onMouseUp(); break;\n case 'touchend': this.__onMouseUp(); break;\n case 'keydown': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break;\n case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @private\n */\n __onMouseDown() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.psv.dynamics.zoom.roll(this.prop.value);\n this.prop.handler.down();\n }\n\n /**\n * @private\n */\n __onMouseUp() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.handler.up(() => this.psv.dynamics.zoom.stop());\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomIn from '../icons/zoom-in.svg';\n\n/**\n * @summary Navigation bar zoom-in button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomInButton extends AbstractZoomButton {\n\n static id = 'zoomIn';\n static icon = zoomIn;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, false);\n }\n\n}\n","import { AbstractZoomButton } from './AbstractZoomButton';\nimport zoomOut from '../icons/zoom-out.svg';\n\n/**\n * @summary Navigation bar zoom-out button class\n * @extends PSV.buttons.AbstractZoomButton\n * @memberof PSV.buttons\n */\nexport class ZoomOutButton extends AbstractZoomButton {\n\n static id = 'zoomOut';\n static icon = zoomOut;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, true);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { getStyle } from '../utils';\nimport { AbstractButton } from './AbstractButton';\n\n/**\n * @summary Navigation bar zoom button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class ZoomRangeButton extends AbstractButton {\n\n static id = 'zoomRange';\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-zoom-range', false, false);\n\n /**\n * @override\n * @property {boolean} mousedown\n * @property {number} mediaMinWidth\n */\n this.prop = {\n ...this.prop,\n mousedown : false,\n mediaMinWidth: 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomRange = document.createElement('div');\n this.zoomRange.className = 'psv-zoom-range-line';\n this.container.appendChild(this.zoomRange);\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.zoomValue = document.createElement('div');\n this.zoomValue.className = 'psv-zoom-range-handle';\n this.zoomRange.appendChild(this.zoomValue);\n\n this.prop.mediaMinWidth = parseInt(getStyle(this.container, 'maxWidth'), 10);\n\n this.container.addEventListener('mousedown', this);\n this.container.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n\n this.psv.on(EVENTS.ZOOM_UPDATED, this);\n\n if (this.psv.prop.ready) {\n this.__moveZoomValue(this.psv.getZoomLevel());\n }\n else {\n this.psv.once(EVENTS.READY, this);\n }\n\n this.refreshUi();\n }\n\n /**\n * @override\n */\n destroy() {\n this.__stopZoomChange();\n\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n delete this.zoomRange;\n delete this.zoomValue;\n\n this.psv.off(EVENTS.ZOOM_UPDATED, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__initZoomChangeWithMouse(e); break;\n case 'touchstart': this.__initZoomChangeByTouch(e); break;\n case 'mousemove': this.__changeZoomWithMouse(e); break;\n case 'touchmove': this.__changeZoomByTouch(e); break;\n case 'mouseup': this.__stopZoomChange(e); break;\n case 'touchend': this.__stopZoomChange(e); break;\n case EVENTS.ZOOM_UPDATED: this.__moveZoomValue(e.args[0]); break;\n case EVENTS.READY: this.__moveZoomValue(this.psv.getZoomLevel()); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n isSupported() {\n return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) };\n }\n\n /**\n * @override\n */\n refreshUi() {\n if (this.prop.supported) {\n if (this.psv.prop.size.width <= this.prop.mediaMinWidth && this.prop.visible) {\n this.hide();\n }\n else if (this.psv.prop.size.width > this.prop.mediaMinWidth && !this.prop.visible) {\n this.show();\n }\n }\n }\n\n /**\n * @override\n */\n onClick() {\n // nothing\n }\n\n /**\n * @summary Moves the zoom cursor\n * @param {number} level\n * @private\n */\n __moveZoomValue(level) {\n this.zoomValue.style.left = (level / 100 * this.zoomRange.offsetWidth - this.zoomValue.offsetWidth / 2) + 'px';\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __initZoomChangeWithMouse(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __initZoomChangeByTouch(evt) {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = true;\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Handles mouse up events\n * @private\n */\n __stopZoomChange() {\n if (!this.prop.enabled) {\n return;\n }\n\n this.prop.mousedown = false;\n this.prop.buttondown = false;\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __changeZoomWithMouse(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n\n evt.preventDefault();\n this.__changeZoom(evt.clientX);\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __changeZoomByTouch(evt) {\n if (!this.prop.enabled || !this.prop.mousedown) {\n return;\n }\n this.__changeZoom(evt.changedTouches[0].clientX);\n }\n\n /**\n * @summary Zoom change\n * @param {number} x - mouse/touch position\n * @private\n */\n __changeZoom(x) {\n const userInput = x - this.zoomRange.getBoundingClientRect().left;\n const zoomLevel = userInput / this.zoomRange.offsetWidth * 100;\n this.psv.zoom(zoomLevel);\n }\n\n}\n","import { PSVError } from '../PSVError';\n\n/**\n * @namespace PSV.adapters\n */\n\n/**\n * @summary Base adapters class\n * @memberof PSV.adapters\n * @abstract\n */\nexport class AbstractAdapter {\n\n /**\n * @summary Unique identifier of the adapter\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @summary Indicates if the adapter supports transitions between panoramas\n * @member {boolean}\n * @readonly\n * @static\n */\n static supportsTransition = false;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Destroys the adapter\n */\n destroy() {\n delete this.psv;\n }\n\n /**\n * @abstract\n * @summary Loads the panorama texture(s)\n * @param {*} panorama\n * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData]\n * @returns {Promise.}\n */\n loadTexture(panorama, newPanoData) { // eslint-disable-line no-unused-vars\n throw new PSVError('loadTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Creates the cube mesh\n * @param {number} [scale=1]\n * @returns {external:THREE.Mesh}\n */\n createMesh(scale = 1) { // eslint-disable-line no-unused-vars\n throw new PSVError('createMesh not implemented');\n }\n\n /**\n * @abstract\n * @summary Applies the texture to the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {PSV.TextureData} textureData\n */\n setTexture(mesh, textureData) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTexture not implemented');\n }\n\n /**\n * @abstract\n * @summary Changes the opacity of the mesh\n * @param {external:THREE.Mesh} mesh\n * @param {number} opacity\n */\n setTextureOpacity(mesh, opacity) { // eslint-disable-line no-unused-vars\n throw new PSVError('setTextureOpacity not implemented');\n }\n\n}\n","import * as THREE from 'three';\nimport { SPHERE_RADIUS } from '../../data/constants';\nimport { SYSTEM } from '../../data/system';\nimport { PSVError } from '../../PSVError';\nimport { createTexture, firstNonNull, getXMPValue, logWarn } from '../../utils';\nimport { AbstractAdapter } from '../AbstractAdapter';\n\nconst SPHERE_SEGMENTS = 64;\n\n/**\n * @summary Adapter for equirectangular panoramas\n * @memberof PSV.adapters\n */\nexport class EquirectangularAdapter extends AbstractAdapter {\n\n static id = 'equirectangular';\n static supportsTransition = true;\n\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),\n posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch),\n poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll),\n };\n\n if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) {\n logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image.\n panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`);\n }\n if (panoData.fullWidth !== panoData.fullHeight * 2) {\n logWarn('Invalid panoData, fullWidth should be twice fullHeight');\n }\n\n const texture = this.__createEquirectangularTexture(img, panoData);\n\n return { texture, panoData };\n });\n }\n\n /**\n * @summary Loads the XMP data of an image\n * @param {string} panorama\n * @param {function(number)} [onProgress]\n * @returns {Promise}\n * @throws {PSV.PSVError} when the image cannot be loaded\n * @private\n */\n __loadXMP(panorama, onProgress) {\n return this.psv.textureLoader.loadFile(panorama, onProgress)\n .then(blob => this.__loadBlobAsString(blob))\n .then((binary) => {\n const a = binary.indexOf('');\n const data = binary.substring(a, b);\n\n if (a !== -1 && b !== -1 && data.indexOf('GPano:') !== -1) {\n return {\n fullWidth : getXMPValue(data, 'FullPanoWidthPixels'),\n fullHeight : getXMPValue(data, 'FullPanoHeightPixels'),\n croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'),\n croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'),\n croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'),\n croppedY : getXMPValue(data, 'CroppedAreaTopPixels'),\n poseHeading : getXMPValue(data, 'PoseHeadingDegrees'),\n posePitch : getXMPValue(data, 'PosePitchDegrees'),\n poseRoll : getXMPValue(data, 'PoseRollDegrees'),\n };\n }\n\n return null;\n });\n }\n\n /**\n * @summmary read a Blob as string\n * @param {Blob} blob\n * @returns {Promise}\n * @private\n */\n __loadBlobAsString(blob) {\n return new Promise((resolve, reject) => {\n const reader = new FileReader();\n reader.onload = () => resolve(reader.result);\n reader.onerror = reject;\n reader.readAsText(blob);\n });\n }\n\n /**\n * @summary Creates the final texture from image and panorama data\n * @param {Image} img\n * @param {PSV.PanoData} panoData\n * @returns {external:THREE.Texture}\n * @private\n */\n __createEquirectangularTexture(img, panoData) {\n let finalImage;\n\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 resizedPanoData = { ...panoData };\n\n const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth;\n\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 finalImage = buffer;\n }\n else {\n finalImage = img;\n }\n\n return createTexture(finalImage);\n }\n\n /**\n * @override\n */\n createMesh(scale = 1) {\n // The middle of the panorama is placed at longitude=0\n const geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, SPHERE_SEGMENTS, SPHERE_SEGMENTS / 2, -Math.PI / 2);\n\n const material = new THREE.MeshBasicMaterial({\n side: THREE.BackSide,\n });\n\n const mesh = new THREE.Mesh(geometry, material);\n mesh.scale.set(-1, 1, 1);\n\n return mesh;\n }\n\n /**\n * @override\n */\n setTexture(mesh, textureData) {\n const { texture } = textureData;\n\n if (mesh.material.map) {\n mesh.material.map.dispose();\n }\n\n mesh.material.map = texture;\n }\n\n /**\n * @override\n */\n setTextureOpacity(mesh, opacity) {\n mesh.material.opacity = opacity;\n mesh.material.transparent = opacity < 1;\n }\n\n}\n","import { EventEmitter } from 'uevent';\n\n/**\n * @namespace PSV.plugins\n */\n\n/**\n * @summary Base plugins class\n * @memberof PSV.plugins\n * @abstract\n */\nexport class AbstractPlugin extends EventEmitter {\n\n /**\n * @summary Unique identifier of the plugin\n * @member {string}\n * @readonly\n * @static\n */\n static id = null;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super();\n\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n }\n\n /**\n * @summary Destroys the plugin\n * @package\n */\n destroy() {\n delete this.psv;\n }\n\n}\n","import { AbstractAdapter } from '../adapters/AbstractAdapter';\nimport { EquirectangularAdapter } from '../adapters/equirectangular';\nimport { AbstractPlugin } from '../plugins/AbstractPlugin';\nimport { PSVError } from '../PSVError';\nimport { bound, clone, deepmerge, each, logWarn, parseAngle, parseSpeed, pluginInterop } from '../utils';\nimport { ACTIONS, KEY_CODES } from './constants';\n\n/**\n * @summary Default options\n * @type {PSV.Options}\n * @memberOf PSV\n * @constant\n */\nexport const DEFAULTS = {\n panorama : null,\n container : null,\n adapter : null,\n caption : null,\n loadingImg : null,\n loadingTxt : 'Loading...',\n size : null,\n fisheye : false,\n minFov : 30,\n maxFov : 90,\n defaultZoomLvl : 50,\n defaultLong : 0,\n defaultLat : 0,\n sphereCorrection : null,\n moveSpeed : 1,\n zoomSpeed : 1,\n autorotateDelay : null,\n autorotateSpeed : '2rpm',\n autorotateLat : null,\n moveInertia : true,\n mousewheel : true,\n mousemove : true,\n captureCursor : false,\n mousewheelCtrlKey : false,\n touchmoveTwoFingers: false,\n useXmpData : true,\n panoData : null,\n requestHeaders : null,\n canvasBackground : '#000',\n withCredentials : false,\n navbar : [\n 'autorotate',\n 'zoom',\n 'move',\n 'download',\n 'caption',\n 'fullscreen',\n ],\n lang : {\n autorotate: 'Automatic rotation',\n zoom : 'Zoom',\n zoomOut : 'Zoom out',\n zoomIn : 'Zoom in',\n move : 'Move',\n download : 'Download',\n fullscreen: 'Fullscreen',\n menu : 'Menu',\n twoFingers: 'Use two fingers to navigate',\n ctrlZoom : 'Use ctrl + scroll to zoom the image',\n loadError : 'The panorama can\\'t be loaded',\n },\n keyboard : {\n [KEY_CODES.ArrowUp] : ACTIONS.ROTATE_LAT_UP,\n [KEY_CODES.ArrowDown] : ACTIONS.ROTATE_LAT_DOWN,\n [KEY_CODES.ArrowRight]: ACTIONS.ROTATE_LONG_RIGHT,\n [KEY_CODES.ArrowLeft] : ACTIONS.ROTATE_LONG_LEFT,\n [KEY_CODES.PageUp] : ACTIONS.ZOOM_IN,\n [KEY_CODES.PageDown] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Plus] : ACTIONS.ZOOM_IN,\n [KEY_CODES.Minus] : ACTIONS.ZOOM_OUT,\n [KEY_CODES.Space] : ACTIONS.TOGGLE_AUTOROTATE,\n },\n plugins : [],\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 return [EquirectangularAdapter];\n }\n else if (Array.isArray(adapter)) {\n return [pluginInterop(adapter[0], AbstractAdapter), adapter[1]];\n }\n else {\n return [pluginInterop(adapter, AbstractAdapter)];\n }\n },\n defaultLong : (defaultLong) => {\n // defaultLat is between 0 and PI\n return parseAngle(defaultLong);\n },\n defaultLat : (defaultLat) => {\n // defaultLat is between -PI/2 and PI/2\n return parseAngle(defaultLat, true);\n },\n minFov : (minFov, config) => {\n // minFov and maxFov must be ordered\n if (config.maxFov < minFov) {\n logWarn('maxFov cannot be lower than minFov');\n minFov = config.maxFov;\n }\n // minFov between 1 and 179\n return bound(minFov, 1, 179);\n },\n maxFov : (maxFov, config) => {\n // minFov and maxFov must be ordered\n if (maxFov < config.minFov) {\n maxFov = config.minFov;\n }\n // maxFov between 1 and 179\n return bound(maxFov, 1, 179);\n },\n lang : (lang) => {\n if (Array.isArray(lang.twoFingers)) {\n logWarn('lang.twoFingers must not be an array');\n lang.twoFingers = lang.twoFingers[0];\n }\n return {\n ...DEFAULTS.lang,\n ...lang,\n };\n },\n keyboard : (keyboard) => {\n // keyboard=true becomes the default map\n if (keyboard === true) {\n return clone(DEFAULTS.keyboard);\n }\n return keyboard;\n },\n autorotateLat : (autorotateLat, config) => {\n // default autorotateLat is defaultLat\n if (autorotateLat === null) {\n return parseAngle(config.defaultLat, true);\n }\n // autorotateLat is between -PI/2 and PI/2\n else {\n return parseAngle(autorotateLat, true);\n }\n },\n autorotateSpeed: (autorotateSpeed) => {\n return parseSpeed(autorotateSpeed);\n },\n fisheye : (fisheye) => {\n // translate boolean fisheye to amount\n if (fisheye === true) {\n return 1;\n }\n else if (fisheye === false) {\n return 0;\n }\n return fisheye;\n },\n plugins : (plugins) => {\n return plugins\n .map((plugin) => {\n if (Array.isArray(plugin)) {\n return [pluginInterop(plugin[0], AbstractPlugin), plugin[1]];\n }\n else {\n return [pluginInterop(plugin, AbstractPlugin)];\n }\n })\n .filter(plugin => !!plugin[0]);\n },\n};\n\n/**\n * @summary Merge user config with default config and performs validation\n * @param {PSV.Options} options\n * @returns {PSV.Options}\n * @memberOf PSV\n * @private\n */\nexport function getConfig(options) {\n const tempConfig = clone(DEFAULTS);\n deepmerge(tempConfig, options);\n\n const config = {};\n\n each(tempConfig, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (CONFIG_PARSERS[key]) {\n config[key] = CONFIG_PARSERS[key](value, tempConfig);\n }\n else {\n config[key] = value;\n }\n });\n\n return config;\n}\n","import { AbstractButton } from './AbstractButton';\nimport { EVENTS } from '../data/constants';\nimport info from '../icons/info.svg';\n\n/**\n * @summary Navigation bar caption button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class CaptionButton extends AbstractButton {\n\n static id = 'caption';\n static icon = info;\n\n /**\n * @param {PSV.components.NavbarCaption} caption\n */\n constructor(caption) {\n super(caption, 'psv-button--hover-scale psv-caption-button');\n\n this.psv.on(EVENTS.HIDE_NOTIFICATION, this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(EVENTS.HIDE_NOTIFICATION, this);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case EVENTS.HIDE_NOTIFICATION: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles caption\n */\n onClick() {\n if (this.psv.notification.prop.visible) {\n this.psv.notification.hide();\n }\n else {\n this.psv.notification.show(this.parent.prop.caption);\n this.toggleActive(true);\n }\n }\n\n}\n","import { CaptionButton } from '../buttons/CaptionButton';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Navbar caption class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class NavbarCaption extends AbstractComponent {\n\n static id = 'caption';\n\n /**\n * @param {PSV.components.Navbar} navbar\n * @param {string} caption\n */\n constructor(navbar, caption) {\n super(navbar, 'psv-caption');\n\n /**\n * @member {PSV.buttons.CaptionButton}\n * @readonly\n * @private\n */\n this.button = new CaptionButton(this);\n this.button.hide();\n\n /**\n * @override\n * @property {string} id\n * @property {boolean} collapsable\n * @property {number} width\n * @property {string} caption\n * @property {boolean} contentVisible - if the content is visible in the navbar\n * @property {number} contentWidth - with of the caption content\n */\n this.prop = {\n ...this.prop,\n id : this.constructor.id,\n collapsable : false,\n width : this.button.prop.width,\n caption : '',\n contentVisible: true,\n contentWidth : 0,\n };\n\n /**\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-caption-content';\n this.container.appendChild(this.content);\n\n this.setCaption(caption);\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.button;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n this.prop.caption = html || '';\n this.content.innerHTML = this.prop.caption;\n\n if (html) {\n this.show(false);\n\n this.content.style.display = '';\n this.prop.contentWidth = this.content.offsetWidth;\n\n this.refreshUi();\n }\n else {\n this.hide();\n }\n }\n\n /**\n * @summary Toggles content and icon depending on available space\n * @private\n */\n refreshUi() {\n const availableWidth = this.container.offsetWidth;\n if (availableWidth >= this.prop.contentWidth && !this.prop.contentVisible) {\n this.content.style.display = '';\n this.prop.contentVisible = true;\n this.button.hide(false);\n }\n else if (availableWidth < this.prop.contentWidth && this.prop.contentVisible) {\n this.content.style.display = 'none';\n this.prop.contentVisible = false;\n this.button.show(false);\n }\n }\n\n}\n","import { AutorotateButton } from '../buttons/AutorotateButton';\nimport { CustomButton } from '../buttons/CustomButton';\nimport { DownloadButton } from '../buttons/DownloadButton';\nimport { FullscreenButton } from '../buttons/FullscreenButton';\nimport { MenuButton } from '../buttons/MenuButton';\nimport { MoveDownButton } from '../buttons/MoveDownButton';\nimport { MoveLeftButton } from '../buttons/MoveLeftButton';\nimport { MoveRightButton } from '../buttons/MoveRightButton';\nimport { MoveUpButton } from '../buttons/MoveUpButton';\nimport { ZoomInButton } from '../buttons/ZoomInButton';\nimport { ZoomOutButton } from '../buttons/ZoomOutButton';\nimport { ZoomRangeButton } from '../buttons/ZoomRangeButton';\nimport { DEFAULTS } from '../data/config';\nimport { PSVError } from '../PSVError';\nimport { clone, logWarn } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { NavbarCaption } from './NavbarCaption';\n\n/**\n * @summary List of available buttons\n * @type {Object>}\n * @private\n */\nconst AVAILABLE_BUTTONS = {};\n\n/**\n * @summary Register a new button available for all viewers\n * @param {Class} button\n * @memberOf PSV\n */\nexport function registerButton(button) {\n if (!button.id) {\n throw new PSVError('Button ID is required');\n }\n\n AVAILABLE_BUTTONS[button.id] = button;\n}\n\n[\n AutorotateButton,\n ZoomInButton,\n ZoomRangeButton,\n ZoomOutButton,\n DownloadButton,\n FullscreenButton,\n MoveRightButton,\n MoveLeftButton,\n MoveUpButton,\n MoveDownButton,\n].forEach(registerButton);\n\n/**\n * @summary Navigation bar class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Navbar extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-navbar');\n\n /**\n * @summary List of buttons of the navbar\n * @member {PSV.buttons.AbstractButton[]}\n * @override\n */\n this.children = [];\n\n /**\n * @summary List of collapsed buttons\n * @member {PSV.buttons.AbstractButton[]}\n * @private\n */\n this.collapsed = [];\n }\n\n /**\n * @summary Change the buttons visible on the navbar\n * @param {string|Array} buttons\n */\n setButtons(buttons) {\n this.children.slice().forEach(item => item.destroy());\n this.children.length = 0;\n\n /* eslint-disable no-new */\n this.__cleanButtons(buttons).forEach((button) => {\n if (typeof button === 'object') {\n new CustomButton(this, button);\n }\n else if (AVAILABLE_BUTTONS[button]) {\n new AVAILABLE_BUTTONS[button](this);\n }\n else if (button === 'caption') {\n new NavbarCaption(this, this.psv.config.caption);\n }\n else if (button === 'zoom') {\n new ZoomOutButton(this);\n new ZoomRangeButton(this);\n new ZoomInButton(this);\n }\n else if (button === 'move') {\n new MoveLeftButton(this);\n new MoveRightButton(this);\n new MoveUpButton(this);\n new MoveDownButton(this);\n }\n else {\n throw new PSVError('Unknown button ' + button);\n }\n });\n\n new MenuButton(this);\n /* eslint-enable no-new */\n\n this.children.forEach((item) => {\n if (typeof item.checkSupported === 'function') {\n item.checkSupported();\n }\n });\n }\n\n /**\n * @summary Sets the bar caption\n * @param {string} html\n */\n setCaption(html) {\n const caption = this.getButton('caption', false);\n\n if (!caption) {\n throw new PSVError('Cannot set caption, the navbar caption container is not initialized.');\n }\n\n caption.setCaption(html);\n }\n\n /**\n * @summary Returns a button by its identifier\n * @param {string} id\n * @param {boolean} [warnNotFound=true]\n * @returns {PSV.buttons.AbstractButton}\n */\n getButton(id, warnNotFound = true) {\n let button = null;\n\n this.children.some((item) => {\n if (item.prop.id === id) {\n button = item;\n return true;\n }\n else {\n return false;\n }\n });\n\n if (!button && warnNotFound) {\n logWarn(`button \"${id}\" not found in the navbar`);\n }\n\n return button;\n }\n\n /**\n * @summary Shows the navbar\n */\n show() {\n this.container.classList.add('psv-navbar--open');\n this.prop.visible = true;\n }\n\n /**\n * @summary Hides the navbar\n */\n hide() {\n this.container.classList.remove('psv-navbar--open');\n this.prop.visible = false;\n }\n\n /**\n * @override\n */\n refreshUi() {\n super.refreshUi();\n\n if (this.psv.prop.uiRefresh === true) {\n const availableWidth = this.container.offsetWidth;\n\n let totalWidth = 0;\n const visibleButtons = [];\n const collapsableButtons = [];\n\n this.children.forEach((item) => {\n if (item.prop.visible) {\n totalWidth += item.prop.width;\n visibleButtons.push(item);\n if (item.prop.collapsable) {\n collapsableButtons.push(item);\n }\n }\n });\n\n if (!visibleButtons.length) {\n return;\n }\n\n if (availableWidth < totalWidth && collapsableButtons.length > 0) {\n collapsableButtons.forEach(item => item.collapse());\n this.collapsed = collapsableButtons;\n\n this.getButton(MenuButton.id).show(false);\n }\n else if (availableWidth >= totalWidth && this.collapsed.length > 0) {\n this.collapsed.forEach(item => item.uncollapse());\n this.collapsed = [];\n\n this.getButton(MenuButton.id).hide(false);\n }\n\n const caption = this.getButton(NavbarCaption.id, false);\n if (caption) {\n caption.refreshUi();\n }\n }\n }\n\n /**\n * @summary Ensure the buttons configuration is correct\n * @private\n */\n __cleanButtons(buttons) {\n // true becomes the default array\n if (buttons === true) {\n return clone(DEFAULTS.navbar);\n }\n // can be a space or coma separated list\n else if (typeof buttons === 'string') {\n return buttons.split(/[ ,]/);\n }\n else {\n return buttons || [];\n }\n }\n\n}\n","import { SYSTEM } from '../data/system';\nimport { bound, getStyle } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Loader class\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\n}\n","import { EVENTS } from '../data/constants';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Notification class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Notification extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-notification');\n\n /**\n * @override\n * @property {*} timeout\n */\n this.prop = {\n ...this.prop,\n visible: false,\n timeout: null,\n };\n\n /**\n * Notification content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-notification-content';\n this.container.appendChild(this.content);\n\n this.content.addEventListener('click', () => this.hide());\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Displays a notification on the viewer\n * @param {Object|string} config\n * @param {string} config.content\n * @param {number} [config.timeout]\n * @fires PSV.show-notification\n *\n * @example\n * viewer.showNotification({ content: 'Hello world', timeout: 5000 })\n * @example\n * viewer.showNotification('Hello world')\n */\n show(config) {\n if (this.prop.timeout) {\n clearTimeout(this.prop.timeout);\n this.prop.timeout = null;\n }\n\n if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.content.innerHTML = config.content;\n this.prop.visible = true;\n\n this.container.classList.add('psv-notification--visible');\n\n this.psv.trigger(EVENTS.SHOW_NOTIFICATION);\n\n if (config.timeout) {\n this.prop.timeout = setTimeout(() => this.hide(), config.timeout);\n }\n }\n\n /**\n * @summary Hides the notification\n * @fires PSV.hide-notification\n */\n hide() {\n if (this.prop.visible) {\n this.container.classList.remove('psv-notification--visible');\n\n this.prop.visible = false;\n\n this.psv.trigger(EVENTS.HIDE_NOTIFICATION);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { getEventKey } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\nimport { PSVError } from '../PSVError';\n\n/**\n * @summary Overlay class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Overlay extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-overlay');\n\n /**\n * @override\n * @property {string} contentId\n * @property {boolean} dissmisable\n */\n this.prop = {\n ...this.prop,\n contentId : undefined,\n dissmisable: true,\n };\n\n /**\n * Image container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.image = document.createElement('div');\n this.image.className = 'psv-overlay-image';\n this.container.appendChild(this.image);\n\n /**\n * Text container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.text = document.createElement('div');\n this.text.className = 'psv-overlay-text';\n this.container.appendChild(this.text);\n\n /**\n * Subtext container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.subtext = document.createElement('div');\n this.subtext.className = 'psv-overlay-subtext';\n this.container.appendChild(this.subtext);\n\n this.container.addEventListener('mouseup', this);\n\n document.addEventListener('keydown', this);\n\n super.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n document.removeEventListener('keydown', this);\n\n delete this.image;\n delete this.text;\n delete this.subtext;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mouseup': this.prop.dissmisable && this.hide(); break;\n case 'keydown': getEventKey(e) === KEY_CODES.Escape && this.prop.dissmisable && this.hide(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n */\n toggle() {\n throw new PSVError('Overlay cannot be toggled');\n }\n\n /**\n * @summary Displays an overlay on the viewer\n * @param {Object|string} config\n * @param {string} [config.id] - unique identifier to use with \"hide\"\n * @param {string} config.image - SVG image/icon displayed above the text\n * @param {string} config.text - main message\n * @param {string} [config.subtext] - secondary message\n * @param {boolean} [config.dissmisable=true] - if the user can hide the overlay by clicking\n * @fires PSV.show-overlay\n */\n show(config) {\n if (typeof config === 'string') {\n config = { text: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.dissmisable = config.dissmisable !== false;\n this.image.innerHTML = config.image || '';\n this.text.innerHTML = config.text || '';\n this.subtext.innerHTML = config.subtext || '';\n\n super.show();\n\n this.psv.trigger(EVENTS.SHOW_OVERLAY, config.id);\n }\n\n /**\n * @summary Hides the overlay\n * @param {string} [id]\n * @fires PSV.hide-overlay\n */\n hide(id) {\n if (this.isVisible() && (!id || !this.prop.contentId || this.prop.contentId === id)) {\n const contentId = this.prop.contentId;\n\n super.hide();\n\n this.prop.contentId = undefined;\n\n this.psv.trigger(EVENTS.HIDE_OVERLAY, contentId);\n }\n }\n\n}\n","import { EVENTS, KEY_CODES } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { PSVError } from '../PSVError';\nimport { getEventKey, toggleClass } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\n/**\n * @summary Minimum width of the panel\n * @type {number}\n * @constant\n * @private\n */\nconst PANEL_MIN_WIDTH = 200;\n\n/**\n * @summary Panel class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Panel extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv, 'psv-panel');\n\n /**\n * @override\n * @property {string} contentId\n * @property {number} mouseX\n * @property {number} mouseY\n * @property {boolean} mousedown\n * @property {function} clickHandler\n * @property {function} keyHandler\n */\n this.prop = {\n ...this.prop,\n visible : false,\n contentId : undefined,\n mouseX : 0,\n mouseY : 0,\n mousedown : false,\n clickHandler: null,\n keyHandler : null,\n width : {},\n };\n\n const resizer = document.createElement('div');\n resizer.className = 'psv-panel-resizer';\n this.container.appendChild(resizer);\n\n const closeBtn = document.createElement('div');\n closeBtn.className = 'psv-panel-close-button';\n this.container.appendChild(closeBtn);\n\n /**\n * @summary Content container\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-panel-content';\n this.container.appendChild(this.content);\n\n // Stop wheel event bubbling from panel\n this.container.addEventListener(SYSTEM.mouseWheelEvent, e => e.stopPropagation());\n\n closeBtn.addEventListener('click', () => this.hide());\n\n // Event for panel resizing + stop bubling\n resizer.addEventListener('mousedown', this);\n resizer.addEventListener('touchstart', this);\n this.psv.container.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchend', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', this);\n\n document.addEventListener('keydown', this);\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchend', this);\n\n document.removeEventListener('keydown', this);\n\n delete this.prop;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(e); break;\n case 'touchstart': this.__onTouchStart(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'touchmove': this.__onTouchMove(e); break;\n case 'mouseup': this.__onMouseUp(e); break;\n case 'touchend': this.__onMouseUp(e); break;\n case 'keydown': getEventKey(e) === KEY_CODES.Escape && this.hide(); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @param {string} [id]\n */\n isVisible(id) {\n return this.prop.visible && (!id || !this.prop.contentId || this.prop.contentId === id);\n }\n\n /**\n * @override\n */\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, if not specified the default width will be used\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 if (typeof config === 'string') {\n config = { content: config };\n }\n\n this.prop.contentId = config.id;\n this.prop.visible = true;\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.content.removeEventListener('keydown', this.prop.keyHandler);\n this.prop.clickHandler = null;\n this.prop.keyHandler = null;\n }\n\n if (config.id && this.prop.width[config.id]) {\n this.container.style.width = this.prop.width[config.id];\n }\n else if (config.width) {\n this.container.style.width = config.width;\n }\n else {\n this.container.style.width = null;\n }\n\n this.content.innerHTML = config.content;\n this.content.scrollTop = 0;\n this.container.classList.add('psv-panel--open');\n\n toggleClass(this.content, 'psv-panel-content--no-margin', config.noMargin === true);\n\n if (config.clickHandler) {\n this.prop.clickHandler = config.clickHandler;\n this.prop.keyHandler = (e) => {\n if (getEventKey(e) === KEY_CODES.Enter) {\n config.clickHandler(e);\n }\n };\n this.content.addEventListener('click', this.prop.clickHandler);\n this.content.addEventListener('keydown', this.prop.keyHandler);\n\n // focus the first element if possible, after animation ends\n setTimeout(() => {\n this.content.querySelector('a,button,[tabindex]')?.focus();\n }, 300);\n }\n\n this.psv.trigger(EVENTS.OPEN_PANEL, config.id);\n }\n\n /**\n * @summary Hides the panel\n * @param {string} [id]\n * @fires PSV.close-panel\n */\n hide(id) {\n if (this.isVisible(id)) {\n const contentId = this.prop.contentId;\n\n this.prop.visible = false;\n this.prop.contentId = undefined;\n\n this.content.innerHTML = null;\n this.container.classList.remove('psv-panel--open');\n\n if (this.prop.clickHandler) {\n this.content.removeEventListener('click', this.prop.clickHandler);\n this.prop.clickHandler = null;\n }\n\n this.psv.trigger(EVENTS.CLOSE_PANEL, contentId);\n }\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n evt.stopPropagation();\n this.__startResize(evt);\n }\n\n /**\n * @summary Handles touch events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchStart(evt) {\n evt.stopPropagation();\n this.__startResize(evt.changedTouches[0]);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.prop.mousedown = false;\n this.content.classList.remove('psv-panel-content--no-interaction');\n }\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (this.prop.mousedown) {\n evt.stopPropagation();\n this.__resize(evt);\n }\n }\n\n /**\n * @summary Handles touch move events\n * @param {TouchEvent} evt\n * @private\n */\n __onTouchMove(evt) {\n if (this.prop.mousedown) {\n this.__resize(evt.touches[0]);\n }\n }\n\n /**\n * @summary Initializes the panel resize\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startResize(evt) {\n this.prop.mouseX = evt.clientX;\n this.prop.mouseY = evt.clientY;\n this.prop.mousedown = true;\n this.content.classList.add('psv-panel-content--no-interaction');\n }\n\n /**\n * @summary Resizes the panel\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __resize(evt) {\n const x = evt.clientX;\n const y = evt.clientY;\n const width = Math.max(PANEL_MIN_WIDTH, this.container.offsetWidth - (x - this.prop.mouseX)) + 'px';\n\n if (this.prop.contentId) {\n this.prop.width[this.prop.contentId] = width;\n }\n\n this.container.style.width = width;\n\n this.prop.mouseX = x;\n this.prop.mouseY = y;\n }\n\n}\n","/**\n * @namespace PSV.services\n */\n\n/**\n * @summary Base services class\n * @memberof PSV.services\n * @abstract\n */\nexport class AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n /**\n * @summary Reference to main controller\n * @type {PSV.Viewer}\n * @readonly\n */\n this.psv = psv;\n\n /**\n * @summary Configuration holder\n * @type {PSV.Options}\n * @readonly\n */\n this.config = psv.config;\n\n /**\n * @summary Properties holder\n * @type {Object}\n * @readonly\n */\n this.prop = psv.prop;\n }\n\n /**\n * @summary Destroys the service\n */\n destroy() {\n delete this.psv;\n delete this.config;\n delete this.prop;\n }\n\n}\n","import * as THREE from 'three';\nimport { SPHERE_RADIUS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { parseAngle, parseSpeed } from '../utils';\nimport { AbstractService } from './AbstractService';\n\nconst vector2 = new THREE.Vector2();\nconst vector3 = new THREE.Vector3();\n\n/**\n * @summary Collections of data converters for the current viewer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class DataHelper extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n }\n\n /**\n * @summary Converts vertical FOV to zoom level\n * @param {number} fov\n * @returns {number}\n */\n fovToZoomLevel(fov) {\n const temp = Math.round((fov - this.config.minFov) / (this.config.maxFov - this.config.minFov) * 100);\n return temp - 2 * (temp - 50);\n }\n\n /**\n * @summary Converts zoom level to vertical FOV\n * @param {number} level\n * @returns {number}\n */\n zoomLevelToFov(level) {\n return this.config.maxFov + (level / 100) * (this.config.minFov - this.config.maxFov);\n }\n\n /**\n * @summary Convert vertical FOV to horizontal FOV\n * @param {number} vFov\n * @returns {number}\n */\n vFovToHFov(vFov) {\n return THREE.Math.radToDeg(2 * Math.atan(Math.tan(THREE.Math.degToRad(vFov) / 2) * this.prop.aspect));\n }\n\n /**\n * @summary Converts a speed into a duration from current position to a new position\n * @param {string|number} value\n * @param {number} angle\n * @returns {number}\n */\n speedToDuration(value, angle) {\n if (!value || typeof value !== 'number') {\n // desired radial speed\n const speed = value ? parseSpeed(value) : this.config.autorotateSpeed;\n // compute duration\n return angle / Math.abs(speed) * 1000;\n }\n else {\n return Math.abs(value);\n }\n }\n\n /**\n * @summary Converts pixel texture coordinates to spherical radians coordinates\n * @param {PSV.Point} point\n * @returns {PSV.Position}\n */\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 return {\n longitude: relativeX >= Math.PI ? relativeX - Math.PI : relativeX + Math.PI,\n latitude : Math.PI / 2 - relativeY,\n };\n }\n\n /**\n * @summary Converts spherical radians coordinates to pixel texture coordinates\n * @param {PSV.Position} position\n * @returns {PSV.Point}\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 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 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 const intersects = this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true);\n\n if (intersects.length === 1) {\n return intersects[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 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 ('x' in position && 'y' in position) {\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","import * as THREE from 'three';\nimport { Animation } from '../Animation';\nimport {\n ACTIONS,\n CTRLZOOM_TIMEOUT,\n DBLCLICK_DELAY,\n EVENTS,\n IDS,\n INERTIA_WINDOW,\n KEY_CODES,\n LONGTOUCH_DELAY,\n MOVE_THRESHOLD,\n 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, getClosest, getEventKey, isFullscreenEnabled, normalizeWheel, throttle } from '../utils';\nimport { PressHandler } from '../utils/PressHandler';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Events handler\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class EventsHandler extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @property {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 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 window.addEventListener('mouseup', this);\n this.psv.container.addEventListener('touchstart', this);\n window.addEventListener('touchend', this);\n this.psv.container.addEventListener('mousemove', this);\n this.psv.container.addEventListener('touchmove', 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 window.removeEventListener('mouseup', this);\n this.psv.container.removeEventListener('touchstart', this);\n window.removeEventListener('touchend', this);\n this.psv.container.removeEventListener('mousemove', this);\n this.psv.container.removeEventListener('touchmove', this);\n this.psv.container.removeEventListener(SYSTEM.mouseWheelEvent, this);\n\n if (SYSTEM.fullscreenEvent) {\n document.removeEventListener(SYSTEM.fullscreenEvent, this);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n clearTimeout(this.state.longtouchTimeout);\n clearTimeout(this.state.twofingersTimeout);\n clearTimeout(this.state.ctrlZoomTimeout);\n\n delete this.state;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} evt\n * @private\n */\n handleEvent(evt) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'resize': this.__onResize(); break;\n case 'keydown': this.__onKeyDown(evt); break;\n case 'keyup': this.__onKeyUp(); break;\n case 'mouseup': this.__onMouseUp(evt); break;\n case 'touchend': this.__onTouchEnd(evt); break;\n case SYSTEM.fullscreenEvent: this.__fullscreenToggled(); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n if (!getClosest(evt.target, '.psv-navbar') && !getClosest(evt.target, '.psv-panel')) {\n /* eslint-disable */\n switch (evt.type) {\n // @formatter:off\n case 'mousedown': this.__onMouseDown(evt); break;\n case 'mouseenter': this.__onMouseEnter(evt); break;\n case 'touchstart': this.__onTouchStart(evt); break;\n case 'mouseleave': this.__onMouseLeave(evt); break;\n case 'mousemove': this.__onMouseMove(evt); break;\n case 'touchmove': this.__onTouchMove(evt); break;\n case SYSTEM.mouseWheelEvent: this.__onMouseWheel(evt); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n }\n\n /**\n * @summary Enables the keyboard controls\n * @protected\n */\n enableKeyboard() {\n this.state.keyboardEnabled = true;\n }\n\n /**\n * @summary Disables the keyboard controls\n * @protected\n */\n disableKeyboard() {\n this.state.keyboardEnabled = false;\n }\n\n /**\n * @summary Handles keyboard events\n * @param {KeyboardEvent} evt\n * @private\n */\n __onKeyDown(evt) {\n const key = getEventKey(evt);\n\n if (this.config.mousewheelCtrlKey) {\n this.state.ctrlKeyDown = key === KEY_CODES.Control;\n\n if (this.state.ctrlKeyDown) {\n clearTimeout(this.state.ctrlZoomTimeout);\n this.psv.overlay.hide(IDS.CTRL_ZOOM);\n }\n }\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n if (this.config.keyboard[key] === ACTIONS.TOGGLE_AUTOROTATE) {\n this.psv.toggleAutorotate();\n }\n else if (this.config.keyboard[key] && !this.state.keyHandler.time) {\n /* eslint-disable */\n switch (this.config.keyboard[key]) {\n // @formatter:off\n case ACTIONS.ROTATE_LAT_UP: this.psv.dynamics.position.roll({latitude: false}); break;\n case ACTIONS.ROTATE_LAT_DOWN: this.psv.dynamics.position.roll({latitude: true}); break;\n case ACTIONS.ROTATE_LONG_RIGHT: this.psv.dynamics.position.roll({longitude: false}); break;\n case ACTIONS.ROTATE_LONG_LEFT: this.psv.dynamics.position.roll({longitude: true}); break;\n case ACTIONS.ZOOM_IN: this.psv.dynamics.zoom.roll(false); break;\n case ACTIONS.ZOOM_OUT: this.psv.dynamics.zoom.roll(true); break;\n // @formatter:on\n }\n /* eslint-enable */\n\n this.state.keyHandler.down();\n }\n }\n\n /**\n * @summary Handles keyboard events\n * @private\n */\n __onKeyUp() {\n this.state.ctrlKeyDown = false;\n\n if (!this.state.keyboardEnabled) {\n return;\n }\n\n this.state.keyHandler.up(() => {\n this.psv.dynamics.position.stop();\n this.psv.dynamics.zoom.stop();\n });\n }\n\n /**\n * @summary Handles mouse down events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseDown(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse enter events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseEnter(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__startMove(evt);\n }\n\n /**\n * @summary Handles mouse up events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseUp(evt) {\n if (!this.config.mousemove || this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse leave events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseLeave(evt) {\n if (!this.config.mousemove || !this.config.captureCursor) {\n return;\n }\n\n this.__stopMove(evt);\n }\n\n /**\n * @summary Handles mouse move events\n * @param {MouseEvent} evt\n * @private\n */\n __onMouseMove(evt) {\n if (!this.config.mousemove) {\n return;\n }\n\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 /**\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.__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\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 if (this.config.touchmoveTwoFingers) {\n this.__cancelTwoFingersOverlay();\n this.psv.overlay.hide(IDS.TWO_FINGERS);\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 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 if (this.config.touchmoveTwoFingers) {\n this.__cancelTwoFingersOverlay();\n }\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 }\n\n /**\n * @summary Handles mouse wheel events\n * @param {WheelEvent} evt\n * @private\n */\n __onMouseWheel(evt) {\n if (!this.config.mousewheel) {\n return;\n }\n\n if (this.config.mousewheelCtrlKey && !this.state.ctrlKeyDown) {\n this.psv.overlay.show({\n id : IDS.CTRL_ZOOM,\n image: mousewheelIcon,\n text : this.config.lang.ctrlZoom,\n });\n\n clearTimeout(this.state.ctrlZoomTimeout);\n this.state.ctrlZoomTimeout = setTimeout(() => this.psv.overlay.hide(IDS.CTRL_ZOOM), CTRLZOOM_TIMEOUT);\n\n return;\n }\n\n evt.preventDefault();\n evt.stopPropagation();\n\n const delta = normalizeWheel(evt).spinY * 5 * this.config.zoomSpeed;\n if (delta !== 0) {\n this.psv.dynamics.zoom.step(-delta, 5);\n }\n }\n\n /**\n * @summary Handles fullscreen events\n * @param {boolean} [force] force state\n * @fires PSV.fullscreen-updated\n * @package\n */\n __fullscreenToggled(force) {\n this.prop.fullscreen = force !== undefined ? force : isFullscreenEnabled(this.psv.container);\n\n if (this.config.keyboard) {\n if (this.prop.fullscreen) {\n this.psv.startKeyboardControl();\n }\n else {\n this.psv.stopKeyboardControl();\n }\n }\n\n this.psv.trigger(EVENTS.FULLSCREEN_UPDATED, this.prop.fullscreen);\n }\n\n /**\n * @summary Initializes the movement\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __startMove(evt) {\n this.psv.stopAutorotate();\n this.psv.stopAnimation()\n .then(() => {\n this.state.mouseX = evt.clientX;\n this.state.mouseY = evt.clientY;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = false;\n\n this.state.mouseHistory.length = 0;\n this.__logMouseMove(evt);\n });\n }\n\n /**\n * @summary Initializes the combines move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __startMoveZoom(evt) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n this.state.pinchDist = distance(p1, p2);\n this.state.mouseX = (p1.x + p2.x) / 2;\n this.state.mouseY = (p1.y + p2.y) / 2;\n this.state.startMouseX = this.state.mouseX;\n this.state.startMouseY = this.state.mouseY;\n this.state.moving = true;\n this.state.zooming = true;\n }\n\n /**\n * @summary Stops the movement\n * @description If the move threshold was not reached a click event is triggered, otherwise an animation is launched to simulate inertia\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMove(evt) {\n if (!getClosest(evt.target, '.psv-container')) {\n this.state.moving = false;\n this.state.mouseHistory.length = 0;\n return;\n }\n\n if (this.state.moving) {\n // move threshold to trigger a click\n if (Math.abs(evt.clientX - this.state.startMouseX) < MOVE_THRESHOLD && Math.abs(evt.clientY - this.state.startMouseY) < MOVE_THRESHOLD) {\n this.__click(evt);\n this.state.moving = false;\n }\n // inertia animation\n else if (this.config.moveInertia) {\n this.__logMouseMove(evt);\n this.__stopMoveInertia(evt);\n }\n else {\n this.state.moving = false;\n }\n\n this.state.mouseHistory.length = 0;\n }\n }\n\n /**\n * @summary Stops the combined move and zoom\n * @private\n */\n __stopMoveZoom() {\n this.state.mouseHistory.length = 0;\n this.state.moving = false;\n this.state.zooming = false;\n }\n\n /**\n * @summary Performs an animation to simulate inertia when the movement stops\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __stopMoveInertia(evt) {\n const direction = {\n x: evt.clientX - this.state.mouseHistory[0][1],\n y: evt.clientY - this.state.mouseHistory[0][2],\n };\n\n const norm = Math.sqrt(direction.x * direction.x + direction.y * direction.y);\n\n this.prop.animationPromise = new Animation({\n properties: {\n clientX: { start: evt.clientX, end: evt.clientX + direction.x },\n clientY: { start: evt.clientY, end: evt.clientY + direction.y },\n },\n duration : norm * INERTIA_WINDOW / 100,\n easing : 'outCirc',\n onTick : (properties) => {\n this.__move(properties, false);\n },\n })\n .finally(() => {\n this.state.moving = false;\n });\n }\n\n /**\n * @summary Triggers an event with all coordinates when a simple click is performed\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [longtouch=false]\n * @fires PSV.click\n * @fires PSV.dblclick\n * @private\n */\n __click(evt, longtouch = false) {\n const boundingRect = this.psv.container.getBoundingClientRect();\n\n /**\n * @type {PSV.ClickData}\n */\n const data = {\n rightclick: longtouch || evt.button === 2,\n target : evt.target,\n clientX : evt.clientX,\n clientY : evt.clientY,\n viewerX : evt.clientX - boundingRect.left,\n viewerY : evt.clientY - boundingRect.top,\n };\n\n const intersect = this.psv.dataHelper.viewerCoordsToVector3({\n x: data.viewerX,\n y: data.viewerY,\n });\n\n if (intersect) {\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(intersect);\n data.longitude = sphericalCoords.longitude;\n data.latitude = sphericalCoords.latitude;\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) < MOVE_THRESHOLD\n && Math.abs(this.state.dblclickData.clientY - data.clientY) < MOVE_THRESHOLD) {\n this.psv.trigger(EVENTS.DOUBLE_CLICK, this.state.dblclickData);\n }\n\n clearTimeout(this.state.dblclickTimeout);\n this.state.dblclickTimeout = null;\n this.state.dblclickData = null;\n }\n }\n }\n\n /**\n * @summary Performs movement\n * @param {MouseEvent|Touch} evt\n * @param {boolean} [log=true]\n * @private\n */\n __move(evt, log) {\n if (this.state.moving) {\n const x = evt.clientX;\n const y = evt.clientY;\n\n const rotation = {\n longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * THREE.Math.degToRad(this.prop.hFov),\n latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.Math.degToRad(this.prop.vFov),\n };\n\n const currentPosition = this.psv.getPosition();\n this.psv.rotate({\n longitude: currentPosition.longitude - rotation.longitude,\n latitude : currentPosition.latitude + rotation.latitude,\n });\n\n this.state.mouseX = x;\n this.state.mouseY = y;\n\n if (log !== false) {\n this.__logMouseMove(evt);\n }\n }\n }\n\n /**\n * @summary Performs movement absolute to cursor position in viewer\n * @param {MouseEvent} evt\n * @private\n */\n __moveAbsolute(evt) {\n if (this.state.moving) {\n const containerRect = this.psv.container.getBoundingClientRect();\n this.psv.dynamics.position.goto({\n longitude: ((evt.clientX - containerRect.left) / containerRect.width - 0.5) * Math.PI * 2,\n latitude : -((evt.clientY - containerRect.top) / containerRect.height - 0.5) * Math.PI,\n }, 10);\n }\n }\n\n /**\n * @summary Perfoms combined move and zoom\n * @param {TouchEvent} evt\n * @private\n */\n __moveZoom(evt) {\n if (this.state.zooming && this.state.moving) {\n const p1 = { x: evt.touches[0].clientX, y: evt.touches[0].clientY };\n const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY };\n\n const p = distance(p1, p2);\n const delta = 80 * (p - this.state.pinchDist) / this.prop.size.width * this.config.zoomSpeed;\n\n this.psv.zoom(this.psv.getZoomLevel() + delta);\n\n this.__move({\n clientX: (p1.x + p2.x) / 2,\n clientY: (p1.y + p2.y) / 2,\n });\n\n this.state.pinchDist = p;\n }\n }\n\n /**\n * @summary Stores each mouse position during a mouse move\n * @description Positions older than \"INERTIA_WINDOW\" are removed
\n * Positions before a pause of \"INERTIA_WINDOW\" / 10 are removed\n * @param {MouseEvent|Touch} evt\n * @private\n */\n __logMouseMove(evt) {\n const now = Date.now();\n this.state.mouseHistory.push([now, evt.clientX, evt.clientY]);\n\n let previous = null;\n\n for (let i = 0; i < this.state.mouseHistory.length;) {\n if (this.state.mouseHistory[0][i] < now - INERTIA_WINDOW) {\n this.state.mouseHistory.splice(i, 1);\n }\n else if (previous && this.state.mouseHistory[0][i] - previous > INERTIA_WINDOW / 10) {\n this.state.mouseHistory.splice(0, i);\n i = 0;\n previous = this.state.mouseHistory[0][i];\n }\n else {\n i++;\n previous = this.state.mouseHistory[0][i];\n }\n }\n }\n\n}\n","import * as THREE from 'three';\nimport { Animation } from '../Animation';\nimport { EVENTS, SPHERE_RADIUS } from '../data/constants';\nimport { SYSTEM } from '../data/system';\nimport { each, isExtendedPosition, isNil } 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 {number}\n * @private\n */\n this.mainReqid = undefined;\n\n /**\n * @member {external:THREE.WebGLRenderer}\n * @readonly\n * @protected\n */\n this.renderer = null;\n\n /**\n * @member {external:THREE.Scene}\n * @readonly\n * @protected\n */\n this.scene = null;\n\n /**\n * @member {external:THREE.PerspectiveCamera}\n * @readonly\n * @protected\n */\n this.camera = null;\n\n /**\n * @member {external:THREE.Mesh}\n * @readonly\n * @protected\n */\n this.mesh = null;\n\n /**\n * @member {external:THREE.Group}\n * @readonly\n * @private\n */\n this.meshContainer = null;\n\n /**\n * @member {external:THREE.Raycaster}\n * @readonly\n * @protected\n */\n this.raycaster = null;\n\n /**\n * @member {number}\n * @private\n */\n this.timestamp = null;\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.psv.container.appendChild(this.canvasContainer);\n\n psv.on(EVENTS.SIZE_UPDATED, (e, size) => {\n if (this.renderer) {\n this.renderer.setSize(size.width, size.height);\n }\n });\n\n psv.on(EVENTS.CONFIG_CHANGED, () => {\n this.canvasContainer.style.cursor = this.psv.config.mousemove ? 'move' : 'default';\n });\n\n this.hide();\n }\n\n /**\n * @override\n */\n destroy() {\n // cancel render loop\n if (this.mainReqid) {\n window.cancelAnimationFrame(this.mainReqid);\n }\n\n // destroy ThreeJS view\n if (this.scene) {\n this.__cleanTHREEScene(this.scene);\n }\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 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 Main event loop, calls {@link render} if `prop.needsUpdate` is true\n * @param {number} timestamp\n * @fires PSV.before-render\n * @package\n */\n __renderLoop(timestamp) {\n const elapsed = this.timestamp !== null ? timestamp - this.timestamp : 0;\n this.timestamp = timestamp;\n\n this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp, elapsed);\n each(this.psv.dynamics, d => d.update(elapsed));\n\n if (this.prop.needsUpdate) {\n this.render();\n this.prop.needsUpdate = false;\n }\n\n this.mainReqid = window.requestAnimationFrame(t => this.__renderLoop(t));\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.camera.position.set(0, 0, 0);\n this.camera.lookAt(this.prop.direction);\n\n if (this.config.fisheye) {\n this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate();\n }\n\n this.updateCameraMatrix();\n\n this.renderer.render(this.scene, this.camera);\n\n this.psv.trigger(EVENTS.RENDER);\n }\n\n /**\n * @summary Updates the camera matrix\n * @package\n */\n updateCameraMatrix() {\n if (this.camera) {\n this.camera.aspect = this.prop.aspect;\n this.camera.fov = this.prop.vFov;\n this.camera.updateProjectionMatrix();\n }\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 if (!this.scene) {\n this.__createScene();\n }\n\n this.prop.panoData = textureData.panoData;\n\n this.psv.adapter.setTexture(this.mesh, textureData);\n\n this.psv.needsUpdate();\n\n this.psv.trigger(EVENTS.PANORAMA_LOADED);\n }\n\n /**\n * @summary Apply a panorama data pose to a Mesh\n * @param {PSV.PanoData} [panoData]\n * @param {external:THREE.Mesh} [mesh=this.mesh]\n * @package\n */\n setPanoramaPose(panoData, mesh = this.mesh) {\n if (!isNil(panoData?.poseHeading) || !isNil(panoData?.posePitch) || !isNil(panoData?.poseRoll)) {\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 mesh.rotation.set(\n -THREE.Math.degToRad(panoData?.posePitch || 0),\n -THREE.Math.degToRad(panoData?.poseHeading || 0),\n -THREE.Math.degToRad(panoData?.poseRoll || 0),\n 'ZXY'\n );\n }\n else {\n mesh.rotation.set(0, 0, 0);\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 if (sphereCorrection) {\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 else {\n mesh.rotation.set(0, 0, 0);\n }\n }\n\n /**\n * @summary Creates the 3D scene and GUI components\n * @private\n */\n __createScene() {\n this.raycaster = new THREE.Raycaster();\n\n this.renderer = new THREE.WebGLRenderer({ alpha: true });\n this.renderer.setSize(this.prop.size.width, this.prop.size.height);\n this.renderer.setPixelRatio(SYSTEM.pixelRatio);\n\n this.camera = new THREE.PerspectiveCamera(this.prop.vFov, this.prop.size.width / this.prop.size.height, 1, 2 * SPHERE_RADIUS);\n this.camera.position.set(0, 0, 0);\n\n this.scene = new THREE.Scene();\n this.scene.add(this.camera);\n\n this.mesh = this.psv.adapter.createMesh();\n\n this.meshContainer = new THREE.Group();\n this.meshContainer.add(this.mesh);\n this.scene.add(this.meshContainer);\n\n // create canvas container\n this.renderer.domElement.className = 'psv-canvas';\n this.canvasContainer.appendChild(this.renderer.domElement);\n }\n\n /**\n * @summary Performs transition between the current and a new texture\n * @param {PSV.TextureData} textureData\n * @param {PSV.PanoramaOptions} options\n * @returns {PSV.Animation}\n * @package\n */\n transition(textureData, options) {\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n const group = new THREE.Group();\n\n const mesh = this.psv.adapter.createMesh(0.5);\n this.psv.adapter.setTexture(mesh, textureData);\n this.psv.adapter.setTextureOpacity(mesh, 0);\n this.setPanoramaPose(options.panoData, mesh);\n this.setSphereCorrection(options.sphereCorrection, group);\n\n // rotate the new sphere to make the target position face the camera\n if (positionProvided) {\n const cleanPosition = this.psv.dataHelper.cleanPosition(options);\n const currentPosition = this.psv.getPosition();\n\n // Longitude rotation along the vertical axis\n const verticalAxis = new THREE.Vector3(0, 1, 0);\n group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - currentPosition.longitude);\n\n // Latitude rotation along the camera horizontal axis\n const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new THREE.Vector3())).normalize();\n group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - currentPosition.latitude);\n }\n\n group.add(mesh);\n this.scene.add(group);\n this.psv.needsUpdate();\n\n return new Animation({\n properties: {\n opacity: { start: 0.0, end: 1.0 },\n zoom : zoomProvided ? { start: this.psv.getZoomLevel(), end: options.zoom } : undefined,\n },\n duration : options.transition,\n easing : 'outCubic',\n onTick : (properties) => {\n this.psv.adapter.setTextureOpacity(mesh, properties.opacity);\n\n if (zoomProvided) {\n this.psv.zoom(properties.zoom);\n }\n\n this.psv.needsUpdate();\n },\n })\n .then(() => {\n // remove temp sphere and transfer the texture to the main sphere\n this.setTexture(textureData);\n this.setPanoramaPose(options.panoData);\n this.setSphereCorrection(options.sphereCorrection);\n\n this.scene.remove(group);\n mesh.geometry.dispose();\n mesh.geometry = null;\n\n // actually rotate the camera\n if (positionProvided) {\n this.psv.rotate(options);\n }\n });\n }\n\n /**\n * @summary Calls `dispose` on all objects and textures\n * @param {external:THREE.Object3D} object\n * @private\n */\n __cleanTHREEScene(object) {\n object.traverse((item) => {\n if (item.geometry) {\n item.geometry.dispose();\n }\n\n if (item.material) {\n if (Array.isArray(item.material)) {\n item.material.forEach((material) => {\n if (material.map) {\n material.map.dispose();\n }\n\n material.dispose();\n });\n }\n else {\n if (item.material.map) {\n item.material.map.dispose();\n }\n\n item.material.dispose();\n }\n }\n\n if (item.dispose && !(item instanceof THREE.Scene)) {\n item.dispose();\n }\n\n if (item !== object) {\n this.__cleanTHREEScene(item);\n }\n });\n }\n\n}\n","import * as THREE from 'three';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Texture loader\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TextureLoader extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @summary Current HTTP requests\n * @type {XMLHttpRequest[]}\n * @private\n */\n this.requests = [];\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 */\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 [...this.requests].forEach(r => r.abort());\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 const request = this.loader.load(\n url,\n (result) => {\n const rIdx = this.requests.indexOf(request);\n if (rIdx !== -1) this.requests.splice(rIdx, 1);\n\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 const rIdx = this.requests.indexOf(request);\n if (rIdx !== -1) this.requests.splice(rIdx, 1);\n\n reject(err);\n }\n );\n\n // when we hit the cache, the result is the cache value\n if (request instanceof XMLHttpRequest) {\n this.requests.push(request);\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 return this.psv.adapter.loadTexture(panorama);\n }\n\n}\n","import { EVENTS } from '../data/constants';\nimport { PSVError } from '../PSVError';\nimport { addClasses, parsePosition } from '../utils';\nimport { AbstractComponent } from './AbstractComponent';\n\nconst LEFT_MAP = { 0: 'left', 0.5: 'center', 1: 'right' };\nconst TOP_MAP = { 0: 'top', 0.5: 'center', 1: 'bottom' };\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 class\n * @extends PSV.components.AbstractComponent\n * @memberof PSV.components\n */\nexport class Tooltip extends AbstractComponent {\n\n /**\n * @param {PSV.Viewer} psv\n * @param {{arrow: number, offset: number}} size\n */\n constructor(psv, size) {\n super(psv, 'psv-tooltip');\n\n /**\n * @override\n * @property {number} arrow\n * @property {number} offset\n * @property {number} width\n * @property {number} height\n * @property {string} pos\n * @property {string} state\n * @property {*} data\n */\n this.prop = {\n ...this.prop,\n ...size,\n state : STATE.NONE,\n width : 0,\n height: 0,\n pos : '',\n data : null,\n };\n\n /**\n * Tooltip content\n * @member {HTMLElement}\n * @readonly\n * @private\n */\n this.content = document.createElement('div');\n this.content.className = 'psv-tooltip-content';\n this.container.appendChild(this.content);\n\n /**\n * Tooltip arrow\n * @member {HTMLElement}\n * @readonly\n * @package\n */\n this.arrow = document.createElement('div');\n this.arrow.className = 'psv-tooltip-arrow';\n this.container.appendChild(this.arrow);\n\n this.container.addEventListener('transitionend', this);\n\n this.container.style.top = '-1000px';\n this.container.style.left = '-1000px';\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.arrow;\n delete this.content;\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case 'transitionend': this.__onTransitionEnd(e); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n */\n toggle() {\n throw new PSVError('Tooltip cannot be toggled');\n }\n\n /**\n * @summary Displays the tooltip on the viewer\n * Do not call this method directly, use {@link PSV.services.TooltipRenderer} instead.\n * @param {PSV.components.Tooltip.Config} config\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @package\n */\n show(config) {\n if (this.prop.state !== STATE.NONE) {\n throw new PSVError('Initialized tooltip cannot be re-initialized');\n }\n\n if (config.className) {\n addClasses(this.container, config.className);\n }\n\n this.content.innerHTML = config.content;\n\n const rect = this.container.getBoundingClientRect();\n this.prop.width = rect.right - rect.left;\n this.prop.height = rect.bottom - rect.top;\n\n this.prop.state = STATE.READY;\n\n this.move(config);\n\n this.prop.data = config.data;\n this.prop.state = STATE.SHOWING;\n\n this.psv.trigger(EVENTS.SHOW_TOOLTIP, this.prop.data, this);\n }\n\n /**\n * @summary Moves the tooltip to a new position\n * @param {PSV.components.Tooltip.Position} config\n *\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n move(config) {\n if (this.prop.state !== STATE.SHOWING && this.prop.state !== STATE.READY) {\n throw new PSVError('Uninitialized tooltip cannot be moved');\n }\n\n const t = this.container;\n const a = this.arrow;\n\n if (!config.position) {\n config.position = ['top', 'center'];\n }\n\n // parse position\n if (typeof config.position === 'string') {\n const tempPos = parsePosition(config.position);\n\n if (!(tempPos.x in LEFT_MAP) || !(tempPos.y in TOP_MAP)) {\n throw new PSVError(`Unable to parse tooltip position \"${config.position}\"`);\n }\n\n config.position = [TOP_MAP[tempPos.y], LEFT_MAP[tempPos.x]];\n }\n\n if (config.position[0] === 'center' && config.position[1] === 'center') {\n throw new PSVError('Unable to parse tooltip position \"center center\"');\n }\n\n // compute size\n const style = {\n posClass : config.position.slice(),\n width : this.prop.width,\n height : this.prop.height,\n top : 0,\n left : 0,\n arrowTop : 0,\n arrowLeft: 0,\n };\n\n // set initial position\n this.__computeTooltipPosition(style, config);\n\n // correct position if overflow\n let refresh = false;\n if (style.top < this.prop.offset) {\n style.posClass[0] = 'bottom';\n refresh = true;\n }\n else if (style.top + style.height > this.psv.prop.size.height - this.prop.offset) {\n style.posClass[0] = 'top';\n refresh = true;\n }\n if (style.left < this.prop.offset) {\n style.posClass[1] = 'right';\n refresh = true;\n }\n else if (style.left + style.width > this.psv.prop.size.width - this.prop.offset) {\n style.posClass[1] = 'left';\n refresh = true;\n }\n if (refresh) {\n this.__computeTooltipPosition(style, config);\n }\n\n // apply position\n t.style.top = style.top + 'px';\n t.style.left = style.left + 'px';\n\n a.style.top = style.arrowTop + 'px';\n a.style.left = style.arrowLeft + 'px';\n\n const newPos = style.posClass.join('-');\n if (newPos !== this.prop.pos) {\n t.classList.remove(`psv-tooltip--${this.prop.pos}`);\n\n this.prop.pos = newPos;\n t.classList.add(`psv-tooltip--${this.prop.pos}`);\n }\n }\n\n /**\n * @summary Hides the tooltip\n * @fires PSV.hide-tooltip\n */\n hide() {\n this.container.classList.remove('psv-tooltip--visible');\n this.prop.state = STATE.HIDING;\n\n this.psv.trigger(EVENTS.HIDE_TOOLTIP, this.prop.data);\n }\n\n /**\n * @summary Finalize transition\n * @param {TransitionEvent} e\n * @private\n */\n __onTransitionEnd(e) {\n if (e.propertyName === 'transform') {\n switch (this.prop.state) {\n case STATE.SHOWING:\n this.container.classList.add('psv-tooltip--visible');\n this.prop.state = STATE.READY;\n break;\n\n case STATE.HIDING:\n this.prop.state = STATE.NONE;\n this.destroy();\n break;\n\n default:\n // nothing\n }\n }\n }\n\n /**\n * @summary Computes the position of the tooltip and its arrow\n * @param {Object} style\n * @param {Object} config\n * @private\n */\n __computeTooltipPosition(style, config) {\n let topBottom = false;\n\n if (!config.box) {\n config.box = {\n width : 0,\n height: 0,\n };\n }\n\n switch (style.posClass[0]) {\n case 'bottom':\n style.top = config.top + config.box.height + this.prop.offset + this.prop.arrow;\n style.arrowTop = -this.prop.arrow * 2;\n topBottom = true;\n break;\n\n case 'center':\n style.top = config.top + config.box.height / 2 - style.height / 2;\n style.arrowTop = style.height / 2 - this.prop.arrow;\n break;\n\n case 'top':\n style.top = config.top - style.height - this.prop.offset - this.prop.arrow;\n style.arrowTop = style.height;\n topBottom = true;\n break;\n\n // no default\n }\n\n switch (style.posClass[1]) {\n case 'right':\n if (topBottom) {\n style.left = config.left + config.box.width / 2 - this.prop.offset - this.prop.arrow;\n style.arrowLeft = this.prop.offset;\n }\n else {\n style.left = config.left + config.box.width + this.prop.offset + this.prop.arrow;\n style.arrowLeft = -this.prop.arrow * 2;\n }\n break;\n\n case 'center':\n style.left = config.left + config.box.width / 2 - style.width / 2;\n style.arrowLeft = style.width / 2 - this.prop.arrow;\n break;\n\n case 'left':\n if (topBottom) {\n style.left = config.left - style.width + config.box.width / 2 + this.prop.offset + this.prop.arrow;\n style.arrowLeft = style.width - this.prop.offset - this.prop.arrow * 2;\n }\n else {\n style.left = config.left - style.width - this.prop.offset - this.prop.arrow;\n style.arrowLeft = style.width;\n }\n break;\n\n // no default\n }\n }\n\n}\n","import { Tooltip } from '../components/Tooltip';\nimport { getStyle } from '../utils';\nimport { AbstractService } from './AbstractService';\n\n/**\n * @summary Tooltip renderer\n * @extends PSV.services.AbstractService\n * @memberof PSV.services\n */\nexport class TooltipRenderer extends AbstractService {\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n const testTooltip = new Tooltip(this.psv);\n\n /**\n * @summary Computed static sizes\n * @member {Object}\n * @package\n * @property {number} arrowSize\n * @property {number} offset\n */\n this.size = {\n arrow : parseInt(getStyle(testTooltip.arrow, 'borderTopWidth'), 10),\n offset: parseInt(getStyle(testTooltip.container, 'outlineWidth'), 10),\n };\n\n testTooltip.destroy();\n }\n\n /**\n * @override\n */\n destroy() {\n delete this.size;\n\n super.destroy();\n }\n\n /**\n * @summary Displays a tooltip on the viewer\n * @param {PSV.components.Tooltip.Config} config\n * @returns {PSV.components.Tooltip}\n *\n * @fires PSV.show-tooltip\n * @throws {PSV.PSVError} when the configuration is incorrect\n *\n * @example\n * viewer.tooltip.create({ content: 'Hello world', top: 200, left: 450, position: 'center bottom'})\n */\n create(config) {\n const tooltip = new Tooltip(this.psv, this.size);\n tooltip.show(config);\n\n return tooltip;\n }\n\n}\n","import { bound } from './index';\n\n/**\n * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame)\n * @memberOf PSV\n * @package\n */\nexport class Dynamic {\n\n static STOP = 0;\n static INFINITE = 1;\n static POSITION = 2;\n\n /**\n * @param {Function} fn Callback function\n * @param {number} [min] Minimum position\n * @param {number} [max] Maximum position\n */\n constructor(fn, min = -Infinity, max = Infinity) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {number}\n * @private\n */\n this.mode = Dynamic.STOP;\n\n /**\n * @type {number}\n * @private\n */\n this.speed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.speedMult = 1;\n\n /**\n * @type {number}\n * @private\n */\n this.currentSpeed = 0;\n\n /**\n * @type {number}\n * @private\n */\n this.target = 0;\n\n /**\n * @type {number}\n * @readonly\n */\n this.current = 0;\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 /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n this.speed = speed;\n }\n\n /**\n * Defines the target position\n * @param {number} position\n * @param {number} [speedMult=1]\n */\n goto(position, speedMult = 1) {\n this.mode = Dynamic.POSITION;\n this.target = bound(position, this.min, this.max);\n this.speedMult = speedMult;\n }\n\n /**\n * Increase/decrease the target position\n * @param {number} step\n * @param {number} [speedMult=1]\n */\n step(step, speedMult = 1) {\n if (this.mode !== Dynamic.POSITION) {\n this.target = this.current;\n }\n this.goto(this.target + step, speedMult);\n }\n\n /**\n * Starts infinite movement\n * @param {boolean} [invert=false]\n * @param {number} [speedMult=1]\n */\n roll(invert = false, speedMult = 1) {\n this.mode = Dynamic.INFINITE;\n this.target = invert ? -Infinity : Infinity;\n this.speedMult = speedMult;\n }\n\n /**\n * Stops movement\n */\n stop() {\n this.mode = Dynamic.STOP;\n }\n\n /**\n * Defines the current position and immediately stops movement\n * @param {number} values\n */\n setValue(values) {\n const next = bound(values, this.min, this.max);\n this.target = next;\n this.mode = Dynamic.STOP;\n if (next !== this.current) {\n this.current = next;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n return false;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n // in position mode switch to stop mode when in the decceleration window\n if (this.mode === Dynamic.POSITION) {\n const dstStop = this.currentSpeed * this.currentSpeed / (this.speed * this.speedMult * 4);\n if (Math.abs(this.target - this.current) <= dstStop) {\n this.mode = Dynamic.STOP;\n }\n }\n\n // compute speed\n let targetSpeed = this.mode === Dynamic.STOP ? 0 : this.speed * this.speedMult;\n if (this.target < this.current) {\n targetSpeed = -targetSpeed;\n }\n if (this.currentSpeed < targetSpeed) {\n this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n else if (this.currentSpeed > targetSpeed) {\n this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsed / 1000 * this.speed * this.speedMult * 2);\n }\n\n // compute new position\n let next = null;\n if (this.current > this.target && this.currentSpeed) {\n next = Math.max(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n else if (this.current < this.target && this.currentSpeed) {\n next = Math.min(this.target, this.current + this.currentSpeed * elapsed / 1000);\n }\n\n // apply value\n if (next !== null) {\n next = bound(next, this.min, this.max);\n if (next !== this.current) {\n this.current = next;\n if (this.fn) {\n this.fn(this.current);\n }\n return true;\n }\n }\n\n return false;\n }\n\n}\n","import { each } from './index';\n\n/**\n * @summary Wrapper for multiple {@link PSV.Dynamic} evolving together\n * @memberOf PSV\n * @package\n */\nexport class MultiDynamic {\n\n /**\n * @type {Object}\n * @readonly\n */\n get current() {\n const values = {};\n each(this.dynamics, (dynamic, name) => {\n values[name] = dynamic.current;\n });\n return values;\n }\n\n /**\n * @param {Record} dynamics\n * @param {Function} fn Callback function\n */\n constructor(dynamics, fn) {\n /**\n * @type {Function}\n * @private\n * @readonly\n */\n this.fn = fn;\n\n /**\n * @type {Record}\n * @private\n * @readonly\n */\n this.dynamics = dynamics;\n }\n\n /**\n * Changes base speed\n * @param {number} speed\n */\n setSpeed(speed) {\n each(this.dynamics, (d) => {\n d.setSpeed(speed);\n });\n }\n\n /**\n * Defines the target positions\n * @param {Record} positions\n * @param {number} [speedMult=1]\n */\n goto(positions, speedMult = 1) {\n each(positions, (position, name) => {\n this.dynamics[name].goto(position, speedMult);\n });\n }\n\n /**\n * Increase/decrease the target positions\n * @param {Record} steps\n * @param {number} [speedMult=1]\n */\n step(steps, speedMult = 1) {\n each(steps, (step, name) => {\n this.dynamics[name].step(step, speedMult);\n });\n }\n\n /**\n * Starts infinite movements\n * @param {Record} rolls\n * @param {number} [speedMult=1]\n */\n roll(rolls, speedMult = 1) {\n each(rolls, (roll, name) => {\n this.dynamics[name].roll(roll, speedMult);\n });\n }\n\n /**\n * Stops movements\n */\n stop() {\n each(this.dynamics, d => d.stop());\n }\n\n /**\n * Defines the current positions and immediately stops movements\n * @param {Record} values\n */\n setValue(values) {\n let hasUpdates = false;\n each(values, (value, name) => {\n hasUpdates |= this.dynamics[name].setValue(value);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n /**\n * @package\n */\n update(elapsed) {\n let hasUpdates = false;\n each(this.dynamics, (dynamic) => {\n hasUpdates |= dynamic.update(elapsed);\n });\n\n if (hasUpdates && this.fn) {\n this.fn(this.current);\n }\n\n return hasUpdates;\n }\n\n}\n","import * as THREE from 'three';\nimport { EventEmitter } from 'uevent';\nimport { Animation } from './Animation';\nimport { Loader } from './components/Loader';\nimport { Navbar } from './components/Navbar';\nimport { Notification } from './components/Notification';\nimport { Overlay } from './components/Overlay';\nimport { Panel } from './components/Panel';\nimport { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config';\nimport { CHANGE_EVENTS, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants';\nimport { SYSTEM } from './data/system';\nimport errorIcon from './icons/error.svg';\nimport { AbstractPlugin } from './plugins/AbstractPlugin';\nimport { PSVError } from './PSVError';\nimport { DataHelper } from './services/DataHelper';\nimport { EventsHandler } from './services/EventsHandler';\nimport { Renderer } from './services/Renderer';\nimport { TextureLoader } from './services/TextureLoader';\nimport { TooltipRenderer } from './services/TooltipRenderer';\nimport {\n each,\n exitFullscreen,\n getAngle,\n getShortestArc,\n isExtendedPosition,\n isFullscreenEnabled,\n logWarn,\n pluginInterop,\n requestFullscreen,\n throttle,\n toggleClass\n} from './utils';\nimport { Dynamic } from './utils/Dynamic';\nimport { MultiDynamic } from './utils/MultiDynamic';\n\nTHREE.Cache.enabled = true;\n\n/**\n * @summary Main class\n * @memberOf PSV\n * @extends {external:uEvent.EventEmitter}\n */\nexport class Viewer extends EventEmitter {\n\n /**\n * @param {PSV.Options} options\n * @fires PSV.ready\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n constructor(options) {\n super();\n\n SYSTEM.load();\n\n // must support WebGL\n if (!SYSTEM.isWebGLSupported) {\n throw new PSVError('WebGL is not supported.');\n }\n\n if (SYSTEM.maxTextureWidth === 0) {\n throw new PSVError('Unable to detect system capabilities');\n }\n\n /**\n * @summary Internal properties\n * @member {Object}\n * @protected\n * @property {boolean} ready - when all components are loaded\n * @property {boolean} needsUpdate - if the view needs to be renderer\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 (either go to position or image transition)\n * @property {Promise} loadingPromise - promise of the setPanorama method\n * @property startTimeout - timeout id of the automatic rotation delay\n * @property {PSV.Size} size - size of the container\n * @property {PSV.PanoData} panoData - panorama metadata\n */\n this.prop = {\n ready : false,\n uiRefresh : false,\n needsUpdate : false,\n fullscreen : false,\n direction : new THREE.Vector3(0, 0, SPHERE_RADIUS),\n vFov : null,\n hFov : null,\n aspect : null,\n autorotateEnabled: false,\n animationPromise : null,\n loadingPromise : null,\n startTimeout : null,\n 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 },\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 * @summary Main render controller\n * @type {PSV.services.Renderer}\n * @readonly\n */\n this.renderer = new Renderer(this);\n\n /**\n * @summary Textures loader\n * @type {PSV.services.TextureLoader}\n * @readonly\n */\n this.textureLoader = new TextureLoader(this);\n\n /**\n * @summary Main event handler\n * @type {PSV.services.EventsHandler}\n * @readonly\n */\n this.eventsHandler = new EventsHandler(this);\n\n /**\n * @summary Utilities to help converting data\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\n this.needsUpdate();\n this.trigger(EVENTS.ZOOM_UPDATED, value);\n }, 0, 100),\n\n position: new MultiDynamic({\n longitude: new Dynamic(null),\n latitude : new Dynamic(null, -Math.PI / 2, Math.PI / 2),\n }, (position) => {\n this.dataHelper.sphericalCoordsToVector3(position, this.prop.direction);\n this.needsUpdate();\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\n // init buttons\n this.navbar.setButtons(this.config.navbar);\n\n // load panorama\n if (this.config.panorama) {\n this.setPanorama(this.config.panorama);\n }\n\n SYSTEM.isTouchEnabled.then(enabled => toggleClass(this.container, 'psv--is-touch', enabled));\n\n // enable GUI after first render\n this.once(EVENTS.RENDER, () => {\n if (this.config.navbar) {\n this.container.classList.add('psv--has-navbar');\n this.navbar.show();\n }\n\n // Queue autorotate\n if (this.config.autorotateDelay) {\n this.prop.startTimeout = setTimeout(() => this.startAutorotate(), this.config.autorotateDelay);\n }\n\n this.prop.ready = true;\n\n setTimeout(() => {\n this.refreshUi('init');\n\n this.trigger(EVENTS.READY);\n }, 0);\n });\n }\n\n /**\n * @summary Destroys the viewer\n * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible.\n */\n destroy() {\n this.__stopAll();\n this.stopKeyboardControl();\n this.exitFullscreen();\n\n this.eventsHandler.destroy();\n this.renderer.destroy();\n this.textureLoader.destroy();\n this.dataHelper.destroy();\n this.adapter.destroy();\n\n this.children.slice().forEach(child => child.destroy());\n this.children.length = 0;\n\n each(this.plugins, plugin => plugin.destroy());\n delete this.plugins;\n\n this.parent.removeChild(this.container);\n delete this.parent[VIEWER_DATA];\n\n delete this.parent;\n delete this.container;\n\n delete this.loader;\n delete this.navbar;\n delete this.panel;\n delete this.tooltip;\n delete this.notification;\n delete this.overlay;\n\n delete this.config;\n }\n\n /**\n * @summary Refresh UI\n * @package\n */\n refreshUi(reason) {\n if (!this.prop.ready) {\n return;\n }\n\n if (!this.prop.uiRefresh) {\n // console.log(`PhotoSphereViewer: UI Refresh, ${reason}`);\n\n this.prop.uiRefresh = true;\n\n this.children.every((child) => {\n child.refreshUi();\n return this.prop.uiRefresh === true;\n });\n\n this.prop.uiRefresh = false;\n }\n else if (this.prop.uiRefresh !== 'new') {\n this.prop.uiRefresh = 'new';\n\n // wait for current refresh to cancel\n setTimeout(() => {\n this.prop.uiRefresh = false;\n this.refreshUi(reason);\n });\n }\n }\n\n /**\n * @summary Returns the instance of a plugin if it exists\n * @param {Class|string} pluginId\n * @returns {PSV.plugins.AbstractPlugin}\n */\n getPlugin(pluginId) {\n if (typeof pluginId === 'string') {\n return this.plugins[pluginId];\n }\n else {\n const pluginCtor = pluginInterop(pluginId, AbstractPlugin);\n return pluginCtor ? this.plugins[pluginCtor.id] : undefined;\n }\n }\n\n /**\n * @summary Returns the current position of the camera\n * @returns {PSV.Position}\n */\n getPosition() {\n return this.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 {\n width : this.prop.size.width,\n height: this.prop.size.height,\n };\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 if (!this.renderer.mainReqid && this.renderer.renderer) {\n this.renderer.__renderLoop(+new Date());\n }\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.renderer.updateCameraMatrix();\n\n this.needsUpdate();\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}\n */\n setPanorama(path, options = {}) {\n if (this.prop.loadingPromise !== null) {\n this.textureLoader.abortLoading();\n }\n\n // apply default parameters on first load\n if (!this.prop.ready) {\n if (!('longitude' in options)) {\n options.longitude = this.config.defaultLong;\n }\n if (!('latitude' in options)) {\n options.latitude = this.config.defaultLat;\n }\n if (!('zoom' in options)) {\n options.zoom = this.config.defaultZoomLvl;\n }\n if (!('sphereCorrection' in options)) {\n options.sphereCorrection = this.config.sphereCorrection;\n }\n if (!('panoData' in options)) {\n options.panoData = this.config.panoData;\n }\n }\n\n if (options.transition === undefined || options.transition === true) {\n options.transition = 1500;\n }\n if (options.showLoader === undefined) {\n options.showLoader = true;\n }\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n if (positionProvided || zoomProvided) {\n this.__stopAll();\n }\n\n this.hideError();\n\n this.config.panorama = path;\n\n const done = (err) => {\n if (err && err.type === 'abort') {\n console.warn(err);\n }\n else if (err) {\n this.showError(this.config.lang.loadError);\n console.error(err);\n }\n\n this.loader.hide();\n this.renderer.show();\n\n this.prop.loadingPromise = null;\n\n if (err) {\n return Promise.reject(err);\n }\n else {\n return true;\n }\n };\n\n if (!options.transition || !this.prop.ready || !this.adapter.constructor.supportsTransition) {\n if (options.showLoader || !this.prop.ready) {\n this.loader.show();\n }\n\n this.prop.loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData)\n .then((textureData) => {\n this.renderer.setTexture(textureData);\n this.renderer.setPanoramaPose(textureData.panoData);\n this.renderer.setSphereCorrection(options.sphereCorrection);\n\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n if (positionProvided) {\n this.rotate(options);\n }\n })\n .then(done, done);\n }\n else {\n if (options.showLoader) {\n this.loader.show();\n }\n\n this.prop.loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData)\n .then((textureData) => {\n this.loader.hide();\n\n return this.renderer.transition(textureData, options);\n })\n .then(done, done);\n }\n\n return this.prop.loadingPromise;\n }\n\n /**\n * @summary Update options\n * @param {PSV.Options} options\n * @fires PSV.config-changed\n */\n setOptions(options) {\n each(options, (value, key) => {\n if (DEPRECATED_OPTIONS[key]) {\n logWarn(DEPRECATED_OPTIONS[key]);\n return;\n }\n\n if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) {\n throw new PSVError(`Unknown option ${key}`);\n }\n\n if (READONLY_OPTIONS[key]) {\n throw new PSVError(READONLY_OPTIONS[key]);\n }\n\n if (CONFIG_PARSERS[key]) {\n this.config[key] = CONFIG_PARSERS[key](value, options);\n }\n else {\n this.config[key] = value;\n }\n\n switch (key) {\n case 'caption':\n this.navbar.setCaption(value);\n break;\n\n case 'size':\n this.resize(value);\n break;\n\n case 'sphereCorrection':\n this.renderer.setSphereCorrection(value);\n break;\n\n case 'navbar':\n case 'lang':\n this.navbar.setButtons(this.config.navbar);\n break;\n\n case 'moveSpeed':\n case 'zoomSpeed':\n this.__updateSpeeds();\n break;\n\n case 'minFov':\n case 'maxFov':\n this.dynamics.zoom.setValue(this.dataHelper.fovToZoomLevel(this.prop.vFov));\n this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel());\n break;\n\n case 'canvasBackground':\n this.renderer.canvasContainer.style.background = this.config.canvasBackground;\n break;\n\n default:\n break;\n }\n });\n\n this.needsUpdate();\n this.refreshUi('set options');\n\n this.trigger(EVENTS.CONFIG_CHANGED, Object.keys(options));\n }\n\n /**\n * @summary Update options\n * @param {string} option\n * @param {any} value\n * @fires PSV.config-changed\n */\n setOption(option, value) {\n this.setOptions({ [option]: value });\n }\n\n /**\n * @summary Starts the automatic rotation\n * @fires PSV.autorotate\n */\n startAutorotate() {\n this.__stopAll();\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 this.trigger(EVENTS.AUTOROTATE, true);\n }\n\n /**\n * @summary Stops the automatic rotation\n * @fires PSV.autorotate\n */\n stopAutorotate() {\n if (this.prop.startTimeout) {\n clearTimeout(this.prop.startTimeout);\n this.prop.startTimeout = null;\n }\n\n if (this.isAutorotateEnabled()) {\n this.dynamics.position.stop();\n\n this.prop.autorotateEnabled = false;\n\n this.trigger(EVENTS.AUTOROTATE, false);\n }\n }\n\n /**\n * @summary Starts or stops the automatic rotation\n * @fires PSV.autorotate\n */\n toggleAutorotate() {\n if (this.isAutorotateEnabled()) {\n this.stopAutorotate();\n }\n else {\n this.startAutorotate();\n }\n }\n\n /**\n * @summary Displays an error message\n * @param {string} message\n */\n showError(message) {\n this.overlay.show({\n id : IDS.ERROR,\n image : errorIcon,\n text : message,\n dissmisable: false,\n });\n }\n\n /**\n * @summary Hides the error message\n */\n hideError() {\n this.overlay.hide(IDS.ERROR);\n }\n\n /**\n * @summary Rotates the view to specific longitude and latitude\n * @param {PSV.ExtendedPosition} position\n * @fires PSV.before-rotate\n * @fires PSV.position-updated\n */\n rotate(position) {\n const e = this.trigger(EVENTS.BEFORE_ROTATE, position);\n if (e.isDefaultPrevented()) {\n return;\n }\n\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ROTATE_POSITION, this.dataHelper.cleanPosition(position));\n this.dynamics.position.setValue(cleanPosition);\n }\n\n /**\n * @summary Rotates and zooms the view with a smooth animation\n * @param {PSV.AnimateOptions} options - position and/or zoom level\n * @returns {PSV.Animation}\n */\n animate(options) {\n this.__stopAll();\n\n const positionProvided = isExtendedPosition(options);\n const zoomProvided = 'zoom' in options;\n\n const animProperties = {};\n let duration;\n\n // clean/filter position and compute duration\n if (positionProvided) {\n const cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options));\n const currentPosition = this.getPosition();\n\n // longitude offset for shortest arc\n const tOffset = getShortestArc(currentPosition.longitude, cleanPosition.longitude);\n\n animProperties.longitude = { start: currentPosition.longitude, end: currentPosition.longitude + tOffset };\n animProperties.latitude = { start: currentPosition.latitude, end: cleanPosition.latitude };\n\n duration = this.dataHelper.speedToDuration(options.speed, getAngle(currentPosition, cleanPosition));\n }\n\n // clean/filter zoom and compute duration\n if (zoomProvided) {\n const dZoom = Math.abs(options.zoom - this.getZoomLevel());\n\n animProperties.zoom = { start: this.getZoomLevel(), end: options.zoom };\n\n if (!duration) {\n // if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration\n duration = this.dataHelper.speedToDuration(options.speed, Math.PI / 4 * dZoom / 100);\n }\n }\n\n // if no animation needed\n if (!duration) {\n if (positionProvided) {\n this.rotate(options);\n }\n if (zoomProvided) {\n this.zoom(options.zoom);\n }\n\n return Animation.resolve();\n }\n\n this.prop.animationPromise = new Animation({\n properties: animProperties,\n duration : duration,\n easing : 'inOutSine',\n onTick : (properties) => {\n if (positionProvided) {\n this.rotate(properties);\n }\n if (zoomProvided) {\n this.zoom(properties.zoom);\n }\n },\n });\n\n return this.prop.animationPromise;\n }\n\n /**\n * @summary Stops the ongoing animation\n * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously.\n * @returns {Promise} Resolved when the animation has ben cancelled\n */\n stopAnimation() {\n if (this.prop.animationPromise) {\n return new Promise((resolve) => {\n this.prop.animationPromise.finally(resolve);\n this.prop.animationPromise.cancel();\n this.prop.animationPromise = null;\n });\n }\n else {\n return Promise.resolve();\n }\n }\n\n /**\n * @summary Zooms to a specific level between `max_fov` and `min_fov`\n * @param {number} level - new zoom level from 0 to 100\n * @fires PSV.zoom-updated\n */\n zoom(level) {\n this.dynamics.zoom.setValue(level);\n }\n\n /**\n * @summary Increases the zoom level\n * @param {number} [step=1]\n */\n zoomIn(step = 1) {\n this.dynamics.zoom.step(step);\n }\n\n /**\n * @summary Decreases the zoom level\n * @param {number} [step=1]\n */\n zoomOut(step = 1) {\n this.dynamics.zoom.step(-step);\n }\n\n /**\n * @summary Resizes the viewer\n * @param {PSV.CssSize} size\n */\n resize(size) {\n ['width', 'height'].forEach((dim) => {\n if (size && size[dim]) {\n if (/^[0-9.]+$/.test(size[dim])) {\n size[dim] += 'px';\n }\n this.parent.style[dim] = size[dim];\n }\n });\n\n this.autoSize();\n }\n\n /**\n * @summary Enters the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n enterFullscreen() {\n if (SYSTEM.fullscreenEvent) {\n requestFullscreen(this.container);\n }\n else {\n this.container.classList.add('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(true);\n }\n }\n\n /**\n * @summary Exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n exitFullscreen() {\n if (this.isFullscreenEnabled()) {\n if (SYSTEM.fullscreenEvent) {\n exitFullscreen();\n }\n else {\n this.container.classList.remove('psv-container--fullscreen');\n this.autoSize();\n this.eventsHandler.__fullscreenToggled(false);\n }\n }\n }\n\n /**\n * @summary Enters or exits the fullscreen mode\n * @fires PSV.fullscreen-updated\n */\n toggleFullscreen() {\n if (!this.isFullscreenEnabled()) {\n this.enterFullscreen();\n }\n else {\n this.exitFullscreen();\n }\n }\n\n /**\n * @summary Enables the keyboard controls (done automatically when entering fullscreen)\n */\n startKeyboardControl() {\n this.eventsHandler.enableKeyboard();\n }\n\n /**\n * @summary Disables the keyboard controls (done automatically when exiting fullscreen)\n */\n stopKeyboardControl() {\n this.eventsHandler.disableKeyboard();\n }\n\n /**\n * @summary Stops all current animations\n * @package\n */\n __stopAll() {\n this.stopAutorotate();\n this.stopAnimation();\n\n this.trigger(EVENTS.STOP_ALL);\n }\n\n /**\n * @summary Recomputes dynamics speeds\n * @private\n */\n __updateSpeeds() {\n this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50);\n this.dynamics.position.setSpeed(THREE.Math.degToRad(this.config.moveSpeed * 50));\n }\n\n}\n"],"names":["MOVE_THRESHOLD","DBLCLICK_DELAY","LONGTOUCH_DELAY","TWOFINGERSOVERLAY_DELAY","CTRLZOOM_TIMEOUT","INERTIA_WINDOW","SPHERE_RADIUS","VIEWER_DATA","ACTIONS","ROTATE_LAT_UP","ROTATE_LAT_DOWN","ROTATE_LONG_RIGHT","ROTATE_LONG_LEFT","ZOOM_IN","ZOOM_OUT","TOGGLE_AUTOROTATE","EVENTS","AUTOROTATE","BEFORE_RENDER","BEFORE_ROTATE","CLICK","CLOSE_PANEL","CONFIG_CHANGED","DOUBLE_CLICK","FULLSCREEN_UPDATED","HIDE_NOTIFICATION","HIDE_OVERLAY","HIDE_TOOLTIP","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","IDS","MENU","TWO_FINGERS","CTRL_ZOOM","ERROR","EASINGS","linear","t","inQuad","outQuad","inOutQuad","inCubic","outCubic","inOutCubic","inQuart","outQuart","inOutQuart","inQuint","outQuint","inOutQuint","inSine","Math","cos","PI","outSine","sin","inOutSine","inExpo","pow","outExpo","inOutExpo","inCirc","sqrt","outCirc","inOutCirc","KEY_CODES","Enter","Control","Escape","Space","PageUp","PageDown","ArrowLeft","ArrowUp","ArrowRight","ArrowDown","Delete","Plus","Minus","toggleClass","element","className","active","classList","currentClassName","getAttribute","currentActive","indexOf","regex","RegExp","undefined","length","replace","setAttribute","toggle","contains","add","remove","addClasses","split","forEach","name","removeClasses","hasParent","el","parent","test","parentNode","getClosest","selector","matches","msMatchesSelector","bind","SVGElement","parentElement","KEYMAP","MS_KEYMAP","Add","Del","Down","Esc","Left","Right","Spacebar","Subtract","Up","getEventKey","evt","key","keyCode","which","isFullscreenEnabled","elt","document","fullscreenElement","mozFullScreenElement","webkitFullscreenElement","msFullscreenElement","requestFullscreen","mozRequestFullScreen","webkitRequestFullscreen","msRequestFullscreen","call","exitFullscreen","mozCancelFullScreen","webkitExitFullscreen","msExitFullscreen","getStyle","prop","window","getComputedStyle","normalizeWheel","event","PIXEL_STEP","LINE_HEIGHT","PAGE_HEIGHT","spinX","spinY","pixelX","pixelY","detail","wheelDelta","wheelDeltaY","wheelDeltaX","axis","HORIZONTAL_AXIS","deltaY","deltaX","deltaMode","bound","x","min","max","isInteger","value","Number","isFinite","floor","sum","array","reduce","a","b","distance","p1","p2","y","getShortestArc","from","to","tCandidates","candidate","newCandidate","abs","Infinity","getAngle","position1","position2","acos","latitude","longitude","greatArcDistance","λ1","φ1","λ2","φ2","dasherize","str","s","i","toLowerCase","throttle","func","wait","self","args","result","timeout","previous","later","Date","now","apply","remaining","arguments","clearTimeout","setTimeout","isPlainObject","obj","Object","getPrototypeOf","proto","prototype","toString","deepmerge","target","src","first","merge","Array","isArray","e","keys","clone","isEmpty","constructor","each","object","callback","intersect","array1","array2","filter","isNil","val","firstNonNull","values","PSVError","message","Error","captureStackTrace","stack","create","pluginInterop","plugin","entries","p","logWarn","console","warn","isExtendedPosition","some","key1","key2","getXMPValue","data","attr","match","parseInt","isNaN","CSS_POSITIONS","top","bottom","left","right","center","parsePosition","tokens","toLocaleLowerCase","slice","xFirst","map","token","reverse","parsed","join","parseFloat","parseSpeed","speed","speedStr","trim","speedValue","speedUnit","THREE","degToRad","parseAngle","angle","zeroCenter","halfCircle","unit","createTexture","img","texture","Texture","needsUpdate","minFilter","LinearFilter","generateMipmaps","Animation","options","__cancelled","__resolved","__promise","Promise","resolve","reject","__resolve","__reject","easing","__start","delay","__delayTimeout","requestAnimationFrame","__run","timestamp","progress","duration","current","properties","start","end","onTick","then","onFulfilled","onRejected","cancel","catch","finally","onFinally","cancelAnimationFrame","AbstractComponent","psv","children","push","visible","container","createElement","appendChild","destroy","removeChild","childIdx","splice","child","refreshUi","every","uiRefresh","isVisible","hide","show","style","display","AbstractButton","navbar","collapsable","tabbable","id","enabled","supported","collapsed","width","offsetWidth","icon","__setIcon","config","lang","title","tabIndex","addEventListener","onClick","stopPropagation","checkSupported","supportedOrObject","isSupported","initial","promise","toggleActive","iconActive","refresh","disable","enable","collapse","uncollapse","innerHTML","querySelector","AutorotateButton","on","off","handleEvent","type","toggleAutorotate","play","playActive","CustomButton","random","substr","content","DownloadButton","link","href","panorama","download","click","FullscreenButton","toggleFullscreen","fullscreenIn","fullscreenOut","MenuButton","__hideMenu","__showMenu","panel","MENU_TEMPLATE","BUTTON_DATA","noMargin","clickHandler","li","buttonId","dataset","getButton","menuIcon","buttons","dataKey","menu","button","SYSTEM","loaded","pixelRatio","isWebGLSupported","isTouchEnabled","maxTextureWidth","mouseWheelEvent","fullscreenEvent","load","ctx","getWebGLCtx","devicePixelRatio","getMaxTextureWidth","getMouseWheelEvent","getFullscreenEvent","maxCanvasWidth","getMaxCanvasWidth","canvas","names","context","getContext","listener","removeEventListener","getParameter","MAX_TEXTURE_SIZE","maxWidth","height","fillStyle","fillRect","getImageData","onmousewheel","FULLSCREEN_EVT_MAP","validExits","exit","PressHandler","time","down","getTime","up","cb","elapsed","getOrientedArrow","direction","arrow","AbstractMoveButton","move","handler","__onMouseUp","__onMouseDown","__stopAll","dynamics","position","roll","stop","MoveDownButton","MoveLeftButton","MoveRightButton","MoveUpButton","AbstractZoomButton","zoom","ZoomInButton","zoomIn","ZoomOutButton","zoomOut","ZoomRangeButton","mousedown","mediaMinWidth","zoomRange","zoomValue","ready","__moveZoomValue","getZoomLevel","once","__stopZoomChange","__initZoomChangeWithMouse","__initZoomChangeByTouch","__changeZoomWithMouse","__changeZoomByTouch","size","level","__changeZoom","clientX","changedTouches","buttondown","preventDefault","userInput","getBoundingClientRect","zoomLevel","AbstractAdapter","loadTexture","newPanoData","createMesh","scale","setTexture","mesh","textureData","setTextureOpacity","opacity","supportsTransition","SPHERE_SEGMENTS","EquirectangularAdapter","useXmpData","textureLoader","loadImage","loader","setProgress","xmpPanoData","__loadXMP","panoData","fullWidth","fullHeight","croppedWidth","croppedHeight","croppedX","croppedY","poseHeading","posePitch","poseRoll","__createEquirectangularTexture","onProgress","loadFile","blob","__loadBlobAsString","binary","substring","reader","FileReader","onload","onerror","readAsText","finalImage","resizedPanoData","ratio","buffer","drawImage","geometry","SphereGeometry","material","MeshBasicMaterial","side","BackSide","Mesh","set","dispose","transparent","AbstractPlugin","EventEmitter","DEFAULTS","adapter","caption","loadingImg","loadingTxt","fisheye","minFov","maxFov","defaultZoomLvl","defaultLong","defaultLat","sphereCorrection","moveSpeed","zoomSpeed","autorotateDelay","autorotateSpeed","autorotateLat","moveInertia","mousewheel","mousemove","captureCursor","mousewheelCtrlKey","touchmoveTwoFingers","requestHeaders","canvasBackground","withCredentials","autorotate","fullscreen","twoFingers","ctrlZoom","loadError","keyboard","plugins","READONLY_OPTIONS","DEPRECATED_OPTIONS","zoomButtonIncrement","mousewheelSpeed","sphereCorrectionReorder","CONFIG_PARSERS","getConfig","tempConfig","hasOwnProperty","CaptionButton","notification","info","NavbarCaption","contentVisible","contentWidth","setCaption","html","availableWidth","AVAILABLE_BUTTONS","registerButton","Navbar","setButtons","item","__cleanButtons","warnNotFound","totalWidth","visibleButtons","collapsableButtons","Loader","clientWidth","tickness","lastChild","inner","round","maxHeight","clearRect","lineWidth","strokeStyle","beginPath","arc","stroke","Notification","trigger","Overlay","contentId","dissmisable","image","text","subtext","PANEL_MIN_WIDTH","Panel","mouseX","mouseY","keyHandler","resizer","closeBtn","__onTouchStart","__onMouseMove","__onTouchMove","scrollTop","focus","__startResize","__resize","touches","clientY","AbstractService","vector2","Vector2","vector3","Vector3","DataHelper","fovToZoomLevel","fov","temp","zoomLevelToFov","vFovToHFov","vFov","radToDeg","atan","tan","aspect","speedToDuration","textureCoordsToSphericalCoords","point","relativeX","relativeY","sphericalCoordsToTextureCoords","relativeLong","relativeLat","sphericalCoordsToVector3","vector","z","vector3ToSphericalCoords","phi","theta","atan2","viewerCoordsToVector3","viewerPoint","renderer","raycaster","setFromCamera","camera","intersects","intersectObjects","scene","vector3ToViewerCoords","vectorClone","project","sphericalCoordsToViewerCoords","cleanPosition","cleanSphereCorrection","pan","tilt","EventsHandler","state","keyboardEnabled","moving","zooming","startMouseX","startMouseY","mouseHistory","pinchDist","ctrlKeyDown","dblclickData","dblclickTimeout","longtouchTimeout","twofingersTimeout","ctrlZoomTimeout","__onResize","autoSize","init","__onKeyDown","__onKeyUp","__onTouchEnd","__fullscreenToggled","__onMouseEnter","__onMouseLeave","__onMouseWheel","enableKeyboard","disableKeyboard","overlay","__startMove","__stopMove","__move","__moveAbsolute","__click","__cancelLongTouch","__startMoveZoom","__stopMoveZoom","__cancelTwoFingersOverlay","gestureIcon","__moveZoom","mousewheelIcon","delta","step","force","startKeyboardControl","stopKeyboardControl","stopAutorotate","stopAnimation","__logMouseMove","__stopMoveInertia","norm","animationPromise","longtouch","boundingRect","rightclick","viewerX","viewerY","dataHelper","sphericalCoords","textureCoords","textureX","textureY","NaN","log","rotation","hFov","currentPosition","getPosition","rotate","containerRect","goto","Renderer","mainReqid","meshContainer","canvasContainer","background","cursor","setSize","__cleanTHREEScene","__renderLoop","d","update","render","lookAt","copy","multiplyScalar","negate","updateCameraMatrix","updateProjectionMatrix","__createScene","setPanoramaPose","setSphereCorrection","cleanCorrection","Raycaster","WebGLRenderer","alpha","setPixelRatio","PerspectiveCamera","Scene","Group","domElement","transition","positionProvided","zoomProvided","group","verticalAxis","rotateOnWorldAxis","horizontalAxis","cross","getWorldDirection","normalize","traverse","TextureLoader","requests","FileLoader","setResponseType","setWithCredentials","setRequestHeader","abortLoading","r","abort","url","request","rIdx","lengthComputable","newProgress","total","err","XMLHttpRequest","createElementNS","URL","revokeObjectURL","createObjectURL","preloadPanorama","LEFT_MAP","TOP_MAP","STATE","NONE","SHOWING","HIDING","Tooltip","pos","__onTransitionEnd","rect","tempPos","posClass","arrowTop","arrowLeft","__computeTooltipPosition","offset","newPos","propertyName","topBottom","box","TooltipRenderer","testTooltip","tooltip","Dynamic","fn","mode","STOP","speedMult","currentSpeed","setSpeed","POSITION","invert","INFINITE","setValue","next","dstStop","targetSpeed","MultiDynamic","positions","steps","rolls","hasUpdates","dynamic","Cache","Viewer","autorotateEnabled","loadingPromise","startTimeout","getElementById","eventsHandler","__updateSpeeds","__resizeRefresh","resize","opts","setPanorama","startAutorotate","reason","getPlugin","pluginId","pluginCtor","getSize","isAutorotateEnabled","clientHeight","path","showLoader","hideError","done","showError","error","setOptions","setOption","option","errorIcon","isDefaultPrevented","change","animate","animProperties","tOffset","dZoom","dim","enterFullscreen"],"mappings":";;;;;;;;;;;;EAAA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;EACO,IAAMA,cAAc,GAAG,CAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,eAAe,GAAG,GAAxB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,uBAAuB,GAAG,GAAhC;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,gBAAgB,GAAG,IAAzB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,cAAc,GAAG,GAAvB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,aAAa,GAAG,EAAtB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,WAAW,GAAG,mBAApB;EAEP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,OAAO,GAAG;EACrBC,EAAAA,aAAa,EAAM,kBADE;EAErBC,EAAAA,eAAe,EAAI,oBAFE;EAGrBC,EAAAA,iBAAiB,EAAE,sBAHE;EAIrBC,EAAAA,gBAAgB,EAAG,qBAJE;EAKrBC,EAAAA,OAAO,EAAY,QALE;EAMrBC,EAAAA,QAAQ,EAAW,SANE;EAOrBC,EAAAA,iBAAiB,EAAE;EAPE,CAAhB;EAUP;EACA;EACA;EACA;EACA;EACA;;EACO,IAAMC,MAAM,GAAG;EACpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YAPA;;EAQpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eAfA;;EAgBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,aAAa,EAAO,eAtBA;;EAuBpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OA7BA;;EA8BpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,WAAW,EAAS,aApCA;;EAqCpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,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;EACEC,EAAAA,iBAAiB,EAAG,mBA/DA;;EAgEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAtEA;;EAuEpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA7EA;;EA8EpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,UAAU,EAAU,YApFA;;EAqFpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,eAAe,EAAK,iBA1FA;;EA2FpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,gBAAgB,EAAI,kBAjGA;;EAkGpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,KAAK,EAAe,OAvGA;;EAwGpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,MAAM,EAAc,QA7GA;;EA8GpB;EACF;EACA;EACA;EACA;EACEC,EAAAA,iBAAiB,EAAG,mBAnHA;;EAoHpB;EACF;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cA1HA;;EA2HpB;EACF;EACA;EACA;EACA;EACA;EACA;EACEC,EAAAA,YAAY,EAAQ,cAlIA;;EAmIpB;EACF;EACA;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SAg2BE4nB,oBAh2BF,GAg2BE,gCAAuB;EACrB,SAAK2I,aAAL,CAAmB7J,cAAnB;EACD;EAED;EACF;EACA;EAt2BA;;EAAA,SAu2BEmB,mBAv2BF,GAu2BE,+BAAsB;EACpB,SAAK0I,aAAL,CAAmB5J,eAAnB;EACD;EAED;EACF;EACA;EACA;EA92BA;;EAAA,SA+2BE9Q,SA/2BF,GA+2BE,qBAAY;EACV,SAAKiS,cAAL;EACA,SAAKC,aAAL;EAEA,SAAKrH,OAAL,CAAarpB,MAAM,CAACqB,QAApB;EACD;EAED;EACF;EACA;EACA;EAz3BA;;EAAA,SA03BE83B,cA13BF,GA03BE,0BAAiB;EACf,SAAK1a,QAAL,CAAcS,IAAd,CAAmB4Y,QAAnB,CAA4B,KAAKngB,MAAL,CAAY4N,SAAZ,GAAwB,EAApD;EACA,SAAK9G,QAAL,CAAcC,QAAd,CAAuBoZ,QAAvB,CAAgCnlB,KAAK,CAAC5P,IAAN,CAAW6P,QAAX,CAAoB,KAAK+E,MAAL,CAAY2N,SAAZ,GAAwB,EAA5C,CAAhC;EACD,GA73BH;;EAAA;EAAA,EAA4Bb,mBAA5B;;;;;;;;;;;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/autorotate-keypoints.d.ts b/dist/plugins/autorotate-keypoints.d.ts new file mode 100644 index 000000000..f93dea8d3 --- /dev/null +++ b/dist/plugins/autorotate-keypoints.d.ts @@ -0,0 +1,32 @@ +import { ExtendedPosition, AbstractPlugin, Viewer } from 'photo-sphere-viewer'; + +/** + * @summary Definition of keypoints for automatic rotation, can be a position object, a marker id or an object with the following properties + */ +type AutorotateKeypoint = string | ExtendedPosition | { + markerId?: string; + position?: ExtendedPosition; + tooltip?: string | { content: string, position: string }; + pause?: number; +}; + +type AutorotateKeypointsPluginOptions = { + startFromClosest?: boolean; + keypoints?: AutorotateKeypoint[]; +} + +/** + * @summary Replaces the standard autorotate animation by a smooth transition between multiple points + */ +declare class AutorotateKeypointsPlugin extends AbstractPlugin { + + constructor(psv: Viewer, options: AutorotateKeypointsPluginOptions); + + /** + * @summary Changes the keypoints + */ + setKeypoints(keypoints: AutorotateKeypoint[]); + +} + +export { AutorotateKeypoint, AutorotateKeypointsPlugin, AutorotateKeypointsPluginOptions }; diff --git a/dist/plugins/autorotate-keypoints.js b/dist/plugins/autorotate-keypoints.js index b42f83a1d..bfdb75f05 100644 --- a/dist/plugins/autorotate-keypoints.js +++ b/dist/plugins/autorotate-keypoints.js @@ -1,14 +1,14 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.AutorotateKeypointsPlugin = factory(global.PhotoSphereViewer))); -}(this, (function (photoSphereViewer) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('photo-sphere-viewer')) : + typeof define === 'function' && define.amd ? define(['exports', 'photo-sphere-viewer'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.AutorotateKeypointsPlugin = {}), global.PhotoSphereViewer)); +}(this, (function (exports, photoSphereViewer) { 'use strict'; function _extends() { _extends = Object.assign || function (target) { @@ -31,7 +31,17 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -125,6 +135,8 @@ _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.AUTOROTATE, _assertThisInitialized(_this)); + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, _assertThisInitialized(_this)); + return _this; } @@ -132,6 +144,7 @@ _proto.destroy = function destroy() { this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.AUTOROTATE, this); + this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, this); delete this.keypoints; delete this.state; @@ -141,6 +154,8 @@ _proto.handleEvent = function handleEvent(e) { if (e.type === photoSphereViewer.CONSTANTS.EVENTS.AUTOROTATE) { this.__configure(); + } else if (e.type === photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER) { + this.__beforeRender(e.args[0]); } } /** @@ -161,12 +176,10 @@ if (this.keypoints) { this.keypoints.forEach(function (pt, i) { if (typeof pt === 'string') { - // eslint-disable-next-line no-param-reassign pt = { markerId: pt }; } else if (photoSphereViewer.utils.isExtendedPosition(pt)) { - // eslint-disable-next-line no-param-reassign pt = { position: pt }; @@ -204,15 +217,15 @@ ; _proto.__configure = function __configure() { - var _this3 = this; - if (!this.psv.isAutorotateEnabled() || !this.keypoints) { this.__hideTooltip(); this.state = {}; return; - } + } // cancel core rotation + + this.psv.dynamics.position.stop(); this.state = { idx: -1, curve: [], @@ -228,30 +241,34 @@ if (this.config.startFromClosest) { var _this$keypoints; + var currentPosition = serializePt(this.psv.getPosition()); + var index = this.__findMinIndex(this.keypoints, function (keypoint) { - return photoSphereViewer.utils.greatArcDistance(keypoint.position, serializePt(_this3.psv.prop.position)); + return photoSphereViewer.utils.greatArcDistance(keypoint.position, currentPosition); }); (_this$keypoints = this.keypoints).push.apply(_this$keypoints, this.keypoints.splice(0, index)); } + } + /** + * @private + */ + ; - var autorotateCb = function autorotateCb(e, timestamp) { + _proto.__beforeRender = function __beforeRender(timestamp) { + if (this.psv.isAutorotateEnabled()) { // initialisation - if (!_this3.state.startTime) { - _this3.state.endPt = serializePt(_this3.psv.prop.position); + if (!this.state.startTime) { + this.state.endPt = serializePt(this.psv.getPosition()); - _this3.__nextStep(); + this.__nextStep(); - _this3.state.startTime = timestamp; - _this3.state.lastTime = timestamp; + this.state.startTime = timestamp; + this.state.lastTime = timestamp; } - _this3.__nextFrame(timestamp); - }; - - this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, this.psv.prop.autorotateCb); - this.psv.prop.autorotateCb = autorotateCb; - this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, this.psv.prop.autorotateCb); + this.__nextFrame(timestamp); + } } /** * @private @@ -317,7 +334,8 @@ var workPoints = []; if (this.state.idx === -1) { - workPoints.push(serializePt(this.psv.prop.position), serializePt(this.psv.prop.position), this.keypoints[0].position, this.keypoints[1].position); + var currentPosition = serializePt(this.psv.getPosition()); + workPoints.push(currentPosition, currentPosition, this.keypoints[0].position, this.keypoints[1].position); } else { for (var i = -1; i < 3; i++) { var keypoint = this.state.idx + i < 0 ? this.keypoints[this.keypoints.length - 1] : this.keypoints[(this.state.idx + i) % this.keypoints.length]; @@ -500,10 +518,11 @@ return AutorotateKeypointsPlugin; }(photoSphereViewer.AbstractPlugin); - AutorotateKeypointsPlugin.id = 'autorotate-keypoints'; - return AutorotateKeypointsPlugin; + exports.AutorotateKeypointsPlugin = AutorotateKeypointsPlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=autorotate-keypoints.js.map diff --git a/dist/plugins/autorotate-keypoints.js.map b/dist/plugins/autorotate-keypoints.js.map index 8c5f4bc60..72cc9685f 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 { AbstractPlugin, CONSTANTS, PSVError, utils } from 'photo-sphere-viewer';\n\n/**\n * @typedef {PSV.ExtendedPosition|string|Object} PSV.plugins.AutorotateKeypointsPlugin.Keypoints\n * @summary Definition of keypoints for automatic rotation, can be a position object, a marker id or an object with the following properties\n * @property {string} [markerId]\n * @property {PSV.ExtendedPosition} [position]\n * @property {string|{content: string, position: string}} [tooltip]\n * @property {number} [pause=0]\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.Keypoints[]} keypoints\n */\n\n/**\n * @summary Number of steps between each points\n * @type {number}\n * @constant\n * @private\n */\nconst NUM_STEPS = 16;\n\nconst serializePt = position => [position.longitude, position.latitude];\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 default 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[]} startPt - start point of the current step\n * @property {number[]} endPt - 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 keypoints : null,\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = this.psv.getPlugin('markers');\n\n if (options?.keypoints) {\n this.setKeypoints(options.keypoints);\n }\n\n this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this);\n }\n\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this);\n\n delete this.keypoints;\n delete this.state;\n\n super.destroy();\n }\n\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.AUTOROTATE) {\n this.__configure();\n }\n }\n\n /**\n * @summary Changes the keypoints\n * @param {PSV.plugins.AutorotateKeypointsPlugin.Keypoints[]} 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 // eslint-disable-next-line no-param-reassign\n pt = { markerId: pt };\n }\n else if (utils.isExtendedPosition(pt)) {\n // eslint-disable-next-line no-param-reassign\n pt = { position: pt };\n }\n if (pt.markerId) {\n if (!this.markers) {\n throw new PSVError(`Keypoint #${i} references a marker but 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 this.state = {\n idx : -1,\n curve : [],\n startPt : null,\n endPt : 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 index = this.__findMinIndex(this.keypoints, (keypoint) => {\n return utils.greatArcDistance(keypoint.position, serializePt(this.psv.prop.position));\n });\n\n this.keypoints.push(...this.keypoints.splice(0, index));\n }\n\n const autorotateCb = (e, timestamp) => {\n // initialisation\n if (!this.state.startTime) {\n this.state.endPt = serializePt(this.psv.prop.position);\n this.__nextStep();\n\n this.state.startTime = timestamp;\n this.state.lastTime = timestamp;\n }\n\n this.__nextFrame(timestamp);\n };\n\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this.psv.prop.autorotateCb);\n this.psv.prop.autorotateCb = autorotateCb;\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this.psv.prop.autorotateCb);\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 // one point before and two points before current\n const workPoints = [];\n if (this.state.idx === -1) {\n workPoints.push(\n serializePt(this.psv.prop.position),\n serializePt(this.psv.prop.position),\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 workPoints2 = [workPoints[0].slice(0)];\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 workPoints2[0][0] -= k * 2 * Math.PI;\n k = 0;\n }\n workPoints2.push([workPoints[i][0] + k * 2 * Math.PI, workPoints[i][1]]);\n }\n\n // only keep the curve for the current movement\n this.state.curve = this.__getCurvePoints(workPoints2, 0.6, NUM_STEPS)\n .slice(NUM_STEPS, NUM_STEPS * 2);\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.endPt[0] = utils.parseAngle(this.state.endPt[0]);\n }\n\n // target next point\n this.state.startPt = this.state.endPt;\n this.state.endPt = this.state.curve.shift();\n\n // compute duration from distance and speed\n const distance = utils.greatArcDistance(this.state.startPt, this.state.endPt);\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.startPt[0] + (this.state.endPt[0] - this.state.startPt[0]) * progress,\n latitude : this.state.startPt[1] + (this.state.endPt[1] - this.state.startPt[1]) * progress,\n }, true);\n }\n\n /**\n * @summary Interpolate curvature points using cardinal spline\n * {@link https://stackoverflow.com/a/15528789/1207670}\n * @param {number[][]} pts\n * @param {number} [tension=0.5]\n * @param {number} [numOfSegments=16]\n * @returns {number[][]}\n * @private\n */\n __getCurvePoints(pts, tension = 0.5, numOfSegments = 16) {\n const res = [];\n\n // The algorithm require a previous and next point to the actual point array.\n const _pts = pts.slice(0);\n _pts.unshift(pts[0]);\n _pts.push(pts[pts.length - 1]);\n\n // 1. loop through each point\n // 2. loop through each segment\n for (let i = 1; i < _pts.length - 2; i++) {\n // calc tension vectors\n const t1x = (_pts[i + 1][0] - _pts[i - 1][0]) * tension;\n const t2x = (_pts[i + 2][0] - _pts[i][0]) * tension;\n\n const t1y = (_pts[i + 1][1] - _pts[i - 1][1]) * tension;\n const t2y = (_pts[i + 2][1] - _pts[i][1]) * tension;\n\n for (let t = 1; t <= numOfSegments; t++) {\n // calc step\n const st = t / numOfSegments;\n\n const st3 = Math.pow(st, 3);\n const st2 = Math.pow(st, 2);\n\n // calc cardinals\n const c1 = 2 * st3 - 3 * st2 + 1;\n const c2 = -2 * st3 + 3 * st2;\n const c3 = st3 - 2 * st2 + st;\n const c4 = st3 - st2;\n\n // calc x and y cords with common control vectors\n const x = c1 * _pts[i][0] + c2 * _pts[i + 1][0] + c3 * t1x + c4 * t2x;\n const y = c1 * _pts[i][1] + c2 * _pts[i + 1][1] + c3 * t1y + c4 * t2y;\n\n // store points in array\n res.push([x, y]);\n }\n }\n\n return res;\n }\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","getPlugin","setKeypoints","on","CONSTANTS","EVENTS","AUTOROTATE","destroy","off","handleEvent","e","type","__configure","length","PSVError","utils","clone","forEach","pt","i","markerId","isExtendedPosition","marker","getMarker","props","dataHelper","cleanPosition","tooltip","content","isAutorotateEnabled","__hideTooltip","idx","curve","startPt","endPt","startTime","stepDuration","remainingPause","lastTime","index","__findMinIndex","keypoint","greatArcDistance","prop","push","splice","autorotateCb","timestamp","__nextStep","__nextFrame","BEFORE_RENDER","__incrementIdx","__showTooltip","vector3ToViewerCoords","direction","create","top","y","left","x","showTooltip","hide","hideTooltip","__nextPoint","workPoints","workPoints2","slice","k","d","Math","PI","__getCurvePoints","pause","parseAngle","shift","distance","abs","autorotateSpeed","ellapsed","max","progress","rotate","pts","tension","numOfSegments","res","_pts","unshift","t1x","t2x","t1y","t2y","t","st","st3","pow","st2","c1","c2","c3","c4","array","mapper","current","Number","MAX_VALUE","item","value","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EACA,IAAMA,SAAS,GAAG,EAAlB;;EAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAAAC,QAAQ;EAAA,SAAI,CAACA,QAAQ,CAACC,SAAV,EAAqBD,QAAQ,CAACE,QAA9B,CAAJ;EAAA,CAA5B;EAGA;EACA;EACA;EACA;EACA;;;MACqBC;;;EAInB;EACF;EACA;EACA;EACE,qCAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EACxB,uCAAMD,GAAN;EAEA;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACI,UAAKE,KAAL,GAAa,EAAb;EAEA;EACJ;EACA;E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vB,GAAwCgF,EAAE,GAAGT,GAA7C,GAAmDU,EAAE,GAAGT,GAAlE,CAfuC;;EAkBvCN,QAAAA,GAAG,CAACzC,IAAJ,CAAS,CAACe,CAAD,EAAIF,CAAJ,CAAT;EACD;EACF;;EAED,WAAO4B,GAAP;EACD;;WAED7C,iBAAA,wBAAe6D,KAAf,EAAsBC,MAAtB,EAA8B;EAC5B,QAAIvE,GAAG,GAAG,CAAV;EACA,QAAIwE,OAAO,GAAGC,MAAM,CAACC,SAArB;EAEAJ,IAAAA,KAAK,CAACpF,OAAN,CAAc,UAACyF,IAAD,EAAOvF,CAAP,EAAa;EACzB,UAAMwF,KAAK,GAAGL,MAAM,GAAGA,MAAM,CAACI,IAAD,CAAT,GAAkBA,IAAtC;;EACA,UAAIC,KAAK,GAAGJ,OAAZ,EAAqB;EACnBA,QAAAA,OAAO,GAAGI,KAAV;EACA5E,QAAAA,GAAG,GAAGZ,CAAN;EACD;EACF,KAND;EAQA,WAAOY,GAAP;EACD;;;IA3YoD6E;;EAAlCnH,0BAEZoH,KAAK;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"autorotate-keypoints.js","sources":["../../src/plugins/autorotate-keypoints/index.js"],"sourcesContent":["import { AbstractPlugin, CONSTANTS, PSVError, utils } from '../..';\n\n/**\n * @typedef {PSV.ExtendedPosition|string|Object} PSV.plugins.AutorotateKeypointsPlugin.Keypoints\n * @summary Definition of keypoints for automatic rotation, can be a position object, a marker id or an object with the following properties\n * @property {string} [markerId]\n * @property {PSV.ExtendedPosition} [position]\n * @property {string|{content: string, position: string}} [tooltip]\n * @property {number} [pause=0]\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.Keypoints[]} keypoints\n */\n\n/**\n * @summary Number of steps between each points\n * @type {number}\n * @constant\n * @private\n */\nconst NUM_STEPS = 16;\n\nconst serializePt = position => [position.longitude, position.latitude];\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[]} startPt - start point of the current step\n * @property {number[]} endPt - 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 keypoints : null,\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = this.psv.getPlugin('markers');\n\n if (options?.keypoints) {\n this.setKeypoints(options.keypoints);\n }\n\n this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n }\n\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this);\n this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this);\n\n delete this.keypoints;\n delete this.state;\n\n super.destroy();\n }\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.Keypoints[]} 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 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 startPt : null,\n endPt : 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.endPt = 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 // one point before and two points before current\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 workPoints2 = [workPoints[0].slice(0)];\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 workPoints2[0][0] -= k * 2 * Math.PI;\n k = 0;\n }\n workPoints2.push([workPoints[i][0] + k * 2 * Math.PI, workPoints[i][1]]);\n }\n\n // only keep the curve for the current movement\n this.state.curve = this.__getCurvePoints(workPoints2, 0.6, NUM_STEPS)\n .slice(NUM_STEPS, NUM_STEPS * 2);\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.endPt[0] = utils.parseAngle(this.state.endPt[0]);\n }\n\n // target next point\n this.state.startPt = this.state.endPt;\n this.state.endPt = this.state.curve.shift();\n\n // compute duration from distance and speed\n const distance = utils.greatArcDistance(this.state.startPt, this.state.endPt);\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.startPt[0] + (this.state.endPt[0] - this.state.startPt[0]) * progress,\n latitude : this.state.startPt[1] + (this.state.endPt[1] - this.state.startPt[1]) * progress,\n }, true);\n }\n\n /**\n * @summary Interpolate curvature points using cardinal spline\n * {@link https://stackoverflow.com/a/15528789/1207670}\n * @param {number[][]} pts\n * @param {number} [tension=0.5]\n * @param {number} [numOfSegments=16]\n * @returns {number[][]}\n * @private\n */\n __getCurvePoints(pts, tension = 0.5, numOfSegments = 16) {\n const res = [];\n\n // The algorithm require a previous and next point to the actual point array.\n const _pts = pts.slice(0);\n _pts.unshift(pts[0]);\n _pts.push(pts[pts.length - 1]);\n\n // 1. loop through each point\n // 2. loop through each segment\n for (let i = 1; i < _pts.length - 2; i++) {\n // calc tension vectors\n const t1x = (_pts[i + 1][0] - _pts[i - 1][0]) * tension;\n const t2x = (_pts[i + 2][0] - _pts[i][0]) * tension;\n\n const t1y = (_pts[i + 1][1] - _pts[i - 1][1]) * tension;\n const t2y = (_pts[i + 2][1] - _pts[i][1]) * tension;\n\n for (let t = 1; t <= numOfSegments; t++) {\n // calc step\n const st = t / numOfSegments;\n\n const st3 = Math.pow(st, 3);\n const st2 = Math.pow(st, 2);\n\n // calc cardinals\n const c1 = 2 * st3 - 3 * st2 + 1;\n const c2 = -2 * st3 + 3 * st2;\n const c3 = st3 - 2 * st2 + st;\n const c4 = st3 - st2;\n\n // calc x and y cords with common control vectors\n const x = c1 * _pts[i][0] + c2 * _pts[i + 1][0] + c3 * t1x + c4 * t2x;\n const y = c1 * _pts[i][1] + c2 * _pts[i + 1][1] + c3 * t1y + c4 * t2y;\n\n // store points in array\n res.push([x, y]);\n }\n }\n\n return res;\n }\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","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","startPt","endPt","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","workPoints2","slice","k","d","Math","PI","__getCurvePoints","pause","parseAngle","shift","distance","abs","autorotateSpeed","ellapsed","max","progress","rotate","pts","tension","numOfSegments","res","_pts","unshift","t1x","t2x","t1y","t2y","t","st","st3","pow","st2","c1","c2","c3","c4","array","mapper","current","Number","MAX_VALUE","item","value","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;EACA;;EACA,IAAMA,SAAS,GAAG,EAAlB;;EAEA,IAAMC,WAAW,GAAG,SAAdA,WAAc,CAAAC,QAAQ;EAAA,SAAI,CAACA,QAAQ,CAACC,SAAV,EAAqBD,QAAQ,CAACE,QAA9B,CAAJ;EAAA,CAA5B;EAGA;EACA;EACA;EACA;EACA;;;MACaC,yBAAb;EAAA;;EAIE;EACF;EACA;EACA;EACE,qCAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EACxB,uCAAMD,GAAN;EAEA;EACJ;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACI,UAAKE,KAAL,GAAa,EAAb;EAEA;EACJ;EACA;EACA;;EACI,UAAKC,MAAL;EACEC,MAAAA,gBAAgB,EAAE;EADpB,OAEKH,OAFL;EAGEI,MAAAA,SAAS,EAAS;EAHpB;EAMA;EACJ;EACA;EACA;;EACI,UAAKC,OAAL,GAAe,MAAKN,GAAL,CAASO,SAAT,CAAmB,SAAnB,CAAf;;EAEA,QAAIN,OAAJ,YAAIA,OAAO,CAAEI,SAAb,EAAwB;EACtB,YAAKG,YAAL,CAAkBP,OAAO,CAACI,SAA1B;EACD;;EAED,UAAKL,GAAL,CAASS,EAAT,CAAYC,2BAAS,CAACC,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T,GAAlE,CAfuC;;EAkBvCN,QAAAA,GAAG,CAACxC,IAAJ,CAAS,CAACc,CAAD,EAAIF,CAAJ,CAAT;EACD;EACF;;EAED,WAAO4B,GAAP;EACD,GArYH;;EAAA,SAuYE3C,cAvYF,GAuYE,wBAAe2D,KAAf,EAAsBC,MAAtB,EAA8B;EAC5B,QAAIvE,GAAG,GAAG,CAAV;EACA,QAAIwE,OAAO,GAAGC,MAAM,CAACC,SAArB;EAEAJ,IAAAA,KAAK,CAACtF,OAAN,CAAc,UAAC2F,IAAD,EAAOzF,CAAP,EAAa;EACzB,UAAM0F,KAAK,GAAGL,MAAM,GAAGA,MAAM,CAACI,IAAD,CAAT,GAAkBA,IAAtC;;EACA,UAAIC,KAAK,GAAGJ,OAAZ,EAAqB;EACnBA,QAAAA,OAAO,GAAGI,KAAV;EACA5E,QAAAA,GAAG,GAAGd,CAAN;EACD;EACF,KAND;EAQA,WAAOc,GAAP;EACD,GApZH;;EAAA;EAAA,EAA+C6E,gCAA/C;EAAaxH,0BAEJyH,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/gyroscope.d.ts b/dist/plugins/gyroscope.d.ts new file mode 100644 index 000000000..e625efb94 --- /dev/null +++ b/dist/plugins/gyroscope.d.ts @@ -0,0 +1,48 @@ +import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; +import { Event } from 'uevent'; + +type GyroscopePluginOptions = { + touchmove?: boolean; + absolutePosition?: boolean; +}; + +/** + * @summary Adds gyroscope controls on mobile devices + */ +declare class GyroscopePlugin extends AbstractPlugin { + + static EVENTS: { + GYROSCOPE_UPDATED: 'gyroscope-updated', + }; + + constructor(psv: Viewer, options: GyroscopePluginOptions); + + /** + * @summary Checks if the gyroscope is enabled + */ + isEnabled(): boolean; + + /** + * @summary Enables the gyroscope navigation if available + * @throws {PSVError} if the gyroscope API is not available/granted + */ + start(): Promise; + + /** + * @summary Disables the gyroscope navigation + */ + stop(); + + /** + * @summary Enables or disables the gyroscope navigation + */ + toggle(); + + /** + * @summary Triggered when the gyroscope mode is enabled/disabled + */ + on(e: 'gyroscope-updated', cb: (e: Event, enabled: boolean) => void): this; + +} + +export { GyroscopePlugin, GyroscopePluginOptions }; diff --git a/dist/plugins/gyroscope.js b/dist/plugins/gyroscope.js index 3ee726819..ee7461137 100644 --- a/dist/plugins/gyroscope.js +++ b/dist/plugins/gyroscope.js @@ -1,14 +1,14 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer'), require('three')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer', 'three'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.GyroscopePlugin = factory(global.PhotoSphereViewer, global.THREE))); -}(this, (function (photoSphereViewer, THREE) { 'use strict'; + 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'; function _extends() { _extends = Object.assign || function (target) { @@ -31,7 +31,17 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -42,112 +52,116 @@ return self; } - /** - * W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html) - */ + const _zee = new THREE.Vector3(0, 0, 1); - var DeviceOrientationControls = function DeviceOrientationControls(object) { - var scope = this; - var changeEvent = { - type: 'change' - }; - var EPS = 0.000001; - this.object = object; - this.object.rotation.reorder('YXZ'); - this.enabled = true; - this.deviceOrientation = {}; - this.screenOrientation = 0; - this.alphaOffset = 0; // radians - - var onDeviceOrientationChangeEvent = function onDeviceOrientationChangeEvent(event) { - scope.deviceOrientation = event; - }; + const _euler = new THREE.Euler(); - var onScreenOrientationChangeEvent = function onScreenOrientationChangeEvent() { - scope.screenOrientation = window.orientation || 0; - }; // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y'' + const _q0 = new THREE.Quaternion(); + const _q1 = new THREE.Quaternion(-Math.sqrt(0.5), 0, 0, Math.sqrt(0.5)); // - PI/2 around the x-axis - var setObjectQuaternion = function () { - var zee = new THREE.Vector3(0, 0, 1); - var euler = new THREE.Euler(); - 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 - return function (quaternion, alpha, beta, gamma, orient) { - euler.set(beta, alpha, -gamma, 'YXZ'); // 'ZXY' for the device, but 'YXZ' for us + const _changeEvent = { + type: 'change' + }; - quaternion.setFromEuler(euler); // orient the device + class DeviceOrientationControls extends THREE.EventDispatcher { + constructor(object) { + super(); - quaternion.multiply(q1); // camera looks out the back of the device, not the top + if (window.isSecureContext === false) { + console.error('THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)'); + } - quaternion.multiply(q0.setFromAxisAngle(zee, -orient)); // adjust for screen orientation + const scope = this; + const EPS = 0.000001; + const lastQuaternion = new THREE.Quaternion(); + this.object = object; + this.object.rotation.reorder('YXZ'); + this.enabled = true; + this.deviceOrientation = {}; + this.screenOrientation = 0; + this.alphaOffset = 0; // radians + + const onDeviceOrientationChangeEvent = function (event) { + scope.deviceOrientation = event; }; - }(); - this.connect = function () { - onScreenOrientationChangeEvent(); // run once on load - // iOS 13+ + const onScreenOrientationChangeEvent = function () { + scope.screenOrientation = window.orientation || 0; + }; // The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y'' - if (window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function') { - window.DeviceOrientationEvent.requestPermission().then(function (response) { - if (response == 'granted') { - window.addEventListener('orientationchange', onScreenOrientationChangeEvent); - window.addEventListener('deviceorientation', onDeviceOrientationChangeEvent); - } - }).catch(function (error) { - console.error('THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error); - }); - } else { - window.addEventListener('orientationchange', onScreenOrientationChangeEvent); - window.addEventListener('deviceorientation', onDeviceOrientationChangeEvent); - } - scope.enabled = true; - }; + const setObjectQuaternion = function (quaternion, alpha, beta, gamma, orient) { + _euler.set(beta, alpha, -gamma, 'YXZ'); // 'ZXY' for the device, but 'YXZ' for us - this.disconnect = function () { - window.removeEventListener('orientationchange', onScreenOrientationChangeEvent); - window.removeEventListener('deviceorientation', onDeviceOrientationChangeEvent); - scope.enabled = false; - }; - this.update = function () { - var lastQuaternion = new THREE.Quaternion(); - return function () { + quaternion.setFromEuler(_euler); // orient the device + + quaternion.multiply(_q1); // camera looks out the back of the device, not the top + + quaternion.multiply(_q0.setFromAxisAngle(_zee, -orient)); // adjust for screen orientation + }; + + this.connect = function () { + onScreenOrientationChangeEvent(); // run once on load + // iOS 13+ + + if (window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function') { + window.DeviceOrientationEvent.requestPermission().then(function (response) { + if (response == 'granted') { + window.addEventListener('orientationchange', onScreenOrientationChangeEvent); + window.addEventListener('deviceorientation', onDeviceOrientationChangeEvent); + } + }).catch(function (error) { + console.error('THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error); + }); + } else { + window.addEventListener('orientationchange', onScreenOrientationChangeEvent); + window.addEventListener('deviceorientation', onDeviceOrientationChangeEvent); + } + + scope.enabled = true; + }; + + this.disconnect = function () { + window.removeEventListener('orientationchange', onScreenOrientationChangeEvent); + window.removeEventListener('deviceorientation', onDeviceOrientationChangeEvent); + scope.enabled = false; + }; + + this.update = function () { if (scope.enabled === false) return; - var device = scope.deviceOrientation; + const device = scope.deviceOrientation; if (device) { - var alpha = device.alpha ? THREE.MathUtils.degToRad(device.alpha) + scope.alphaOffset : 0; // Z + const alpha = device.alpha ? THREE.MathUtils.degToRad(device.alpha) + scope.alphaOffset : 0; // Z - var beta = device.beta ? THREE.MathUtils.degToRad(device.beta) : 0; // X' + const beta = device.beta ? THREE.MathUtils.degToRad(device.beta) : 0; // X' - var gamma = device.gamma ? THREE.MathUtils.degToRad(device.gamma) : 0; // Y'' + const gamma = device.gamma ? THREE.MathUtils.degToRad(device.gamma) : 0; // Y'' - var orient = scope.screenOrientation ? THREE.MathUtils.degToRad(scope.screenOrientation) : 0; // O + const orient = scope.screenOrientation ? THREE.MathUtils.degToRad(scope.screenOrientation) : 0; // O setObjectQuaternion(scope.object.quaternion, alpha, beta, gamma, orient); if (8 * (1 - lastQuaternion.dot(scope.object.quaternion)) > EPS) { lastQuaternion.copy(scope.object.quaternion); - scope.dispatchEvent(changeEvent); + scope.dispatchEvent(_changeEvent); } } }; - }(); - this.dispose = function () { - scope.disconnect(); - }; + this.dispose = function () { + scope.disconnect(); + }; - this.connect(); - }; + this.connect(); + } - DeviceOrientationControls.prototype = Object.create(THREE.EventDispatcher.prototype); - DeviceOrientationControls.prototype.constructor = DeviceOrientationControls; + } - var compass = "\n"; + var compass = "\n"; /** * @summary Navigation bar gyroscope button class @@ -233,11 +247,6 @@ GyroscopeButton.id = 'gyroscope'; GyroscopeButton.icon = compass; - /** - * @typedef {Object} external:THREE.DeviceOrientationControls - * @summary {@link https://github.com/mrdoob/three.js/blob/dev/examples/jsm/controls/DeviceOrientationControls.js} - */ - /** * @typedef {Object} PSV.plugins.GyroscopePlugin.Options * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`) @@ -248,6 +257,7 @@ photoSphereViewer.DEFAULTS.navbar.splice(-1, 0, GyroscopeButton.id); photoSphereViewer.DEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope'; photoSphereViewer.registerButton(GyroscopeButton); + var direction = new THREE.Vector3(); /** * @summary Adds gyroscope controls on mobile devices * @extends PSV.plugins.AbstractPlugin @@ -277,14 +287,14 @@ * @private * @property {Promise} isSupported - indicates of the gyroscope API is available * @property {number} alphaOffset - current alpha offset for gyroscope controls - * @property {Function} orientationCb - update callback of the device orientation + * @property {boolean} enabled * @property {boolean} config_moveInertia - original config "moveInertia" */ _this.prop = { isSupported: _this.__checkSupport(), alphaOffset: 0, - orientationCb: null, + enabled: false, config_moveInertia: true }; /** @@ -307,6 +317,8 @@ _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_ROTATE, _assertThisInitialized(_this)); + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, _assertThisInitialized(_this)); + return _this; } /** @@ -319,6 +331,7 @@ _proto.destroy = function destroy() { this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.STOP_ALL, this); this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_ROTATE, this); + this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, this); this.stop(); delete this.controls; delete this.prop; @@ -336,8 +349,13 @@ this.stop(); break; + case photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER: + this.__onBeforeRender(); + + break; + case photoSphereViewer.CONSTANTS.EVENTS.BEFORE_ROTATE: - this.__onRotate(e); + this.__onBeforeRotate(e); break; } @@ -349,7 +367,7 @@ ; _proto.isEnabled = function isEnabled() { - return !!this.prop.orientationCb; + return this.prop.enabled; } /** * @summary Enables the gyroscope navigation if available @@ -381,16 +399,20 @@ _this2.prop.config_moveInertia = _this2.psv.config.moveInertia; - _this2.psv.config.moveInertia = false; + _this2.psv.config.moveInertia = false; // enable gyro controls + + if (!_this2.controls) { + _this2.controls = new DeviceOrientationControls(new THREE.Object3D()); + } else { + _this2.controls.connect(); + } // force reset - _this2.__configure(); - /** - * @event gyroscope-updated - * @memberof PSV.plugins.GyroscopePlugin - * @summary Triggered when the gyroscope mode is enabled/disabled - * @param {boolean} enabled - */ + _this2.controls.deviceOrientation = null; + _this2.controls.screenOrientation = 0; + _this2.controls.alphaOffset = 0; + _this2.prop.alphaOffset = _this2.config.absolutePosition ? 0 : null; + _this2.prop.enabled = true; _this2.trigger(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, true); }); @@ -404,8 +426,7 @@ _proto.stop = function stop() { if (this.isEnabled()) { this.controls.disconnect(); - this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, this.prop.orientationCb); - this.prop.orientationCb = null; + this.prop.enabled = false; this.psv.config.moveInertia = this.prop.config_moveInertia; this.trigger(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, false); } @@ -423,61 +444,39 @@ } } /** - * @summary Attaches the {@link external:THREE.DeviceOrientationControls} to the camera + * @summary Handles gyro movements * @private */ ; - _proto.__configure = function __configure() { - var _this3 = this; - - if (!this.controls) { - this.controls = new DeviceOrientationControls(this.psv.renderer.camera); - } else { - this.controls.connect(); - } // force reset - - - this.controls.deviceOrientation = null; - this.controls.screenOrientation = 0; - this.controls.alphaOffset = 0; - this.prop.alphaOffset = this.config.absolutePosition ? 0 : null; - - this.prop.orientationCb = function () { - if (!_this3.controls.deviceOrientation) { - return; - } // on first run compute the offset depending on the current viewer position and device orientation - - - if (_this3.prop.alphaOffset === null) { - _this3.controls.update(); - - var direction = new THREE.Vector3(); - - _this3.psv.renderer.camera.getWorldDirection(direction); - - var sphericalCoords = _this3.psv.dataHelper.vector3ToSphericalCoords(direction); - - _this3.prop.alphaOffset = sphericalCoords.longitude - _this3.psv.prop.position.longitude; - } else { - _this3.controls.alphaOffset = _this3.prop.alphaOffset; - - _this3.controls.update(); + _proto.__onBeforeRender = function __onBeforeRender() { + if (!this.isEnabled()) { + return; + } - _this3.psv.renderer.camera.getWorldDirection(_this3.psv.prop.direction); + if (!this.controls.deviceOrientation) { + return; + } // on first run compute the offset depending on the current viewer position and device orientation - _this3.psv.prop.direction.multiplyScalar(photoSphereViewer.CONSTANTS.SPHERE_RADIUS); - var _sphericalCoords = _this3.psv.dataHelper.vector3ToSphericalCoords(_this3.psv.prop.direction); + if (this.prop.alphaOffset === null) { + this.controls.update(); + this.controls.object.getWorldDirection(direction); + var sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction); + this.prop.alphaOffset = sphericalCoords.longitude - this.psv.getPosition().longitude; + } else { + this.controls.alphaOffset = this.prop.alphaOffset; + this.controls.update(); + this.controls.object.getWorldDirection(direction); - _this3.psv.prop.position.longitude = _sphericalCoords.longitude; - _this3.psv.prop.position.latitude = _sphericalCoords.latitude; + var _sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction); // TODO use dynamic goto for smooth movement - _this3.psv.needsUpdate(); - } - }; - this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.BEFORE_RENDER, this.prop.orientationCb); + this.psv.dynamics.position.setValue({ + longitude: _sphericalCoords.longitude, + latitude: -_sphericalCoords.latitude + }); + } } /** * @summary Intercepts moves and offsets the alpha angle @@ -486,12 +485,12 @@ */ ; - _proto.__onRotate = function __onRotate(e) { + _proto.__onBeforeRotate = function __onBeforeRotate(e) { if (this.isEnabled()) { e.preventDefault(); if (this.config.touchmove) { - this.prop.alphaOffset -= e.args[0].longitude - this.psv.prop.position.longitude; + this.prop.alphaOffset -= e.args[0].longitude - this.psv.getPosition().longitude; } } } @@ -541,13 +540,20 @@ return GyroscopePlugin; }(photoSphereViewer.AbstractPlugin); - GyroscopePlugin.id = 'gyroscope'; GyroscopePlugin.EVENTS = { + /** + * @event gyroscope-updated + * @memberof PSV.plugins.GyroscopePlugin + * @summary Triggered when the gyroscope mode is enabled/disabled + * @param {boolean} enabled + */ GYROSCOPE_UPDATED: 'gyroscope-updated' }; - return GyroscopePlugin; + exports.GyroscopePlugin = GyroscopePlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=gyroscope.js.map diff --git a/dist/plugins/gyroscope.js.map b/dist/plugins/gyroscope.js.map index ef056843d..1645a32c4 100644 --- a/dist/plugins/gyroscope.js.map +++ b/dist/plugins/gyroscope.js.map @@ -1 +1 @@ -{"version":3,"file":"gyroscope.js","sources":["../../three-examples/controls/DeviceOrientationControls.js","../../src/plugins/gyroscope/GyroscopeButton.js","../../src/plugins/gyroscope/index.js"],"sourcesContent":["import {\n\tEuler,\n\tEventDispatcher,\n\tMathUtils,\n\tQuaternion,\n\tVector3\n} from '../../../build/three.module.js';\n\n/**\n * W3C Device Orientation control (http://w3c.github.io/deviceorientation/spec-source-orientation.html)\n */\n\nvar DeviceOrientationControls = function ( object ) {\n\n\tvar scope = this;\n\tvar changeEvent = { type: 'change' };\n\tvar EPS = 0.000001;\n\n\tthis.object = object;\n\tthis.object.rotation.reorder( 'YXZ' );\n\n\tthis.enabled = true;\n\n\tthis.deviceOrientation = {};\n\tthis.screenOrientation = 0;\n\n\tthis.alphaOffset = 0; // radians\n\n\tvar onDeviceOrientationChangeEvent = function ( event ) {\n\n\t\tscope.deviceOrientation = event;\n\n\t};\n\n\tvar onScreenOrientationChangeEvent = function () {\n\n\t\tscope.screenOrientation = window.orientation || 0;\n\n\t};\n\n\t// The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n\n\tvar setObjectQuaternion = function () {\n\n\t\tvar zee = new Vector3( 0, 0, 1 );\n\n\t\tvar euler = new Euler();\n\n\t\tvar q0 = new Quaternion();\n\n\t\tvar q1 = new Quaternion( - Math.sqrt( 0.5 ), 0, 0, Math.sqrt( 0.5 ) ); // - PI/2 around the x-axis\n\n\t\treturn function ( quaternion, alpha, beta, gamma, orient ) {\n\n\t\t\teuler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us\n\n\t\t\tquaternion.setFromEuler( euler ); // orient the device\n\n\t\t\tquaternion.multiply( q1 ); // camera looks out the back of the device, not the top\n\n\t\t\tquaternion.multiply( q0.setFromAxisAngle( zee, - orient ) ); // adjust for screen orientation\n\n\t\t};\n\n\t}();\n\n\tthis.connect = function () {\n\n\t\tonScreenOrientationChangeEvent(); // run once on load\n\n\t\t// iOS 13+\n\n\t\tif ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {\n\n\t\t\twindow.DeviceOrientationEvent.requestPermission().then( function ( response ) {\n\n\t\t\t\tif ( response == 'granted' ) {\n\n\t\t\t\t\twindow.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n\t\t\t\t\twindow.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n\t\t\t\t}\n\n\t\t\t} ).catch( function ( error ) {\n\n\t\t\t\tconsole.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );\n\n\t\t\t} );\n\n\t\t} else {\n\n\t\t\twindow.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n\t\t\twindow.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n\t\t}\n\n\t\tscope.enabled = true;\n\n\t};\n\n\tthis.disconnect = function () {\n\n\t\twindow.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n\t\twindow.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n\t\tscope.enabled = false;\n\n\t};\n\n\tthis.update = ( function () {\n\n\t\tvar lastQuaternion = new Quaternion();\n\n\t\treturn function () {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tvar device = scope.deviceOrientation;\n\n\t\t\tif ( device ) {\n\n\t\t\t\tvar alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z\n\n\t\t\t\tvar beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'\n\n\t\t\t\tvar gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''\n\n\t\t\t\tvar orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O\n\n\t\t\t\tsetObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );\n\n\t\t\t\tif ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\t\tscope.dispatchEvent( changeEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\n\t} )();\n\n\tthis.dispose = function () {\n\n\t\tscope.disconnect();\n\n\t};\n\n\tthis.connect();\n\n};\n\nDeviceOrientationControls.prototype = Object.create( EventDispatcher.prototype );\nDeviceOrientationControls.prototype.constructor = DeviceOrientationControls;\n\nexport { DeviceOrientationControls };\n","import { AbstractButton } from 'photo-sphere-viewer';\nimport compass from './compass.svg';\nimport GyroscopePlugin from './index';\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(GyroscopePlugin.id);\n\n if (this.plugin) {\n this.plugin.on(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(GyroscopePlugin.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 === GyroscopePlugin.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 { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from 'photo-sphere-viewer';\nimport * as THREE from 'three';\nimport { DeviceOrientationControls } from 'three/examples/jsm/controls/DeviceOrientationControls';\nimport { GyroscopeButton } from './GyroscopeButton';\n\n/**\n * @typedef {Object} external:THREE.DeviceOrientationControls\n * @summary {@link https://github.com/mrdoob/three.js/blob/dev/examples/jsm/controls/DeviceOrientationControls.js}\n */\n\n/**\n * @typedef {Object} PSV.plugins.GyroscopePlugin.Options\n * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`)\n * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control\n */\n\n\n// add gyroscope button\nDEFAULTS.navbar.splice(-1, 0, GyroscopeButton.id);\nDEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope';\nregisterButton(GyroscopeButton);\n\n\n/**\n * @summary Adds gyroscope controls on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport default class GyroscopePlugin extends AbstractPlugin {\n\n static id = 'gyroscope';\n\n /**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GyroscopePlugin\n * @constant\n */\n static EVENTS = {\n GYROSCOPE_UPDATED: 'gyroscope-updated',\n };\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 {Function} orientationCb - update callback of the device orientation\n * @property {boolean} config_moveInertia - original config \"moveInertia\"\n */\n this.prop = {\n isSupported : this.__checkSupport(),\n alphaOffset : 0,\n orientationCb : null,\n config_moveInertia: true,\n };\n\n /**\n * @member {PSV.plugins.GyroscopePlugin.Options}\n * @private\n */\n this.config = {\n touchmove : true,\n absolutePosition: false,\n ...options,\n };\n\n /**\n * @member {external:THREE.DeviceOrientationControls}\n * @private\n */\n this.controls = null;\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.BEFORE_ROTATE, 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\n this.stop();\n\n delete this.controls;\n delete this.prop;\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_ROTATE:\n this.__onRotate(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.orientationCb;\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 this.__configure();\n\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 this.trigger(GyroscopePlugin.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.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this.prop.orientationCb);\n this.prop.orientationCb = null;\n\n this.psv.config.moveInertia = this.prop.config_moveInertia;\n\n this.trigger(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the gyroscope navigation\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Attaches the {@link external:THREE.DeviceOrientationControls} to the camera\n * @private\n */\n __configure() {\n if (!this.controls) {\n this.controls = new DeviceOrientationControls(this.psv.renderer.camera);\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 this.prop.alphaOffset = this.config.absolutePosition ? 0 : null;\n\n this.prop.orientationCb = () => {\n if (!this.controls.deviceOrientation) {\n return;\n }\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\n const direction = new THREE.Vector3();\n this.psv.renderer.camera.getWorldDirection(direction);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction);\n this.prop.alphaOffset = sphericalCoords.longitude - this.psv.prop.position.longitude;\n }\n else {\n this.controls.alphaOffset = this.prop.alphaOffset;\n this.controls.update();\n\n this.psv.renderer.camera.getWorldDirection(this.psv.prop.direction);\n this.psv.prop.direction.multiplyScalar(CONSTANTS.SPHERE_RADIUS);\n\n const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(this.psv.prop.direction);\n this.psv.prop.position.longitude = sphericalCoords.longitude;\n this.psv.prop.position.latitude = sphericalCoords.latitude;\n\n this.psv.needsUpdate();\n }\n };\n\n this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this.prop.orientationCb);\n }\n\n /**\n * @summary Intercepts moves and offsets the alpha angle\n * @param {external:uEvent.Event} e\n * @private\n */\n __onRotate(e) {\n if (this.isEnabled()) {\n e.preventDefault();\n\n if (this.config.touchmove) {\n this.prop.alphaOffset -= e.args[0].longitude - this.psv.prop.position.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\n // after 2 secs, auto-reject the promise\n setTimeout(listener, 2000);\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":["DeviceOrientationControls","object","scope","changeEvent","type","EPS","rotation","reorder","enabled","deviceOrientation","screenOrientation","alphaOffset","onDeviceOrientationChangeEvent","event","onScreenOrientationChangeEvent","window","orientation","setObjectQuaternion","zee","Vector3","euler","Euler","q0","Quaternion","q1","Math","sqrt","quaternion","alpha","beta","gamma","orient","set","setFromEuler","multiply","setFromAxisAngle","connect","DeviceOrientationEvent","undefined","requestPermission","then","response","addEventListener","catch","error","console","disconnect","removeEventListener","update","lastQuaternion","device","MathUtils","degToRad","dot","copy","dispatchEvent","dispose","prototype","Object","create","EventDispatcher","constructor","GyroscopeButton","navbar","plugin","psv","getPlugin","GyroscopePlugin","id","on","EVENTS","GYROSCOPE_UPDATED","destroy","off","isSupported","initial","promise","prop","handleEvent","e","toggleActive","args","onClick","toggle","AbstractButton","icon","compass","DEFAULTS","splice","lang","registerButton","options","__checkSupport","orientationCb","config_moveInertia","config","touchmove","absolutePosition","controls","CONSTANTS","STOP_ALL","BEFORE_ROTATE","stop","__onRotate","isEnabled","start","supported","__requestPermission","utils","logWarn","Promise","reject","granted","resolve","__stopAll","moveInertia","__configure","trigger","BEFORE_RENDER","renderer","camera","direction","THREE","getWorldDirection","sphericalCoords","dataHelper","vector3ToSphericalCoords","longitude","position","multiplyScalar","SPHERE_RADIUS","latitude","needsUpdate","preventDefault","DeviceMotionEvent","listener","isNaN","setTimeout","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA;EACA;EACA;;EAEA,IAAIA,yBAAyB,GAAG,SAA5BA,yBAA4B,CAAWC,MAAX,EAAoB;EAEnD,MAAIC,KAAK,GAAG,IAAZ;EACA,MAAIC,WAAW,GAAG;EAAEC,IAAAA,IAAI,EAAE;EAAR,GAAlB;EACA,MAAIC,GAAG,GAAG,QAAV;EAEA,OAAKJ,MAAL,GAAcA,MAAd;EACA,OAAKA,MAAL,CAAYK,QAAZ,CAAqBC,OAArB,CAA8B,KAA9B;EAEA,OAAKC,OAAL,GAAe,IAAf;EAEA,OAAKC,iBAAL,GAAyB,EAAzB;EACA,OAAKC,iBAAL,GAAyB,CAAzB;EAEA,OAAKC,WAAL,GAAmB,CAAnB,CAdmD;;EAgBnD,MAAIC,8BAA8B,GAAG,SAAjCA,8BAAiC,CAAWC,KAAX,EAAmB;EAEvDX,IAAAA,KAAK,CAACO,iBAAN,GAA0BI,KAA1B;EAEA,GAJD;;EAMA,MAAIC,8BAA8B,GAAG,SAAjCA,8BAAiC,GAAY;EAEhDZ,IAAAA,KAAK,CAACQ,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AAAA,UAAU,CAACF,QAAD,EAAW,IAAX,CAAV;EACD,OAXM,CAAP;EAYD,KAbI,MAcA;EACH,aAAOzB,OAAO,CAACG,OAAR,CAAgB,KAAhB,CAAP;EACD;EACF;EAED;EACF;EACA;EACA;EACA;;;WACEN,sBAAA,+BAAsB;EACpB,QAAI,uBAAuB5F,MAAvB,IAAiC,OAAOuH,iBAAiB,CAAC/F,iBAAzB,KAA+C,UAApF,EAAgG;EAC9F,aAAOF,sBAAsB,CAACE,iBAAvB,GACJC,IADI,CACC,UAAAC,QAAQ;EAAA,eAAIA,QAAQ,KAAK,SAAjB;EAAA,OADT,EAEJE,KAFI,CAEE;EAAA,eAAM,KAAN;EAAA,OAFF,CAAP;EAGD,KAJD,MAKK;EACH,aAAOmE,OAAO,CAACG,OAAR,CAAgB,IAAhB,CAAP;EACD;EACF;;;IArR0CyB;;EAAxBvE,gBAEZC,KAAK;EAFOD,gBAUZG,SAAS;EACdC,EAAAA,iBAAiB,EAAE;EADL;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"gyroscope.js","sources":["../../three-examples/controls/DeviceOrientationControls.js","../../src/plugins/gyroscope/GyroscopeButton.js","../../src/plugins/gyroscope/index.js"],"sourcesContent":["import {\n\tEuler,\n\tEventDispatcher,\n\tMathUtils,\n\tQuaternion,\n\tVector3\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\nconst _changeEvent = { type: 'change' };\n\nclass DeviceOrientationControls extends EventDispatcher {\n\n\tconstructor( object ) {\n\n\t\tsuper();\n\n\t\tif ( window.isSecureContext === false ) {\n\n\t\t\tconsole.error( 'THREE.DeviceOrientationControls: DeviceOrientationEvent is only available in secure contexts (https)' );\n\n\t\t}\n\n\t\tconst scope = this;\n\n\t\tconst EPS = 0.000001;\n\t\tconst lastQuaternion = new Quaternion();\n\n\t\tthis.object = object;\n\t\tthis.object.rotation.reorder( 'YXZ' );\n\n\t\tthis.enabled = true;\n\n\t\tthis.deviceOrientation = {};\n\t\tthis.screenOrientation = 0;\n\n\t\tthis.alphaOffset = 0; // radians\n\n\t\tconst onDeviceOrientationChangeEvent = function ( event ) {\n\n\t\t\tscope.deviceOrientation = event;\n\n\t\t};\n\n\t\tconst onScreenOrientationChangeEvent = function () {\n\n\t\t\tscope.screenOrientation = window.orientation || 0;\n\n\t\t};\n\n\t\t// The angles alpha, beta and gamma form a set of intrinsic Tait-Bryan angles of type Z-X'-Y''\n\n\t\tconst setObjectQuaternion = function ( quaternion, alpha, beta, gamma, orient ) {\n\n\t\t\t_euler.set( beta, alpha, - gamma, 'YXZ' ); // 'ZXY' for the device, but 'YXZ' for us\n\n\t\t\tquaternion.setFromEuler( _euler ); // orient the device\n\n\t\t\tquaternion.multiply( _q1 ); // camera looks out the back of the device, not the top\n\n\t\t\tquaternion.multiply( _q0.setFromAxisAngle( _zee, - orient ) ); // adjust for screen orientation\n\n\t\t};\n\n\t\tthis.connect = function () {\n\n\t\t\tonScreenOrientationChangeEvent(); // run once on load\n\n\t\t\t// iOS 13+\n\n\t\t\tif ( window.DeviceOrientationEvent !== undefined && typeof window.DeviceOrientationEvent.requestPermission === 'function' ) {\n\n\t\t\t\twindow.DeviceOrientationEvent.requestPermission().then( function ( response ) {\n\n\t\t\t\t\tif ( response == 'granted' ) {\n\n\t\t\t\t\t\twindow.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n\t\t\t\t\t\twindow.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n\t\t\t\t\t}\n\n\t\t\t\t} ).catch( function ( error ) {\n\n\t\t\t\t\tconsole.error( 'THREE.DeviceOrientationControls: Unable to use DeviceOrientation API:', error );\n\n\t\t\t\t} );\n\n\t\t\t} else {\n\n\t\t\t\twindow.addEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n\t\t\t\twindow.addEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n\t\t\t}\n\n\t\t\tscope.enabled = true;\n\n\t\t};\n\n\t\tthis.disconnect = function () {\n\n\t\t\twindow.removeEventListener( 'orientationchange', onScreenOrientationChangeEvent );\n\t\t\twindow.removeEventListener( 'deviceorientation', onDeviceOrientationChangeEvent );\n\n\t\t\tscope.enabled = false;\n\n\t\t};\n\n\t\tthis.update = function () {\n\n\t\t\tif ( scope.enabled === false ) return;\n\n\t\t\tconst device = scope.deviceOrientation;\n\n\t\t\tif ( device ) {\n\n\t\t\t\tconst alpha = device.alpha ? MathUtils.degToRad( device.alpha ) + scope.alphaOffset : 0; // Z\n\n\t\t\t\tconst beta = device.beta ? MathUtils.degToRad( device.beta ) : 0; // X'\n\n\t\t\t\tconst gamma = device.gamma ? MathUtils.degToRad( device.gamma ) : 0; // Y''\n\n\t\t\t\tconst orient = scope.screenOrientation ? MathUtils.degToRad( scope.screenOrientation ) : 0; // O\n\n\t\t\t\tsetObjectQuaternion( scope.object.quaternion, alpha, beta, gamma, orient );\n\n\t\t\t\tif ( 8 * ( 1 - lastQuaternion.dot( scope.object.quaternion ) ) > EPS ) {\n\n\t\t\t\t\tlastQuaternion.copy( scope.object.quaternion );\n\t\t\t\t\tscope.dispatchEvent( _changeEvent );\n\n\t\t\t\t}\n\n\t\t\t}\n\n\t\t};\n\n\t\tthis.dispose = function () {\n\n\t\t\tscope.disconnect();\n\n\t\t};\n\n\t\tthis.connect();\n\n\t}\n\n}\n\nexport { DeviceOrientationControls };\n","import { AbstractButton } from '../..';\nimport compass from './compass.svg';\nimport { GyroscopePlugin } from './index';\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(GyroscopePlugin.id);\n\n if (this.plugin) {\n this.plugin.on(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(GyroscopePlugin.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 === GyroscopePlugin.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 { DeviceOrientationControls } from 'three/examples/jsm/controls/DeviceOrientationControls';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from '../..';\nimport { GyroscopeButton } from './GyroscopeButton';\n\n\n/**\n * @typedef {Object} PSV.plugins.GyroscopePlugin.Options\n * @property {boolean} [touchmove=true] - allows to pan horizontally when the gyroscope is enabled (requires global `mousemove=true`)\n * @property {boolean} [absolutePosition=false] - when true the view will ignore the current direction when enabling gyroscope control\n */\n\n\n// add gyroscope button\nDEFAULTS.navbar.splice(-1, 0, GyroscopeButton.id);\nDEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope';\nregisterButton(GyroscopeButton);\n\nconst direction = new THREE.Vector3();\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 /**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.GyroscopePlugin\n * @constant\n */\n static 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\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.GyroscopePlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @member {Object}\n * @private\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {number} alphaOffset - current alpha offset for gyroscope controls\n * @property {boolean} enabled\n * @property {boolean} config_moveInertia - original config \"moveInertia\"\n */\n this.prop = {\n isSupported : this.__checkSupport(),\n alphaOffset : 0,\n enabled : false,\n config_moveInertia: true,\n };\n\n /**\n * @member {PSV.plugins.GyroscopePlugin.Options}\n * @private\n */\n this.config = {\n touchmove : true,\n absolutePosition: false,\n ...options,\n };\n\n /**\n * @member {external:THREE.DeviceOrientationControls}\n * @private\n */\n this.controls = null;\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 delete this.prop;\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(GyroscopePlugin.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(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the gyroscope navigation\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Handles gyro movements\n * @private\n */\n __onBeforeRender() {\n if (!this.isEnabled()) {\n return;\n }\n\n if (!this.controls.deviceOrientation) {\n return;\n }\n\n // 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 - this.psv.getPosition().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 // TODO use dynamic goto for smooth movement\n this.psv.dynamics.position.setValue({\n longitude: sphericalCoords.longitude,\n latitude : -sphericalCoords.latitude,\n });\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\n // after 2 secs, auto-reject the promise\n setTimeout(listener, 2000);\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":["_zee","Vector3","_euler","Euler","_q0","Quaternion","_q1","Math","sqrt","_changeEvent","type","DeviceOrientationControls","EventDispatcher","constructor","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","dispatchEvent","dispose","GyroscopeButton","navbar","plugin","psv","getPlugin","GyroscopePlugin","id","on","EVENTS","GYROSCOPE_UPDATED","destroy","off","isSupported","initial","promise","prop","handleEvent","e","toggleActive","args","onClick","toggle","AbstractButton","icon","compass","DEFAULTS","splice","lang","registerButton","direction","THREE","options","__checkSupport","config_moveInertia","config","touchmove","absolutePosition","controls","CONSTANTS","STOP_ALL","BEFORE_ROTATE","BEFORE_RENDER","stop","__onBeforeRender","__onBeforeRotate","isEnabled","start","supported","__requestPermission","utils","logWarn","Promise","reject","granted","resolve","__stopAll","moveInertia","Object3D","trigger","getWorldDirection","sphericalCoords","dataHelper","vector3ToSphericalCoords","longitude","getPosition","dynamics","position","setValue","latitude","preventDefault","DeviceMotionEvent","listener","isNaN","setTimeout","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAQA,MAAMA,IAAI,GAAG,IAAIC,aAAJ,CAAa,CAAb,EAAgB,CAAhB,EAAmB,CAAnB,CAAb;;EACA,MAAMC,MAAM,GAAG,IAAIC,WAAJ,EAAf;;EACA,MAAMC,GAAG,GAAG,IAAIC,gBAAJ,EAAZ;;EACA,MAAMC,GAAG,GAAG,IAAID,gBAAJ,CAAgB,CAAEE,IAAI,CAACC,IAAL,CAAW,GAAX,CAAlB,EAAoC,CAApC,EAAuC,CAAvC,EAA0CD,IAAI,CAACC,IAAL,CAAW,GAAX,CAA1C,CAAZ;;;EAEA,MAAMC,YAAY,GAAG;EAAEC,EAAAA,IAAI,EAAE;EAAR,CAArB;;EAEA,MAAMC,yBAAN,SAAwCC,qBAAxC,CAAwD;EAEvDC,EAAAA,WAAW,CAAEC,MAAF,EAAW;EAErB;;EAEA,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ACA;EACA;EACA;EA5QA;;EAAA,SA6QEN,mBA7QF,GA6QE,+BAAsB;EACpB,QAAI,uBAAuB7F,MAAvB,IAAiC,OAAOmH,iBAAiB,CAACrF,iBAAzB,KAA+C,UAApF,EAAgG;EAC9F,aAAOF,sBAAsB,CAACE,iBAAvB,GACJC,IADI,CACC,UAAAC,QAAQ;EAAA,eAAIA,QAAQ,KAAK,SAAjB;EAAA,OADT,EAEJE,KAFI,CAEE;EAAA,eAAM,KAAN;EAAA,OAFF,CAAP;EAGD,KAJD,MAKK;EACH,aAAO8D,OAAO,CAACG,OAAR,CAAgB,IAAhB,CAAP;EACD;EACF,GAtRH;;EAAA;EAAA,EAAqCoB,gCAArC;EAAarE,gBAEJC,KAAK;EAFDD,gBAUJG,SAAS;EACd;EACJ;EACA;EACA;EACA;EACA;EACIC,EAAAA,iBAAiB,EAAE;EAPL;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/markers.css b/dist/plugins/markers.css index ec8f40d49..426c97ce1 100644 --- a/dist/plugins/markers.css +++ b/dist/plugins/markers.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.2.1 + * Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/markers.d.ts b/dist/plugins/markers.d.ts new file mode 100644 index 000000000..520e2bffc --- /dev/null +++ b/dist/plugins/markers.d.ts @@ -0,0 +1,283 @@ +import { ExtendedPosition, AbstractPlugin, Viewer, Animation } from 'photo-sphere-viewer'; +import { Event } from 'uevent'; + +type MarkerType = + 'image' + | 'html' + | 'square' + | 'rect' + | 'circle' + | 'ellipse' + | 'path' + | 'polygonPx' + | 'polygonRad' + | 'polylinePx' + | 'polylineRad'; + +/** + * @summary Marker properties + */ +type MarkerProperties = Partial & { + image?: string; + html?: string; + square?: number; + rect?: [number, number] | { width: number, height: number }; + circle?: number; + ellipse?: [number, number] | { cx: number, cy: number }; + path?: string; + polygonPx?: [number, number][]; + polygonRad?: [number, number][]; + polylinePx?: [number, number][]; + polylineRad?: [number, number][]; + + id: string; + width?: number; + height?: number; + scale?: number | [number, number]; + className?: string; + style?: Record; + svgStyle?: Record; + anchor?: string; + visible?: boolean; + tooltip?: string | { content: string, position?: string }; + content?: string; + hideList?: boolean; + data?: any; +}; + +/** + * @summary Data of the `select-marker` event + */ +type SelectMarkerData = { + dblclick: boolean; + rightclick: boolean; +}; + +type MarkersPluginOptions = { + clickEventOnMarker?: boolean; + markers?: MarkerProperties[]; +}; + +/** + * @summary Object representing a marker + */ +declare class Marker { + + private constructor(); + + readonly id: string; + readonly type: MarkerType; + readonly visible: boolean; + readonly config: MarkerProperties; + readonly data?: any; + + /** + * @summary Checks if it is a normal marker (image or html) + */ + isNormal(): boolean; + + /** + * @summary Checks if it is a polygon/polyline marker + */ + isPoly(): boolean; + + /** + * @summary Checks if it is a polygon/polyline using pixel coordinates + */ + isPolyPx(): boolean; + + /** + * @summary Checks if it is a polygon/polyline using radian coordinates + */ + isPolyRad(): boolean; + + /** + * @summary Checks if it is a polygon marker + */ + isPolygon(): boolean; + + /** + * @summary Checks if it is a polyline marker + */ + isPolyline(): boolean; + + /** + * @summary Checks if it is an SVG marker + */ + isSvg(): boolean; + +} + +/** + * @summary Displays various markers on the viewer + */ +declare class MarkersPlugin extends AbstractPlugin { + + static EVENTS: { + GOTO_MARKER_DONE : 'goto-marker-done', + LEAVE_MARKER : 'leave-marker', + OVER_MARKER : 'over-marker', + RENDER_MARKERS_LIST: 'render-markers-list', + SELECT_MARKER : 'select-marker', + SELECT_MARKER_LIST : 'select-marker-list', + UNSELECT_MARKER : 'unselect-marker', + HIDE_MARKERS : 'hide-markers', + SHOW_MARKERS : 'show-markers', + }; + + constructor(psv: Viewer, options: MarkersPluginOptions); + + /** + * @summary Toggles the visibility of all tooltips + */ + toggleAllTooltips(); + + /** + * @summary Displays all tooltips + */ + showAllTooltips(); + + /** + * @summary Hides all tooltips + */ + hideAllTooltips(); + + /** + * @summary Return the total number of markers + * @returns {number} + */ + getNbMarkers(): number; + + /** + * @summary Adds a new marker to viewer + * @returns {PSV.plugins.MarkersPlugin.Marker} + * @throws {PSVError} when the marker's id is missing or already exists + */ + addMarker(properties: MarkerProperties, render?: boolean): Marker; + + /** + * @summary Returns the internal marker object for a marker id + * @throws {PSVError} when the marker cannot be found + */ + getMarker(markerId: string): Marker; + + /** + * @summary Returns the last marker selected by the user + */ + getCurrentMarker(): Marker; + + /** + * @summary Updates the existing marker with the same id + * @description Every property can be changed but you can't change its type (Eg: `image` to `html`). + */ + updateMarker(properties: MarkerProperties, render?: boolean): Marker; + + /** + * @summary Removes a marker from the viewer + */ + removeMarker(markerId: string, render?: boolean); + + /** + * @summary Replaces all markers + */ + setMarkers(markers: MarkerProperties[], render?: boolean); + + /** + * @summary Removes all markers + */ + clearMarkers(render?: boolean); + + /** + * @summary Rotate the view to face the marker + */ + gotoMarker(markerId: string, speed: string | number): Animation; + + /** + * @summary Hides a marker + */ + hideMarker(markerId: string); + + /** + * @summary Shows a marker + */ + showMarker(markerId: string); + + /** + * @summary Toggles a marker + */ + toggleMarker(markerId: string); + + /** + * @summary Opens the panel with the content of the marker + */ + showMarkerPanel(markerId: string); + + /** + * @summary Toggles the visibility of markers list + */ + toggleMarkersList(); + + /** + * @summary Opens side panel with list of markers + */ + showMarkersList(); + + /** + * @summary Closes side panel if it contains the list of markers + */ + hideMarkersList(); + + /** + * @summary Updates the visibility and the position of all markers + */ + renderMarkers(); + + /** + * @summary Triggered when the animation to a marker is done + */ + on(e: 'goto-marker-done', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when the user puts the cursor away from a marker + */ + on(e: 'leave-marker', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when the user puts the cursor hover a marker + */ + on(e: 'over-marker', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Used to alter the list of markers displayed on the side-panel + */ + on(e: 'render-markers-list', cb: (e: Event, markers: Marker[]) => Marker[]): this; + + /** + * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler + * with {@link MarkersPlugin.getCurrentMarker} + */ + on(e: 'select-marker', cb: (e: Event, marker: Marker, data: SelectMarkerData) => void): this; + + /** + * @summary Triggered when a marker is selected from the side panel + */ + on(e: 'select-marker-list', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when a marker was selected and the user clicks elsewhere + */ + on(e: 'unselect-marker', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when the markers are hidden + */ + on(e: 'hide-markers', cb: (e: Event) => void): this; + + /** + * @summary Triggered when the markers are shown + */ + on(e: 'show-markers', cb: (e: Event) => void): this; + +} + +export { Marker, MarkerProperties, MarkerType, MarkersPlugin, MarkersPluginOptions, SelectMarkerData }; diff --git a/dist/plugins/markers.js b/dist/plugins/markers.js index 854ba2f07..6c4f5da1d 100644 --- a/dist/plugins/markers.js +++ b/dist/plugins/markers.js @@ -1,14 +1,14 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer'), require('three')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer', 'three'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.MarkersPlugin = factory(global.PhotoSphereViewer, global.THREE))); -}(this, (function (photoSphereViewer, THREE) { 'use strict'; + 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'; function _extends() { _extends = Object.assign || function (target) { @@ -31,7 +31,17 @@ function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -679,10 +689,10 @@ }); } // clean angles else { - this.props.def = actualPoly.map(function (coord) { - return [photoSphereViewer.utils.parseAngle(coord[0]), photoSphereViewer.utils.parseAngle(coord[1], true)]; - }); - } + this.props.def = actualPoly.map(function (coord) { + return [photoSphereViewer.utils.parseAngle(coord[0]), photoSphereViewer.utils.parseAngle(coord[1], true)]; + }); + } var centroid = this.isPolygon() ? getPolygonCenter(this.props.def) : getPolylineCenter(this.props.def); this.props.position = { @@ -1157,12 +1167,6 @@ _proto.show = function show() { this.prop.visible = true; this.renderMarkers(); - /** - * @event show-markers - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the markers are shown - */ - this.trigger(MarkersPlugin.EVENTS.SHOW_MARKERS); } /** @@ -1174,12 +1178,6 @@ _proto.hide = function hide() { this.prop.visible = false; this.renderMarkers(); - /** - * @event hide-markers - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the markers are hidden - */ - this.trigger(MarkersPlugin.EVENTS.HIDE_MARKERS); } /** @@ -1405,12 +1403,6 @@ return this.psv.animate(_extends({}, marker.props.position, { speed: speed })).then(function () { - /** - * @event goto-marker-done - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the animation to a marker is done - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ _this4.trigger(MarkersPlugin.EVENTS.GOTO_MARKER_DONE, marker); }); } @@ -1491,14 +1483,6 @@ markers.push(marker); } }); - /** - * @event filter:render-markers-list - * @memberof PSV.plugins.MarkersPlugin - * @summary Used to alter the list of markers displayed on the side-panel - * @param {PSV.plugins.MarkersPlugin.Marker[]} markers - * @returns {PSV.plugins.MarkersPlugin.Marker[]} - */ - markers = this.change(MarkersPlugin.EVENTS.RENDER_MARKERS_LIST, markers); this.psv.panel.show({ id: MarkersPlugin.ID_PANEL_MARKERS_LIST, @@ -1510,13 +1494,6 @@ if (markerId) { var marker = _this5.getMarker(markerId); - /** - * @event select-marker-list - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when a marker is selected from the side panel - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ - _this5.trigger(MarkersPlugin.EVENTS.SELECT_MARKER_LIST, marker); @@ -1670,7 +1647,7 @@ } if (marker.isPoly()) { - return this.psv.dataHelper.vector3ToViewerCoords(this.psv.dataHelper.sphericalCoordsToVector3(marker.props.position)); + return this.psv.dataHelper.sphericalCoordsToViewerCoords(marker.props.position); } else { var position = this.psv.dataHelper.vector3ToViewerCoords(marker.props.positions3D[0]); position.x -= marker.props.width * marker.props.anchor.x * scale; @@ -1793,13 +1770,6 @@ if (marker && !marker.isPoly()) { this.prop.hoveringMarker = marker; - /** - * @event over-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the user puts the cursor hover a marker - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ - this.trigger(MarkersPlugin.EVENTS.OVER_MARKER, marker); if (!this.prop.showAllTooltips) { @@ -1820,12 +1790,6 @@ if (marker && !(marker.isPoly() && this.__targetOnTooltip(e.relatedTarget, marker.tooltip))) { - /** - * @event leave-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the user puts the cursor away from a marker - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.LEAVE_MARKER, marker); this.prop.hoveringMarker = null; @@ -1854,8 +1818,8 @@ marker = targetMarker; } // do not hide if we enter the tooltip itself while hovering a polygon else if (this.prop.hoveringMarker && this.__targetOnTooltip(e.target, this.prop.hoveringMarker.tooltip)) { - marker = this.prop.hoveringMarker; - } + marker = this.prop.hoveringMarker; + } if (marker) { if (!this.prop.hoveringMarker) { @@ -1907,15 +1871,6 @@ if (marker) { this.prop.currentMarker = marker; - /** - * @event select-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler - * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker} - * @param {PSV.plugins.MarkersPlugin.Marker} marker - * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data - */ - this.trigger(MarkersPlugin.EVENTS.SELECT_MARKER, marker, { dblclick: dblclick, rightclick: data.rightclick @@ -1933,12 +1888,6 @@ this.showMarkerPanel(marker.id); } } else if (this.prop.currentMarker) { - /** - * @event unselect-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when a marker was selected and the user clicks elsewhere - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.UNSELECT_MARKER, this.prop.currentMarker); this.psv.panel.hide(MarkersPlugin.ID_PANEL_MARKER); this.prop.currentMarker = null; @@ -1980,17 +1929,79 @@ return MarkersPlugin; }(photoSphereViewer.AbstractPlugin); - MarkersPlugin.id = 'markers'; MarkersPlugin.EVENTS = { + /** + * @event goto-marker-done + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the animation to a marker is done + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ GOTO_MARKER_DONE: 'goto-marker-done', + + /** + * @event leave-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the user puts the cursor away from a marker + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ LEAVE_MARKER: 'leave-marker', + + /** + * @event over-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the user puts the cursor hover a marker + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ OVER_MARKER: 'over-marker', + + /** + * @event filter:render-markers-list + * @memberof PSV.plugins.MarkersPlugin + * @summary Used to alter the list of markers displayed on the side-panel + * @param {PSV.plugins.MarkersPlugin.Marker[]} markers + * @returns {PSV.plugins.MarkersPlugin.Marker[]} + */ RENDER_MARKERS_LIST: 'render-markers-list', + + /** + * @event select-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler + * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker} + * @param {PSV.plugins.MarkersPlugin.Marker} marker + * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data + */ SELECT_MARKER: 'select-marker', + + /** + * @event select-marker-list + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when a marker is selected from the side panel + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ SELECT_MARKER_LIST: 'select-marker-list', + + /** + * @event unselect-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when a marker was selected and the user clicks elsewhere + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ UNSELECT_MARKER: 'unselect-marker', + + /** + * @event hide-markers + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the markers are hidden + */ HIDE_MARKERS: 'hide-markers', + + /** + * @event show-markers + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the markers are shown + */ SHOW_MARKERS: 'show-markers' }; MarkersPlugin.SVG_NS = 'http://www.w3.org/2000/svg'; @@ -2000,11 +2011,13 @@ MarkersPlugin.MARKERS_LIST_TEMPLATE = function (markers, title, dataKey) { return "\n
\n

" + icon + " " + title + "

\n
    \n " + markers.map(function (marker) { - return "\n
  • \n " + (marker.type === 'image' ? "" : '') + "\n " + marker.getListContent() + "\n
  • \n "; + return "\n
  • \n " + (marker.type === 'image' ? "" : '') + "\n " + marker.getListContent() + "\n
  • \n "; }).join('') + "\n
\n
\n"; }; - return MarkersPlugin; + exports.MarkersPlugin = MarkersPlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=markers.js.map diff --git a/dist/plugins/markers.js.map b/dist/plugins/markers.js.map index 6d790080b..dde93620f 100644 --- a/dist/plugins/markers.js.map +++ b/dist/plugins/markers.js.map @@ -1 +1 @@ -{"version":3,"file":"markers.js","sources":["../../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 { CONSTANTS, utils } from 'photo-sphere-viewer';\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 { CONSTANTS, PSVError, utils } from 'photo-sphere-viewer';\nimport MarkersPlugin from './index';\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 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 http://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}\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} inViewport\n * @property {boolean} dynamicSize\n * @property {PSV.Point} anchor\n * @property {PSV.Position} position - position in spherical coordinates\n * @property {PSV.Point} position2D - position in viewer coordinates\n * @property {external:THREE.Vector3[]} positions3D - positions in 3D space\n * @property {number} width\n * @property {number} height\n * @property {*} def\n */\n this.props = {\n inViewport : false,\n dynamicSize: false,\n anchor : null,\n position : null,\n position2D : null,\n positions3D: null,\n width : null,\n height : null,\n def : null,\n };\n\n // create element\n if (this.isNormal()) {\n this.$el = document.createElement('div');\n }\n else if (this.isPolygon()) {\n this.$el = document.createElementNS(MarkersPlugin.SVG_NS, 'polygon');\n }\n else if (this.isPolyline()) {\n this.$el = document.createElementNS(MarkersPlugin.SVG_NS, 'polyline');\n }\n else {\n this.$el = document.createElementNS(MarkersPlugin.SVG_NS, this.type);\n }\n\n this.$el.id = `psv-marker-${this.id}`;\n this.$el[MarkersPlugin.MARKER_DATA] = this;\n\n this.update(properties);\n }\n\n /**\n * @summary Destroys the marker\n */\n destroy() {\n delete this.$el[MarkersPlugin.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 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 * @returns {number}\n */\n getScale(zoomLevel) {\n if (Array.isArray(this.config.scale)) {\n return this.config.scale[0] + (this.config.scale[1] - this.config.scale[0]) * CONSTANTS.EASINGS.inQuad(zoomLevel / 100);\n }\n else if (typeof this.config.scale === 'function') {\n return this.config.scale(zoomLevel);\n }\n else if (typeof this.config.scale === 'number') {\n return this.config.scale * CONSTANTS.EASINGS.inQuad(zoomLevel / 100);\n }\n else {\n return 1;\n }\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) {\n return this.config.tooltip.content;\n }\n else if (this.config.html) {\n return this.config.html;\n }\n else {\n return this.id;\n }\n }\n\n /**\n * @summary Display the tooltip of this marker\n * @param {{clientX: number, clientY: number}} [mousePosition]\n */\n showTooltip(mousePosition) {\n if (this.visible && this.config.tooltip && this.props.position2D) {\n const config = {\n content : this.config.tooltip.content,\n position: this.config.tooltip.position,\n data : this,\n };\n\n if (this.isPoly()) {\n const boundingRect = this.psv.container.getBoundingClientRect();\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 - boundingRect.top - this.psv.tooltip.size.arrow / 2;\n config.left = mousePosition.clientX - boundingRect.left - this.psv.tooltip.size.arrow;\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n }\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n config.box = {\n width : this.props.width,\n height: this.props.height,\n };\n }\n\n if (this.tooltip) {\n this.tooltip.move(config);\n }\n else {\n this.tooltip = this.psv.tooltip.create(config);\n }\n }\n }\n\n /**\n * @summary Hides the tooltip of this marker\n */\n hideTooltip() {\n if (this.tooltip) {\n this.tooltip.hide();\n this.tooltip = null;\n }\n }\n\n /**\n * @summary Updates the marker with new properties\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n update(properties) {\n const newType = Marker.getType(properties, true);\n\n if (newType !== undefined && newType !== this.type) {\n throw new PSVError('cannot change marker type');\n }\n\n utils.deepmerge(this.config, properties);\n this.data = this.config.data;\n\n this.visible = properties.visible !== false;\n\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 if (this.config.tooltip) {\n utils.addClasses(this.$el, 'psv-marker--has-tooltip');\n if (typeof this.config.tooltip === 'string') {\n this.config.tooltip = { content: this.config.tooltip };\n }\n }\n if (this.config.content) {\n utils.addClasses(this.$el, 'psv-marler--has-content');\n }\n\n // apply style\n if (this.config.style) {\n utils.deepmerge(this.$el.style, this.config.style);\n }\n\n // parse anchor\n this.props.anchor = utils.parsePosition(this.config.anchor);\n\n if (this.isNormal()) {\n this.__updateNormal();\n }\n else if (this.isPoly()) {\n this.__updatePoly();\n }\n else {\n this.__updateSvg();\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 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 (type in properties) {\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 'photo-sphere-viewer';\nimport MarkersPlugin from './index';\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(MarkersPlugin.id);\n\n if (this.plugin) {\n this.plugin.on(MarkersPlugin.EVENTS.SHOW_MARKERS, this);\n this.plugin.on(MarkersPlugin.EVENTS.HIDE_MARKERS, this);\n\n this.toggleActive(true);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(MarkersPlugin.EVENTS.SHOW_MARKERS, this);\n this.plugin.off(MarkersPlugin.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 MarkersPlugin.EVENTS.SHOW_MARKERS: this.toggleActive(true); break;\n case MarkersPlugin.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 'photo-sphere-viewer';\nimport MarkersPlugin from './index';\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(MarkersPlugin.id);\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] === MarkersPlugin.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 { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer';\nimport * as THREE from 'three';\nimport { Marker } from './Marker';\nimport { MarkersButton } from './MarkersButton';\nimport { MarkersListButton } from './MarkersListButton';\nimport icon from './pin-list.svg';\nimport './style.scss';\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.navbar.splice(DEFAULTS.navbar.indexOf('caption'), 0, MarkersButton.id, MarkersListButton.id);\nDEFAULTS.lang[MarkersButton.id] = 'Markers';\nDEFAULTS.lang[MarkersListButton.id] = 'Markers list';\nregisterButton(MarkersButton);\nregisterButton(MarkersListButton);\n\n\n/**\n * @summary Displays various markers on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport default class MarkersPlugin extends AbstractPlugin {\n\n static id = 'markers';\n\n /**\n * @summary Available events\n * @enum {string}\n * @constant\n */\n static EVENTS = {\n GOTO_MARKER_DONE : 'goto-marker-done',\n LEAVE_MARKER : 'leave-marker',\n OVER_MARKER : 'over-marker',\n RENDER_MARKERS_LIST: 'render-markers-list',\n SELECT_MARKER : 'select-marker',\n SELECT_MARKER_LIST : 'select-marker-list',\n UNSELECT_MARKER : 'unselect-marker',\n HIDE_MARKERS : 'hide-markers',\n SHOW_MARKERS : 'show-markers',\n };\n\n /**\n * @summary Namespace for SVG creation\n * @type {string}\n * @constant\n */\n static SVG_NS = 'http://www.w3.org/2000/svg';\n\n /**\n * @summary Property name added to marker elements\n * @type {string}\n * @constant\n */\n static MARKER_DATA = 'psvMarker';\n\n /**\n * @summary Panel identifier for marker content\n * @type {string}\n * @constant\n */\n static ID_PANEL_MARKER = 'marker';\n\n /**\n * @summary Panel identifier for markers list\n * @type {string}\n * @constant\n */\n static ID_PANEL_MARKERS_LIST = 'markersList';\n\n /**\n * @summary Markers list template\n * @param {PSV.Marker[]} markers\n * @param {string} title\n * @param {string} dataKey\n * @returns {string}\n */\n static 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 /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.MarkersPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\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 this.psv.container.appendChild(this.container);\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 };\n\n /**\n * @type {PSV.plugins.MarkersPlugin.Options}\n */\n this.config = {\n clickEventOnMarker: false,\n ...options,\n };\n\n /**\n * @member {SVGElement}\n * @readonly\n */\n this.svgContainer = document.createElementNS(MarkersPlugin.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 // 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 (options?.markers) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.setMarkers(options.markers);\n });\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.clearMarkers(false);\n\n this.container.removeEventListener('mouseenter', this);\n this.container.removeEventListener('mouseleave', this);\n this.container.removeEventListener('mousemove', this);\n this.container.removeEventListener('contextmenu', this);\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 delete this.prop;\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); break;\n case 'mouseleave': this.__onMouseLeave(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'contextmenu': this.__onContextMenu(e); 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.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 * @override\n * @fires PSV.plugins.MarkersPlugin.show-markers\n */\n show() {\n this.prop.visible = true;\n\n this.renderMarkers();\n\n /**\n * @event show-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are shown\n */\n this.trigger(MarkersPlugin.EVENTS.SHOW_MARKERS);\n }\n\n /**\n * @override\n * @fires PSV.plugins.MarkersPlugin.hide-markers\n */\n hide() {\n this.prop.visible = false;\n\n this.renderMarkers();\n\n /**\n * @event hide-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are hidden\n */\n this.trigger(MarkersPlugin.EVENTS.HIDE_MARKERS);\n }\n\n /**\n * @summary Toggles the visibility of all tooltips\n */\n toggleAllTooltips() {\n this.prop.showAllTooltips = !this.prop.showAllTooltips;\n this.renderMarkers();\n }\n\n /**\n * @summary Displays all tooltips\n */\n showAllTooltips() {\n this.prop.showAllTooltips = true;\n this.renderMarkers();\n }\n\n /**\n * @summary Hides all tooltips\n */\n hideAllTooltips() {\n this.prop.showAllTooltips = false;\n this.renderMarkers();\n }\n\n /**\n * @summary Return the total number of markers\n * @returns {number}\n */\n getNbMarkers() {\n return Object.keys(this.markers).length;\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 {\n this.svgContainer.appendChild(marker.$el);\n }\n\n this.markers[marker.id] = marker;\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\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\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 {\n this.svgContainer.removeChild(marker.$el);\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 }\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 }\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 }\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 /**\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 this.trigger(MarkersPlugin.EVENTS.GOTO_MARKER_DONE, marker);\n });\n }\n\n /**\n * @summary Hides a marker\n * @param {string} markerId\n */\n hideMarker(markerId) {\n this.getMarker(markerId).visible = false;\n this.renderMarkers();\n }\n\n /**\n * @summary Shows a marker\n * @param {string} markerId\n */\n showMarker(markerId) {\n this.getMarker(markerId).visible = true;\n this.renderMarkers();\n }\n\n /**\n * @summary Toggles a marker\n * @param {string} markerId\n */\n toggleMarker(markerId) {\n this.getMarker(markerId).visible ^= true;\n this.renderMarkers();\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 : MarkersPlugin.ID_PANEL_MARKER,\n content: marker.config.content,\n });\n }\n else {\n this.psv.panel.hide(MarkersPlugin.ID_PANEL_MARKER);\n }\n }\n\n /**\n * @summary Toggles the visibility of markers list\n */\n toggleMarkersList() {\n if (this.psv.panel.prop.contentId === MarkersPlugin.ID_PANEL_MARKERS_LIST) {\n this.hideMarkersList();\n }\n else {\n this.showMarkersList();\n }\n }\n\n /**\n * @summary Opens side panel with 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 /**\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 markers = this.change(MarkersPlugin.EVENTS.RENDER_MARKERS_LIST, markers);\n\n this.psv.panel.show({\n id : MarkersPlugin.ID_PANEL_MARKERS_LIST,\n content : MarkersPlugin.MARKERS_LIST_TEMPLATE(\n markers,\n this.psv.config.lang.markers,\n utils.dasherize(MarkersPlugin.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[MarkersPlugin.MARKER_DATA] : undefined;\n\n if (markerId) {\n const marker = this.getMarker(markerId);\n\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 this.trigger(MarkersPlugin.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(MarkersPlugin.ID_PANEL_MARKERS_LIST);\n }\n\n /**\n * @summary Updates the visibility and the position of all markers\n */\n renderMarkers() {\n utils.each(this.markers, (marker) => {\n let isVisible = this.prop.visible && marker.visible;\n\n if (isVisible && marker.isPoly()) {\n const positions = this.__getPolyPositions(marker);\n isVisible = positions.length > (marker.isPolygon() ? 2 : 1);\n\n if (isVisible) {\n const position = this.__getMarkerPosition(marker);\n marker.props.position2D = position;\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 const scale = marker.getScale(this.psv.getZoomLevel());\n const position = this.__getMarkerPosition(marker, scale);\n isVisible = this.__isMarkerVisible(marker, position);\n\n if (isVisible) {\n marker.props.position2D = position;\n\n if (marker.isSvg()) {\n let transform = `translate(${position.x}, ${position.y})`;\n if (scale !== 1) {\n transform += ` scale(${scale}, ${scale})`;\n }\n\n marker.$el.setAttributeNS(null, 'transform', transform);\n }\n else {\n let transform = `translate3D(${position.x}px, ${position.y}px, 0px)`;\n if (scale !== 1) {\n transform += ` scale(${scale}, ${scale})`;\n }\n\n marker.$el.style.transform = transform;\n }\n }\n }\n\n marker.props.inViewport = isVisible;\n utils.toggleClass(marker.$el, 'psv-marker--visible', isVisible);\n\n if (marker.props.inViewport && (this.prop.showAllTooltips || (marker === this.prop.hoveringMarker && !marker.isPoly()))) {\n marker.showTooltip();\n }\n else if (!marker.props.inViewport || marker !== this.prop.hoveringMarker) {\n marker.hideTooltip();\n }\n });\n }\n\n /**\n * @summary Determines if a point marker is visible
\n * It tests if the point is in the general direction of the camera, then check if it's in the viewport\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.Point} position\n * @returns {boolean}\n * @private\n */\n __isMarkerVisible(marker, position) {\n return marker.props.positions3D[0].dot(this.psv.prop.direction) > 0\n && position.x + marker.props.width >= 0\n && position.x - marker.props.width <= this.psv.prop.size.width\n && position.y + marker.props.height >= 0\n && position.y - marker.props.height <= this.psv.prop.size.height;\n }\n\n /**\n * @summary Computes the real size of a marker\n * @description This is done by removing all it's transformations (if any) and making it visible\n * before querying its bounding rect\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __updateMarkerSize(marker) {\n utils.addClasses(marker.$el, 'psv-marker--transparent');\n\n let transform;\n if (marker.isSvg()) {\n transform = marker.$el.getAttributeNS(null, 'transform');\n marker.$el.removeAttributeNS(null, 'transform');\n }\n else {\n transform = marker.$el.style.transform;\n marker.$el.style.transform = '';\n }\n\n const rect = marker.$el.getBoundingClientRect();\n marker.props.width = rect.width;\n marker.props.height = rect.height;\n\n utils.removeClasses(marker.$el, 'psv-marker--transparent');\n\n if (transform) {\n if (marker.isSvg()) {\n marker.$el.setAttributeNS(null, 'transform', transform);\n }\n else {\n marker.$el.style.transform = transform;\n }\n }\n\n // the size is no longer dynamic once known\n marker.props.dynamicSize = false;\n }\n\n /**\n * @summary Computes viewer coordinates of a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {number} [scale=1]\n * @returns {PSV.Point}\n * @private\n */\n __getMarkerPosition(marker, scale = 1) {\n if (marker.isPoly()) {\n return this.psv.dataHelper.vector3ToViewerCoords(this.psv.dataHelper.sphericalCoordsToVector3(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 * scale;\n position.y -= marker.props.height * marker.props.anchor.y * scale;\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[MarkersPlugin.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 * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseEnter(e) {\n const marker = this.__getTargetMarker(e.target);\n\n if (marker && !marker.isPoly()) {\n this.prop.hoveringMarker = marker;\n\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 this.trigger(MarkersPlugin.EVENTS.OVER_MARKER, marker);\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n }\n\n /**\n * @summary Handles mouse leave events, hide the tooltip\n * @param {MouseEvent} e\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @private\n */\n __onMouseLeave(e) {\n const marker = this.__getTargetMarker(e.target);\n\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 /**\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 this.trigger(MarkersPlugin.EVENTS.LEAVE_MARKER, marker);\n\n this.prop.hoveringMarker = null;\n\n if (!this.prop.showAllTooltips) {\n marker.hideTooltip();\n }\n }\n }\n\n /**\n * @summary Handles mouse move events, refreshUi the tooltip for polygon markers\n * @param {MouseEvent} e\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseMove(e) {\n let marker;\n const targetMarker = this.__getTargetMarker(e.target);\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(MarkersPlugin.EVENTS.OVER_MARKER, marker);\n\n this.prop.hoveringMarker = marker;\n }\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n else if (this.prop.hoveringMarker?.isPoly()) {\n this.trigger(MarkersPlugin.EVENTS.LEAVE_MARKER, this.prop.hoveringMarker);\n\n if (!this.prop.showAllTooltips) {\n this.prop.hoveringMarker.hideTooltip();\n }\n\n this.prop.hoveringMarker = null;\n }\n }\n\n /**\n * @summary Handles context menu events\n * @param {MouseWheelEvent} evt\n * @private\n */\n __onContextMenu(evt) {\n if (!utils.getClosest(evt.target, '.psv-marker')) {\n return true;\n }\n\n evt.preventDefault();\n return false;\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 const marker = this.__getTargetMarker(data.target, true);\n\n if (marker) {\n this.prop.currentMarker = marker;\n\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 this.trigger(MarkersPlugin.EVENTS.SELECT_MARKER, marker, {\n dblclick : dblclick,\n rightclick: data.rightclick,\n });\n\n if (this.config.clickEventOnMarker) {\n // add the marker to event data\n data.marker = marker;\n }\n else {\n e.stopPropagation();\n }\n\n // the marker could have been deleted in an event handler\n if (this.markers[marker.id]) {\n this.showMarkerPanel(marker.id);\n }\n }\n else if (this.prop.currentMarker) {\n /**\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 this.trigger(MarkersPlugin.EVENTS.UNSELECT_MARKER, this.prop.currentMarker);\n\n this.psv.panel.hide(MarkersPlugin.ID_PANEL_MARKER);\n\n this.prop.currentMarker = null;\n }\n }\n\n /**\n * @summary Updates the visiblity of the panel and the buttons\n * @private\n */\n __refreshUi() {\n const nbMarkers = Object.values(this.markers).filter(m => !m.config.hideList).length;\n const markersButton = this.psv.navbar.getButton(MarkersButton.id, false);\n const markersListButton = this.psv.navbar.getButton(MarkersListButton.id, false);\n\n if (nbMarkers === 0) {\n markersButton?.hide();\n markersListButton?.hide();\n\n if (this.psv.panel.isVisible(MarkersPlugin.ID_PANEL_MARKERS_LIST)) {\n this.psv.panel.hide();\n }\n else if (this.psv.panel.isVisible(MarkersPlugin.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(MarkersPlugin.ID_PANEL_MARKERS_LIST)) {\n this.showMarkersList();\n }\n else if (this.psv.panel.isVisible(MarkersPlugin.ID_PANEL_MARKER)) {\n this.prop.currentMarker ? this.showMarkerPanel(this.prop.currentMarker) : this.psv.panel.hide();\n }\n }\n }\n\n}\n"],"names":["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","image","html","polygonPx","polygonRad","polylinePx","polylineRad","square","rect","circle","ellipse","path","Marker","properties","psv","id","PSVError","type","getType","visible","$el","config","data","undefined","tooltip","props","inViewport","dynamicSize","anchor","position","position2D","positions3D","width","height","def","isNormal","document","createElement","isPolygon","createElementNS","MarkersPlugin","SVG_NS","isPolyline","MARKER_DATA","update","destroy","isPoly","isPolyPx","isPolyRad","isSvg","getScale","zoomLevel","Array","isArray","scale","EASINGS","inQuad","getListContent","listContent","content","showTooltip","mousePosition","boundingRect","container","getBoundingClientRect","box","size","arrow","top","clientY","left","clientX","move","create","hideTooltip","hide","newType","deepmerge","setAttribute","className","addClasses","style","parsePosition","__updateNormal","__updatePoly","__updateSvg","isExtendedPosition","backgroundImage","innerHTML","transformOrigin","dataHelper","cleanPosition","sphericalCoordsToVector3","cx","cy","rx","ry","each","value","prop","setAttributeNS","svgStyle","dasherize","fill","actualPoly","splice","map","coord","sphericalCoords","textureCoordsToSphericalCoords","longitude","latitude","centroid","allowNone","found","Object","keys","join","MarkersButton","navbar","plugin","getPlugin","on","EVENTS","SHOW_MARKERS","HIDE_MARKERS","toggleActive","off","isSupported","handleEvent","e","onClick","show","AbstractButton","icon","pin","MarkersListButton","OPEN_PANEL","CLOSE_PANEL","args","ID_PANEL_MARKERS_LIST","toggleMarkersList","pinList","DEFAULTS","indexOf","lang","registerButton","options","cursor","mousemove","appendChild","markers","currentMarker","hoveringMarker","clickEventOnMarker","svgContainer","addEventListener","CLICK","DOUBLE_CLICK","RENDER","CONFIG_CHANGED","once","READY","setMarkers","clearMarkers","removeEventListener","removeChild","__onMouseEnter","__onMouseLeave","__onMouseMove","__onContextMenu","__onClick","renderMarkers","trigger","toggleAllTooltips","showAllTooltips","hideAllTooltips","getNbMarkers","addMarker","render","marker","__refreshUi","getMarker","markerId","getCurrentMarker","updateMarker","removeMarker","gotoMarker","speed","animate","then","GOTO_MARKER_DONE","hideMarker","showMarker","toggleMarker","showMarkerPanel","panel","ID_PANEL_MARKER","contentId","hideMarkersList","showMarkersList","hideList","change","RENDER_MARKERS_LIST","MARKERS_LIST_TEMPLATE","noMargin","clickHandler","li","target","getClosest","dataset","SELECT_MARKER_LIST","isVisible","positions","__getPolyPositions","__getMarkerPosition","points","pos","__updateMarkerSize","getZoomLevel","__isMarkerVisible","transform","toggleClass","dot","direction","getAttributeNS","removeAttributeNS","removeClasses","vector3ToViewerCoords","nbVectors","vector","toBeComputed","forEach","neighbours","neighbour","invisible","index","reverse","pair","__getPolyIntermediaryPoint","filter","P1","P2","C","clone","normalize","N","THREE","crossVectors","V","X","multiplyScalar","Y","H","addVectors","applyAxisAngle","__getTargetMarker","closest","target2","__targetOnTooltip","hasParent","OVER_MARKER","relatedTarget","LEAVE_MARKER","targetMarker","evt","preventDefault","dblclick","SELECT_MARKER","rightclick","stopPropagation","UNSELECT_MARKER","nbMarkers","values","m","markersButton","getButton","markersListButton","AbstractPlugin","title","dataKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACO,SAASA,yBAAT,CAAmCC,EAAnC,EAAuCC,EAAvC,EAA2CC,CAA3C,EAA8C;EAAA,MAC5CC,EAD4C,GAClCH,EADkC;EAAA,MACxCI,EADwC,GAClCJ,EADkC;EAAA,MAE5CK,EAF4C,GAElCJ,EAFkC;EAAA,MAExCK,EAFwC,GAElCL,EAFk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EhBqK,MAAM,CAACnK,IAAP,KAAgB,OAAhB,6DAA+EmK,MAAM,CAAC/J,MAAP,CAAcpB,KAA7F,mBAAiH,EAFjG,2DAGwBmL,MAAM,CAAC3H,cAAP,EAHxB;EAAA,GAAlB,EAKC4D,IALD,CAKM,EALN,CAJ2B;EAAA;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"markers.js","sources":["../../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 { 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 { CONSTANTS, PSVError, utils } from '../..';\nimport { MarkersPlugin } from './index';\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 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 http://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}\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} inViewport\n * @property {boolean} dynamicSize\n * @property {PSV.Point} anchor\n * @property {PSV.Position} position - position in spherical coordinates\n * @property {PSV.Point} position2D - position in viewer coordinates\n * @property {external:THREE.Vector3[]} positions3D - positions in 3D space\n * @property {number} width\n * @property {number} height\n * @property {*} def\n */\n this.props = {\n inViewport : false,\n dynamicSize: false,\n anchor : null,\n position : null,\n position2D : null,\n positions3D: null,\n width : null,\n height : null,\n def : null,\n };\n\n // create element\n if (this.isNormal()) {\n this.$el = document.createElement('div');\n }\n else if (this.isPolygon()) {\n this.$el = document.createElementNS(MarkersPlugin.SVG_NS, 'polygon');\n }\n else if (this.isPolyline()) {\n this.$el = document.createElementNS(MarkersPlugin.SVG_NS, 'polyline');\n }\n else {\n this.$el = document.createElementNS(MarkersPlugin.SVG_NS, this.type);\n }\n\n this.$el.id = `psv-marker-${this.id}`;\n this.$el[MarkersPlugin.MARKER_DATA] = this;\n\n this.update(properties);\n }\n\n /**\n * @summary Destroys the marker\n */\n destroy() {\n delete this.$el[MarkersPlugin.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 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 * @returns {number}\n */\n getScale(zoomLevel) {\n if (Array.isArray(this.config.scale)) {\n return this.config.scale[0] + (this.config.scale[1] - this.config.scale[0]) * CONSTANTS.EASINGS.inQuad(zoomLevel / 100);\n }\n else if (typeof this.config.scale === 'function') {\n return this.config.scale(zoomLevel);\n }\n else if (typeof this.config.scale === 'number') {\n return this.config.scale * CONSTANTS.EASINGS.inQuad(zoomLevel / 100);\n }\n else {\n return 1;\n }\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) {\n return this.config.tooltip.content;\n }\n else if (this.config.html) {\n return this.config.html;\n }\n else {\n return this.id;\n }\n }\n\n /**\n * @summary Display the tooltip of this marker\n * @param {{clientX: number, clientY: number}} [mousePosition]\n */\n showTooltip(mousePosition) {\n if (this.visible && this.config.tooltip && this.props.position2D) {\n const config = {\n content : this.config.tooltip.content,\n position: this.config.tooltip.position,\n data : this,\n };\n\n if (this.isPoly()) {\n const boundingRect = this.psv.container.getBoundingClientRect();\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 - boundingRect.top - this.psv.tooltip.size.arrow / 2;\n config.left = mousePosition.clientX - boundingRect.left - this.psv.tooltip.size.arrow;\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n }\n }\n else {\n config.top = this.props.position2D.y;\n config.left = this.props.position2D.x;\n config.box = {\n width : this.props.width,\n height: this.props.height,\n };\n }\n\n if (this.tooltip) {\n this.tooltip.move(config);\n }\n else {\n this.tooltip = this.psv.tooltip.create(config);\n }\n }\n }\n\n /**\n * @summary Hides the tooltip of this marker\n */\n hideTooltip() {\n if (this.tooltip) {\n this.tooltip.hide();\n this.tooltip = null;\n }\n }\n\n /**\n * @summary Updates the marker with new properties\n * @param {PSV.plugins.MarkersPlugin.Properties} properties\n * @throws {PSV.PSVError} when the configuration is incorrect\n */\n update(properties) {\n const newType = Marker.getType(properties, true);\n\n if (newType !== undefined && newType !== this.type) {\n throw new PSVError('cannot change marker type');\n }\n\n utils.deepmerge(this.config, properties);\n this.data = this.config.data;\n\n this.visible = properties.visible !== false;\n\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 if (this.config.tooltip) {\n utils.addClasses(this.$el, 'psv-marker--has-tooltip');\n if (typeof this.config.tooltip === 'string') {\n this.config.tooltip = { content: this.config.tooltip };\n }\n }\n if (this.config.content) {\n utils.addClasses(this.$el, 'psv-marler--has-content');\n }\n\n // apply style\n if (this.config.style) {\n utils.deepmerge(this.$el.style, this.config.style);\n }\n\n // parse anchor\n this.props.anchor = utils.parsePosition(this.config.anchor);\n\n if (this.isNormal()) {\n this.__updateNormal();\n }\n else if (this.isPoly()) {\n this.__updatePoly();\n }\n else {\n this.__updateSvg();\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 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 (type in properties) {\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 { MarkersPlugin } from './index';\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(MarkersPlugin.id);\n\n if (this.plugin) {\n this.plugin.on(MarkersPlugin.EVENTS.SHOW_MARKERS, this);\n this.plugin.on(MarkersPlugin.EVENTS.HIDE_MARKERS, this);\n\n this.toggleActive(true);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(MarkersPlugin.EVENTS.SHOW_MARKERS, this);\n this.plugin.off(MarkersPlugin.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 MarkersPlugin.EVENTS.SHOW_MARKERS: this.toggleActive(true); break;\n case MarkersPlugin.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 { MarkersPlugin } from './index';\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(MarkersPlugin.id);\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] === MarkersPlugin.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 { Marker } from './Marker';\nimport { MarkersButton } from './MarkersButton';\nimport { MarkersListButton } from './MarkersListButton';\nimport icon from './pin-list.svg';\nimport './style.scss';\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.navbar.splice(DEFAULTS.navbar.indexOf('caption'), 0, MarkersButton.id, MarkersListButton.id);\nDEFAULTS.lang[MarkersButton.id] = 'Markers';\nDEFAULTS.lang[MarkersListButton.id] = 'Markers list';\nregisterButton(MarkersButton);\nregisterButton(MarkersListButton);\n\n\n/**\n * @summary Displays various markers on the viewer\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class MarkersPlugin extends AbstractPlugin {\n\n static id = 'markers';\n\n /**\n * @summary Available events\n * @enum {string}\n * @constant\n */\n static EVENTS = {\n /**\n * @event goto-marker-done\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the animation to a marker is done\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n GOTO_MARKER_DONE : 'goto-marker-done',\n /**\n * @event leave-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user puts the cursor away from a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n LEAVE_MARKER : 'leave-marker',\n /**\n * @event over-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user puts the cursor hover a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n OVER_MARKER : 'over-marker',\n /**\n * @event filter:render-markers-list\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Used to alter the list of markers displayed on the side-panel\n * @param {PSV.plugins.MarkersPlugin.Marker[]} markers\n * @returns {PSV.plugins.MarkersPlugin.Marker[]}\n */\n RENDER_MARKERS_LIST: 'render-markers-list',\n /**\n * @event select-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler\n * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker}\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data\n */\n SELECT_MARKER : 'select-marker',\n /**\n * @event select-marker-list\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when a marker is selected from the side panel\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n SELECT_MARKER_LIST : 'select-marker-list',\n /**\n * @event unselect-marker\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when a marker was selected and the user clicks elsewhere\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n */\n UNSELECT_MARKER : 'unselect-marker',\n /**\n * @event hide-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are hidden\n */\n HIDE_MARKERS : 'hide-markers',\n /**\n * @event show-markers\n * @memberof PSV.plugins.MarkersPlugin\n * @summary Triggered when the markers are shown\n */\n SHOW_MARKERS : 'show-markers',\n };\n\n /**\n * @summary Namespace for SVG creation\n * @type {string}\n * @constant\n */\n static SVG_NS = 'http://www.w3.org/2000/svg';\n\n /**\n * @summary Property name added to marker elements\n * @type {string}\n * @constant\n */\n static MARKER_DATA = 'psvMarker';\n\n /**\n * @summary Panel identifier for marker content\n * @type {string}\n * @constant\n */\n static ID_PANEL_MARKER = 'marker';\n\n /**\n * @summary Panel identifier for markers list\n * @type {string}\n * @constant\n */\n static ID_PANEL_MARKERS_LIST = 'markersList';\n\n /**\n * @summary Markers list template\n * @param {PSV.Marker[]} markers\n * @param {string} title\n * @param {string} dataKey\n * @returns {string}\n */\n static 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 /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.MarkersPlugin.Options} [options]\n */\n constructor(psv, options) {\n super(psv);\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 this.psv.container.appendChild(this.container);\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 };\n\n /**\n * @type {PSV.plugins.MarkersPlugin.Options}\n */\n this.config = {\n clickEventOnMarker: false,\n ...options,\n };\n\n /**\n * @member {SVGElement}\n * @readonly\n */\n this.svgContainer = document.createElementNS(MarkersPlugin.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 // 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 (options?.markers) {\n this.psv.once(CONSTANTS.EVENTS.READY, () => {\n this.setMarkers(options.markers);\n });\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.clearMarkers(false);\n\n this.container.removeEventListener('mouseenter', this);\n this.container.removeEventListener('mouseleave', this);\n this.container.removeEventListener('mousemove', this);\n this.container.removeEventListener('contextmenu', this);\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 delete this.prop;\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); break;\n case 'mouseleave': this.__onMouseLeave(e); break;\n case 'mousemove': this.__onMouseMove(e); break;\n case 'contextmenu': this.__onContextMenu(e); 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.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 * @override\n * @fires PSV.plugins.MarkersPlugin.show-markers\n */\n show() {\n this.prop.visible = true;\n\n this.renderMarkers();\n\n this.trigger(MarkersPlugin.EVENTS.SHOW_MARKERS);\n }\n\n /**\n * @override\n * @fires PSV.plugins.MarkersPlugin.hide-markers\n */\n hide() {\n this.prop.visible = false;\n\n this.renderMarkers();\n\n this.trigger(MarkersPlugin.EVENTS.HIDE_MARKERS);\n }\n\n /**\n * @summary Toggles the visibility of all tooltips\n */\n toggleAllTooltips() {\n this.prop.showAllTooltips = !this.prop.showAllTooltips;\n this.renderMarkers();\n }\n\n /**\n * @summary Displays all tooltips\n */\n showAllTooltips() {\n this.prop.showAllTooltips = true;\n this.renderMarkers();\n }\n\n /**\n * @summary Hides all tooltips\n */\n hideAllTooltips() {\n this.prop.showAllTooltips = false;\n this.renderMarkers();\n }\n\n /**\n * @summary Return the total number of markers\n * @returns {number}\n */\n getNbMarkers() {\n return Object.keys(this.markers).length;\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 {\n this.svgContainer.appendChild(marker.$el);\n }\n\n this.markers[marker.id] = marker;\n\n if (render) {\n this.renderMarkers();\n this.__refreshUi();\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\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 {\n this.svgContainer.removeChild(marker.$el);\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 }\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 }\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 }\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(MarkersPlugin.EVENTS.GOTO_MARKER_DONE, marker);\n });\n }\n\n /**\n * @summary Hides a marker\n * @param {string} markerId\n */\n hideMarker(markerId) {\n this.getMarker(markerId).visible = false;\n this.renderMarkers();\n }\n\n /**\n * @summary Shows a marker\n * @param {string} markerId\n */\n showMarker(markerId) {\n this.getMarker(markerId).visible = true;\n this.renderMarkers();\n }\n\n /**\n * @summary Toggles a marker\n * @param {string} markerId\n */\n toggleMarker(markerId) {\n this.getMarker(markerId).visible ^= true;\n this.renderMarkers();\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 : MarkersPlugin.ID_PANEL_MARKER,\n content: marker.config.content,\n });\n }\n else {\n this.psv.panel.hide(MarkersPlugin.ID_PANEL_MARKER);\n }\n }\n\n /**\n * @summary Toggles the visibility of markers list\n */\n toggleMarkersList() {\n if (this.psv.panel.prop.contentId === MarkersPlugin.ID_PANEL_MARKERS_LIST) {\n this.hideMarkersList();\n }\n else {\n this.showMarkersList();\n }\n }\n\n /**\n * @summary Opens side panel with 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(MarkersPlugin.EVENTS.RENDER_MARKERS_LIST, markers);\n\n this.psv.panel.show({\n id : MarkersPlugin.ID_PANEL_MARKERS_LIST,\n content : MarkersPlugin.MARKERS_LIST_TEMPLATE(\n markers,\n this.psv.config.lang.markers,\n utils.dasherize(MarkersPlugin.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[MarkersPlugin.MARKER_DATA] : undefined;\n\n if (markerId) {\n const marker = this.getMarker(markerId);\n\n this.trigger(MarkersPlugin.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(MarkersPlugin.ID_PANEL_MARKERS_LIST);\n }\n\n /**\n * @summary Updates the visibility and the position of all markers\n */\n renderMarkers() {\n utils.each(this.markers, (marker) => {\n let isVisible = this.prop.visible && marker.visible;\n\n if (isVisible && marker.isPoly()) {\n const positions = this.__getPolyPositions(marker);\n isVisible = positions.length > (marker.isPolygon() ? 2 : 1);\n\n if (isVisible) {\n const position = this.__getMarkerPosition(marker);\n marker.props.position2D = position;\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 const scale = marker.getScale(this.psv.getZoomLevel());\n const position = this.__getMarkerPosition(marker, scale);\n isVisible = this.__isMarkerVisible(marker, position);\n\n if (isVisible) {\n marker.props.position2D = position;\n\n if (marker.isSvg()) {\n let transform = `translate(${position.x}, ${position.y})`;\n if (scale !== 1) {\n transform += ` scale(${scale}, ${scale})`;\n }\n\n marker.$el.setAttributeNS(null, 'transform', transform);\n }\n else {\n let transform = `translate3D(${position.x}px, ${position.y}px, 0px)`;\n if (scale !== 1) {\n transform += ` scale(${scale}, ${scale})`;\n }\n\n marker.$el.style.transform = transform;\n }\n }\n }\n\n marker.props.inViewport = isVisible;\n utils.toggleClass(marker.$el, 'psv-marker--visible', isVisible);\n\n if (marker.props.inViewport && (this.prop.showAllTooltips || (marker === this.prop.hoveringMarker && !marker.isPoly()))) {\n marker.showTooltip();\n }\n else if (!marker.props.inViewport || marker !== this.prop.hoveringMarker) {\n marker.hideTooltip();\n }\n });\n }\n\n /**\n * @summary Determines if a point marker is visible
\n * It tests if the point is in the general direction of the camera, then check if it's in the viewport\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {PSV.Point} position\n * @returns {boolean}\n * @private\n */\n __isMarkerVisible(marker, position) {\n return marker.props.positions3D[0].dot(this.psv.prop.direction) > 0\n && position.x + marker.props.width >= 0\n && position.x - marker.props.width <= this.psv.prop.size.width\n && position.y + marker.props.height >= 0\n && position.y - marker.props.height <= this.psv.prop.size.height;\n }\n\n /**\n * @summary Computes the real size of a marker\n * @description This is done by removing all it's transformations (if any) and making it visible\n * before querying its bounding rect\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @private\n */\n __updateMarkerSize(marker) {\n utils.addClasses(marker.$el, 'psv-marker--transparent');\n\n let transform;\n if (marker.isSvg()) {\n transform = marker.$el.getAttributeNS(null, 'transform');\n marker.$el.removeAttributeNS(null, 'transform');\n }\n else {\n transform = marker.$el.style.transform;\n marker.$el.style.transform = '';\n }\n\n const rect = marker.$el.getBoundingClientRect();\n marker.props.width = rect.width;\n marker.props.height = rect.height;\n\n utils.removeClasses(marker.$el, 'psv-marker--transparent');\n\n if (transform) {\n if (marker.isSvg()) {\n marker.$el.setAttributeNS(null, 'transform', transform);\n }\n else {\n marker.$el.style.transform = transform;\n }\n }\n\n // the size is no longer dynamic once known\n marker.props.dynamicSize = false;\n }\n\n /**\n * @summary Computes viewer coordinates of a marker\n * @param {PSV.plugins.MarkersPlugin.Marker} marker\n * @param {number} [scale=1]\n * @returns {PSV.Point}\n * @private\n */\n __getMarkerPosition(marker, scale = 1) {\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 * scale;\n position.y -= marker.props.height * marker.props.anchor.y * scale;\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[MarkersPlugin.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 * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseEnter(e) {\n const marker = this.__getTargetMarker(e.target);\n\n if (marker && !marker.isPoly()) {\n this.prop.hoveringMarker = marker;\n\n this.trigger(MarkersPlugin.EVENTS.OVER_MARKER, marker);\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n }\n\n /**\n * @summary Handles mouse leave events, hide the tooltip\n * @param {MouseEvent} e\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @private\n */\n __onMouseLeave(e) {\n const marker = this.__getTargetMarker(e.target);\n\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(MarkersPlugin.EVENTS.LEAVE_MARKER, marker);\n\n this.prop.hoveringMarker = null;\n\n if (!this.prop.showAllTooltips) {\n marker.hideTooltip();\n }\n }\n }\n\n /**\n * @summary Handles mouse move events, refreshUi the tooltip for polygon markers\n * @param {MouseEvent} e\n * @fires PSV.plugins.MarkersPlugin.leave-marker\n * @fires PSV.plugins.MarkersPlugin.over-marker\n * @private\n */\n __onMouseMove(e) {\n let marker;\n const targetMarker = this.__getTargetMarker(e.target);\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(MarkersPlugin.EVENTS.OVER_MARKER, marker);\n\n this.prop.hoveringMarker = marker;\n }\n\n if (!this.prop.showAllTooltips) {\n marker.showTooltip(e);\n }\n }\n else if (this.prop.hoveringMarker?.isPoly()) {\n this.trigger(MarkersPlugin.EVENTS.LEAVE_MARKER, this.prop.hoveringMarker);\n\n if (!this.prop.showAllTooltips) {\n this.prop.hoveringMarker.hideTooltip();\n }\n\n this.prop.hoveringMarker = null;\n }\n }\n\n /**\n * @summary Handles context menu events\n * @param {MouseWheelEvent} evt\n * @private\n */\n __onContextMenu(evt) {\n if (!utils.getClosest(evt.target, '.psv-marker')) {\n return true;\n }\n\n evt.preventDefault();\n return false;\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 const marker = this.__getTargetMarker(data.target, true);\n\n if (marker) {\n this.prop.currentMarker = marker;\n\n this.trigger(MarkersPlugin.EVENTS.SELECT_MARKER, marker, {\n dblclick : dblclick,\n rightclick: data.rightclick,\n });\n\n if (this.config.clickEventOnMarker) {\n // add the marker to event data\n data.marker = marker;\n }\n else {\n e.stopPropagation();\n }\n\n // the marker could have been deleted in an event handler\n if (this.markers[marker.id]) {\n this.showMarkerPanel(marker.id);\n }\n }\n else if (this.prop.currentMarker) {\n this.trigger(MarkersPlugin.EVENTS.UNSELECT_MARKER, this.prop.currentMarker);\n\n this.psv.panel.hide(MarkersPlugin.ID_PANEL_MARKER);\n\n this.prop.currentMarker = null;\n }\n }\n\n /**\n * @summary Updates the visiblity of the panel and the buttons\n * @private\n */\n __refreshUi() {\n const nbMarkers = Object.values(this.markers).filter(m => !m.config.hideList).length;\n const markersButton = this.psv.navbar.getButton(MarkersButton.id, false);\n const markersListButton = this.psv.navbar.getButton(MarkersListButton.id, false);\n\n if (nbMarkers === 0) {\n markersButton?.hide();\n markersListButton?.hide();\n\n if (this.psv.panel.isVisible(MarkersPlugin.ID_PANEL_MARKERS_LIST)) {\n this.psv.panel.hide();\n }\n else if (this.psv.panel.isVisible(MarkersPlugin.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(MarkersPlugin.ID_PANEL_MARKERS_LIST)) {\n this.showMarkersList();\n }\n else if (this.psv.panel.isVisible(MarkersPlugin.ID_PANEL_MARKER)) {\n this.prop.currentMarker ? this.showMarkerPanel(this.prop.currentMarker) : this.psv.panel.hide();\n }\n }\n }\n\n}\n"],"names":["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","image","html","polygonPx","polygonRad","polylinePx","polylineRad","square","rect","circle","ellipse","path","Marker","properties","psv","id","PSVError","type","getType","visible","$el","config","data","undefined","tooltip","props","inViewport","dynamicSize","anchor","position","position2D","positions3D","width","height","def","isNormal","document","createElement","isPolygon","createElementNS","MarkersPlugin","SVG_NS","isPolyline","MARKER_DATA","update","destroy","isPoly","isPolyPx","isPolyRad","isSvg","getScale","zoomLevel","Array","isArray","scale","EASINGS","inQuad","getListContent","listContent","content","showTooltip","mousePosition","boundingRect","container","getBoundingClientRect","box","size","arrow","top","clientY","left","clientX","move","create","hideTooltip","hide","newType","deepmerge","setAttribute","className","addClasses","style","parsePosition","__updateNormal","__updatePoly","__updateSvg","isExtendedPosition","backgroundImage","innerHTML","transformOrigin","dataHelper","cleanPosition","sphericalCoordsToVector3","cx","cy","rx","ry","each","value","prop","setAttributeNS","svgStyle","dasherize","fill","actualPoly","splice","map","coord","sphericalCoords","textureCoordsToSphericalCoords","longitude","latitude","centroid","allowNone","found","Object","keys","join","MarkersButton","navbar","plugin","getPlugin","on","EVENTS","SHOW_MARKERS","HIDE_MARKERS","toggleActive","off","isSupported","handleEvent","e","onClick","show","AbstractButton","icon","pin","MarkersListButton","OPEN_PANEL","CLOSE_PANEL","args","ID_PANEL_MARKERS_LIST","toggleMarkersList","pinList","DEFAULTS","indexOf","lang","registerButton","options","cursor","mousemove","appendChild","markers","currentMarker","hoveringMarker","clickEventOnMarker","svgContainer","addEventListener","CLICK","DOUBLE_CLICK","RENDER","CONFIG_CHANGED","once","READY","setMarkers","clearMarkers","removeEventListener","removeChild","__onMouseEnter","__onMouseLeave","__onMouseMove","__onContextMenu","__onClick","renderMarkers","trigger","toggleAllTooltips","showAllTooltips","hideAllTooltips","getNbMarkers","addMarker","render","marker","__refreshUi","getMarker","markerId","getCurrentMarker","updateMarker","removeMarker","gotoMarker","speed","animate","then","GOTO_MARKER_DONE","hideMarker","showMarker","toggleMarker","showMarkerPanel","panel","ID_PANEL_MARKER","contentId","hideMarkersList","showMarkersList","hideList","change","RENDER_MARKERS_LIST","MARKERS_LIST_TEMPLATE","noMargin","clickHandler","li","target","getClosest","dataset","SELECT_MARKER_LIST","isVisible","positions","__getPolyPositions","__getMarkerPosition","points","pos","__updateMarkerSize","getZoomLevel","__isMarkerVisible","transform","toggleClass","dot","direction","getAttributeNS","removeAttributeNS","removeClasses","sphericalCoordsToViewerCoords","vector3ToViewerCoords","nbVectors","vector","toBeComputed","forEach","neighbours","neighbour","invisible","index","reverse","pair","__getPolyIntermediaryPoint","filter","P1","P2","C","clone","normalize","N","THREE","Vector3","crossVectors","V","X","multiplyScalar","Y","H","addVectors","applyAxisAngle","__getTargetMarker","closest","target2","__targetOnTooltip","hasParent","OVER_MARKER","relatedTarget","LEAVE_MARKER","targetMarker","evt","preventDefault","dblclick","SELECT_MARKER","rightclick","stopPropagation","UNSELECT_MARKER","nbMarkers","values","m","markersButton","getButton","markersListButton","AbstractPlugin","title","dataKey"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAEA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;;EACO,SAASA,yBAAT,CAAmCC,EAAnC,EAAuCC,EAAvC,EAA2CC,CAA3C,EAA8C;EACnD,MAAOC,EAAP,GAAiBH,EAAjB;EAAA,MAAWI,EAAX,GAAiBJ,EAAjB;EACA,MAAOK,EAAP,GAAiBJ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ution.d.ts new file mode 100644 index 000000000..50e804d91 --- /dev/null +++ b/dist/plugins/resolution.d.ts @@ -0,0 +1,47 @@ +import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; +import { Event } from 'uevent'; + +type Resolution = { + id: string; + label: string; + panorama: any; +}; + +type ResolutionPluginOptions = { + resolutions: Resolution[]; +}; + +/** + * @summary Adds a setting to choose between multiple resolutions of the panorama. + */ +declare class ResolutionPlugin extends AbstractPlugin { + + static EVENTS: { + RESOLUTION_CHANGED: 'resolution-changed', + }; + + constructor(psv: Viewer, options: ResolutionPluginOptions); + + /** + * @summary Changes the available resolutions + */ + setResolutions(resolutions: Resolution[]); + + /** + * @summary Changes the current resolution + */ + setResolution(id: string); + + /** + * @summary Returns the current resolution + */ + getResolution(): string; + + /** + * @summary Triggered when the resolution is changed + */ + on(e: 'resolution-changed', cb: (e: Event, resolutionId: string) => void): this; + +} + +export { Resolution, ResolutionPlugin, ResolutionPluginOptions }; diff --git a/dist/plugins/resolution.js b/dist/plugins/resolution.js index 5704314ff..6eb9b341c 100644 --- a/dist/plugins/resolution.js +++ b/dist/plugins/resolution.js @@ -1,19 +1,29 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer'), require('photo-sphere-viewer/dist/plugins/settings')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer', 'photo-sphere-viewer/dist/plugins/settings'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.ResolutionPlugin = factory(global.PhotoSphereViewer, global.PhotoSphereViewer.SettingsPlugin))); -}(this, (function (photoSphereViewer, SettingsPlugin) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('photo-sphere-viewer'), require('photo-sphere-viewer/dist/plugins/settings')) : + typeof define === 'function' && define.amd ? define(['exports', 'photo-sphere-viewer', 'photo-sphere-viewer/dist/plugins/settings'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.ResolutionPlugin = {}), global.PhotoSphereViewer, global.PhotoSphereViewer.SettingsPlugin)); +}(this, (function (exports, photoSphereViewer, settings) { 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -63,7 +73,7 @@ * @typedef {Object} PSV.plugins.ResolutionPlugin.Resolution * @property {string} id * @property {string} label - * @property {string|string[]|PSV.Cubemap} panorama + * @property {*} panorama */ /** @@ -101,7 +111,7 @@ * @private */ - _this.settings = SettingsPlugin ? psv.getPlugin(SettingsPlugin) : null; + _this.settings = settings.SettingsPlugin ? psv.getPlugin(settings.SettingsPlugin) : null; if (!_this.settings) { throw new photoSphereViewer.PSVError('Resolution plugin requires the Settings plugin'); @@ -162,7 +172,7 @@ _proto.destroy = function destroy() { this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.PANORAMA_LOADED, this); - this.settings.removeSetting(SettingsPlugin.id); + this.settings.removeSetting(settings.SettingsPlugin.id); _AbstractPlugin.prototype.destroy.call(this); } @@ -260,7 +270,6 @@ return ResolutionPlugin; }(photoSphereViewer.AbstractPlugin); - ResolutionPlugin.id = 'resolution'; ResolutionPlugin.EVENTS = { /** @@ -272,7 +281,9 @@ RESOLUTION_CHANGED: 'resolution-changed' }; - return ResolutionPlugin; + exports.ResolutionPlugin = ResolutionPlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=resolution.js.map diff --git a/dist/plugins/resolution.js.map b/dist/plugins/resolution.js.map index caf0e1af9..fc9a03a6a 100644 --- a/dist/plugins/resolution.js.map +++ b/dist/plugins/resolution.js.map @@ -1 +1 @@ -{"version":3,"file":"resolution.js","sources":["../../src/plugins/resolution/utils.js","../../src/plugins/resolution/index.js"],"sourcesContent":["/**\n * @summary Returns deep equality between objects\n * {@link https://gist.github.com/egardner/efd34f270cc33db67c0246e837689cb9}\n * @param obj1\n * @param obj2\n * @return {boolean}\n * @private\n */\nexport function deepEqual(obj1, obj2) {\n if (obj1 === obj2) {\n return true;\n }\n else if (isObject(obj1) && isObject(obj2)) {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (const prop of Object.keys(obj1)) {\n if (!deepEqual(obj1[prop], obj2[prop])) {\n return false;\n }\n }\n return true;\n }\n else {\n return false;\n }\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj != null;\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError } from 'photo-sphere-viewer';\nimport SettingsPlugin from 'photo-sphere-viewer/dist/plugins/settings';\nimport { deepEqual } from './utils';\n\n\nDEFAULTS.lang.resolution = 'Quality';\n\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Resolution\n * @property {string} id\n * @property {string} label\n * @property {string|string[]|PSV.Cubemap} panorama\n */\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Options\n * @property {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions - list of available resolutions\n */\n\n/**\n * @summary Adds a setting to choose between multiple resolutions of the panorama.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport default class ResolutionPlugin extends AbstractPlugin {\n\n static id = 'resolution';\n\n /**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.ResolutionPlugin\n * @constant\n */\n static EVENTS = {\n /**\n * @event resolution-changed\n * @memberof PSV.plugins.ResolutionPlugin\n * @summary Triggered when the resolution is changed\n * @param {string} resolutionId\n */\n RESOLUTION_CHANGED: 'resolution-changed',\n };\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.ResolutionPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @readonly\n * @private\n */\n this.settings = SettingsPlugin ? psv.getPlugin(SettingsPlugin) : null;\n\n if (!this.settings) {\n throw new PSVError('Resolution plugin requires the Settings plugin');\n }\n\n this.settings.addSetting({\n id : ResolutionPlugin.id,\n type : 'options',\n label : this.psv.config.lang.resolution,\n current: () => this.prop.resolution,\n options: () => this.__getSettingsOptions(),\n apply : resolution => this.setResolution(resolution),\n });\n\n /**\n * @summary Available resolutions\n * @member {PSV.plugins.ResolutionPlugin.Resolution[]}\n */\n this.resolutions = [];\n\n /**\n * @summary Available resolutions\n * @member {Object.}\n * @private\n */\n this.resolutionsById = {};\n\n /**\n * @type {Object}\n * @property {string} resolution - Current resolution\n * @private\n */\n this.prop = {\n resolution: null,\n };\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n if (options?.resolutions) {\n this.setResolutions(options.resolutions);\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n this.settings.removeSetting(SettingsPlugin.id);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.PANORAMA_LOADED) {\n this.__refreshResolution();\n }\n }\n\n /**\n * @summary Changes the available resolutions\n * @param {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions\n */\n setResolutions(resolutions) {\n this.resolutions = resolutions;\n this.resolutionsById = {};\n\n resolutions.forEach((resolution) => {\n if (!resolution.id) {\n throw new PSVError('Missing resolution id');\n }\n this.resolutionsById[resolution.id] = resolution;\n });\n\n this.__refreshResolution();\n }\n\n /**\n * @summary Changes the current resolution\n * @param {string} id\n */\n setResolution(id) {\n if (!this.resolutionsById[id]) {\n throw new PSVError(`Resolution ${id} unknown`);\n }\n\n return this.psv.setPanorama(this.resolutionsById[id].panorama, { transition: false, showLoader: false });\n }\n\n /**\n * @summary Returns the current resolution\n * @return {string}\n */\n getResolution() {\n return this.prop.resolution;\n }\n\n /**\n * @summary Updates current resolution on panorama load\n * @private\n */\n __refreshResolution() {\n const resolution = this.resolutions.find(r => deepEqual(this.psv.config.panorama, r.panorama));\n if (this.prop.resolution !== resolution?.id) {\n this.prop.resolution = resolution?.id;\n this.trigger(ResolutionPlugin.EVENTS.RESOLUTION_CHANGED, this.prop.resolution);\n }\n }\n\n /**\n * @summary Returns options for Settings plugin\n * @return {PSV.plugins.SettingsPlugin.Option[]}\n * @private\n */\n __getSettingsOptions() {\n return this.resolutions\n .map(resolution => ({\n id : resolution.id,\n label: resolution.label,\n }));\n }\n\n}\n"],"names":["deepEqual","obj1","obj2","isObject","Object","keys","length","prop","obj","DEFAULTS","lang","resolution","ResolutionPlugin","psv","options","settings","SettingsPlugin","getPlugin","PSVError","addSetting","id","type","label","config","current","__getSettingsOptions","apply","setResolution","resolutions","resolutionsById","on","CONSTANTS","EVENTS","PANORAMA_LOADED","setResolutions","destroy","off","removeSetting","handleEvent","e","__refreshResolution","forEach","setPanorama","panorama","transition","showLoader","getResolution","find","r","trigger","RESOLUTION_CHANGED","map","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,SAASA,SAAT,CAAmBC,IAAnB,EAAyBC,IAAzB,EAA+B;EACpC,MAAID,IAAI,KAAKC,IAAb,EAAmB;EACjB,WAAO,IAAP;EACD,GAFD,MAGK,IAAIC,QAAQ,CAACF,IAAD,CAAR,IAAkBE,QAAQ,CAACD,IAAD,CAA9B,EAAsC;EACzC,QAAIE,MAAM,CAACC,IAAP,CA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ACrB,WAAO,KAAKG,WAAL,CACJuB,GADI,CACA,UAAAxC,UAAU;EAAA,aAAK;EAClBS,QAAAA,EAAE,EAAKT,UAAU,CAACS,EADA;EAElBE,QAAAA,KAAK,EAAEX,UAAU,CAACW;EAFA,OAAL;EAAA,KADV,CAAP;EAKD;;;IA/J2C8B;;EAAzBxC,iBAEZQ,KAAK;EAFOR,iBAUZoB,SAAS;EACd;EACJ;EACA;EACA;EACA;EACA;EACIkB,EAAAA,kBAAkB,EAAE;EAPN;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"resolution.js","sources":["../../src/plugins/resolution/utils.js","../../src/plugins/resolution/index.js"],"sourcesContent":["/**\n * @summary Returns deep equality between objects\n * {@link https://gist.github.com/egardner/efd34f270cc33db67c0246e837689cb9}\n * @param obj1\n * @param obj2\n * @return {boolean}\n * @private\n */\nexport function deepEqual(obj1, obj2) {\n if (obj1 === obj2) {\n return true;\n }\n else if (isObject(obj1) && isObject(obj2)) {\n if (Object.keys(obj1).length !== Object.keys(obj2).length) {\n return false;\n }\n for (const prop of Object.keys(obj1)) {\n if (!deepEqual(obj1[prop], obj2[prop])) {\n return false;\n }\n }\n return true;\n }\n else {\n return false;\n }\n}\n\nfunction isObject(obj) {\n return typeof obj === 'object' && obj != null;\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError } from '../..';\nimport { SettingsPlugin } from '../settings';\nimport { deepEqual } from './utils';\n\n\nDEFAULTS.lang.resolution = 'Quality';\n\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Resolution\n * @property {string} id\n * @property {string} label\n * @property {*} panorama\n */\n\n/**\n * @typedef {Object} PSV.plugins.ResolutionPlugin.Options\n * @property {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions - list of available resolutions\n */\n\n/**\n * @summary Adds a setting to choose between multiple resolutions of the panorama.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class ResolutionPlugin extends AbstractPlugin {\n\n static id = 'resolution';\n\n /**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.ResolutionPlugin\n * @constant\n */\n static EVENTS = {\n /**\n * @event resolution-changed\n * @memberof PSV.plugins.ResolutionPlugin\n * @summary Triggered when the resolution is changed\n * @param {string} resolutionId\n */\n RESOLUTION_CHANGED: 'resolution-changed',\n };\n\n /**\n * @param {PSV.Viewer} psv\n * @param {PSV.plugins.ResolutionPlugin.Options} options\n */\n constructor(psv, options) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @readonly\n * @private\n */\n this.settings = SettingsPlugin ? psv.getPlugin(SettingsPlugin) : null;\n\n if (!this.settings) {\n throw new PSVError('Resolution plugin requires the Settings plugin');\n }\n\n this.settings.addSetting({\n id : ResolutionPlugin.id,\n type : 'options',\n label : this.psv.config.lang.resolution,\n current: () => this.prop.resolution,\n options: () => this.__getSettingsOptions(),\n apply : resolution => this.setResolution(resolution),\n });\n\n /**\n * @summary Available resolutions\n * @member {PSV.plugins.ResolutionPlugin.Resolution[]}\n */\n this.resolutions = [];\n\n /**\n * @summary Available resolutions\n * @member {Object.}\n * @private\n */\n this.resolutionsById = {};\n\n /**\n * @type {Object}\n * @property {string} resolution - Current resolution\n * @private\n */\n this.prop = {\n resolution: null,\n };\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n if (options?.resolutions) {\n this.setResolutions(options.resolutions);\n }\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this);\n\n this.settings.removeSetting(SettingsPlugin.id);\n\n super.destroy();\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === CONSTANTS.EVENTS.PANORAMA_LOADED) {\n this.__refreshResolution();\n }\n }\n\n /**\n * @summary Changes the available resolutions\n * @param {PSV.plugins.ResolutionPlugin.Resolution[]} resolutions\n */\n setResolutions(resolutions) {\n this.resolutions = resolutions;\n this.resolutionsById = {};\n\n resolutions.forEach((resolution) => {\n if (!resolution.id) {\n throw new PSVError('Missing resolution id');\n }\n this.resolutionsById[resolution.id] = resolution;\n });\n\n this.__refreshResolution();\n }\n\n /**\n * @summary Changes the current resolution\n * @param {string} id\n */\n setResolution(id) {\n if (!this.resolutionsById[id]) {\n throw new PSVError(`Resolution ${id} unknown`);\n }\n\n return this.psv.setPanorama(this.resolutionsById[id].panorama, { transition: false, showLoader: false });\n }\n\n /**\n * @summary Returns the current resolution\n * @return {string}\n */\n getResolution() {\n return this.prop.resolution;\n }\n\n /**\n * @summary Updates current resolution on panorama load\n * @private\n */\n __refreshResolution() {\n const resolution = this.resolutions.find(r => deepEqual(this.psv.config.panorama, r.panorama));\n if (this.prop.resolution !== resolution?.id) {\n this.prop.resolution = resolution?.id;\n this.trigger(ResolutionPlugin.EVENTS.RESOLUTION_CHANGED, this.prop.resolution);\n }\n }\n\n /**\n * @summary Returns options for Settings plugin\n * @return {PSV.plugins.SettingsPlugin.Option[]}\n * @private\n */\n __getSettingsOptions() {\n return this.resolutions\n .map(resolution => ({\n id : resolution.id,\n label: resolution.label,\n }));\n }\n\n}\n"],"names":["deepEqual","obj1","obj2","isObject","Object","keys","length","prop","obj","DEFAULTS","lang","resolution","ResolutionPlugin","psv","options","settings","SettingsPlugin","getPlugin","PSVError","addSetting","id","type","label","config","current","__getSettingsOptions","apply","setResolution","resolutions","resolutionsById","on","CONSTANTS","EVENTS","PANORAMA_LOADED","setResolutions","destroy","off","removeSetting","handleEvent","e","__refreshResolution","forEach","setPanorama","panorama","transition","showLoader","getResolution","find","r","trigger","RESOLUTION_CHANGED","map","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAAA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACO,SAASA,SAAT,CAAmBC,IAAnB,EAAyBC,IAAzB,EAA+B;EACpC,MAAID,IAAI,KAAKC,IAAb,EAAmB;EACjB,WAAO,IAAP;EACD,GAFD,MAG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C,CAAJ,EAA6C;EAC3C,WAAKb,IAAL,CAAUI,UAAV,GAAuBA,UAAvB,oBAAuBA,UAAU,CAAES,EAAnC;EACA,WAAK6B,OAAL,CAAarC,gBAAgB,CAACoB,MAAjB,CAAwBkB,kBAArC,EAAyD,KAAK3C,IAAL,CAAUI,UAAnE;EACD;EACF;EAED;EACF;EACA;EACA;EACA;EAxJA;;EAAA,SAyJEc,oBAzJF,GAyJE,gCAAuB;EACrB,WAAO,KAAKG,WAAL,CACJuB,GADI,CACA,UAAAxC,UAAU;EAAA,aAAK;EAClBS,QAAAA,EAAE,EAAKT,UAAU,CAACS,EADA;EAElBE,QAAAA,KAAK,EAAEX,UAAU,CAACW;EAFA,OAAL;EAAA,KADV,CAAP;EAKD,GA/JH;;EAAA;EAAA,EAAsC8B,gCAAtC;EAAaxC,iBAEJQ,KAAK;EAFDR,iBAUJoB,SAAS;EACd;EACJ;EACA;EACA;EACA;EACA;EACIkB,EAAAA,kBAAkB,EAAE;EAPN;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/settings.css b/dist/plugins/settings.css index de0b947f5..4c333cfe5 100644 --- a/dist/plugins/settings.css +++ b/dist/plugins/settings.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 4.2.1 + * Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) diff --git a/dist/plugins/settings.d.ts b/dist/plugins/settings.d.ts new file mode 100644 index 000000000..1a8eecaf8 --- /dev/null +++ b/dist/plugins/settings.d.ts @@ -0,0 +1,75 @@ +import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; + +/** + * @summary Description of a setting + */ +type BaseSetting = { + id: string; + label: string; +}; + +/** + * @summary Description of a 'options' setting + */ +type OptionsSetting = BaseSetting & { + type: 'options'; + current: () => string; + options: () => SettingOption[] + apply: (string) => void; +}; + +/** + * @summary Description of a 'toggle' setting + */ +type ToggleSetting = BaseSetting & { + type: 'toggle'; + active: () => boolean; + toggle: () => void; +}; + +/** + * @summary Option of an 'option' setting + */ +type SettingOption = { + id: string; + label: string; +}; + +type Setting = OptionsSetting | ToggleSetting; + +/** + * @summary Adds a button to access various settings. + */ +declare class SettingsPlugin extends AbstractPlugin { + + constructor(psv: Viewer); + + /** + * @summary Registers a new setting + */ + addSetting(setting: Setting); + + /** + * @summary Removes a setting + * @param {string} id + */ + removeSetting(id: string); + + /** + * @summary Toggles the settings panel + */ + toggleSettings(); + + /** + * @summary Hides the settings panel + */ + hideSettings(); + + /** + * @summary Shows the settings panel + */ + showSettings(); + +} + +export { BaseSetting, OptionsSetting, Setting, SettingOption, SettingsPlugin, ToggleSetting }; diff --git a/dist/plugins/settings.js b/dist/plugins/settings.js index dda225853..36db19bec 100644 --- a/dist/plugins/settings.js +++ b/dist/plugins/settings.js @@ -1,19 +1,29 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.SettingsPlugin = factory(global.PhotoSphereViewer))); -}(this, (function (photoSphereViewer) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('photo-sphere-viewer')) : + typeof define === 'function' && define.amd ? define(['exports', 'photo-sphere-viewer'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.SettingsPlugin = {}), global.PhotoSphereViewer)); +}(this, (function (exports, photoSphereViewer) { 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -381,7 +391,6 @@ return SettingsPlugin; }(photoSphereViewer.AbstractPlugin); - SettingsPlugin.id = 'settings'; SettingsPlugin.ID_PANEL = 'settings'; SettingsPlugin.SETTING_DATA = 'settingId'; @@ -407,7 +416,9 @@ }).join('') + "\n \n"; }; - return SettingsPlugin; + exports.SettingsPlugin = SettingsPlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=settings.js.map diff --git a/dist/plugins/settings.js.map b/dist/plugins/settings.js.map index 28cc4c7e9..36a3bd5ca 100644 --- a/dist/plugins/settings.js.map +++ b/dist/plugins/settings.js.map @@ -1 +1 @@ -{"version":3,"file":"settings.js","sources":["../../src/plugins/settings/SettingsButton.js","../../src/plugins/settings/index.js"],"sourcesContent":["import { AbstractButton, CONSTANTS } from 'photo-sphere-viewer';\nimport SettingsPlugin from './index';\nimport icon from './settings.svg';\n\n/**\n * @summary Navigation bar settings button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class SettingsButton extends AbstractButton {\n\n static id = 'settings';\n static icon = icon;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-settings-button', true);\n\n /**\n * @type {PSV.plugins.SettingsPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin(SettingsPlugin.id);\n\n if (this.plugin) {\n this.psv.on(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.on(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.OPEN_PANEL, this);\n this.psv.off(CONSTANTS.EVENTS.CLOSE_PANEL, this);\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !!this.plugin;\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n /* eslint-disable */\n switch (e.type) {\n // @formatter:off\n case CONSTANTS.EVENTS.OPEN_PANEL: this.toggleActive(e.args[0] === SettingsPlugin.ID_PANEL); break;\n case CONSTANTS.EVENTS.CLOSE_PANEL: this.toggleActive(false); break;\n // @formatter:on\n }\n /* eslint-enable */\n }\n\n /**\n * @override\n * @description Toggles settings\n */\n onClick() {\n this.plugin.toggleSettings();\n }\n\n}\n","import { AbstractPlugin, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer';\nimport check from './check.svg';\nimport chevron from './chevron.svg';\nimport icon from './settings.svg';\nimport { SettingsButton } from './SettingsButton';\nimport './style.scss';\nimport switchOff from './switch-off.svg';\nimport switchOn from './switch-on.svg';\n\n\n// add settings button\nDEFAULTS.navbar.splice(DEFAULTS.navbar.indexOf('fullscreen'), 0, SettingsButton.id);\nDEFAULTS.lang[SettingsButton.id] = 'Settings';\nregisterButton(SettingsButton);\n\n/**\n * @typedef {Object} PSV.plugins.SettingsPlugin.Setting\n * @summary Description of a setting\n * @property {string} id - identifier of the setting\n * @property {string} label - label of the setting\n * @property {'options' | 'toggle'} type - type of the setting\n */\n\n/**\n * @typedef {PSV.plugins.SettingsPlugin.Setting} PSV.plugins.SettingsPlugin.OptionsSetting\n * @summary Description of a 'options' setting\n * @property {'options'} type - type of the setting\n * @property {function} current - function which returns the current option id\n * @property {function} options - function which the possible options as an array of {@link PSV.plugins.SettingsPlugin.Option}\n * @property {function} apply - function called with the id of the selected option\n */\n\n/**\n * @typedef {PSV.plugins.SettingsPlugin.Setting} PSV.plugins.SettingsPlugin.ToggleSetting\n * @summary Description of a 'toggle' setting\n * @property {'toggle'} type - type of the setting\n * @property {function} active - function which return whereas the setting is active or not\n * @property {function} toggle - function called when the setting is toggled\n */\n\n/**\n * @typedef {Object} PSV.plugins.SettingsPlugin.Option\n * @summary Option of an 'option' setting\n * @property {string} id - identifier of the option\n * @property {string} label - label of the option\n */\n\n/**\n * @summary Adds a button to access various settings.\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport default class SettingsPlugin extends AbstractPlugin {\n\n static id = 'settings';\n\n /**\n * @summary Panel identifier for settings content\n * @type {string}\n * @constant\n */\n static ID_PANEL = 'settings';\n\n /**\n * @summary Property name added to settings items\n * @type {string}\n * @constant\n */\n static SETTING_DATA = 'settingId';\n\n /**\n * @summary Settings list template\n * @param {PSV.plugins.SettingsPlugin.Setting[]} settings\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionsCurrent\n * @returns {string}\n */\n static SETTINGS_TEMPLATE = (settings, title, dataKey, optionsCurrent) => `\n
\n

${icon} ${title}

\n
    \n ${settings.map(s => `\n
  • \n ${SettingsPlugin.SETTINGS_TEMPLATE_[s.type](s, optionsCurrent)}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @summary Setting item template, by type\n */\n static SETTINGS_TEMPLATE_ = {\n options: (setting, optionsCurrent) => `\n ${setting.label} \n ${optionsCurrent(setting)} \n ${chevron}\n `,\n toggle : setting => `\n ${setting.label}\n ${setting.active() ? switchOn : switchOff}\n `,\n };\n\n /**\n * @summary Settings options template\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionActive\n * @returns {string}\n */\n static SETTING_OPTIONS_TEMPLATE = (setting, title, dataKey, optionActive) => `\n
\n

${icon} ${title}

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

${icon} ${title}

\n
    \n ${settings.map(s => `\n
  • \n ${SettingsPlugin.SETTINGS_TEMPLATE_[s.type](s, optionsCurrent)}\n
  • \n `).join('')}\n
\n
\n`;\n\n /**\n * @summary Setting item template, by type\n */\n static SETTINGS_TEMPLATE_ = {\n options: (setting, optionsCurrent) => `\n ${setting.label} \n ${optionsCurrent(setting)} \n ${chevron}\n `,\n toggle : setting => `\n ${setting.label}\n ${setting.active() ? switchOn : switchOff}\n `,\n };\n\n /**\n * @summary Settings options template\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @param {string} title\n * @param {string} dataKey\n * @param {function} optionActive\n * @returns {string}\n */\n static SETTING_OPTIONS_TEMPLATE = (setting, title, dataKey, optionActive) => `\n
\n

${icon} ${title}

\n
    \n
  • \n ${chevron}\n ${setting.label}\n
  • \n ${setting.options().map(s => `\n
  • \n ${optionActive(s) ? check : ''}\n ${s.label}\n
  • \n `).join('')}\n
\n`;\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.SettingsPlugin.Setting[]}\n * @private\n */\n this.settings = [];\n }\n\n /**\n * @package\n */\n destroy() {\n super.destroy();\n }\n\n /**\n * @summary Registers a new setting\n * @param {PSV.plugins.SettingsPlugin.Setting} setting\n */\n addSetting(setting) {\n if (!setting.id) {\n throw new PSVError('Missing setting id');\n }\n if (!setting.type) {\n throw new PSVError('Missing setting type');\n }\n if (!SettingsPlugin.SETTINGS_TEMPLATE_[setting.type]) {\n throw new PSVError('Unsupported setting type');\n }\n\n this.settings.push(setting);\n\n if (this.psv.panel.prop.contentId === SettingsPlugin.ID_PANEL) {\n this.showSettings();\n }\n }\n\n /**\n * @summary Removes a setting\n * @param {string} id\n */\n removeSetting(id) {\n let idx = -1;\n // FIXME use findIndex, one day, when IE11 is totally dead\n this.settings.some((setting, i) => {\n if (setting.id === id) {\n idx = i;\n return true;\n }\n return false;\n });\n if (idx !== -1) {\n this.settings.splice(idx, 1);\n\n if (this.psv.panel.prop.contentId === SettingsPlugin.ID_PANEL) {\n this.showSettings();\n }\n }\n }\n\n /**\n * @summary Toggles the settings panel\n */\n toggleSettings() {\n if (this.psv.panel.prop.contentId === SettingsPlugin.ID_PANEL) {\n this.hideSettings();\n }\n else {\n this.showSettings();\n }\n }\n\n /**\n * @summary Hides the settings panel\n */\n hideSettings() {\n this.psv.panel.hide(SettingsPlugin.ID_PANEL);\n }\n\n /**\n * @summary Shows the settings panel\n */\n showSettings() {\n this.psv.panel.show({\n id : SettingsPlugin.ID_PANEL,\n content : SettingsPlugin.SETTINGS_TEMPLATE(\n this.settings,\n this.psv.config.lang[SettingsButton.id],\n utils.dasherize(SettingsPlugin.SETTING_DATA),\n (setting) => { // retrocompatibility with \"current\" returning a label\n const current = setting.current();\n const option = setting.options().find(opt => opt.id === current);\n return option?.label || current;\n }\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const settingId = li ? li.dataset[SettingsPlugin.SETTING_DATA] : undefined;\n const setting = this.settings.find(s => s.id === settingId);\n\n if (setting) {\n switch (setting.type) {\n case 'toggle':\n setting.toggle();\n this.showSettings();\n break;\n\n case 'options':\n this.__showOptions(setting);\n break;\n\n default:\n // noop\n }\n }\n },\n });\n }\n\n /**\n * @summary Shows setting options panel\n * @param {PSV.plugins.SettingsPlugin.OptionsSetting} setting\n * @private\n */\n __showOptions(setting) {\n const current = setting.current();\n\n this.psv.panel.show({\n id : SettingsPlugin.ID_PANEL,\n content : SettingsPlugin.SETTING_OPTIONS_TEMPLATE(\n setting,\n this.psv.config.lang[SettingsButton.id],\n utils.dasherize(SettingsPlugin.SETTING_DATA),\n (option) => { // retrocompatibility with options having an \"active\" flag\n return 'active' in option ? option.active : option.id === current;\n }\n ),\n noMargin : true,\n clickHandler: (e) => {\n const li = e.target ? utils.getClosest(e.target, 'li') : undefined;\n const optionId = li ? li.dataset[SettingsPlugin.SETTING_DATA] : undefined;\n\n if (optionId === '__back') {\n this.showSettings();\n }\n else {\n setting.apply(optionId);\n this.hideSettings();\n }\n },\n });\n }\n\n}\n"],"names":["SettingsButton","navbar","plugin","psv","getPlugin","SettingsPlugin","id","on","CONSTANTS","EVENTS","OPEN_PANEL","CLOSE_PANEL","destroy","off","isSupported","handleEvent","e","type","toggleActive","args","ID_PANEL","onClick","toggleSettings","AbstractButton","icon","DEFAULTS","splice","indexOf","lang","registerButton","settings","addSetting","setting","PSVError","SETTINGS_TEMPLATE_","push","panel","prop","contentId","showSettings","removeSetting","idx","some","i","hideSettings","hide","show","content","SETTINGS_TEMPLATE","config","utils","dasherize","SETTING_DATA","current","option","options","find","opt","label","noMargin","clickHandler","li","target","getClosest","undefined","settingId","dataset","s","toggle","__showOptions","SETTING_OPTIONS_TEMPLATE","active","optionId","apply","AbstractPlugin","title","dataKey","optionsCurrent","map","join","chevron","switchOn","switchOff","optionActive","check"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAIA;EACA;EACA;EACA;EACA;;MACaA,cAAb;EAAA;;EAKE;EACF;EACA;EACE,0BAAYC,MAAZ,EAAoB;EAAA;;EAClB,uCAAMA,MAAN,EAAc,6CAAd,EAA6D,IAA7D;EAEA;EACJ;EACA;EACA;EACA;;EACI,UAAKC,MAAL,GAAc,MAAKC,GAAL,CAASC,SAAT,CAAmBC,cAAc,CAACC,EAAlC,CAAd;;EAEA,QAAI,MAAKJ,MAAT,EAAiB;EACf,YAAKC,GAAL,CAASI,EAAT,CAAYC,2BAAS,CAACC,MAAV,CAAiBC,UAA7B;;EACA,YAAKP,GAAL,CAASI,EAAT,CAAYC,2BAAS,CAACC,MAAV,CAAiBE,WAA7B;EACD;;EAbiB;EAcnB;EAED;EACF;EACA;;;EA1BA;;EAAA,SA2BEC,OA3BF,GA2BE,mBAAU;EACR,SAAKT,GAAL,CAASU,GAAT,CAAaL,2BAAS,CAACC,MAAV,CAAiBC,UAA9B,EAA0C,IAA1C;EACA,SAAKP,GAAL,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AApC,EAA0CkD,CAA1C,EAA6CU,cAA7C,CAFU;EAAA,GAAd,EAICE,IAJD,CAIM,EAJN,CAJuB;EAAA;;EA1BhB1E,eA0CJ6B,qBAAqB;EAC1BqB,EAAAA,OAAO,EAAE,iBAACvB,OAAD,EAAU6C,cAAV;EAAA,gEACiC7C,OAAO,CAAC0B,KADzC,gEAEiCmB,cAAc,CAAC7C,OAAD,CAF/C,+DAGgCgD,OAHhC;EAAA,GADiB;EAM1BZ,EAAAA,MAAM,EAAG,gBAAApC,OAAO;EAAA,gEAC0BA,OAAO,CAAC0B,KADlC,gEAE0B1B,OAAO,CAACuC,MAAR,KAAmBU,QAAnB,GAA8BC,SAFxD;EAAA;EANU;;EA1CjB7E,eA8DJiE,2BAA2B,UAACtC,OAAD,EAAU2C,KAAV,EAAiBC,OAAjB,EAA0BO,YAA1B;EAAA,qFAEC3D,IAFD,SAESmD,KAFT,0HAIiCC,OAJjC,mEAKSI,OALT,+DAMUhD,OAAO,CAAC0B,KANlB,gCAQ9B1B,OAAO,CAACuB,OAAR,GAAkBuB,GAAlB,CAAsB,UAAAX,CAAC;EAAA,+DACgBS,OADhB,WAC4BT,CAAC,CAAC7D,EAD9B,6DAEkB6E,YAAY,CAAChB,CAAD,CAAZ,GAAkBiB,KAAlB,GAA0B,EAF5C,kEAGmBjB,CAAC,CAACT,KAHrB;EAAA,GAAvB,EAKCqB,IALD,CAKM,EALN,CAR8B;EAAA;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/stereo.d.ts b/dist/plugins/stereo.d.ts new file mode 100644 index 000000000..2f3e50de2 --- /dev/null +++ b/dist/plugins/stereo.d.ts @@ -0,0 +1,43 @@ +import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; +import { Event } from 'uevent'; + +/** + * @summary Adds stereo view on mobile devices + */ +declare class StereoPlugin extends AbstractPlugin { + + static EVENTS: { + STEREO_UPDATED: 'stereo-updated', + }; + + constructor(psv: Viewer); + + /** + * @summary Checks if the stereo view is enabled + */ + isEnabled(): boolean; + + /** + * @summary Enables the stereo view + * @throws {PSVError} if the gyroscope API is not available/granted + */ + start(): Promise; + + /** + * @summary Disables the stereo view + */ + stop(); + + /** + * @summary Enables or disables the stereo view + */ + toggle(); + + /** + * @summary Triggered when the stereo view is enabled/disabled + */ + on(e: 'stereo-updated', cb: (e: Event, enabled: boolean) => void): this; + +} + +export { StereoPlugin }; diff --git a/dist/plugins/stereo.js b/dist/plugins/stereo.js index 991be1db4..b690c6617 100644 --- a/dist/plugins/stereo.js +++ b/dist/plugins/stereo.js @@ -1,19 +1,29 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer'), require('photo-sphere-viewer/dist/plugins/gyroscope'), require('three')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer', 'photo-sphere-viewer/dist/plugins/gyroscope', 'three'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.StereoPlugin = factory(global.PhotoSphereViewer, global.PhotoSphereViewer.GyroscopePlugin, global.THREE))); -}(this, (function (photoSphereViewer, GyroscopePlugin, three) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('three'), require('photo-sphere-viewer'), require('photo-sphere-viewer/dist/plugins/gyroscope')) : + typeof define === 'function' && define.amd ? define(['exports', 'three', 'photo-sphere-viewer', 'photo-sphere-viewer/dist/plugins/gyroscope'], factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.StereoPlugin = {}), global.THREE, global.PhotoSphereViewer, global.PhotoSphereViewer.GyroscopePlugin)); +}(this, (function (exports, three, photoSphereViewer, gyroscope) { 'use strict'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -24,38 +34,41 @@ return self; } - var StereoEffect = function StereoEffect(renderer) { - var _stereo = new three.StereoCamera(); + class StereoEffect { + constructor(renderer) { + const _stereo = new three.StereoCamera(); - _stereo.aspect = 0.5; - var size = new three.Vector2(); + _stereo.aspect = 0.5; + const size = new three.Vector2(); - this.setEyeSeparation = function (eyeSep) { - _stereo.eyeSep = eyeSep; - }; + this.setEyeSeparation = function (eyeSep) { + _stereo.eyeSep = eyeSep; + }; - this.setSize = function (width, height) { - renderer.setSize(width, height); - }; + this.setSize = function (width, height) { + renderer.setSize(width, height); + }; - this.render = function (scene, camera) { - scene.updateMatrixWorld(); - if (camera.parent === null) camera.updateMatrixWorld(); - - _stereo.update(camera); - - renderer.getSize(size); - if (renderer.autoClear) renderer.clear(); - renderer.setScissorTest(true); - renderer.setScissor(0, 0, size.width / 2, size.height); - renderer.setViewport(0, 0, size.width / 2, size.height); - renderer.render(scene, _stereo.cameraL); - renderer.setScissor(size.width / 2, 0, size.width / 2, size.height); - renderer.setViewport(size.width / 2, 0, size.width / 2, size.height); - renderer.render(scene, _stereo.cameraR); - renderer.setScissorTest(false); - }; - }; + this.render = function (scene, camera) { + scene.updateMatrixWorld(); + if (camera.parent === null) camera.updateMatrixWorld(); + + _stereo.update(camera); + + renderer.getSize(size); + if (renderer.autoClear) renderer.clear(); + renderer.setScissorTest(true); + renderer.setScissor(0, 0, size.width / 2, size.height); + renderer.setViewport(0, 0, size.width / 2, size.height); + renderer.render(scene, _stereo.cameraL); + renderer.setScissor(size.width / 2, 0, size.width / 2, size.height); + renderer.setViewport(size.width / 2, 0, size.width / 2, size.height); + renderer.render(scene, _stereo.cameraR); + renderer.setScissorTest(false); + }; + } + + } var mobileRotateIcon = "\n"; @@ -145,11 +158,6 @@ StereoButton.id = 'stereo'; StereoButton.icon = stereo; - /** - * @typedef {Object} external:THREE.StereoEffect - * @summary {@link https://github.com/mrdoob/three.js/blob/dev/examples/jsm/effects/StereoEffect.js} - */ - /** * @external NoSleep * @description {@link https://github.com/richtr/NoSleep.js} @@ -197,7 +205,7 @@ * @private */ - _this.gyroscope = GyroscopePlugin ? psv.getPlugin(GyroscopePlugin) : null; + _this.gyroscope = gyroscope.GyroscopePlugin ? psv.getPlugin(gyroscope.GyroscopePlugin) : null; if (!_this.gyroscope) { throw new photoSphereViewer.PSVError('Stereo plugin requires the Gyroscope plugin'); @@ -309,13 +317,6 @@ _this2.psv.navbar.hide(); _this2.psv.panel.hide(); - /** - * @event stereo-updated - * @memberof PSV.plugins.StereoPlugin - * @summary Triggered when the stereo view is enabled/disabled - * @param {boolean} enabled - */ - _this2.trigger(StereoPlugin.EVENTS.STEREO_UPDATED, true); @@ -466,14 +467,21 @@ return StereoPlugin; }(photoSphereViewer.AbstractPlugin); - StereoPlugin.id = 'stereo'; StereoPlugin.ID_OVERLAY_PLEASE_ROTATE = 'pleaseRotate'; StereoPlugin.EVENTS = { + /** + * @event stereo-updated + * @memberof PSV.plugins.StereoPlugin + * @summary Triggered when the stereo view is enabled/disabled + * @param {boolean} enabled + */ STEREO_UPDATED: 'stereo-updated' }; - return StereoPlugin; + exports.StereoPlugin = StereoPlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=stereo.js.map diff --git a/dist/plugins/stereo.js.map b/dist/plugins/stereo.js.map index 1a2d5f84f..eb094cbb7 100644 --- a/dist/plugins/stereo.js.map +++ b/dist/plugins/stereo.js.map @@ -1 +1 @@ -{"version":3,"file":"stereo.js","sources":["../../three-examples/effects/StereoEffect.js","../../src/plugins/stereo/StereoButton.js","../../src/plugins/stereo/index.js"],"sourcesContent":["import {\n\tStereoCamera,\n\tVector2\n} from '../../../build/three.module.js';\n\nvar StereoEffect = function ( renderer ) {\n\n\tvar _stereo = new StereoCamera();\n\t_stereo.aspect = 0.5;\n\tvar size = new Vector2();\n\n\tthis.setEyeSeparation = function ( eyeSep ) {\n\n\t\t_stereo.eyeSep = eyeSep;\n\n\t};\n\n\tthis.setSize = function ( width, height ) {\n\n\t\trenderer.setSize( width, height );\n\n\t};\n\n\tthis.render = function ( scene, camera ) {\n\n\t\tscene.updateMatrixWorld();\n\n\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\t_stereo.update( camera );\n\n\t\trenderer.getSize( size );\n\n\t\tif ( renderer.autoClear ) renderer.clear();\n\t\trenderer.setScissorTest( true );\n\n\t\trenderer.setScissor( 0, 0, size.width / 2, size.height );\n\t\trenderer.setViewport( 0, 0, size.width / 2, size.height );\n\t\trenderer.render( scene, _stereo.cameraL );\n\n\t\trenderer.setScissor( size.width / 2, 0, size.width / 2, size.height );\n\t\trenderer.setViewport( size.width / 2, 0, size.width / 2, size.height );\n\t\trenderer.render( scene, _stereo.cameraR );\n\n\t\trenderer.setScissorTest( false );\n\n\t};\n\n};\n\nexport { StereoEffect };\n","import { AbstractButton } from 'photo-sphere-viewer';\nimport StereoPlugin from './index';\nimport stereo from './stereo.svg';\n\n/**\n * @summary Navigation bar stereo button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class StereoButton extends AbstractButton {\n\n static id = 'stereo';\n static icon = stereo;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-stereo-button', true);\n\n /**\n * @type {PSV.plugins.StereoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin(StereoPlugin.id);\n\n if (this.plugin) {\n this.plugin.on(StereoPlugin.EVENTS.STEREO_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(StereoPlugin.EVENTS.STEREO_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === StereoPlugin.EVENTS.STEREO_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles stereo control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer';\nimport GyroscopePlugin from 'photo-sphere-viewer/dist/plugins/gyroscope';\nimport { StereoEffect } from 'three/examples/jsm/effects/StereoEffect';\nimport mobileRotateIcon from './mobile-rotate.svg';\nimport { StereoButton } from './StereoButton';\n\n\n/**\n * @typedef {Object} external:THREE.StereoEffect\n * @summary {@link https://github.com/mrdoob/three.js/blob/dev/examples/jsm/effects/StereoEffect.js}\n */\n\n/**\n * @external NoSleep\n * @description {@link https://github.com/richtr/NoSleep.js}\n */\n\n\n// add stereo button\nDEFAULTS.navbar.splice(-1, 0, StereoButton.id);\nDEFAULTS.lang[StereoButton.id] = 'Stereo view';\nregisterButton(StereoButton);\n\n// other lang strings\nDEFAULTS.lang.stereoNotification = 'Click anywhere to exit stereo view.';\nDEFAULTS.lang.pleaseRotate = ['Please rotate your device', '(or tap to continue)'];\n\n\n/**\n * @summary Adds stereo view on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport default class StereoPlugin extends AbstractPlugin {\n\n static id = 'stereo';\n\n /**\n * @summary Identifier of the overlay \"please rotate your screen\"\n * @type {string}\n * @constant\n */\n static ID_OVERLAY_PLEASE_ROTATE = 'pleaseRotate';\n\n /**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.StereoPlugin\n * @constant\n */\n static EVENTS = {\n STEREO_UPDATED: 'stereo-updated',\n };\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.gyroscope = GyroscopePlugin ? psv.getPlugin(GyroscopePlugin) : null;\n\n if (!this.gyroscope) {\n throw new PSVError('Stereo plugin requires the Gyroscope plugin');\n }\n\n /**\n * @member {Object}\n * @protected\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {external:THREE.WebGLRenderer} renderer - original renderer\n * @property {external:NoSleep} noSleep\n * @property {WakeLockSentinel} wakeLock\n */\n this.prop = {\n isSupported: this.gyroscope.prop.isSupported,\n renderer : null,\n noSleep : null,\n wakeLock : null,\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = this.psv.getPlugin('markers');\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n\n this.stop();\n\n if (this.prop.noSleep) {\n delete this.prop.noSleep;\n }\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n case CONSTANTS.EVENTS.CLICK:\n this.stop();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the stereo view is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.prop.renderer;\n }\n\n /**\n * @summary Enables the stereo view\n * @description\n * - enables NoSleep.js\n * - enables full screen\n * - starts gyroscope controle\n * - hides markers, navbar and panel\n * - instanciate {@link external:THREE.StereoEffect}\n * @returns {Promise}\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n // Need to be in the main event queue\n this.psv.enterFullscreen();\n this.__startNoSleep();\n this.__lockOrientation();\n\n return this.gyroscope.start().then(() => {\n // switch renderer\n this.prop.renderer = this.psv.renderer.renderer;\n this.psv.renderer.renderer = new StereoEffect(this.psv.renderer.renderer);\n\n this.psv.needsUpdate();\n\n if (this.markers) {\n this.markers.hide();\n }\n this.psv.navbar.hide();\n this.psv.panel.hide();\n\n /**\n * @event stereo-updated\n * @memberof PSV.plugins.StereoPlugin\n * @summary Triggered when the stereo view is enabled/disabled\n * @param {boolean} enabled\n */\n this.trigger(StereoPlugin.EVENTS.STEREO_UPDATED, true);\n\n this.psv.notification.show({\n content: this.psv.config.lang.stereoNotification,\n timeout: 3000,\n });\n }, () => {\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n });\n }\n\n /**\n * @summary Disables the stereo view\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.psv.renderer.renderer = this.prop.renderer;\n this.prop.renderer = null;\n\n this.psv.needsUpdate();\n\n if (this.markers) {\n this.markers.show();\n }\n this.psv.navbar.show();\n\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n this.gyroscope.stop();\n\n this.trigger(StereoPlugin.EVENTS.STEREO_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the stereo view\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Enables WakeLock or NoSleep.js\n * @private\n */\n __startNoSleep() {\n if ('wakeLock' in navigator) {\n navigator.wakeLock.request('screen')\n .then((wakeLock) => {\n this.prop.wakeLock = wakeLock;\n })\n .catch(() => utils.logWarn('Cannot acquire WakeLock'));\n }\n else if ('NoSleep' in window) {\n if (!this.prop.noSleep) {\n this.prop.noSleep = new window.NoSleep();\n }\n this.prop.noSleep.enable();\n }\n else {\n utils.logWarn('NoSleep is not available');\n }\n }\n\n /**\n * @summary Disables WakeLock or NoSleep.js\n * @private\n */\n __stopNoSleep() {\n if (this.prop.wakeLock) {\n this.prop.wakeLock.release();\n this.prop.wakeLock = null;\n }\n else if (this.prop.noSleep) {\n this.prop.noSleep.disable();\n }\n }\n\n /**\n * @summary Tries to lock the device in landscape or display a message\n * @private\n */\n __lockOrientation() {\n let displayRotateMessageTimeout;\n\n const displayRotateMessage = () => {\n if (this.isEnabled() && window.innerHeight > window.innerWidth) {\n this.psv.overlay.show({\n id : StereoPlugin.ID_OVERLAY_PLEASE_ROTATE,\n image : mobileRotateIcon,\n text : this.psv.config.lang.pleaseRotate[0],\n subtext: this.psv.config.lang.pleaseRotate[1],\n });\n }\n\n if (displayRotateMessageTimeout) {\n clearTimeout(displayRotateMessageTimeout);\n displayRotateMessageTimeout = null;\n }\n };\n\n if (window.screen?.orientation) {\n window.screen.orientation.lock('landscape').then(null, () => displayRotateMessage());\n displayRotateMessageTimeout = setTimeout(() => displayRotateMessage(), 500);\n }\n else {\n displayRotateMessage();\n }\n }\n\n /**\n * @summary Unlock the device orientation\n * @private\n */\n __unlockOrientation() {\n if (window.screen?.orientation) {\n window.screen.orientation.unlock();\n }\n else {\n this.psv.overlay.hide(StereoPlugin.ID_OVERLAY_PLEASE_ROTATE);\n }\n }\n\n}\n"],"names":["StereoEffect","renderer","_stereo","StereoCamera","aspect","size","Vector2","setEyeSeparation","eyeSep","setSize","width","height","render","scene","camera","updateMatrixWorld","parent","update","getSize","autoClear","clear","setScissorTest","setScissor","setViewport","cameraL","cameraR","StereoButton","navbar","plugin","psv","getPlugin","StereoPlugin","id","on","EVENTS","STEREO_UPDATED","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","icon","stereo","DEFAULTS","splice","lang","registerButton","stereoNotification","pleaseRotate","gyroscope","GyroscopePlugin","PSVError","noSleep","wakeLock","markers","CONSTANTS","STOP_ALL","CLICK","stop","isEnabled","start","enterFullscreen","__startNoSleep","__lockOrientation","then","needsUpdate","hide","panel","trigger","notification","show","content","config","timeout","__unlockOrientation","__stopNoSleep","exitFullscreen","navigator","request","catch","utils","logWarn","window","NoSleep","enable","release","disable","displayRotateMessageTimeout","displayRotateMessage","innerHeight","innerWidth","overlay","ID_OVERLAY_PLEASE_ROTATE","image","mobileRotateIcon","text","subtext","clearTimeout","screen","orientation","lock","setTimeout","unlock","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAKA,IAAIA,YAAY,GAAG,SAAfA,YAAe,CAAWC,QAAX,EAAsB;EAExC,MAAIC,OAAO,GAAG,IAAIC,kBAAJ,EAAd;;EACAD,EAAAA,OAAO,CAACE,MAAR,GAAiB,GAAjB;EACA,MAAIC,IAAI,GAAG,IAAIC,aAAJ,EAAX;;EAEA,OAAKC,gBAAL,GAAwB,UAAWC,MAAX,EAAoB;EAE3CN,IAAAA,OAAO,CAACM,MAAR,GAAiBA,MAAjB;EAEA,GAJD;;EAMA,OAAKC,OAAL,GAAe,UAAWC,KAAX,EAAkBC,MAAlB,EAA2B;EAEzCV,IAAAA,QAAQ,CAACQ,OAAT,CAAkBC,KAAlB,EAAyBC,MAAzB;EAEA,GAJD;;EAMA,OAAKC,MAAL,GAAc,UAAWC,KAAX,EAAkBC,MAAlB,EAA2B;EAExCD,IAAAA,KAAK,CAACE,iBAAN;EAEA,QAAKD,MAAM,CAACE,MAAP,KAAkB,IAAvB,EAA8BF,MAAM,CAACC,iBAAP;;EAE9Bb,IAAAA,OAAO,CAACe,MAAR,CAAgBH,MAAhB;;EAEAb,IAAAA,QAAQ,CAACiB,OAAT,CAAkBb,IAAlB;EAEA,QAAKJ,QAAQ,CAACkB,SAAd,EAA0BlB,QAAQ,CAACmB,KAAT;EAC1BnB,IAAAA,QAAQ,CAACoB,cAAT,CAAyB,IAAzB;EAEApB,IAAAA,QAAQ,CAACqB,UAAT,CAAqB,CAArB,EAAwB,CAAxB,EAA2BjB,IAAI,CAACK,KAAL,GAAa,CAAxC,EAA2CL,IAAI,CAACM,MAAhD;EACAV,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kC,CAAlC;EAJW,SAAtB;EAMD;;EAED,UAAIuC,2BAAJ,EAAiC;EAC/BU,QAAAA,YAAY,CAACV,2BAAD,CAAZ;EACAA,QAAAA,2BAA2B,GAAG,IAA9B;EACD;EACF,KAdD;;EAgBA,0BAAIL,MAAM,CAACgB,MAAX,aAAI,eAAeC,WAAnB,EAAgC;EAC9BjB,MAAAA,MAAM,CAACgB,MAAP,CAAcC,WAAd,CAA0BC,IAA1B,CAA+B,WAA/B,EAA4CpC,IAA5C,CAAiD,IAAjD,EAAuD;EAAA,eAAMwB,oBAAoB,EAA1B;EAAA,OAAvD;EACAD,MAAAA,2BAA2B,GAAGc,UAAU,CAAC;EAAA,eAAMb,oBAAoB,EAA1B;EAAA,OAAD,EAA+B,GAA/B,CAAxC;EACD,KAHD,MAIK;EACHA,MAAAA,oBAAoB;EACrB;EACF;EAED;EACF;EACA;EACA;;;WACEd,sBAAA,+BAAsB;EAAA;;EACpB,2BAAIQ,MAAM,CAACgB,MAAX,aAAI,gBAAeC,WAAnB,EAAgC;EAC9BjB,MAAAA,MAAM,CAACgB,MAAP,CAAcC,WAAd,CAA0BG,MAA1B;EACD,KAFD,MAGK;EACH,WAAKlF,GAAL,CAASuE,OAAT,CAAiBzB,IAAjB,CAAsB5C,YAAY,CAACsE,wBAAnC;EACD;EACF;;;IA5QuCW;;EAArBjF,aAEZC,KAAK;EAFOD,aASZsE,2BAA2B;EATftE,aAiBZG,SAAS;EACdC,EAAAA,cAAc,EAAE;EADF;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"stereo.js","sources":["../../three-examples/effects/StereoEffect.js","../../src/plugins/stereo/StereoButton.js","../../src/plugins/stereo/index.js"],"sourcesContent":["import {\n\tStereoCamera,\n\tVector2\n} from 'three';\n\nclass StereoEffect {\n\n\tconstructor( renderer ) {\n\n\t\tconst _stereo = new StereoCamera();\n\t\t_stereo.aspect = 0.5;\n\t\tconst size = new Vector2();\n\n\t\tthis.setEyeSeparation = function ( eyeSep ) {\n\n\t\t\t_stereo.eyeSep = eyeSep;\n\n\t\t};\n\n\t\tthis.setSize = function ( width, height ) {\n\n\t\t\trenderer.setSize( width, height );\n\n\t\t};\n\n\t\tthis.render = function ( scene, camera ) {\n\n\t\t\tscene.updateMatrixWorld();\n\n\t\t\tif ( camera.parent === null ) camera.updateMatrixWorld();\n\n\t\t\t_stereo.update( camera );\n\n\t\t\trenderer.getSize( size );\n\n\t\t\tif ( renderer.autoClear ) renderer.clear();\n\t\t\trenderer.setScissorTest( true );\n\n\t\t\trenderer.setScissor( 0, 0, size.width / 2, size.height );\n\t\t\trenderer.setViewport( 0, 0, size.width / 2, size.height );\n\t\t\trenderer.render( scene, _stereo.cameraL );\n\n\t\t\trenderer.setScissor( size.width / 2, 0, size.width / 2, size.height );\n\t\t\trenderer.setViewport( size.width / 2, 0, size.width / 2, size.height );\n\t\t\trenderer.render( scene, _stereo.cameraR );\n\n\t\t\trenderer.setScissorTest( false );\n\n\t\t};\n\n\t}\n\n}\n\nexport { StereoEffect };\n","import { AbstractButton } from '../..';\nimport { StereoPlugin } from './index';\nimport stereo from './stereo.svg';\n\n/**\n * @summary Navigation bar stereo button class\n * @extends PSV.buttons.AbstractButton\n * @memberof PSV.buttons\n */\nexport class StereoButton extends AbstractButton {\n\n static id = 'stereo';\n static icon = stereo;\n\n /**\n * @param {PSV.components.Navbar} navbar\n */\n constructor(navbar) {\n super(navbar, 'psv-button--hover-scale psv-stereo-button', true);\n\n /**\n * @type {PSV.plugins.StereoPlugin}\n * @private\n * @readonly\n */\n this.plugin = this.psv.getPlugin(StereoPlugin.id);\n\n if (this.plugin) {\n this.plugin.on(StereoPlugin.EVENTS.STEREO_UPDATED, this);\n }\n }\n\n /**\n * @override\n */\n destroy() {\n if (this.plugin) {\n this.plugin.off(StereoPlugin.EVENTS.STEREO_UPDATED, this);\n }\n\n delete this.plugin;\n\n super.destroy();\n }\n\n /**\n * @override\n */\n isSupported() {\n return !this.plugin ? false : { initial: false, promise: this.plugin.prop.isSupported };\n }\n\n /**\n * @summary Handles events\n * @param {Event} e\n * @private\n */\n handleEvent(e) {\n if (e.type === StereoPlugin.EVENTS.STEREO_UPDATED) {\n this.toggleActive(e.args[0]);\n }\n }\n\n /**\n * @override\n * @description Toggles stereo control\n */\n onClick() {\n this.plugin.toggle();\n }\n\n}\n","import { StereoEffect } from 'three/examples/jsm/effects/StereoEffect';\nimport { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..';\nimport { GyroscopePlugin } from '../gyroscope';\nimport mobileRotateIcon from './mobile-rotate.svg';\nimport { StereoButton } from './StereoButton';\n\n\n/**\n * @external NoSleep\n * @description {@link https://github.com/richtr/NoSleep.js}\n */\n\n\n// add stereo button\nDEFAULTS.navbar.splice(-1, 0, StereoButton.id);\nDEFAULTS.lang[StereoButton.id] = 'Stereo view';\nregisterButton(StereoButton);\n\n// other lang strings\nDEFAULTS.lang.stereoNotification = 'Click anywhere to exit stereo view.';\nDEFAULTS.lang.pleaseRotate = ['Please rotate your device', '(or tap to continue)'];\n\n\n/**\n * @summary Adds stereo view on mobile devices\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport class StereoPlugin extends AbstractPlugin {\n\n static id = 'stereo';\n\n /**\n * @summary Identifier of the overlay \"please rotate your screen\"\n * @type {string}\n * @constant\n */\n static ID_OVERLAY_PLEASE_ROTATE = 'pleaseRotate';\n\n /**\n * @summary Available events\n * @enum {string}\n * @memberof PSV.plugins.StereoPlugin\n * @constant\n */\n static EVENTS = {\n /**\n * @event stereo-updated\n * @memberof PSV.plugins.StereoPlugin\n * @summary Triggered when the stereo view is enabled/disabled\n * @param {boolean} enabled\n */\n STEREO_UPDATED: 'stereo-updated',\n };\n\n /**\n * @param {PSV.Viewer} psv\n */\n constructor(psv) {\n super(psv);\n\n /**\n * @type {PSV.plugins.GyroscopePlugin}\n * @readonly\n * @private\n */\n this.gyroscope = GyroscopePlugin ? psv.getPlugin(GyroscopePlugin) : null;\n\n if (!this.gyroscope) {\n throw new PSVError('Stereo plugin requires the Gyroscope plugin');\n }\n\n /**\n * @member {Object}\n * @protected\n * @property {Promise} isSupported - indicates of the gyroscope API is available\n * @property {external:THREE.WebGLRenderer} renderer - original renderer\n * @property {external:NoSleep} noSleep\n * @property {WakeLockSentinel} wakeLock\n */\n this.prop = {\n isSupported: this.gyroscope.prop.isSupported,\n renderer : null,\n noSleep : null,\n wakeLock : null,\n };\n\n /**\n * @type {PSV.plugins.MarkersPlugin}\n * @private\n */\n this.markers = this.psv.getPlugin('markers');\n\n this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.on(CONSTANTS.EVENTS.CLICK, this);\n }\n\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this);\n this.psv.off(CONSTANTS.EVENTS.CLICK, this);\n\n this.stop();\n\n if (this.prop.noSleep) {\n delete this.prop.noSleep;\n }\n\n super.destroy();\n }\n\n /**\n * @private\n */\n handleEvent(e) {\n switch (e.type) {\n case CONSTANTS.EVENTS.STOP_ALL:\n case CONSTANTS.EVENTS.CLICK:\n this.stop();\n break;\n default:\n break;\n }\n }\n\n /**\n * @summary Checks if the stereo view is enabled\n * @returns {boolean}\n */\n isEnabled() {\n return !!this.prop.renderer;\n }\n\n /**\n * @summary Enables the stereo view\n * @description\n * - enables NoSleep.js\n * - enables full screen\n * - starts gyroscope controle\n * - hides markers, navbar and panel\n * - instanciate {@link external:THREE.StereoEffect}\n * @returns {Promise}\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n * @throws {PSV.PSVError} if the gyroscope API is not available/granted\n */\n start() {\n // Need to be in the main event queue\n this.psv.enterFullscreen();\n this.__startNoSleep();\n this.__lockOrientation();\n\n return this.gyroscope.start().then(() => {\n // switch renderer\n this.prop.renderer = this.psv.renderer.renderer;\n this.psv.renderer.renderer = new StereoEffect(this.psv.renderer.renderer);\n\n this.psv.needsUpdate();\n\n if (this.markers) {\n this.markers.hide();\n }\n this.psv.navbar.hide();\n this.psv.panel.hide();\n\n this.trigger(StereoPlugin.EVENTS.STEREO_UPDATED, true);\n\n this.psv.notification.show({\n content: this.psv.config.lang.stereoNotification,\n timeout: 3000,\n });\n }, () => {\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n });\n }\n\n /**\n * @summary Disables the stereo view\n * @fires PSV.plugins.StereoPlugin.stereo-updated\n */\n stop() {\n if (this.isEnabled()) {\n this.psv.renderer.renderer = this.prop.renderer;\n this.prop.renderer = null;\n\n this.psv.needsUpdate();\n\n if (this.markers) {\n this.markers.show();\n }\n this.psv.navbar.show();\n\n this.__unlockOrientation();\n this.__stopNoSleep();\n this.psv.exitFullscreen();\n this.gyroscope.stop();\n\n this.trigger(StereoPlugin.EVENTS.STEREO_UPDATED, false);\n }\n }\n\n /**\n * @summary Enables or disables the stereo view\n */\n toggle() {\n if (this.isEnabled()) {\n this.stop();\n }\n else {\n this.start();\n }\n }\n\n /**\n * @summary Enables WakeLock or NoSleep.js\n * @private\n */\n __startNoSleep() {\n if ('wakeLock' in navigator) {\n navigator.wakeLock.request('screen')\n .then((wakeLock) => {\n this.prop.wakeLock = wakeLock;\n })\n .catch(() => utils.logWarn('Cannot acquire WakeLock'));\n }\n else if ('NoSleep' in window) {\n if (!this.prop.noSleep) {\n this.prop.noSleep = new window.NoSleep();\n }\n this.prop.noSleep.enable();\n }\n else {\n utils.logWarn('NoSleep is not available');\n }\n }\n\n /**\n * @summary Disables WakeLock or NoSleep.js\n * @private\n */\n __stopNoSleep() {\n if (this.prop.wakeLock) {\n this.prop.wakeLock.release();\n this.prop.wakeLock = null;\n }\n else if (this.prop.noSleep) {\n this.prop.noSleep.disable();\n }\n }\n\n /**\n * @summary Tries to lock the device in landscape or display a message\n * @private\n */\n __lockOrientation() {\n let displayRotateMessageTimeout;\n\n const displayRotateMessage = () => {\n if (this.isEnabled() && window.innerHeight > window.innerWidth) {\n this.psv.overlay.show({\n id : StereoPlugin.ID_OVERLAY_PLEASE_ROTATE,\n image : mobileRotateIcon,\n text : this.psv.config.lang.pleaseRotate[0],\n subtext: this.psv.config.lang.pleaseRotate[1],\n });\n }\n\n if (displayRotateMessageTimeout) {\n clearTimeout(displayRotateMessageTimeout);\n displayRotateMessageTimeout = null;\n }\n };\n\n if (window.screen?.orientation) {\n window.screen.orientation.lock('landscape').then(null, () => displayRotateMessage());\n displayRotateMessageTimeout = setTimeout(() => displayRotateMessage(), 500);\n }\n else {\n displayRotateMessage();\n }\n }\n\n /**\n * @summary Unlock the device orientation\n * @private\n */\n __unlockOrientation() {\n if (window.screen?.orientation) {\n window.screen.orientation.unlock();\n }\n else {\n this.psv.overlay.hide(StereoPlugin.ID_OVERLAY_PLEASE_ROTATE);\n }\n }\n\n}\n"],"names":["StereoEffect","constructor","renderer","_stereo","StereoCamera","aspect","size","Vector2","setEyeSeparation","eyeSep","setSize","width","height","render","scene","camera","updateMatrixWorld","parent","update","getSize","autoClear","clear","setScissorTest","setScissor","setViewport","cameraL","cameraR","StereoButton","navbar","plugin","psv","getPlugin","StereoPlugin","id","on","EVENTS","STEREO_UPDATED","destroy","off","isSupported","initial","promise","prop","handleEvent","e","type","toggleActive","args","onClick","toggle","AbstractButton","icon","stereo","DEFAULTS","splice","lang","registerButton","stereoNotification","pleaseRotate","gyroscope","GyroscopePlugin","PSVError","noSleep","wakeLock","markers","CONSTANTS","STOP_ALL","CLICK","stop","isEnabled","start","enterFullscreen","__startNoSleep","__lockOrientation","then","needsUpdate","hide","panel","trigger","notification","show","content","config","timeout","__unlockOrientation","__stopNoSleep","exitFullscreen","navigator","request","catch","utils","logWarn","window","NoSleep","enable","release","disable","displayRotateMessageTimeout","displayRotateMessage","innerHeight","innerWidth","overlay","ID_OVERLAY_PLEASE_ROTATE","image","mobileRotateIcon","text","subtext","clearTimeout","screen","orientation","lock","setTimeout","unlock","AbstractPlugin"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAKA,MAAMA,YAAN,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;EACAA,QAAAA,2BAA2B,GAAG,IAA9B;EACD;EACF,KAdD;;EAgBA,0BAAIL,MAAM,CAACgB,MAAX,aAAI,eAAeC,WAAnB,EAAgC;EAC9BjB,MAAAA,MAAM,CAACgB,MAAP,CAAcC,WAAd,CAA0BC,IAA1B,CAA+B,WAA/B,EAA4CpC,IAA5C,CAAiD,IAAjD,EAAuD;EAAA,eAAMwB,oBAAoB,EAA1B;EAAA,OAAvD;EACAD,MAAAA,2BAA2B,GAAGc,UAAU,CAAC;EAAA,eAAMb,oBAAoB,EAA1B;EAAA,OAAD,EAA+B,GAA/B,CAAxC;EACD,KAHD,MAIK;EACHA,MAAAA,oBAAoB;EACrB;EACF;EAED;EACF;EACA;EACA;EApQA;;EAAA,SAqQEd,mBArQF,GAqQE,+BAAsB;EAAA;;EACpB,2BAAIQ,MAAM,CAACgB,MAAX,aAAI,gBAAeC,WAAnB,EAAgC;EAC9BjB,MAAAA,MAAM,CAACgB,MAAP,CAAcC,WAAd,CAA0BG,MAA1B;EACD,KAFD,MAGK;EACH,WAAKlF,GAAL,CAASuE,OAAT,CAAiBzB,IAAjB,CAAsB5C,YAAY,CAACsE,wBAAnC;EACD;EACF,GA5QH;;EAAA;EAAA,EAAkCW,gCAAlC;EAAajF,aAEJC,KAAK;EAFDD,aASJsE,2BAA2B;EATvBtE,aAiBJG,SAAS;EACd;EACJ;EACA;EACA;EACA;EACA;EACIC,EAAAA,cAAc,EAAE;EAPF;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/plugins/visible-range.d.ts b/dist/plugins/visible-range.d.ts new file mode 100644 index 000000000..b73941642 --- /dev/null +++ b/dist/plugins/visible-range.d.ts @@ -0,0 +1,33 @@ +import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; + +type VisibleRangePluginOptions = { + latitudeRange?: number[] | string[]; + longitudeRange?: number[] | string[]; + usePanoData: boolean; +}; + +/** + * @summary Locks visible longitude and/or latitude + */ +declare class VisibleRangePlugin extends AbstractPlugin { + + constructor(psv: Viewer, options: VisibleRangePluginOptions); + + /** + * @summary Changes the latitude range + */ + setLatitudeRange(range: number[] | string[]); + + /** + * @summary Changes the longitude range + */ + setLongitudeRange(range: number[] | string[]); + + /** + * @summary Changes the latitude and longitude ranges according the current panorama cropping data + */ + setRangesFromPanoData() + +} + +export { VisibleRangePlugin, VisibleRangePluginOptions }; diff --git a/dist/plugins/visible-range.js b/dist/plugins/visible-range.js index 0608e7374..46dbd0e92 100644 --- a/dist/plugins/visible-range.js +++ b/dist/plugins/visible-range.js @@ -1,19 +1,29 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('photo-sphere-viewer'), require('three')) : - typeof define === 'function' && define.amd ? define(['photo-sphere-viewer', 'three'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.VisibleRangePlugin = factory(global.PhotoSphereViewer, global.THREE))); -}(this, (function (photoSphereViewer, THREE) { 'use strict'; + 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'; function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; + + _setPrototypeOf(subClass, superClass); + } + + function _setPrototypeOf(o, p) { + _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { + o.__proto__ = p; + return o; + }; + + return _setPrototypeOf(o, p); } function _assertThisInitialized(self) { @@ -69,6 +79,8 @@ _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.PANORAMA_LOADED, _assertThisInitialized(_this)); + _this.psv.on(photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED, _assertThisInitialized(_this)); + _this.psv.on(photoSphereViewer.CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, _assertThisInitialized(_this)); _this.psv.on(photoSphereViewer.CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, _assertThisInitialized(_this)); @@ -84,6 +96,7 @@ _proto.destroy = function destroy() { this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.PANORAMA_LOADED, this); + this.psv.off(photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED, this); this.psv.off(photoSphereViewer.CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this); this.psv.off(photoSphereViewer.CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this); @@ -117,6 +130,15 @@ if (this.config.usePanoData) { this.setRangesFromPanoData(); } + } else if (e.type === photoSphereViewer.CONSTANTS.EVENTS.ZOOM_UPDATED) { + var currentPosition = this.psv.getPosition(); + + var _this$applyRanges3 = this.applyRanges(currentPosition), + _rangedPosition2 = _this$applyRanges3.rangedPosition; + + if (currentPosition.longitude !== _rangedPosition2.longitude || currentPosition.latitude !== _rangedPosition2.latitude) { + this.psv.rotate(_rangedPosition2); + } } } /** @@ -128,15 +150,13 @@ _proto.setLatitudeRange = function setLatitudeRange(range) { // latitude range must have two values if (range && range.length !== 2) { - photoSphereViewer.utils.logWarn('latitude range must have exactly two elements'); // eslint-disable-next-line no-param-reassign - + photoSphereViewer.utils.logWarn('latitude range must have exactly two elements'); range = null; } // latitude range must be ordered else if (range && range[0] > range[1]) { - photoSphereViewer.utils.logWarn('latitude range values must be ordered'); // eslint-disable-next-line no-param-reassign - - range = [range[1], range[0]]; - } // latitude range is between -PI/2 and PI/2 + photoSphereViewer.utils.logWarn('latitude range values must be ordered'); + range = [range[1], range[0]]; + } // latitude range is between -PI/2 and PI/2 if (range) { @@ -160,8 +180,7 @@ _proto.setLongitudeRange = function setLongitudeRange(range) { // longitude range must have two values if (range && range.length !== 2) { - photoSphereViewer.utils.logWarn('longitude range must have exactly two elements'); // eslint-disable-next-line no-param-reassign - + photoSphereViewer.utils.logWarn('longitude range must have exactly two elements'); range = null; } // longitude range is between 0 and 2*PI @@ -336,10 +355,11 @@ return VisibleRangePlugin; }(photoSphereViewer.AbstractPlugin); - VisibleRangePlugin.id = 'visible-range'; - return VisibleRangePlugin; + exports.VisibleRangePlugin = VisibleRangePlugin; + + Object.defineProperty(exports, '__esModule', { value: true }); }))); //# sourceMappingURL=visible-range.js.map diff --git a/dist/plugins/visible-range.js.map b/dist/plugins/visible-range.js.map index f2898e14f..7d277d629 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 { AbstractPlugin, utils, CONSTANTS, Animation } from 'photo-sphere-viewer';\nimport * as THREE from 'three';\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] - use panoData as visible range, you can also manually call `setRangesFromPanoData`\n */\n\n/**\n * @summary Locks visible longitude and/or latitude\n * @extends PSV.plugins.AbstractPlugin\n * @memberof PSV.plugins\n */\nexport default 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 };\n\n if (options) {\n this.config.usePanoData = !!options.usePanoData;\n this.setLatitudeRange(options.latitudeRange);\n this.setLongitudeRange(options.longitudeRange);\n }\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, 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\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, 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 if (e.type === CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION) {\n const { rangedPosition } = this.applyRanges(e.value);\n return rangedPosition;\n }\n else if (e.type === CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION) {\n const { rangedPosition, sidesReached } = this.applyRanges(e.value);\n\n if (utils.intersect(['left', 'right'], sidesReached).length > 0 && this.psv.isAutorotateEnabled()) {\n this.__reverseAutorotate();\n return e.value;\n }\n\n return rangedPosition;\n }\n else if (e.type === CONSTANTS.EVENTS.PANORAMA_LOADED) {\n if (this.config.usePanoData) {\n this.setRangesFromPanoData();\n }\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 // eslint-disable-next-line no-param-reassign\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 // eslint-disable-next-line no-param-reassign\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 // eslint-disable-next-line no-param-reassign\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.Math.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.push('left');\n }\n else {\n rangedPosition.longitude = range[1];\n sidesReached.push('right');\n }\n }\n }\n else if (position.longitude < range[0]) {\n rangedPosition.longitude = range[0];\n sidesReached.push('left');\n }\n else if (position.longitude > range[1]) {\n rangedPosition.longitude = range[1];\n sidesReached.push('right');\n }\n }\n\n if (this.config.latitudeRange) {\n range = utils.clone(this.config.latitudeRange);\n offset = THREE.Math.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.push('bottom');\n }\n else if (position.latitude > range[1]) {\n rangedPosition.latitude = range[1];\n sidesReached.push('top');\n }\n }\n\n return { rangedPosition, sidesReached };\n }\n\n /**\n * @summary Reverses autorotate direction with smooth transition\n * @private\n */\n __reverseAutorotate() {\n const newSpeed = -this.psv.config.autorotateSpeed;\n const range = this.config.longitudeRange;\n this.config.longitudeRange = null;\n\n new Animation({\n properties: {\n speed: { start: this.psv.config.autorotateSpeed, end: 0 },\n },\n duration : 300,\n easing : 'inSine',\n onTick : (properties) => {\n this.psv.config.autorotateSpeed = properties.speed;\n },\n })\n .then(() => new Animation({\n properties: {\n speed: { start: 0, end: newSpeed },\n },\n duration : 300,\n easing : 'outSine',\n onTick : (properties) => {\n this.psv.config.autorotateSpeed = properties.speed;\n },\n }))\n .then(() => {\n this.config.longitudeRange = range;\n });\n }\n\n}\n"],"names":["VisibleRangePlugin","psv","options","config","latitudeRange","longitudeRange","usePanoData","setLatitudeRange","setLongitudeRange","on","CONSTANTS","EVENTS","PANORAMA_LOADED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","destroy","off","handleEvent","e","type","applyRanges","value","rangedPosition","sidesReached","utils","intersect","length","isAutorotateEnabled","__reverseAutorotate","setRangesFromPanoData","range","logWarn","map","angle","parseAngle","prop","ready","rotate","getPosition","getPanoLatitudeRange","getPanoLongitudeRange","p","panoData","croppedHeight","fullHeight","croppedY","latitude","y","Math","PI","croppedWidth","fullWidth","croppedX","longitude","x","position","offset","clone","THREE","degToRad","hFov","push","vFov","min","max","newSpeed","autorotateSpeed","Animation","properties","speed","start","end","duration","easing","onTick","then","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;MACqBA;;;EAInB;EACF;EACA;EACA;EACE,8BAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EACxB,uCAAMD,GAAN;EAEA;EACJ;EACA;EACA;;EACI,UAAKE,MAAL,GAAc;EACZC,MAAAA,aAAa,EAAG,IADJ;EAEZC,MAAAA,cAAc,EAAE,IAFJ;EAGZC,MAAAA,WAAW,EAAE;EAHD,KAAd;;EAMA,QAAIJ,OAAJ,EAAa;EACX,YAAKC,MAAL,CAAYG,WAAZ,GAA0B,CAAC,CAACJ,OAAO,CAACI,WAApC;;EACA,YAAKC,gBAAL,CAAsBL,OAAO,CAACE,aAA9B;;EACA,YAAKI,iBAAL,CAAuBN,OAAO,CAACG,cAA/B;EACD;;EAED,UAAKJ,GAAL,CAASQ,EAAT,CAAYC,2BAAS,CAACC,MAAV,CAAiBC,eAA7B;;EACA,UAAKX,GAAL,CAASQ,EAAT,CAAYC,2BAAS,CAACG,aAAV,CAAwBC,oBAApC;;EACA,UAAKb,GAAL,CAASQ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AK,EAAE,KAAKtE,GAAL,CAASE,MAAT,CAAgBgE,eAAzB;EAA0CK,UAAAA,GAAG,EAAE;EAA/C;EADG,OADA;EAIZC,MAAAA,QAAQ,EAAI,GAJA;EAKZC,MAAAA,MAAM,EAAM,QALA;EAMZC,MAAAA,MAAM,EAAM,gBAACN,UAAD,EAAgB;EAC1B,QAAA,MAAI,CAACpE,GAAL,CAASE,MAAT,CAAgBgE,eAAhB,GAAkCE,UAAU,CAACC,KAA7C;EACD;EARW,KAAd,EAUGM,IAVH,CAUQ;EAAA,aAAM,IAAIR,2BAAJ,CAAc;EACxBC,QAAAA,UAAU,EAAE;EACVC,UAAAA,KAAK,EAAE;EAAEC,YAAAA,KAAK,EAAE,CAAT;EAAYC,YAAAA,GAAG,EAAEN;EAAjB;EADG,SADY;EAIxBO,QAAAA,QAAQ,EAAI,GAJY;EAKxBC,QAAAA,MAAM,EAAM,SALY;EAMxBC,QAAAA,MAAM,EAAM,gBAACN,UAAD,EAAgB;EAC1B,UAAA,MAAI,CAACpE,GAAL,CAASE,MAAT,CAAgBgE,eAAhB,GAAkCE,UAAU,CAACC,KAA7C;EACD;EARuB,OAAd,CAAN;EAAA,KAVR,EAoBGM,IApBH,CAoBQ,YAAM;EACV,MAAA,MAAI,CAACzE,MAAL,CAAYE,cAAZ,GAA6B0B,KAA7B;EACD,KAtBH;EAuBD;;;IApQ6C8C;;EAA3B7E,mBAEZ8E,KAAK;;;;;;;;"} \ No newline at end of file +{"version":3,"file":"visible-range.js","sources":["../../src/plugins/visible-range/index.js"],"sourcesContent":["import * as THREE from 'three';\nimport { AbstractPlugin, Animation, CONSTANTS, utils } from '../..';\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] - use panoData as visible range, you can also manually call `setRangesFromPanoData`\n */\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 };\n\n if (options) {\n this.config.usePanoData = !!options.usePanoData;\n this.setLatitudeRange(options.latitudeRange);\n this.setLongitudeRange(options.longitudeRange);\n }\n\n this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, 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\n /**\n * @package\n */\n destroy() {\n this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, 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 if (e.type === CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION) {\n const { rangedPosition } = this.applyRanges(e.value);\n return rangedPosition;\n }\n else if (e.type === CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION) {\n const { rangedPosition, sidesReached } = this.applyRanges(e.value);\n\n if (utils.intersect(['left', 'right'], sidesReached).length > 0 && this.psv.isAutorotateEnabled()) {\n this.__reverseAutorotate();\n return e.value;\n }\n\n return rangedPosition;\n }\n else if (e.type === CONSTANTS.EVENTS.PANORAMA_LOADED) {\n if (this.config.usePanoData) {\n this.setRangesFromPanoData();\n }\n }\n else if (e.type === CONSTANTS.EVENTS.ZOOM_UPDATED) {\n const currentPosition = this.psv.getPosition();\n const { rangedPosition } = this.applyRanges(currentPosition);\n if (currentPosition.longitude !== rangedPosition.longitude || currentPosition.latitude !== rangedPosition.latitude) {\n this.psv.rotate(rangedPosition);\n }\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.Math.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.push('left');\n }\n else {\n rangedPosition.longitude = range[1];\n sidesReached.push('right');\n }\n }\n }\n else if (position.longitude < range[0]) {\n rangedPosition.longitude = range[0];\n sidesReached.push('left');\n }\n else if (position.longitude > range[1]) {\n rangedPosition.longitude = range[1];\n sidesReached.push('right');\n }\n }\n\n if (this.config.latitudeRange) {\n range = utils.clone(this.config.latitudeRange);\n offset = THREE.Math.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.push('bottom');\n }\n else if (position.latitude > range[1]) {\n rangedPosition.latitude = range[1];\n sidesReached.push('top');\n }\n }\n\n return { rangedPosition, sidesReached };\n }\n\n /**\n * @summary Reverses autorotate direction with smooth transition\n * @private\n */\n __reverseAutorotate() {\n const newSpeed = -this.psv.config.autorotateSpeed;\n const range = this.config.longitudeRange;\n this.config.longitudeRange = null;\n\n new Animation({\n properties: {\n speed: { start: this.psv.config.autorotateSpeed, end: 0 },\n },\n duration : 300,\n easing : 'inSine',\n onTick : (properties) => {\n this.psv.config.autorotateSpeed = properties.speed;\n },\n })\n .then(() => new Animation({\n properties: {\n speed: { start: 0, end: newSpeed },\n },\n duration : 300,\n easing : 'outSine',\n onTick : (properties) => {\n this.psv.config.autorotateSpeed = properties.speed;\n },\n }))\n .then(() => {\n this.config.longitudeRange = range;\n });\n }\n\n}\n"],"names":["VisibleRangePlugin","psv","options","config","latitudeRange","longitudeRange","usePanoData","setLatitudeRange","setLongitudeRange","on","CONSTANTS","EVENTS","PANORAMA_LOADED","ZOOM_UPDATED","CHANGE_EVENTS","GET_ANIMATE_POSITION","GET_ROTATE_POSITION","destroy","off","handleEvent","e","type","applyRanges","value","rangedPosition","sidesReached","utils","intersect","length","isAutorotateEnabled","__reverseAutorotate","setRangesFromPanoData","currentPosition","getPosition","longitude","latitude","rotate","range","logWarn","map","angle","parseAngle","prop","ready","getPanoLatitudeRange","getPanoLongitudeRange","p","panoData","croppedHeight","fullHeight","croppedY","y","Math","PI","croppedWidth","fullWidth","croppedX","x","position","offset","clone","THREE","degToRad","hFov","push","vFov","min","max","newSpeed","autorotateSpeed","Animation","properties","speed","start","end","duration","easing","onTick","then","AbstractPlugin","id"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAGA;EACA;EACA;EACA;EACA;EACA;;EAEA;EACA;EACA;EACA;EACA;;MACaA,kBAAb;EAAA;;EAIE;EACF;EACA;EACA;EACE,8BAAYC,GAAZ,EAAiBC,OAAjB,EAA0B;EAAA;;EACxB,uCAAMD,GAAN;EAEA;EACJ;EACA;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EACZC,MAAAA,UAAU,EAAE;EACVC,QAAAA,KAAK,EAAE;EAAEC,UAAAA,KAAK,EAAE,KAAKxE,GAAL,CAASE,MAAT,CAAgBkE,eAAzB;EAA0CK,UAAAA,GAAG,EAAE;EAA/C;EADG,OADA;EAIZC,MAAAA,QAAQ,EAAI,GAJA;EAKZC,MAAAA,MAAM,EAAM,QALA;EAMZC,MAAAA,MAAM,EAAM,gBAACN,UAAD,EAAgB;EAC1B,QAAA,MAAI,CAACtE,GAAL,CAASE,MAAT,CAAgBkE,eAAhB,GAAkCE,UAAU,CAACC,KAA7C;EACD;EARW,KAAd,EAUGM,IAVH,CAUQ;EAAA,aAAM,IAAIR,2BAAJ,CAAc;EACxBC,QAAAA,UAAU,EAAE;EACVC,UAAAA,KAAK,EAAE;EAAEC,YAAAA,KAAK,EAAE,CAAT;EAAYC,YAAAA,GAAG,EAAEN;EAAjB;EADG,SADY;EAIxBO,QAAAA,QAAQ,EAAI,GAJY;EAKxBC,QAAAA,MAAM,EAAM,SALY;EAMxBC,QAAAA,MAAM,EAAM,gBAACN,UAAD,EAAgB;EAC1B,UAAA,MAAI,CAACtE,GAAL,CAASE,MAAT,CAAgBkE,eAAhB,GAAkCE,UAAU,CAACC,KAA7C;EACD;EARuB,OAAd,CAAN;EAAA,KAVR,EAoBGM,IApBH,CAoBQ,YAAM;EACV,MAAA,MAAI,CAAC3E,MAAL,CAAYE,cAAZ,GAA6BgC,KAA7B;EACD,KAtBH;EAuBD,GA1QH;;EAAA;EAAA,EAAwC0C,gCAAxC;EAAa/E,mBAEJgF,KAAK;;;;;;;;;;"} \ No newline at end of file diff --git a/dist/viewer-compat.js b/dist/viewer-compat.js index c4988a7e3..10a9020fd 100644 --- a/dist/viewer-compat.js +++ b/dist/viewer-compat.js @@ -1,331 +1,18 @@ /*! -* Photo Sphere Viewer 4.2.1 +* Photo Sphere Viewer 4.3.0 * @copyright 2014-2015 Jérémy Heleine * @copyright 2015-2021 Damien "Mistic" Sorel * @licence MIT (https://opensource.org/licenses/MIT) */ (function (global, factory) { - typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('three'), require('photo-sphere-viewer'), require('photo-sphere-viewer/dist/plugins/gyroscope'), require('photo-sphere-viewer/dist/plugins/stereo'), require('photo-sphere-viewer/dist/plugins/markers'), require('photo-sphere-viewer/dist/plugins/visible-range')) : - typeof define === 'function' && define.amd ? define(['three', 'photo-sphere-viewer', 'photo-sphere-viewer/dist/plugins/gyroscope', 'photo-sphere-viewer/dist/plugins/stereo', 'photo-sphere-viewer/dist/plugins/markers', 'photo-sphere-viewer/dist/plugins/visible-range'], factory) : - (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.ViewerCompat = factory(global.THREE, global.PhotoSphereViewer, global.PhotoSphereViewer.GyroscopePlugin, global.PhotoSphereViewer.StereoPlugin, global.PhotoSphereViewer.MarkersPlugin, global.PhotoSphereViewer.VisibleRangePlugin))); -}(this, (function (THREE, photoSphereViewer, GyroscopePlugin, StereoPlugin, MarkersPlugin, VisibleRangePlugin) { 'use strict'; + typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() : + typeof define === 'function' && define.amd ? define(factory) : + (global = typeof globalThis !== 'undefined' ? globalThis : global || self, (global.PhotoSphereViewer = global.PhotoSphereViewer || {}, global.PhotoSphereViewer.ViewerCompat = factory())); +}(this, (function () { 'use strict'; - function _inheritsLoose(subClass, superClass) { - subClass.prototype = Object.create(superClass.prototype); - subClass.prototype.constructor = subClass; - subClass.__proto__ = superClass; - } - - /** - * @private - */ - - function snakeCaseToCamelCase(options) { - if (typeof options === 'object') { - photoSphereViewer.utils.each(options, function (value, key) { - if (typeof key === 'string' && key.indexOf('_') !== -1) { - var camelKey = key.replace(/(_\w)/g, function (matches) { - return matches[1].toUpperCase(); - }); - options[camelKey] = snakeCaseToCamelCase(value); - delete options[key]; - } - }); - } - - return options; - } - /** - * @private - */ - - - var RENAMED_OPTIONS = { - animSpeed: 'autorotateSpeed', - animLat: 'autorotateLat', - usexmpdata: 'useXmpData', - mousemoveHover: 'captureCursor', - zoomSpeed: 'zoomButtonIncrement', - mousewheelFactor: 'mousewheelSpeed' + var ViewerCompat = function ViewerCompat() { + throw new Error('PhotoSphereViewer#ViewerCompat has been removed, please migrate to v4 Viewer.'); }; - /** - * @summary Compatibility wrapper for version 3 - * @memberOf PSV - * @deprecated - */ - - var ViewerCompat = /*#__PURE__*/function (_Viewer) { - _inheritsLoose(ViewerCompat, _Viewer); - - /** - * @param {PSV.Options} options - * @fires PSV.ready - * @throws {PSV.PSVError} when the configuration is incorrect - */ - function ViewerCompat(options) { - var _this; - - snakeCaseToCamelCase(options); - photoSphereViewer.utils.each(RENAMED_OPTIONS, function (newName, oldName) { - if (oldName in options) { - options[newName] = options[oldName]; - delete options[oldName]; - } - }); - - if ('defaultFov' in options) { - var minFov = options.minFov !== undefined ? options.minFov : photoSphereViewer.DEFAULTS.minFov; - var maxFov = options.maxFov !== undefined ? options.maxFov : photoSphereViewer.DEFAULTS.maxFov; - var defaultFov = photoSphereViewer.utils.bound(options.defaultFov, minFov, maxFov); - options.defaultZoomLvl = (defaultFov - minFov) / (maxFov - minFov) * 100; - delete options.defaultFov; - } - - if (!('timeAnim' in options)) { - options.autorotateDelay = 2000; - } else if (options.timeAnim === false) { - options.autorotateDelay = null; - } else if (typeof options.timeAnim === 'number') { - options.autorotateDelay = options.timeAnim; - } - - delete options.timeAnim; - delete options.transition; - - if ('panoramaRoll' in options) { - options.sphereCorrection = options.sphereCorrection || {}; - options.sphereCorrection.roll = options.panoramaRoll; - delete options.panoramaRoll; - } - - if (typeof options.navbar === 'string') { - options.navbar = options.navbar.split(' '); - } - - if (Array.isArray(options.navbar)) { - var markersIdx = options.navbar.indexOf('markers'); - - if (markersIdx !== -1) { - options.navbar.splice(markersIdx, 1, 'markersList'); - } - } - - var clickEventOnMarker = options.clickEventOnMarker; - delete options.clickEventOnMarker; - var markers = options.markers; - delete options.markers; - var longitudeRange = options.longitudeRange; - delete options.longitudeRange; - var latitudeRange = options.latitudeRange; - delete options.latitudeRange; - options.plugins = []; - - if (GyroscopePlugin) { - options.plugins.push(GyroscopePlugin); - } - - if (StereoPlugin) { - options.plugins.push(StereoPlugin); - } - - if (MarkersPlugin) { - options.plugins.push([MarkersPlugin, { - clickEventOnMarker: clickEventOnMarker, - markers: markers - }]); - } - - if (VisibleRangePlugin) { - options.plugins.push([VisibleRangePlugin, { - longitudeRange: longitudeRange, - latitudeRange: latitudeRange - }]); - } - - _this = _Viewer.call(this, options) || this; - _this.gyroscope = _this.getPlugin(GyroscopePlugin); - _this.stereo = _this.getPlugin(StereoPlugin); - _this.markers = _this.getPlugin(MarkersPlugin); - return _this; - } // GENERAL - - - var _proto = ViewerCompat.prototype; - - _proto.render = function render() { - this.renderer.render(); - }; - - _proto.setPanorama = function setPanorama(panorama, options, transition) { - if (options === void 0) { - options = {}; - } - - if (transition === void 0) { - transition = false; - } - - snakeCaseToCamelCase(options); - options.transition = transition; - return _Viewer.prototype.setPanorama.call(this, panorama, options); - }; - - _proto.preloadPanorama = function preloadPanorama(panorama) { - return this.textureLoader.preloadPanorama(panorama); - }; - - _proto.clearPanoramaCache = function clearPanoramaCache(panorama) { - if (panorama) { - THREE.Cache.remove(panorama); - } else { - THREE.Cache.clear(); - } - } // GYROSCOPE / STEREO - ; - - _proto.isGyroscopeEnabled = function isGyroscopeEnabled() { - return this.gyroscope && this.gyroscope.isEnabled(); - }; - - _proto.startGyroscopeControl = function startGyroscopeControl() { - return this.gyroscope && this.gyroscope.start(); - }; - - _proto.stopGyroscopeControl = function stopGyroscopeControl() { - this.gyroscope && this.gyroscope.stop(); - }; - - _proto.toggleGyroscopeControl = function toggleGyroscopeControl() { - this.gyroscope && this.gyroscope.toggle(); - }; - - _proto.isStereoEnabled = function isStereoEnabled() { - return this.stereo && this.stereo.isEnabled(); - }; - - _proto.startStereoView = function startStereoView() { - return this.stereo && this.stereo.start(); - }; - - _proto.stopStereoView = function stopStereoView() { - this.stereo && this.stereo.stop(); - }; - - _proto.toggleStereoView = function toggleStereoView() { - this.stereo && this.stereo.toggle(); - } // MARKERS - ; - - _proto.addMarker = function addMarker(marker, render) { - return this.markers && this.markers.addMarker(snakeCaseToCamelCase(marker), render); - }; - - _proto.getMarker = function getMarker(markerId) { - return this.markers && this.markers.getMarker(markerId); - }; - - _proto.updateMarker = function updateMarker(marker, render) { - return this.markers && this.markers.updateMarker(snakeCaseToCamelCase(marker), render); - }; - - _proto.removeMarker = function removeMarker(marker, render) { - this.markers && this.markers.removeMarker(marker, render); - }; - - _proto.gotoMarker = function gotoMarker(markerOrId, duration) { - this.markers && this.markers.gotoMarker(markerOrId, duration); - }; - - _proto.hideMarker = function hideMarker(markerId) { - this.markers && this.markers.hideMarker(markerId); - }; - - _proto.showMarker = function showMarker(markerId) { - this.markers && this.markers.showMarker(markerId); - }; - - _proto.clearMarkers = function clearMarkers(render) { - this.markers && this.markers.clearMarkers(render); - }; - - _proto.getCurrentMarker = function getCurrentMarker() { - return this.markers && this.markers.getCurrentMarker(); - } // NAVBAR - ; - - _proto.showNavbar = function showNavbar() { - this.navbar.show(); - }; - - _proto.hideNavbar = function hideNavbar() { - this.navbar.hide(); - }; - - _proto.toggleNavbar = function toggleNavbar() { - this.navbar.toggle(); - }; - - _proto.getNavbarButton = function getNavbarButton(id, silent) { - return this.navbar.getButton(id, silent); - }; - - _proto.setCaption = function setCaption(html) { - return this.navbar.setCaption(html); - } // NOTIFICATION - ; - - _proto.showNotification = function showNotification(config) { - this.notification.show(config); - }; - - _proto.hideNotification = function hideNotification() { - this.notification.hide(); - }; - - _proto.isNotificationVisible = function isNotificationVisible() { - return this.notification.isVisible(); - } // OVERLAY - ; - - _proto.showOverlay = function showOverlay(config) { - this.overlay.show(config); - }; - - _proto.hideOverlay = function hideOverlay() { - this.overlay.hide(); - }; - - _proto.isOverlayVisible = function isOverlayVisible() { - return this.overlay.isVisible(); - } // PANEL - ; - - _proto.showPanel = function showPanel(config) { - this.panel.show(config); - }; - - _proto.hidePanel = function hidePanel() { - this.panel.hide(); - } // TOOLTIP - ; - - _proto.showTooltip = function showTooltip(config) { - this.prop.mainTooltip = this.tooltip.create(config); - }; - - _proto.hideTooltip = function hideTooltip() { - if (this.prop.mainTooltip) { - this.prop.mainTooltip.hide(); - this.prop.mainTooltip = null; - } - }; - - _proto.isTooltipVisible = function isTooltipVisible() { - return !!this.prop.mainTooltip; - }; - - return ViewerCompat; - }(photoSphereViewer.Viewer); return ViewerCompat; diff --git a/dist/viewer-compat.js.map b/dist/viewer-compat.js.map index ac73fba0e..c7c7bbc1d 100644 --- a/dist/viewer-compat.js.map +++ b/dist/viewer-compat.js.map @@ -1 +1 @@ -{"version":3,"file":"viewer-compat.js","sources":["../src/ViewerCompat.js"],"sourcesContent":["import * as THREE from 'three';\nimport { DEFAULTS, utils, Viewer } from 'photo-sphere-viewer';\nimport GyroscopePlugin from 'photo-sphere-viewer/dist/plugins/gyroscope';\nimport StereoPlugin from 'photo-sphere-viewer/dist/plugins/stereo';\nimport MarkersPlugin from 'photo-sphere-viewer/dist/plugins/markers';\nimport VisibleRangePlugin from 'photo-sphere-viewer/dist/plugins/visible-range';\n\n/**\n * @private\n */\nfunction snakeCaseToCamelCase(options) {\n if (typeof options === 'object') {\n utils.each(options, (value, key) => {\n if (typeof key === 'string' && key.indexOf('_') !== -1) {\n const camelKey = key.replace(/(_\\w)/g, matches => matches[1].toUpperCase());\n options[camelKey] = snakeCaseToCamelCase(value);\n delete options[key];\n }\n });\n }\n\n return options;\n}\n\n/**\n * @private\n */\nconst RENAMED_OPTIONS = {\n animSpeed : 'autorotateSpeed',\n animLat : 'autorotateLat',\n usexmpdata : 'useXmpData',\n mousemoveHover : 'captureCursor',\n zoomSpeed : 'zoomButtonIncrement',\n mousewheelFactor: 'mousewheelSpeed',\n};\n\n/**\n * @summary Compatibility wrapper for version 3\n * @memberOf PSV\n * @deprecated\n */\nexport default class ViewerCompat extends Viewer {\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 snakeCaseToCamelCase(options);\n\n utils.each(RENAMED_OPTIONS, (newName, oldName) => {\n if (oldName in options) {\n options[newName] = options[oldName];\n delete options[oldName];\n }\n });\n\n if ('defaultFov' in options) {\n const minFov = options.minFov !== undefined ? options.minFov : DEFAULTS.minFov;\n const maxFov = options.maxFov !== undefined ? options.maxFov : DEFAULTS.maxFov;\n const defaultFov = utils.bound(options.defaultFov, minFov, maxFov);\n options.defaultZoomLvl = (defaultFov - minFov) / (maxFov - minFov) * 100;\n delete options.defaultFov;\n }\n\n if (!('timeAnim' in options)) {\n options.autorotateDelay = 2000;\n }\n else if (options.timeAnim === false) {\n options.autorotateDelay = null;\n }\n else if (typeof options.timeAnim === 'number') {\n options.autorotateDelay = options.timeAnim;\n }\n delete options.timeAnim;\n\n delete options.transition;\n\n if ('panoramaRoll' in options) {\n options.sphereCorrection = options.sphereCorrection || {};\n options.sphereCorrection.roll = options.panoramaRoll;\n delete options.panoramaRoll;\n }\n\n if (typeof options.navbar === 'string') {\n options.navbar = options.navbar.split(' ');\n }\n\n if (Array.isArray(options.navbar)) {\n const markersIdx = options.navbar.indexOf('markers');\n if (markersIdx !== -1) {\n options.navbar.splice(markersIdx, 1, 'markersList');\n }\n }\n\n const clickEventOnMarker = options.clickEventOnMarker;\n delete options.clickEventOnMarker;\n\n const markers = options.markers;\n delete options.markers;\n\n const longitudeRange = options.longitudeRange;\n delete options.longitudeRange;\n\n const latitudeRange = options.latitudeRange;\n delete options.latitudeRange;\n\n options.plugins = [];\n if (GyroscopePlugin) {\n options.plugins.push(GyroscopePlugin);\n }\n if (StereoPlugin) {\n options.plugins.push(StereoPlugin);\n }\n if (MarkersPlugin) {\n options.plugins.push([MarkersPlugin, { clickEventOnMarker, markers }]);\n }\n if (VisibleRangePlugin) {\n options.plugins.push([VisibleRangePlugin, { longitudeRange, latitudeRange }]);\n }\n\n super(options);\n\n this.gyroscope = this.getPlugin(GyroscopePlugin);\n this.stereo = this.getPlugin(StereoPlugin);\n this.markers = this.getPlugin(MarkersPlugin);\n }\n\n // GENERAL\n\n render() {\n this.renderer.render();\n }\n\n setPanorama(panorama, options = {}, transition = false) {\n snakeCaseToCamelCase(options);\n options.transition = transition;\n return super.setPanorama(panorama, options);\n }\n\n preloadPanorama(panorama) {\n return this.textureLoader.preloadPanorama(panorama);\n }\n\n clearPanoramaCache(panorama) {\n if (panorama) {\n THREE.Cache.remove(panorama);\n }\n else {\n THREE.Cache.clear();\n }\n }\n\n // GYROSCOPE / STEREO\n\n isGyroscopeEnabled() {\n return this.gyroscope && this.gyroscope.isEnabled();\n }\n\n startGyroscopeControl() {\n return this.gyroscope && this.gyroscope.start();\n }\n\n stopGyroscopeControl() {\n this.gyroscope && this.gyroscope.stop();\n }\n\n toggleGyroscopeControl() {\n this.gyroscope && this.gyroscope.toggle();\n }\n\n isStereoEnabled() {\n return this.stereo && this.stereo.isEnabled();\n }\n\n startStereoView() {\n return this.stereo && this.stereo.start();\n }\n\n stopStereoView() {\n this.stereo && this.stereo.stop();\n }\n\n toggleStereoView() {\n this.stereo && this.stereo.toggle();\n }\n\n // MARKERS\n\n addMarker(marker, render) {\n return this.markers && this.markers.addMarker(snakeCaseToCamelCase(marker), render);\n }\n\n getMarker(markerId) {\n return this.markers && this.markers.getMarker(markerId);\n }\n\n updateMarker(marker, render) {\n return this.markers && this.markers.updateMarker(snakeCaseToCamelCase(marker), render);\n }\n\n removeMarker(marker, render) {\n this.markers && this.markers.removeMarker(marker, render);\n }\n\n gotoMarker(markerOrId, duration) {\n this.markers && this.markers.gotoMarker(markerOrId, duration);\n }\n\n hideMarker(markerId) {\n this.markers && this.markers.hideMarker(markerId);\n }\n\n showMarker(markerId) {\n this.markers && this.markers.showMarker(markerId);\n }\n\n clearMarkers(render) {\n this.markers && this.markers.clearMarkers(render);\n }\n\n getCurrentMarker() {\n return this.markers && this.markers.getCurrentMarker();\n }\n\n // NAVBAR\n\n showNavbar() {\n this.navbar.show();\n }\n\n hideNavbar() {\n this.navbar.hide();\n }\n\n toggleNavbar() {\n this.navbar.toggle();\n }\n\n getNavbarButton(id, silent) {\n return this.navbar.getButton(id, silent);\n }\n\n setCaption(html) {\n return this.navbar.setCaption(html);\n }\n\n // NOTIFICATION\n\n showNotification(config) {\n this.notification.show(config);\n }\n\n hideNotification() {\n this.notification.hide();\n }\n\n isNotificationVisible() {\n return this.notification.isVisible();\n }\n\n // OVERLAY\n\n showOverlay(config) {\n this.overlay.show(config);\n }\n\n hideOverlay() {\n this.overlay.hide();\n }\n\n isOverlayVisible() {\n return this.overlay.isVisible();\n }\n\n // PANEL\n\n showPanel(config) {\n this.panel.show(config);\n }\n\n hidePanel() {\n this.panel.hide();\n }\n\n // TOOLTIP\n\n showTooltip(config) {\n this.prop.mainTooltip = this.tooltip.create(config);\n }\n\n hideTooltip() {\n if (this.prop.mainTooltip) {\n this.prop.mainTooltip.hide();\n this.prop.mainTooltip = null;\n }\n }\n\n isTooltipVisible() {\n return !!this.prop.mainTooltip;\n }\n\n}\n"],"names":["snakeCaseToCamelCase","options","utils","each","value","key","indexOf","camelKey","replace","matches","toUpperCase","RENAMED_OPTIONS","animSpeed","animLat","usexmpdata","mousemoveHover","zoomSpeed","mousewheelFactor","ViewerCompat","newName","oldName","minFov","undefined","DEFAULTS","maxFov","defaultFov","bound","defaultZoomLvl","autorotateDelay","timeAnim","transition","sphereCorrection","roll","panoramaRoll","navbar","split","Array","isArray","markersIdx","splice","clickEventOnMarker","markers","longitudeRange","latitudeRange","plugins","GyroscopePlugin","push","StereoPlugin","MarkersPlugin","VisibleRangePlugin","gyroscope","getPlugin","stereo","render","renderer","setPanorama","panorama","preloadPanorama","textureLoader","clearPanoramaCache","THREE","remove","clear","isGyroscopeEnabled","isEnabled","startGyroscopeControl","start","stopGyroscopeControl","stop","toggleGyroscopeControl","toggle","isStereoEnabled","startStereoView","stopStereoView","toggleStereoView","addMarker","marker","getMarker","markerId","updateMarker","removeMarker","gotoMarker","markerOrId","duration","hideMarker","showMarker","clearMarkers","getCurrentMarker","showNavbar","show","hideNavbar","hide","toggleNavbar","getNavbarButton","id","silent","getButton","setCaption","html","showNotification","config","notification","hideNotification","isNotificationVisible","isVisible","showOverlay","overlay","hideOverlay","isOverlayVisible","showPanel","panel","hidePanel","showTooltip","prop","mainTooltip","tooltip","create","hideTooltip","isTooltipVisible","Viewer"],"mappings":";;;;;;;;;;;;;;;;;;EAOA;EACA;EACA;;EACA,SAASA,oBAAT,CAA8BC,OAA9B,EAAuC;EACrC,MAAI,OAAOA,OAAP,KAAmB,QAAvB,EAAiC;EAC/BC,IAAAA,uBAAK,CAACC,IAAN,CAAWF,OAAX,EAAoB,UAACG,KAAD,EAAQC,GAAR,EAAgB;EAClC,UAAI,OAAOA,GAAP,KAAe,QAAf,IAA2BA,GAAG,CAACC,OAAJ,CAAY,GAAZ,MAAqB,CAAC,CAArD,EAAwD;EACtD,YAAMC,QAAQ,GAAGF,GAAG,CAACG,OAAJ,CAAY,QAAZ,EAAsB,UAAAC,OAAO;EAAA,iBAAIA,OAAO,CAAC,CAAD,CAAP,CAAWC,WAAX,EAAJ;EAAA,SAA7B,CAAjB;EACAT,QAAAA,OAAO,CAACM,QAAD,CAAP,GAAoBP,oBAAoB,CAACI,KAAD,CAAxC;EACA,eAAOH,OAAO,CAACI,GAAD,CAAd;EACD;EACF,KAND;EAOD;;EAED,SAAOJ,OAAP;EACD;EAED;EACA;EACA;;;EACA,IAAMU,eAAe,GAAG;EACtBC,EAAAA,SAAS,EAAS,iBADI;EAEtBC,EAAAA,OAAO,EAAW,eAFI;EAGtBC,EAAAA,UAAU,EAAQ,YAHI;EAItBC,EAAAA,cAAc,EAAI,eAJI;EAKtBC,EAAAA,SAAS,EAAS,qBALI;EAMtBC,EAAAA,gBAAgB,EAAE;EANI,CAAxB;EASA;EACA;EACA;EACA;EACA;;MACqBC;;;EAEnB;EACF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ewer-compat.js","sources":["../src/ViewerCompat.js"],"sourcesContent":["export default class ViewerCompat {\n\n constructor() {\n throw new Error('PhotoSphereViewer#ViewerCompat has been removed, please migrate to v4 Viewer.');\n }\n\n}\n"],"names":["ViewerCompat","Error"],"mappings":";;;;;;;;;;;;MAAqBA,eAEnB,wBAAc;EACZ,QAAM,IAAIC,KAAJ,CAAU,+EAAV,CAAN;EACD;;;;;;;;"} \ No newline at end of file diff --git a/docs/.jsdoc/index.md b/docs/.jsdoc/index.md index 52fa09afb..9b2498530 100644 --- a/docs/.jsdoc/index.md +++ b/docs/.jsdoc/index.md @@ -9,11 +9,13 @@ - [Viewer](PSV.Viewer.html) - [Events](PSV.html#.event:autorotate) - [Plugins](PSV.plugins.html) +- [Adapters](PSV.adapters.html) --- ## Exported members +- [AbstractAdapter](PSV.adapters.AbstractAdapter.html) - Base class for render adapters - [AbstractButton](PSV.buttons.AbstractButton.html) - Base class for plugins buttons - [AbstractPlugin](PSV.plugins.AbstractPlugin.html) - Base class for plugins - [Animation](PSV.Animation.html) - Animations manager diff --git a/docs/.vuepress/components/Playground.vue b/docs/.vuepress/components/Playground.vue index 7f7cb3b23..adf67b0b6 100644 --- a/docs/.vuepress/components/Playground.vue +++ b/docs/.vuepress/components/Playground.vue @@ -178,20 +178,14 @@
- +
- - - -
-
- - - + +
@@ -250,6 +244,7 @@ navbar : [ { code: 'autorotate', label: DEFAULTS.lang.autorotate, enabled: true }, { code: 'zoom', label: DEFAULTS.lang.zoom, enabled: true }, + { code: 'move', label: DEFAULTS.lang.move, enabled: true }, { code: 'download', label: DEFAULTS.lang.download, enabled: true }, { code: 'caption', label: 'Caption', enabled: true }, { code: 'fullscreen', label: DEFAULTS.lang.fullscreen, enabled: true }, @@ -291,7 +286,6 @@ this.psv = new Viewer({ container : 'viewer', loadingImg: 'https://photo-sphere-viewer.js.org/assets/photosphere-logo.gif', - sphereCorrectionReorder: true, }); this.loadPsv(); diff --git a/docs/.vuepress/config.js b/docs/.vuepress/config.js index 6e745ade6..bc1bcf90d 100644 --- a/docs/.vuepress/config.js +++ b/docs/.vuepress/config.js @@ -40,9 +40,17 @@ module.exports = { 'events', 'navbar', 'markers', - 'cubemap', 'cropped-panorama', 'migration-v3', + { + title: 'Adapters', + path: '/guide/adapters/', + collapsable : false, + children: [ + 'adapters/cubemap', + 'adapters/tiles', + ], + }, { title: 'Reusable components', path: '/guide/components/', diff --git a/docs/README.md b/docs/README.md index 51c1c3b94..b45a84436 100644 --- a/docs/README.md +++ b/docs/README.md @@ -20,10 +20,23 @@ features: footer: Licensed under MIT License, documentation under CC BY 3.0 --- -::: tip New playground -Test Photo Sphere Viewer with you own panorama in the [Playground](playground.md) +
+
+ +::: tip New tiles support +Improve the loading time of big panoramas with the the [Tiles adapter](guide/adapters/tiles.md). ::: +
+
+ +::: tip Typescript support +Photo Sphere Viewer is now shipped with its own typings. +::: + +
+
+ ::: tip Thanks to Jéremy Heleine diff --git a/docs/guide/README.md b/docs/guide/README.md index 3285ee938..500ab9258 100644 --- a/docs/guide/README.md +++ b/docs/guide/README.md @@ -34,7 +34,7 @@ You can also [download the latest release](https://github.com/mistic100/Photo-Sp * [three.js](https://threejs.org) (use `build/three.min.js` file) * [uEvent 2](https://github.com/mistic100/uEvent) (use `browser.js` file) -#### Optionals +#### Optional * [promise-polyfill](https://github.com/taylorhakes/promise-polyfill) for IE compatibility (use `dist/polyfill.min.js` file) @@ -42,27 +42,23 @@ You can also [download the latest release](https://github.com/mistic100/Photo-Sp Include all JS & CSS files in your page manually or with your favorite bundler and init the viewer. -The `panorama` must be an [equirectangular projection](https://en.wikipedia.org/wiki/Equirectangular_projection) of your photo. You can also use [cubemap projection](./cubemap.md) with a special syntax. - :::: tabs ::: tab Direct import ```html - + + + + + + -
- - + +
+``` + +```js +new PhotoSphereViewer.Viewer({ + adapter: [PhotoSphereViewer.CubemapAdapter, { + // optional adapter config + }], + panorama: // specific to the adapter, +}); +``` +::: + +::: tab ES import +```js +import { CubemapAdapter } from 'photo-sphere-viewer/dist/adapters/cubemap'; + +new Viewer({ + adapter: [CubemapAdapter, { + // optional adapter config + }], + panorama: // specific to the adapter, +}); +``` +::: + +:::: diff --git a/docs/guide/adapters/cubemap.md b/docs/guide/adapters/cubemap.md new file mode 100644 index 000000000..26d3fccbc --- /dev/null +++ b/docs/guide/adapters/cubemap.md @@ -0,0 +1,57 @@ +# Cubemap adapter + +> [Cube mapping](https://en.wikipedia.org/wiki/Cube_mapping) is a kind of projection where the environment is mapped to the six faces of a cube around the viewer. + +This adapter is available in the core `photo-sphere-viewer` package in `dist/adapters/cubemap.js`. + +Photo Sphere Viewer supports cubemaps as six distinct image files. The files can be provided as an object or an array. All features of Photo Sphere Viewer are fully supported when using cubemaps but the `fisheye` option gives funky results. + +```js +new PhotoSphereViewer.Viewer({ + adapter: PhotoSphereViewer.CubemapAdapter, + panorama: { + left: 'path/to/left.jpg', + front: 'path/to/front.jpg', + right: 'path/to/right.jpg', + back: 'path/to/back.jpg', + top: 'path/to/top.jpg', + bottom: 'path/to/bottom.jpg', + }, +}); +``` + +::: warning +This adapter does not use `panoData` option. You can use `sphereCorrection` if the tilt/roll/pan needs to be corrected. +::: + + +## Example + + + + +## Panorama options + +When using this adapter the `panorama` option and the `setPanorama()` method accept an array or an object of six URLs. + +```js +// Cubemap as array (order is important) : +panorama: [ + 'path/to/left.jpg', + 'path/to/front.jpg', + 'path/to/right.jpg', + 'path/to/back.jpg', + 'path/to/top.jpg', + 'path/to/bottom.jpg', +] + +// Cubemap as object : +panorama: { + left: 'path/to/left.jpg', + front: 'path/to/front.jpg', + right: 'path/to/right.jpg', + back: 'path/to/back.jpg', + top: 'path/to/top.jpg', + bottom: 'path/to/bottom.jpg', +} +``` diff --git a/docs/guide/adapters/tiles.md b/docs/guide/adapters/tiles.md new file mode 100644 index 000000000..8b9020c66 --- /dev/null +++ b/docs/guide/adapters/tiles.md @@ -0,0 +1,92 @@ +# Equirectangular tiles adapter + +> Reduce the initial loading time and used bandwidth by slicing big panoramas into many small tiles. + +This adapter is available in the core `photo-sphere-viewer` package in `dist/adapters/equirectangular-tiles.js`. + +```js +new PhotoSphereViewer.Viewer({ + adapter: PhotoSphereViewer.EquirectangularTilesAdapter, + panorama: { + width: 6000, + cols: 16, + rows: 8, + baseUrl: 'low_res.jpg', + tileUrl: (col, row) => { + return `tile_${col}x${row}.jpg`; + }, + }, +}); +``` + +::: warning +This adapter does not use `panoData` option. You can use `sphereCorrection` if the tilt/roll/pan needs to be corrected. +::: + + +## Example + + + + +## Configuration + +#### `baseBlur` +- type: `boolean` +- default: `true` + +Applies a 1px blur to the base image (option `baseUrl`). + +#### `showErrorTile` +- type: `boolean` +- default: `true` + +Shows a warning sign on tiles that cannot be loaded. + + +## Panorama options + +When using this adapter the `panorama` option and the `setPanorama()` method accept an object to configure the tiles. + +#### `width` (required) +- type: `number` + +Total width of the panorama, the height is always width / 2. + +#### `cols` (required) +- type: `number` + +Number of columns, must be power of two (4, 8, 16, 32, 64) and the maximum value is 64. + +#### `rows` (required) +- type: `number` + +Number of rows, must be power of two (2, 4, 8, 16, 32) and the maximum value is 32. + +#### `tileUrl` (required) +- type: `function: (col, row) => string` + +Function used to build the URL of a tile. + +#### `baseUrl` (recommended) +- type: `string` + +URL of a low resolution complete panorama image to display while the tiles are loading. + + +## Preparing the panorama + +The tiles can be easily generated using [ImageMagick](https://imagemagick.org) software. + +Let's say you have a 12.000x6.000 pixels panorama you want to split in 32 columns and 16 rows, use the following command: + +``` +magick panorama.jpg -crop 375x375 tile_%04d.jpg +``` + +You can also use this [online tool](https://pinetools.com/split-image). + + +::: tip Performances +It is recommanded to not exceed tiles with a size of 1024x1024 pixels, thus limiting the maximum panorama size to 65.536x32.768 pixels (a little more than 2 Gigapixels). +::: diff --git a/docs/guide/components/notification.md b/docs/guide/components/notification.md index 17a1072f5..644ea3152 100644 --- a/docs/guide/components/notification.md +++ b/docs/guide/components/notification.md @@ -16,17 +16,12 @@ This example consistently displays new notifications. ### `show(config)` -Show the notification. The configuration is described bellow. +Show the notification. -##### `content` (required) -- type: `string` - -HTML content of the notification. - -##### `timeout` -- type: `number` - -Auto-hide delay in milliseconds. +| | | | +|---|---|---| +| `content` (required) | `string` | HTML content of the notification. | +| `timeout` | `number` | Auto-hide delay in milliseconds. | ### `hide()` diff --git a/docs/guide/components/overlay.md b/docs/guide/components/overlay.md index 239ddaa5a..056816a4e 100644 --- a/docs/guide/components/overlay.md +++ b/docs/guide/components/overlay.md @@ -16,28 +16,14 @@ This example displays a overlay at startup. ### `show(config)` -Show the overlay. The configuration is described bellow. - -##### `id` -- type: `string` - -Unique identifier of the overlay, this will be used to `hide` the overlay only if the content has not been replaced by something else. - -##### `text` (required) -- type: `string` - -Main message of the overlay. - -##### `subtext` -- type: `string` - -Secondary message of the overlay. - -##### `image` -- type: `string` - -SVG image/icon displayed above the text. - +Show the overlay. + +| | | | +|---|---|---| +| `id` | `string` | Unique identifier of the overlay, this will be used to `hide` the overlay only if the content has not been replaced by something else. | +| `text` (required) | `string` | Main message of the overlay. | +| `subtext` | `string` | Secondary message of the overlay. | +| `image` | `string` |SVG image/icon displayed above the text. | ### `hide([id])` diff --git a/docs/guide/components/panel.md b/docs/guide/components/panel.md index 15043d38d..ecb2957ae 100644 --- a/docs/guide/components/panel.md +++ b/docs/guide/components/panel.md @@ -16,34 +16,19 @@ This example adds a custom button to toggle a panel. ### `show(config)` -Open the side panel. The configuration is described bellow. - -##### `id` -- type: `string` - -Unique identifier of the panel, this will be used to `hide` the panel only if the content has not been replaced by something else. It will be used to store the width defined by the user when using the resize handle. - -##### `content` (required) -- type: `string` - -HTML content of the panel. - -##### `noMargin` -- type: `boolean` -- default: `false` - -Remove the default margins inside the panel. - -##### `width` -- type: `string` -- default: `400px` (from CSS) - -Initial width if the panel (example: `100%`, `600px`). - -##### `clickHandler` -- type: `function` - -Function called when the user clicks inside the panel. +Open the side panel. + +| | | | +|---|---|---| +| `id` | `string` | Unique identifier of the panel, this will be used to `hide` the panel only if the content has not been replaced by something else. It will be used to store the width defined by the user when using the resize handle. | +| `content` (required) | `string` | HTML content of the panel. | +| `noMargin` (default `false`) | `boolean` | Remove the default margins inside the panel. | +| `width` (default `400px`) | `string` | Initial width if the panel (example: `100%`, `600px`). | +| `clickHandler` | `function` | Function called when the user clicks inside the panel or presses the Enter key while an element focused. | + +::: tip Content focus +After openning, the first focusable element (`a`, `button` or anything with `tabindex`) will be focused, allowing the user to navigate with the Tab key and activate the `clickHandler` with the `Enter` key. +::: ### `hide([id])` diff --git a/docs/guide/components/tooltip.md b/docs/guide/components/tooltip.md index 2919f40ad..320af9a1a 100644 --- a/docs/guide/components/tooltip.md +++ b/docs/guide/components/tooltip.md @@ -18,33 +18,15 @@ This example adds a persistent tooltip following the cursor. ### `create(config)` -Create a tooltip. The configuration is described bellow. - -##### `content` (required) -- type: `string` - -HTML content of the tooltip. - -#### `top` | `left` (required) -- type: `integer` - -Pixel coordinate of the tooltip relative to the top-left corner of the viewer. - -##### `position` -- type: `string` -- default: `top center` - -Tooltip position toward it's arrow tip. Accepted values are combinations of `top`, `center`, `bottom` and `left`, `center`, `right`. - -##### `className` -- type: `string` - -Additional CSS class added to the tooltip. - -##### `data` -- type: `any` - -Userdata associated to the tooltip (useful for events). +Create a tooltip. + +| | | | +|---|---|---| +| `content` (required) | `string` |HTML content of the tooltip. | +| `top` & `left` (required) | `number` | Pixel coordinates of the tooltip relative to the top-left corner of the viewer. | +| `position` (default `top center`) | `string` | Tooltip position toward it's arrow tip. Accepted values are combinations of `top`, `center`, `bottom` and `left`, `center`, `right`. | +| `className` | `string` | Additional CSS class added to the tooltip. | +| `data` | `any` | User data associated to the tooltip (useful for events). | ### `tooltip.move(config)` diff --git a/docs/guide/config.md b/docs/guide/config.md index 8744cf78a..de1a84104 100644 --- a/docs/guide/config.md +++ b/docs/guide/config.md @@ -23,29 +23,15 @@ container: document.querySelector('.viewer') container: 'viewer' // will target [id="viewer"] ``` -#### `panorama` (required) -- type: `string | string[] | object` +#### `adapter` +- default: `equirectangular` -Path to the panorama image(s). It must be a single string for equirectangular panoramas and an array or an object for cubemaps. +Which [adapter](./adapters) used to load the panorama. -```js -// Equirectangular panorama : -panorama: 'path/to/panorama.jpg' - -// Cubemap as array (order is important) : -panorama: [ - 'path/to/left.jpg', 'path/to/front.jpg', - 'path/to/right.jpg', 'path/to/back.jpg', - 'path/to/top.jpg', 'path/to/bottom.jpg', -] - -// Cubemap as object : -panorama: { - left: 'path/to/left.jpg', front: 'path/to/front.jpg', - right: 'path/to/right.jpg', back: 'path/to/back.jpg', - top: 'path/to/top.jpg', bottom: 'path/to/bottom.jpg', -} -``` +#### `panorama` (required) +- type: `*` + +Path to the panorama. Must be a single URL for the default equirectangular adapter. Other adapters support other values. #### `plugins` - type: `array` @@ -145,6 +131,7 @@ lang: { zoom : 'Zoom', zoomOut : 'Zoom out', zoomIn : 'Zoom in', + move : 'Move', download : 'Download', fullscreen: 'Fullscreen', menu : 'Menu', @@ -210,27 +197,17 @@ Sphere rotation angles, in radians. ![pan-tilt-toll](/assets//pan-tilt-roll.png) -::: warning Future change in computation -In a future version the order in which the angles are applied will change. It is highly recommended to set `sphereCorrectionReorder: true` to any new viewer to enable the new behaviour. -::: - #### `moveSpeed` - type: `double` - default `1` -Speed multiplicator for manual moves. - -#### `zoomButtonIncrement` -- type: `double` -- default `2` - -Zoom increment when using the keyboard or the navbar buttons. +Speed multiplicator for panorama moves. Used for click move, touch move and navbar buttons. -#### `mousewheelSpeed` +#### `zoomSpeed` - type: `double` -- default: `1` +- default `1` -Zoom speed when using the mouse wheel. +Speed multiplicator for panorama zooms. Used for mouse wheel, touch pinch and navbar buttons. #### `useXmpData` - type: `boolean` @@ -273,6 +250,25 @@ panoData: (image) => ({ **Note** : if any of _poseHeading_, _posePitch_ or _poseRoll_ parameters are found, the `sphereCorrection` option is ignored. +#### `requestHeaders` +- type: `object | function` + +Sets the HTTP headers when loading the images files. + +```js +requestHeaders: { + header: value, +} +``` + +It can also be a function to dynamically set the request headers before every call. This can be useful when adding a Bearer, which is temporarily valid, to the Authorization header. + +```js +requestHeaders: (url) => ({ + header: value, +}) +``` + #### `canvasBackground` - type: `string` - default: `#000` diff --git a/docs/guide/cubemap.md b/docs/guide/cubemap.md deleted file mode 100644 index 93856de1a..000000000 --- a/docs/guide/cubemap.md +++ /dev/null @@ -1,9 +0,0 @@ -# Cubemap projection - -[Cube mapping](https://en.wikipedia.org/wiki/Cube_mapping) is a kind of projection where the environment is mapped to the six faces of a cube arround the viewer. - -Photo Sphere Viewer supports cubemaps as six distinct image files. The files can be provided as [an object or an array](./config.md#panorama-required). - -All features of Photo Sphere Viewer are fully supported when using cubemaps but the `fisheye` option gives funky results. - - diff --git a/docs/guide/events.md b/docs/guide/events.md index 1ce073868..21c5ce23a 100644 --- a/docs/guide/events.md +++ b/docs/guide/events.md @@ -18,7 +18,7 @@ Triggered when the user clicks on the viewer (everywhere excluding the navbar an ```js viewer.on('click', (e, data) => { - console.log(`${data.rightclick ? 'right clicked' : 'clicked'} at longitude: ${data.longitude} latitude: ${data.latitude}`); + console.log(`${data.rightclick?'right ':''}clicked at longitude: ${data.longitude} latitude: ${data.latitude}`); }); ``` @@ -38,6 +38,18 @@ viewer.on('position-updated', (e, position) => { Triggered when the panorama image has been loaded and the viewer is ready to perform the first render. +```js +viewer.once('ready', () => { + console.log(`viewer is ready`); +}); +``` + ### `zoom-updated(level)` Triggered when the zoom level changes. + +```js +viewer.on('zoom-updated', (e, level) => { + console.log(`new zoom level is ${level}`); +}); +``` diff --git a/docs/guide/methods.md b/docs/guide/methods.md index 325bb0545..4028cb492 100644 --- a/docs/guide/methods.md +++ b/docs/guide/methods.md @@ -30,13 +30,9 @@ viewer.once('ready', () => { This section describes the most useful methods available, remember to check the for a full list. -### `destroy()` - -Removes the viewer from the page and frees memory used by three.js. - ### `animate(options): Animation` -Rotates and zooms the view with a smooth animation. You can change the position (`longitude`, `latitude` or `x`, `y`) and the zoom level (`zoom`). The `speed` option is either a duration in milliseconds or string containing the speed in revolutions per minute (`2rpm`) or degrees per second (`10dps`). It returns a `PSV.Animation` which is a standard Promise with an additional `cancel` method. +Rotate and zoom the view with a smooth animation. You can change the position (`longitude`, `latitude` or `x`, `y`) and the zoom level (`zoom`). The `speed` option is either a duration in milliseconds or string containing the speed in revolutions per minute (`2rpm`) or degrees per second (`10dps`). It returns a `PSV.Animation` which is a standard Promise with an additional `cancel` method. ```js viewer.animate({ @@ -48,17 +44,21 @@ viewer.animate({ .then(() => /* animation complete */); ``` +### `destroy()` + +Remove the viewer from the page and frees memory used by three.js. + ### `getPosition(): Position` -Returns the current position of the view. +Return the current position of the view. ### `getZoomLevel(): number` -Returns the current zoom level between 0 and 100. +Return the current zoom level between 0 and 100. ### `rotate(position)` -Immediately rotates the view without animation. +Immediately rotate the view without animation. ```js // you can also use longitude and latitude @@ -68,17 +68,28 @@ viewer.rotate({ }); ``` -### `setOption(option, value)` | `setOptions(options)` +### `setOption(option, value)` -Updates one or more options of the viewer. Some options cannot be changed : `panorama`, `panoData`, `container` and `plugins`. +Update an option of the viewer. Some options cannot be changed : `panorama`, `panoData`, `container`, `adapter` and `plugins`. ```js viewer.setOption('fisheye', true); ``` +### `setOptions(options)` + +Update multiple options at once. + +```js +viewer.setOptions({ + fisheye: true, + autorotateSpeed: '-1rpm', +}); +``` + ### `setPanorama(panorama, options): Promise` -Changes the panorama image with an optional transition animation (enabled by default). You can also set the new `sphereCorrection` and `panoData` if needed. +Change the panorama image with an optional transition animation (enabled by default). You can also set the new `sphereCorrection` and `panoData` if needed. ```js viewer.setPanorama('image.jpg') @@ -87,4 +98,4 @@ viewer.setPanorama('image.jpg') ### `zoom(level)` | `zoomIn()` | `zoomOut()` -Changes the zoom level without animation. +Change the zoom level without animation. diff --git a/docs/guide/migration-v3.md b/docs/guide/migration-v3.md index 3ce9a16c4..26cdca8d3 100644 --- a/docs/guide/migration-v3.md +++ b/docs/guide/migration-v3.md @@ -4,36 +4,6 @@ > Photo Sphere Viewer 4 is a complete rewrite of the internals of the library using ES6 modules and a modular plugin system. The library is still compatible with less modern browsers and any build systems (or no build system at all) but many methods and options have been moved and renamed. -## Compatibility wrapper - -For a quick migration from Photo Sphere Viewer 3 you can use the `CompatViewer` class instead of ` PhotoSphereViewer`. - -```html - - - - - - - - - - - - - -``` - -::: warning -Please note this wrapper is not fully tested and only addresses renamed options and moved methods. - -It does not cover the signature changes of event methods (`on` and `once`). -::: - ## Plugins @@ -59,8 +29,6 @@ Be sure to rename your configuration properties, the old naming is not supported - `time_anim` → `autorotateDelay` - `default_fov`→ `defaultZoomLvl` - `mousemove_hover` → `captureCursor` -- `zoom_speed` → `zoomButtonIncrement` -- `mousewheel_factor` → `mousewheelSpeed` ### Deleted options @@ -68,6 +36,7 @@ Be sure to rename your configuration properties, the old naming is not supported - `tooltip` → the properties of the tooltip are now extracted from the stylesheet - `webgl` → WebGL is now always enabled since three.js deprecated the CanvasRenderer - `panorama_roll` → use `sphereCorrection` with the `roll` property +- `mousewheel_factor` ## Methods diff --git a/docs/guide/navbar.md b/docs/guide/navbar.md index 7874bbe9d..babb2156a 100644 --- a/docs/guide/navbar.md +++ b/docs/guide/navbar.md @@ -6,19 +6,25 @@ The `navbar` option is an array which can contain the following elements: - - `autorotate` : toggles the automatic rotation - - `zoomOut` : zooms in - - `zoomRange` : zoom slider - - `zoomIn` : zooms out - - `zoom`: `zoomOut` + `zoomRange` + `zoomIn` - - `download` : download the source image - - `caption` : the caption - - `fullscreen` : toggles fullscreen view - - ~~`markers` : toggles the markers~~ now part of a [plugin](../plugins/plugin-markers.md) - - ~~`markersList` : shows the markers list~~ now part of a [plugin](../plugins/plugin-markers.md) - - ~~`gyroscope` : toggles the gyroscope~~ now part of a [plugin](../plugins/plugin-gyroscope.md) - - ~~`stereo` : toggles stereo view (VR)~~ now part of a [plugin](../plugins/plugin-stereo.md) - + - `autorotate` + - `zoomOut` + - `zoomRange` + - `zoomIn` + - `zoom` = `zoomOut` + `zoomRange` + `zoomIn` + - `moveLeft` + - `moveRight` + - `moveTop` + - `moveDown` + - `move` = `moveLeft` + `moveRight` + `moveTop` + `moveDown` + - `download` + - `caption` + - `fullscreen` + - ~~`markers`~~ now part of a [plugin](../plugins/plugin-markers.md) + - ~~`markersList`~~ now part of a [plugin](../plugins/plugin-markers.md) + - ~~`gyroscope`~~ now part of a [plugin](../plugins/plugin-gyroscope.md) + - ~~`stereo`~~ now part of a [plugin](../plugins/plugin-stereo.md) + +Other buttons can be made available by plugins. ## Custom buttons diff --git a/docs/plugins/README.md b/docs/plugins/README.md index 42ab739b9..b1a54dcd2 100644 --- a/docs/plugins/README.md +++ b/docs/plugins/README.md @@ -6,7 +6,7 @@ Plugins are used to add new functionalities to Photo Sphere Viewer. They can acc Official plugins (listed on the left menu) are available in the the main `photo-sphere-viewer` package inside the `dist/plugins` directory. Some plugins also have an additional CSS file. -**Example for the Markers plugins:** +**Example for the Markers plugin:** :::: tabs @@ -24,7 +24,7 @@ Official plugins (listed on the left menu) are available in the the main `photo- Import `photo-sphere-viewer/dist/plugins/markers.css` with the prefered way depending on your tooling. ```js -import MarkersPlugins from 'photo-sphere-viewer/dist/plugins/markers'; +import { MarkersPlugins } from 'photo-sphere-viewer/dist/plugins/markers'; ``` ::: diff --git a/docs/plugins/plugin-markers.md b/docs/plugins/plugin-markers.md index 0e2c97475..385ed1b31 100644 --- a/docs/plugins/plugin-markers.md +++ b/docs/plugins/plugin-markers.md @@ -73,7 +73,7 @@ One of these options is required. | `polylinePx` | `integer[2][]` | Same as `polygonPx` but generates a polyline. | | `polylineRad` | `double[2][]` | Same as `polygonRad` but generates a polyline. | -#### Examples : +**Examples :** ```js { diff --git a/docs/plugins/writing-a-plugin.md b/docs/plugins/writing-a-plugin.md index eb26a7b69..0288a81d4 100644 --- a/docs/plugins/writing-a-plugin.md +++ b/docs/plugins/writing-a-plugin.md @@ -19,7 +19,7 @@ Your plugin is also an [`EventEmitter`](https://github.com/mistic100/uEvent) wit ```js import { AbstractPlugin } from 'photo-sphere-viewer'; -export default class PhotoSphereViewerCustomPlugin extends AbstractPlugin { +export class PhotoSphereViewerCustomPlugin extends AbstractPlugin { static id = 'custom-plugin'; @@ -68,7 +68,8 @@ export default { ], plugins : [ require('rollup-plugin-babel')({ - exclude: 'node_modules/**', + exclude : 'node_modules/**', + babelHelpers: 'bundled', }), ], }; @@ -192,7 +193,7 @@ A plugin can expose one or more settings to the viewer by using the [Settings pl This is done by requiring the settings plugin and calling the `addSetting` method. Consult the [Settings plugin](./plugin-settings.md) page for more information. ```js -import SettingsPlugin from 'photo-sphere-viewer/plugins/settings'; +import { SettingsPlugin } from 'photo-sphere-viewer/dist/plugins/settings'; export default class PhotoSphereViewerCustomPlugin extends AbstractPlugin { @@ -227,6 +228,23 @@ export default class PhotoSphereViewerCustomPlugin extends AbstractPlugin { } ``` +For this two work you will need two modifications in your rollup configuration: + +```js +// rollup.config.js + +export default { + output : { + globals : { + 'photo-sphere-viewer/dist/plugins/settings': 'PhotoSphereViewer.SettingsPlugin', + }, + }, + external: [ + 'photo-sphere-viewer/dist/plugins/settings', + ], +}; +``` + ## Naming and publishing diff --git a/example/compat.html b/example/compat.html deleted file mode 100644 index c739465db..000000000 --- a/example/compat.html +++ /dev/null @@ -1,46 +0,0 @@ - - - - - - PhotoSphereViewer - compatibility demo - - - - - - - -
- - - - - - - - - diff --git a/example/components.html b/example/components.html index f56e166c2..4870beb63 100644 --- a/example/components.html +++ b/example/components.html @@ -14,17 +14,13 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { width: 100%; height: 100%; } - - .custom-button { - font-family: sans-serif; - width: auto; - } @@ -59,7 +55,6 @@

Custom panel

loadingImg: 'assets/photosphere-logo.gif', navbar : [ { - className: 'custom-button', content : 'Loader', onClick : () => { PSV.loader.show(); @@ -67,7 +62,6 @@

Custom panel

}, }, { - className: 'custom-button', content : 'Notification', onClick : () => { const messages = ['This is a custom notification', 'This is another notification', 'Yet another notification?']; @@ -78,7 +72,6 @@

Custom panel

}, }, { - className: 'custom-button', content : 'Overlay', onClick : () => { PSV.overlay.show({ @@ -90,7 +83,6 @@

Custom panel

}, }, { - className: 'custom-button', content : 'Panel', onClick : () => { PSV.panel.show({ @@ -101,7 +93,6 @@

Custom panel

}, }, { - className: 'custom-button', content : 'Tooltip', onClick : () => { const position = ['top center', 'top left', 'top right', 'bottom center', 'bottom left', 'bottom right', 'center left', 'center right'][Math.floor(Math.random() * 8)]; diff --git a/example/cubemap.html b/example/cubemap.html index 6110e2f18..006732756 100644 --- a/example/cubemap.html +++ b/example/cubemap.html @@ -15,6 +15,7 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { @@ -37,6 +38,7 @@ + + + + + + + + + + diff --git a/example/equirectangular.html b/example/equirectangular.html index 4e03a0a0d..0dd46ae02 100644 --- a/example/equirectangular.html +++ b/example/equirectangular.html @@ -14,6 +14,7 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { @@ -60,8 +61,10 @@ touchmoveTwoFingers: false, mousewheelCtrlKey : false, captureCursor : false, + moveSpeed : 1, + zoomSpeed : 1, navbar : [ - 'autorotate', 'zoom', 'download', + 'autorotate', 'zoom', 'move', 'download', { title : 'Change image', className: 'custom-button', diff --git a/example/plugin-autorotate-keypoints.html b/example/plugin-autorotate-keypoints.html index 0994506b0..42ce4c007 100644 --- a/example/plugin-autorotate-keypoints.html +++ b/example/plugin-autorotate-keypoints.html @@ -15,6 +15,7 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { @@ -45,7 +46,6 @@ autorotateDelay: 1000, navbar : [ 'autorotate', - 'zoom', { title : 'Change points', content: '🔄', diff --git a/example/plugin-markers.html b/example/plugin-markers.html index f716fd0dc..e139f5340 100644 --- a/example/plugin-markers.html +++ b/example/plugin-markers.html @@ -15,6 +15,7 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { @@ -114,7 +115,7 @@

Header Level 3

caption : 'Parc national du Mercantour © Damien Sorel', loadingImg: 'assets/photosphere-logo.gif', navbar : [ - 'autorotate', 'zoom', 'download', 'markers', 'markersList', + 'markers', 'markersList', { content : '💬', title : 'Show all tooltips', @@ -123,7 +124,7 @@

Header Level 3

markers.toggleAllTooltips(); } }, - 'caption', 'gyroscope', 'stereo', 'fullscreen', + 'caption', 'fullscreen', ], plugins : [ PhotoSphereViewer.GyroscopePlugin, diff --git a/example/plugin-resolution.html b/example/plugin-resolution.html index 8f489c3ee..d658416ec 100644 --- a/example/plugin-resolution.html +++ b/example/plugin-resolution.html @@ -15,6 +15,7 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { @@ -40,6 +41,7 @@ panorama : 'sphere_small.jpg', caption : 'Parc national du Mercantour © Damien Sorel', loadingImg: 'assets/photosphere-logo.gif', + navbar : ['caption', 'settings', 'fullscreen'], plugins : [ PhotoSphereViewer.SettingsPlugin, [PhotoSphereViewer.ResolutionPlugin, { diff --git a/example/plugin-visible-range.html b/example/plugin-visible-range.html index 345d8b4cd..3ce8ecf3f 100644 --- a/example/plugin-visible-range.html +++ b/example/plugin-visible-range.html @@ -15,17 +15,13 @@ overflow: hidden; margin: 0; padding: 0; + font-family: sans-serif; } #photosphere { width: 100%; height: 100%; } - - .custom-button { - font-family: sans-serif; - width: auto; - } diff --git a/package.json b/package.json index 387168c59..7119efddf 100644 --- a/package.json +++ b/package.json @@ -1,12 +1,14 @@ { "name": "photo-sphere-viewer", - "version": "4.2.1", + "version": "4.3.0", "description": "A JavaScript library to display Photo Sphere panoramas", "homepage": "https://photo-sphere-viewer.js.org", "main": "dist/photo-sphere-viewer.js", + "types": "dist/photo-sphere-viewer.d.ts", "files": [ "src/", - "dist/" + "dist/", + "types/" ], "authors": [ { @@ -31,54 +33,54 @@ "url": "git://github.com/mistic100/Photo-Sphere-Viewer.git" }, "dependencies": { - "three": "^0.126.0", - "uevent": "~2.0.0" + "three": "^0.133.1", + "uevent": "~2.0.1" }, "devDependencies": { - "@babel/core": "^7.7.4", - "@babel/plugin-proposal-class-properties": "^7.8.3", - "@babel/plugin-proposal-optional-chaining": "^7.9.0", - "@babel/preset-env": "^7.7.4", - "@babel/register": "^7.7.4", + "@babel/core": "^7.15.0", + "@babel/plugin-proposal-class-properties": "^7.14.5", + "@babel/plugin-proposal-optional-chaining": "^7.14.5", + "@babel/preset-env": "^7.15.0", + "@babel/register": "^7.15.3", "@csstools/postcss-sass": "https://github.com/sinankeskin/postcss-sass#master", "@pixi/jsdoc-template": "^2.5.1", - "@rollup/plugin-alias": "^3.0.1", - "@rollup/plugin-babel": "^5.2.2", - "@rollup/plugin-inject": "^4.0.1", - "@rollup/plugin-replace": "^2.3.1", - "@vuepress/plugin-active-header-links": "^1.2.0", - "@vuepress/plugin-back-to-top": "^1.2.0", - "@vuepress/plugin-google-analytics": "^1.2.0", - "autoprefixer": "^10.2.4", - "axios": "^0.21.0", + "@rollup/plugin-babel": "^5.3.0", + "@rollup/plugin-replace": "^3.0.0", + "@vuepress/plugin-active-header-links": "^1.8.2", + "@vuepress/plugin-back-to-top": "^1.8.2", + "@vuepress/plugin-google-analytics": "^1.8.2", + "autoprefixer": "^10.3.3", + "axios": "^0.23.0", "babel-eslint": "^10.0.3", "cpx": "^1.5.0", - "date-fns": "^2.9.0", - "eslint": "^7.7.0", - "eslint-config-airbnb-base": "^14.2.0", - "eslint-plugin-import": "^2.21.2", - "jsdoc": "^3.6.3", + "date-fns": "^2.23.0", + "eslint": "^7.32.0", + "eslint-config-airbnb-base": "^14.2.1", + "eslint-plugin-import": "^2.24.2", + "jsdoc": "^3.6.7", "live-server": "^1.2.0", - "marked": "^2.0.0", - "mocha": "^8.0.1", - "ngrok": "^3.2.7", + "marked": "^3.0.2", + "mocha": "^9.1.1", + "ngrok": "^4.0.0", "nosleep.js": "^0.12.0", "npm-run-all": "^4.1.3", - "postcss": "^8.2.6", - "postcss-banner": "^4.0.0", - "promise-polyfill": "^8.1.3", - "raw-loader": "^4.0.0", - "rollup": "^2.36.2", + "postcss": "^8.3.6", + "postcss-banner": "^4.0.1", + "promise-polyfill": "^8.2.0", + "raw-loader": "^4.0.2", + "rollup": "^2.56.0", + "rollup-plugin-dts": "^4.0.0", "rollup-plugin-local-resolve": "^1.0.7", - "rollup-plugin-postcss": "^4.0.0", + "rollup-plugin-postcss": "^4.0.1", "rollup-plugin-string": "^3.0.0", - "stylelint": "^13.0.0", - "stylelint-config-standard": "^20.0.0", - "stylelint-scss": "^3.13.0", + "stylelint": "^13.13.1", + "stylelint-config-standard": "^22.0.0", + "stylelint-scss": "^3.20.1", + "typescript": "^4.4.2", "vue-material": "^1.0.0-beta-11", - "vue-slider-component": "^3.2.11", - "vue-swatches": "^2.1.0", - "vuepress": "^1.4.0", + "vue-slider-component": "^3.2.14", + "vue-swatches": "^2.1.1", + "vuepress": "^1.8.2", "vuepress-plugin-element-tabs": "^0.2.8" }, "scripts": { @@ -94,10 +96,11 @@ "test:mocha": "mocha --require @babel/register --recursive \"src/**/*.spec.js\"", "test:eslint": "eslint src --ignore-path .gitignore --ignore-pattern \"*.spec.js\"", "test:sasslint": "stylelint \"src/**/*.scss\"", + "test:types": "cd tests && npm run test", "start": "npm-run-all --parallel dev:**", "start:doc": "vuepress dev docs", "start:remote": "ngrok http 8080", "dev:serve": "live-server --watch=dist,example --open=example", - "dev:watch": "npm run compile:rollup -- --watch" + "dev:watch": "npm run compile:prepare && npm run compile:rollup -- --watch" } } diff --git a/rollup.config.js b/rollup.config.js index 0190094e4..70a03248f 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -1,17 +1,20 @@ -import alias from '@rollup/plugin-alias'; import babel from '@rollup/plugin-babel'; -import inject from '@rollup/plugin-inject'; import replace from '@rollup/plugin-replace'; import fs from 'fs'; import path from 'path'; import localResolve from 'rollup-plugin-local-resolve'; import postcss from 'rollup-plugin-postcss' +import dts from 'rollup-plugin-dts'; import { string } from 'rollup-plugin-string'; import pkg from './package.json'; const plugins = fs.readdirSync(path.join(__dirname, 'src/plugins')) - .filter(p => p !== 'AbstractPlugin.js'); + .filter(p => fs.lstatSync(`src/plugins/${p}`).isDirectory()); + +const adapters = fs.readdirSync(path.join(__dirname, 'src/adapters')) + .filter(p => fs.lstatSync(`src/adapters/${p}`).isDirectory()) + .filter(p => p !== 'equirectangular'); const banner = `/*! * Photo Sphere Viewer ${pkg.version} @@ -46,8 +49,6 @@ const baseConfig = { 'three', 'uevent', ], - // wrapped in a function to ensure unique plugin instances for each entry-point - // https://github.com/egoist/rollup-plugin-postcss/issues/158 plugins : () => [ localResolve(), babel({ @@ -92,28 +93,46 @@ const secondaryConfig = { 'photo-sphere-viewer', ...plugins.map(p => `photo-sphere-viewer/dist/plugins/${p}`), ], - plugins: () => [ - ...baseConfig.plugins(), - alias({ - 'photo-sphere-viewer': './src', - ...plugins.reduce((alias, p) => { - alias[`photo-sphere-viewer/dist/plugins/${p}`] = `./src/plugins/${p}`; - return alias; + replace({ + delimiters : ['', ''], + preventAssignment : true, + [`from 'three/examples/jsm`]: `from '../../../three-examples`, + [`from '../..'`] : `from 'photo-sphere-viewer'`, + ...plugins.reduce((replace, p) => { + replace[`from '../${p}'`] = `from 'photo-sphere-viewer/dist/plugins/${p}'`; + return replace; }, {}), }), - inject({ - include: 'three-examples/**', - modules: { - THREE: 'three', - }, - }), + ...baseConfig.plugins(), + ], +}; + +const baseConfigDTS = { + output : { + format: 'es', + }, + plugins: () => [ + dts(), + ], +}; + +const secondaryConfigDTS = { + ...baseConfigDTS, + external: [ + ...secondaryConfig.external, + ], + plugins : () => [ replace({ - // configuration to embed the examples files in PSV source - delimiters : ['', ''], - [`from 'three/examples/jsm`] : `from '../../../three-examples`, - [`from '../../../build/three.module.js'`]: `from "three"`, + delimiters : ['', ''], + preventAssignment: true, + [`from '../..'`] : `from 'photo-sphere-viewer'`, + ...plugins.reduce((replace, p) => { + replace[`from '../${p}'`] = `from 'photo-sphere-viewer/dist/plugins/${p}'`; + return replace; + }, {}), }), + ...baseConfigDTS.plugins(), ], }; @@ -138,8 +157,16 @@ export default [ }, plugins: secondaryConfig.plugins(), }, -].concat( - plugins.map(p => ({ + { + ...baseConfigDTS, + input : 'types/index.d.ts', + output : { + ...baseConfigDTS.output, + file: 'dist/photo-sphere-viewer.d.ts', + }, + plugins: baseConfigDTS.plugins(), + }, + ...plugins.map(p => ({ ...secondaryConfig, input : `src/plugins/${p}/index.js`, output : { @@ -148,5 +175,33 @@ export default [ name: `PhotoSphereViewer.${camelize(p)}Plugin`, }, plugins: secondaryConfig.plugins(), + })), + ...adapters.map(p => ({ + ...secondaryConfig, + input : `src/adapters/${p}/index.js`, + output : { + ...secondaryConfig.output, + file: `dist/adapters/${p}.js`, + name: `PhotoSphereViewer.${camelize(p)}Adapter`, + }, + plugins: secondaryConfig.plugins(), + })), + ...plugins.map(p => ({ + ...secondaryConfigDTS, + input : `types/plugins/${p}/index.d.ts`, + output : { + ...secondaryConfigDTS.output, + file: `dist/plugins/${p}.d.ts`, + }, + plugins: secondaryConfigDTS.plugins(), + })), + ...adapters.map(p => ({ + ...secondaryConfigDTS, + input : `types/adapters/${p}/index.d.ts`, + output : { + ...secondaryConfigDTS.output, + file: `dist/adapters/${p}.d.ts`, + }, + plugins: secondaryConfigDTS.plugins(), })) -); +]; diff --git a/src/Viewer.js b/src/Viewer.js index 23b16f577..1389a7471 100644 --- a/src/Viewer.js +++ b/src/Viewer.js @@ -6,10 +6,11 @@ import { Navbar } from './components/Navbar'; import { Notification } from './components/Notification'; import { Overlay } from './components/Overlay'; import { Panel } from './components/Panel'; -import { CONFIG_PARSERS, DEFAULTS, getConfig, READONLY_OPTIONS } from './data/config'; -import { CHANGE_EVENTS, EVENTS, IDS, VIEWER_DATA } from './data/constants'; +import { CONFIG_PARSERS, DEFAULTS, DEPRECATED_OPTIONS, getConfig, READONLY_OPTIONS } from './data/config'; +import { CHANGE_EVENTS, EVENTS, IDS, SPHERE_RADIUS, VIEWER_DATA } from './data/constants'; import { SYSTEM } from './data/system'; import errorIcon from './icons/error.svg'; +import { AbstractPlugin } from './plugins/AbstractPlugin'; import { PSVError } from './PSVError'; import { DataHelper } from './services/DataHelper'; import { EventsHandler } from './services/EventsHandler'; @@ -17,17 +18,20 @@ import { Renderer } from './services/Renderer'; import { TextureLoader } from './services/TextureLoader'; import { TooltipRenderer } from './services/TooltipRenderer'; import { - bound, each, exitFullscreen, getAngle, getShortestArc, isExtendedPosition, isFullscreenEnabled, + logWarn, + pluginInterop, requestFullscreen, throttle, toggleClass } from './utils'; +import { Dynamic } from './utils/Dynamic'; +import { MultiDynamic } from './utils/MultiDynamic'; THREE.Cache.enabled = true; @@ -63,15 +67,11 @@ export class Viewer extends EventEmitter { * @protected * @property {boolean} ready - when all components are loaded * @property {boolean} needsUpdate - if the view needs to be renderer - * @property {boolean} isCubemap - if the panorama is a cubemap - * @property {PSV.Position} position - current direction of the camera * @property {external:THREE.Vector3} direction - direction of the camera - * @property {number} zoomLvl - current zoom level * @property {number} vFov - vertical FOV * @property {number} hFov - horizontal FOV * @property {number} aspect - viewer aspect ratio - * @property {number} moveSpeed - move speed (computed with pixel ratio and configuration moveSpeed) - * @property {Function} autorotateCb - update callback of the automatic rotation + * @property {boolean} autorotateEnabled - automatic rotation is enabled * @property {PSV.Animation} animationPromise - promise of the current animation (either go to position or image transition) * @property {Promise} loadingPromise - promise of the setPanorama method * @property startTimeout - timeout id of the automatic rotation delay @@ -79,30 +79,23 @@ export class Viewer extends EventEmitter { * @property {PSV.PanoData} panoData - panorama metadata */ this.prop = { - ready : false, - uiRefresh : false, - needsUpdate : false, - fullscreen : false, - isCubemap : undefined, - position : { - longitude: 0, - latitude : 0, - }, - direction : null, - zoomLvl : null, - vFov : null, - hFov : null, - aspect : null, - moveSpeed : 0.1, - autorotateCb : null, - animationPromise: null, - loadingPromise : null, - startTimeout : null, - size : { + ready : false, + uiRefresh : false, + needsUpdate : false, + fullscreen : false, + direction : new THREE.Vector3(0, 0, SPHERE_RADIUS), + vFov : null, + hFov : null, + aspect : null, + autorotateEnabled: false, + animationPromise : null, + loadingPromise : null, + startTimeout : null, + size : { width : 0, height: 0, }, - panoData : { + panoData : { fullWidth : 0, fullHeight : 0, croppedWidth : 0, @@ -136,6 +129,14 @@ export class Viewer extends EventEmitter { this.container.classList.add('psv-container'); this.parent.appendChild(this.container); + /** + * @summary Render adapter + * @type {PSV.adapters.AbstractAdapter} + * @readonly + * @package + */ + this.adapter = new this.config.adapter[0](this, this.config.adapter[1]); // eslint-disable-line new-cap + /** * @summary All child components * @type {PSV.components.AbstractComponent[]} @@ -216,6 +217,31 @@ export class Viewer extends EventEmitter { */ this.overlay = new Overlay(this); + /** + * @member {Record} + * @package + */ + this.dynamics = { + zoom: new Dynamic((value) => { + this.prop.vFov = this.dataHelper.zoomLevelToFov(value); + this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov); + + this.needsUpdate(); + this.trigger(EVENTS.ZOOM_UPDATED, value); + }, 0, 100), + + position: new MultiDynamic({ + longitude: new Dynamic(null), + latitude : new Dynamic(null, -Math.PI / 2, Math.PI / 2), + }, (position) => { + this.dataHelper.sphericalCoordsToVector3(position, this.prop.direction); + this.needsUpdate(); + this.trigger(EVENTS.POSITION_UPDATED, position); + }), + }; + + this.__updateSpeeds(); + this.eventsHandler.init(); this.__resizeRefresh = throttle(() => this.refreshUi('resize'), 500); @@ -223,9 +249,6 @@ export class Viewer extends EventEmitter { // apply container size this.resize(this.config.size); - // actual move speed depends on pixel-ratio - this.prop.moveSpeed = THREE.Math.degToRad(this.config.moveSpeed / SYSTEM.pixelRatio); - // init plugins this.config.plugins.forEach(([plugin, opts]) => { this.plugins[plugin.id] = new plugin(this, opts); // eslint-disable-line new-cap @@ -276,6 +299,7 @@ export class Viewer extends EventEmitter { this.renderer.destroy(); this.textureLoader.destroy(); this.dataHelper.destroy(); + this.adapter.destroy(); this.children.slice().forEach(child => child.destroy()); this.children.length = 0; @@ -337,7 +361,13 @@ export class Viewer extends EventEmitter { * @returns {PSV.plugins.AbstractPlugin} */ getPlugin(pluginId) { - return pluginId ? this.plugins[typeof pluginId === 'function' ? pluginId.id : pluginId] : null; + if (typeof pluginId === 'string') { + return this.plugins[pluginId]; + } + else { + const pluginCtor = pluginInterop(pluginId, AbstractPlugin); + return pluginCtor ? this.plugins[pluginCtor.id] : undefined; + } } /** @@ -345,10 +375,7 @@ export class Viewer extends EventEmitter { * @returns {PSV.Position} */ getPosition() { - return { - longitude: this.prop.position.longitude, - latitude : this.prop.position.latitude, - }; + return this.dynamics.position.current; } /** @@ -356,7 +383,7 @@ export class Viewer extends EventEmitter { * @returns {number} */ getZoomLevel() { - return this.prop.zoomLvl; + return this.dynamics.zoom.current; } /** @@ -375,7 +402,7 @@ export class Viewer extends EventEmitter { * @returns {boolean} */ isAutorotateEnabled() { - return !!this.prop.autorotateCb; + return this.prop.autorotateEnabled; } /** @@ -413,6 +440,8 @@ export class Viewer extends EventEmitter { this.prop.aspect = this.prop.size.width / this.prop.size.height; this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov); + this.renderer.updateCameraMatrix(); + this.needsUpdate(); this.trigger(EVENTS.SIZE_UPDATED, this.getSize()); this.__resizeRefresh(); @@ -424,7 +453,7 @@ export class Viewer extends EventEmitter { * @description Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
* If the "options" parameter is not defined, the camera will not move and the ongoing animation will continue.
* If another loading is already in progress it will be aborted. - * @param {string|string[]|PSV.Cubemap} path - URL of the new panorama file + * @param {*} path - URL of the new panorama file * @param {PSV.PanoramaOptions} [options] * @returns {Promise} */ @@ -435,10 +464,10 @@ export class Viewer extends EventEmitter { // apply default parameters on first load if (!this.prop.ready) { - if (!('longitude' in options) && !this.prop.isCubemap) { + if (!('longitude' in options)) { options.longitude = this.config.defaultLong; } - if (!('latitude' in options) && !this.prop.isCubemap) { + if (!('latitude' in options)) { options.latitude = this.config.defaultLat; } if (!('zoom' in options)) { @@ -492,12 +521,12 @@ export class Viewer extends EventEmitter { } }; - if (!options.transition || !this.prop.ready) { + if (!options.transition || !this.prop.ready || !this.adapter.constructor.supportsTransition) { if (options.showLoader || !this.prop.ready) { this.loader.show(); } - this.prop.loadingPromise = this.textureLoader.loadTexture(this.config.panorama, options.panoData) + this.prop.loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData) .then((textureData) => { this.renderer.setTexture(textureData); this.renderer.setPanoramaPose(textureData.panoData); @@ -517,7 +546,7 @@ export class Viewer extends EventEmitter { this.loader.show(); } - this.prop.loadingPromise = this.textureLoader.loadTexture(this.config.panorama, options.panoData) + this.prop.loadingPromise = this.adapter.loadTexture(this.config.panorama, options.panoData) .then((textureData) => { this.loader.hide(); @@ -536,6 +565,11 @@ export class Viewer extends EventEmitter { */ setOptions(options) { each(options, (value, key) => { + if (DEPRECATED_OPTIONS[key]) { + logWarn(DEPRECATED_OPTIONS[key]); + return; + } + if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) { throw new PSVError(`Unknown option ${key}`); } @@ -570,12 +604,13 @@ export class Viewer extends EventEmitter { break; case 'moveSpeed': - this.prop.moveSpeed = THREE.Math.degToRad(value / SYSTEM.pixelRatio); + case 'zoomSpeed': + this.__updateSpeeds(); break; case 'minFov': case 'maxFov': - this.prop.zoomLvl = this.dataHelper.fovToZoomLevel(this.prop.vFov); + this.dynamics.zoom.setValue(this.dataHelper.fovToZoomLevel(this.prop.vFov)); this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel()); break; @@ -611,22 +646,15 @@ export class Viewer extends EventEmitter { startAutorotate() { this.__stopAll(); - this.prop.autorotateCb = (() => { - let last; - let elapsed; - - return (e, timestamp) => { - elapsed = last === undefined ? 0 : timestamp - last; - last = timestamp; + this.dynamics.position.roll({ + longitude: this.config.autorotateSpeed < 0, + }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed)); - this.rotate({ - longitude: this.prop.position.longitude + this.config.autorotateSpeed * elapsed / 1000, - latitude : this.prop.position.latitude - (this.prop.position.latitude - this.config.autorotateLat) / 200, - }); - }; - })(); + this.dynamics.position.goto({ + latitude: this.config.autorotateLat, + }, Math.abs(this.config.autorotateSpeed / this.config.moveSpeed)); - this.on(EVENTS.BEFORE_RENDER, this.prop.autorotateCb); + this.prop.autorotateEnabled = true; this.trigger(EVENTS.AUTOROTATE, true); } @@ -642,8 +670,9 @@ export class Viewer extends EventEmitter { } if (this.isAutorotateEnabled()) { - this.off(EVENTS.BEFORE_RENDER, this.prop.autorotateCb); - this.prop.autorotateCb = null; + this.dynamics.position.stop(); + + this.prop.autorotateEnabled = false; this.trigger(EVENTS.AUTOROTATE, false); } @@ -695,15 +724,7 @@ export class Viewer extends EventEmitter { } const cleanPosition = this.change(CHANGE_EVENTS.GET_ROTATE_POSITION, this.dataHelper.cleanPosition(position)); - - if (this.prop.position.longitude !== cleanPosition.longitude || this.prop.position.latitude !== cleanPosition.latitude) { - this.prop.position.longitude = cleanPosition.longitude; - this.prop.position.latitude = cleanPosition.latitude; - - this.needsUpdate(); - - this.trigger(EVENTS.POSITION_UPDATED, this.getPosition()); - } + this.dynamics.position.setValue(cleanPosition); } /** @@ -723,21 +744,22 @@ export class Viewer extends EventEmitter { // clean/filter position and compute duration if (positionProvided) { const cleanPosition = this.change(CHANGE_EVENTS.GET_ANIMATE_POSITION, this.dataHelper.cleanPosition(options)); + const currentPosition = this.getPosition(); // longitude offset for shortest arc - const tOffset = getShortestArc(this.prop.position.longitude, cleanPosition.longitude); + const tOffset = getShortestArc(currentPosition.longitude, cleanPosition.longitude); - animProperties.longitude = { start: this.prop.position.longitude, end: this.prop.position.longitude + tOffset }; - animProperties.latitude = { start: this.prop.position.latitude, end: cleanPosition.latitude }; + animProperties.longitude = { start: currentPosition.longitude, end: currentPosition.longitude + tOffset }; + animProperties.latitude = { start: currentPosition.latitude, end: cleanPosition.latitude }; - duration = this.dataHelper.speedToDuration(options.speed, getAngle(this.prop.position, cleanPosition)); + duration = this.dataHelper.speedToDuration(options.speed, getAngle(currentPosition, cleanPosition)); } // clean/filter zoom and compute duration if (zoomProvided) { - const dZoom = Math.abs(options.zoom - this.prop.zoomLvl); + const dZoom = Math.abs(options.zoom - this.getZoomLevel()); - animProperties.zoom = { start: this.prop.zoomLvl, end: options.zoom }; + animProperties.zoom = { start: this.getZoomLevel(), end: options.zoom }; if (!duration) { // if animating zoom only and a speed is given, use an arbitrary PI/4 to compute the duration @@ -798,31 +820,23 @@ export class Viewer extends EventEmitter { * @fires PSV.zoom-updated */ zoom(level) { - const newZoomLvl = bound(level, 0, 100); - - if (this.prop.zoomLvl !== newZoomLvl) { - this.prop.zoomLvl = newZoomLvl; - this.prop.vFov = this.dataHelper.zoomLevelToFov(this.prop.zoomLvl); - this.prop.hFov = this.dataHelper.vFovToHFov(this.prop.vFov); - - this.needsUpdate(); - this.trigger(EVENTS.ZOOM_UPDATED, this.getZoomLevel()); - this.rotate(this.prop.position); - } + this.dynamics.zoom.setValue(level); } /** - * @summary Increases the zoom level by 1 + * @summary Increases the zoom level + * @param {number} [step=1] */ - zoomIn() { - this.zoom(this.prop.zoomLvl + this.config.zoomButtonIncrement); + zoomIn(step = 1) { + this.dynamics.zoom.step(step); } /** - * @summary Decreases the zoom level by 1 + * @summary Decreases the zoom level + * @param {number} [step=1] */ - zoomOut() { - this.zoom(this.prop.zoomLvl - this.config.zoomButtonIncrement); + zoomOut(step = 1) { + this.dynamics.zoom.step(-step); } /** @@ -903,7 +917,7 @@ export class Viewer extends EventEmitter { /** * @summary Stops all current animations - * @private + * @package */ __stopAll() { this.stopAutorotate(); @@ -912,4 +926,13 @@ export class Viewer extends EventEmitter { this.trigger(EVENTS.STOP_ALL); } + /** + * @summary Recomputes dynamics speeds + * @private + */ + __updateSpeeds() { + this.dynamics.zoom.setSpeed(this.config.zoomSpeed * 50); + this.dynamics.position.setSpeed(THREE.Math.degToRad(this.config.moveSpeed * 50)); + } + } diff --git a/src/ViewerCompat.js b/src/ViewerCompat.js index c580441b5..536d069d0 100644 --- a/src/ViewerCompat.js +++ b/src/ViewerCompat.js @@ -1,304 +1,7 @@ -import * as THREE from 'three'; -import { DEFAULTS, utils, Viewer } from 'photo-sphere-viewer'; -import GyroscopePlugin from 'photo-sphere-viewer/dist/plugins/gyroscope'; -import StereoPlugin from 'photo-sphere-viewer/dist/plugins/stereo'; -import MarkersPlugin from 'photo-sphere-viewer/dist/plugins/markers'; -import VisibleRangePlugin from 'photo-sphere-viewer/dist/plugins/visible-range'; +export default class ViewerCompat { -/** - * @private - */ -function snakeCaseToCamelCase(options) { - if (typeof options === 'object') { - utils.each(options, (value, key) => { - if (typeof key === 'string' && key.indexOf('_') !== -1) { - const camelKey = key.replace(/(_\w)/g, matches => matches[1].toUpperCase()); - options[camelKey] = snakeCaseToCamelCase(value); - delete options[key]; - } - }); - } - - return options; -} - -/** - * @private - */ -const RENAMED_OPTIONS = { - animSpeed : 'autorotateSpeed', - animLat : 'autorotateLat', - usexmpdata : 'useXmpData', - mousemoveHover : 'captureCursor', - zoomSpeed : 'zoomButtonIncrement', - mousewheelFactor: 'mousewheelSpeed', -}; - -/** - * @summary Compatibility wrapper for version 3 - * @memberOf PSV - * @deprecated - */ -export default class ViewerCompat extends Viewer { - - /** - * @param {PSV.Options} options - * @fires PSV.ready - * @throws {PSV.PSVError} when the configuration is incorrect - */ - constructor(options) { - snakeCaseToCamelCase(options); - - utils.each(RENAMED_OPTIONS, (newName, oldName) => { - if (oldName in options) { - options[newName] = options[oldName]; - delete options[oldName]; - } - }); - - if ('defaultFov' in options) { - const minFov = options.minFov !== undefined ? options.minFov : DEFAULTS.minFov; - const maxFov = options.maxFov !== undefined ? options.maxFov : DEFAULTS.maxFov; - const defaultFov = utils.bound(options.defaultFov, minFov, maxFov); - options.defaultZoomLvl = (defaultFov - minFov) / (maxFov - minFov) * 100; - delete options.defaultFov; - } - - if (!('timeAnim' in options)) { - options.autorotateDelay = 2000; - } - else if (options.timeAnim === false) { - options.autorotateDelay = null; - } - else if (typeof options.timeAnim === 'number') { - options.autorotateDelay = options.timeAnim; - } - delete options.timeAnim; - - delete options.transition; - - if ('panoramaRoll' in options) { - options.sphereCorrection = options.sphereCorrection || {}; - options.sphereCorrection.roll = options.panoramaRoll; - delete options.panoramaRoll; - } - - if (typeof options.navbar === 'string') { - options.navbar = options.navbar.split(' '); - } - - if (Array.isArray(options.navbar)) { - const markersIdx = options.navbar.indexOf('markers'); - if (markersIdx !== -1) { - options.navbar.splice(markersIdx, 1, 'markersList'); - } - } - - const clickEventOnMarker = options.clickEventOnMarker; - delete options.clickEventOnMarker; - - const markers = options.markers; - delete options.markers; - - const longitudeRange = options.longitudeRange; - delete options.longitudeRange; - - const latitudeRange = options.latitudeRange; - delete options.latitudeRange; - - options.plugins = []; - if (GyroscopePlugin) { - options.plugins.push(GyroscopePlugin); - } - if (StereoPlugin) { - options.plugins.push(StereoPlugin); - } - if (MarkersPlugin) { - options.plugins.push([MarkersPlugin, { clickEventOnMarker, markers }]); - } - if (VisibleRangePlugin) { - options.plugins.push([VisibleRangePlugin, { longitudeRange, latitudeRange }]); - } - - super(options); - - this.gyroscope = this.getPlugin(GyroscopePlugin); - this.stereo = this.getPlugin(StereoPlugin); - this.markers = this.getPlugin(MarkersPlugin); - } - - // GENERAL - - render() { - this.renderer.render(); - } - - setPanorama(panorama, options = {}, transition = false) { - snakeCaseToCamelCase(options); - options.transition = transition; - return super.setPanorama(panorama, options); - } - - preloadPanorama(panorama) { - return this.textureLoader.preloadPanorama(panorama); - } - - clearPanoramaCache(panorama) { - if (panorama) { - THREE.Cache.remove(panorama); - } - else { - THREE.Cache.clear(); - } - } - - // GYROSCOPE / STEREO - - isGyroscopeEnabled() { - return this.gyroscope && this.gyroscope.isEnabled(); - } - - startGyroscopeControl() { - return this.gyroscope && this.gyroscope.start(); - } - - stopGyroscopeControl() { - this.gyroscope && this.gyroscope.stop(); - } - - toggleGyroscopeControl() { - this.gyroscope && this.gyroscope.toggle(); - } - - isStereoEnabled() { - return this.stereo && this.stereo.isEnabled(); - } - - startStereoView() { - return this.stereo && this.stereo.start(); - } - - stopStereoView() { - this.stereo && this.stereo.stop(); - } - - toggleStereoView() { - this.stereo && this.stereo.toggle(); - } - - // MARKERS - - addMarker(marker, render) { - return this.markers && this.markers.addMarker(snakeCaseToCamelCase(marker), render); - } - - getMarker(markerId) { - return this.markers && this.markers.getMarker(markerId); - } - - updateMarker(marker, render) { - return this.markers && this.markers.updateMarker(snakeCaseToCamelCase(marker), render); - } - - removeMarker(marker, render) { - this.markers && this.markers.removeMarker(marker, render); - } - - gotoMarker(markerOrId, duration) { - this.markers && this.markers.gotoMarker(markerOrId, duration); - } - - hideMarker(markerId) { - this.markers && this.markers.hideMarker(markerId); - } - - showMarker(markerId) { - this.markers && this.markers.showMarker(markerId); - } - - clearMarkers(render) { - this.markers && this.markers.clearMarkers(render); - } - - getCurrentMarker() { - return this.markers && this.markers.getCurrentMarker(); - } - - // NAVBAR - - showNavbar() { - this.navbar.show(); - } - - hideNavbar() { - this.navbar.hide(); - } - - toggleNavbar() { - this.navbar.toggle(); - } - - getNavbarButton(id, silent) { - return this.navbar.getButton(id, silent); - } - - setCaption(html) { - return this.navbar.setCaption(html); - } - - // NOTIFICATION - - showNotification(config) { - this.notification.show(config); - } - - hideNotification() { - this.notification.hide(); - } - - isNotificationVisible() { - return this.notification.isVisible(); - } - - // OVERLAY - - showOverlay(config) { - this.overlay.show(config); - } - - hideOverlay() { - this.overlay.hide(); - } - - isOverlayVisible() { - return this.overlay.isVisible(); - } - - // PANEL - - showPanel(config) { - this.panel.show(config); - } - - hidePanel() { - this.panel.hide(); - } - - // TOOLTIP - - showTooltip(config) { - this.prop.mainTooltip = this.tooltip.create(config); - } - - hideTooltip() { - if (this.prop.mainTooltip) { - this.prop.mainTooltip.hide(); - this.prop.mainTooltip = null; - } - } - - isTooltipVisible() { - return !!this.prop.mainTooltip; + constructor() { + throw new Error('PhotoSphereViewer#ViewerCompat has been removed, please migrate to v4 Viewer.'); } } diff --git a/src/adapters/AbstractAdapter.js b/src/adapters/AbstractAdapter.js new file mode 100644 index 000000000..0f7dc5985 --- /dev/null +++ b/src/adapters/AbstractAdapter.js @@ -0,0 +1,90 @@ +import { PSVError } from '../PSVError'; + +/** + * @namespace PSV.adapters + */ + +/** + * @summary Base adapters class + * @memberof PSV.adapters + * @abstract + */ +export class AbstractAdapter { + + /** + * @summary Unique identifier of the adapter + * @member {string} + * @readonly + * @static + */ + static id = null; + + /** + * @summary Indicates if the adapter supports transitions between panoramas + * @member {boolean} + * @readonly + * @static + */ + static supportsTransition = false; + + /** + * @param {PSV.Viewer} psv + */ + constructor(psv) { + /** + * @summary Reference to main controller + * @type {PSV.Viewer} + * @readonly + */ + this.psv = psv; + } + + /** + * @summary Destroys the adapter + */ + destroy() { + delete this.psv; + } + + /** + * @abstract + * @summary Loads the panorama texture(s) + * @param {*} panorama + * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @returns {Promise.} + */ + loadTexture(panorama, newPanoData) { // eslint-disable-line no-unused-vars + throw new PSVError('loadTexture not implemented'); + } + + /** + * @abstract + * @summary Creates the cube mesh + * @param {number} [scale=1] + * @returns {external:THREE.Mesh} + */ + createMesh(scale = 1) { // eslint-disable-line no-unused-vars + throw new PSVError('createMesh not implemented'); + } + + /** + * @abstract + * @summary Applies the texture to the mesh + * @param {external:THREE.Mesh} mesh + * @param {PSV.TextureData} textureData + */ + setTexture(mesh, textureData) { // eslint-disable-line no-unused-vars + throw new PSVError('setTexture not implemented'); + } + + /** + * @abstract + * @summary Changes the opacity of the mesh + * @param {external:THREE.Mesh} mesh + * @param {number} opacity + */ + setTextureOpacity(mesh, opacity) { // eslint-disable-line no-unused-vars + throw new PSVError('setTextureOpacity not implemented'); + } + +} diff --git a/src/adapters/cubemap/index.js b/src/adapters/cubemap/index.js new file mode 100644 index 000000000..e09cde046 --- /dev/null +++ b/src/adapters/cubemap/index.js @@ -0,0 +1,155 @@ +import * as THREE from 'three'; +import { AbstractAdapter, CONSTANTS, PSVError, SYSTEM, utils } from '../..'; + +/** + * @typedef {Object} PSV.adapters.CubemapAdapter.Cubemap + * @summary Object defining a cubemap + * @property {string} top + * @property {string} right + * @property {string} bottom + * @property {string} left + * @property {string} front + * @property {string} back + */ + +const CUBE_VERTICES = 8; +const CUBE_MAP = [0, 2, 4, 5, 3, 1]; +const CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front']; + +/** + * @summary Adapter for cubemaps + * @memberof PSV.adapters + */ +export class CubemapAdapter extends AbstractAdapter { + + static id = 'cubemap'; + static supportsTransition = true; + + /** + * @override + * @param {string[] | PSV.adapters.CubemapAdapter.Cubemap} panorama + * @returns {Promise.} + */ + loadTexture(panorama) { + const cleanPanorama = []; + + if (Array.isArray(panorama)) { + if (panorama.length !== 6) { + return Promise.reject(new PSVError('Must provide exactly 6 image paths when using cubemap.')); + } + + // reorder images + for (let i = 0; i < 6; i++) { + cleanPanorama[i] = panorama[CUBE_MAP[i]]; + } + } + else if (typeof panorama === 'object') { + if (!CUBE_HASHMAP.every(side => !!panorama[side])) { + return Promise.reject(new PSVError('Must provide exactly left, front, right, back, top, bottom when using cubemap.')); + } + + // transform into array + CUBE_HASHMAP.forEach((side, i) => { + cleanPanorama[i] = panorama[side]; + }); + } + else { + return Promise.reject(new PSVError('Invalid cubemap panorama, are you using the right adapter?')); + } + + if (this.psv.config.fisheye) { + utils.logWarn('fisheye effect with cubemap texture can generate distorsion'); + } + + const promises = []; + const progress = [0, 0, 0, 0, 0, 0]; + + for (let i = 0; i < 6; i++) { + promises.push( + this.psv.textureLoader.loadImage(cleanPanorama[i], (p) => { + progress[i] = p; + this.psv.loader.setProgress(utils.sum(progress) / 6); + }) + .then(img => this.__createCubemapTexture(img)) + ); + } + + return Promise.all(promises) + .then(texture => ({ texture })); + } + + /** + * @summary Creates the final texture from image + * @param {HTMLImageElement} img + * @returns {external:THREE.Texture} + * @private + */ + __createCubemapTexture(img) { + let finalImage; + + // resize image + if (img.width > SYSTEM.maxTextureWidth) { + const buffer = document.createElement('canvas'); + const ratio = SYSTEM.getMaxCanvasWidth() / img.width; + + buffer.width = img.width * ratio; + buffer.height = img.height * ratio; + + const ctx = buffer.getContext('2d'); + ctx.drawImage(img, 0, 0, buffer.width, buffer.height); + + finalImage = buffer; + } + else { + finalImage = img; + } + + return utils.createTexture(finalImage); + } + + /** + * @override + */ + createMesh(scale = 1) { + const cubeSize = CONSTANTS.SPHERE_RADIUS * 2 * scale; + const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_VERTICES, CUBE_VERTICES, CUBE_VERTICES); + + const materials = []; + for (let i = 0; i < 6; i++) { + materials.push(new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + })); + } + + const mesh = new THREE.Mesh(geometry, materials); + mesh.scale.set(1, 1, -1); + + return mesh; + } + + /** + * @override + */ + setTexture(mesh, textureData) { + const { texture } = textureData; + + for (let i = 0; i < 6; i++) { + if (mesh.material[i].map) { + mesh.material[i].map.dispose(); + } + + mesh.material[i].map = texture[i]; + } + } + + /** + * @override + */ + setTextureOpacity(mesh, opacity) { + for (let i = 0; i < 6; i++) { + mesh.material[i].opacity = opacity; + mesh.material[i].transparent = opacity < 1; + } + } + +} diff --git a/src/adapters/equirectangular-tiles/Queue.js b/src/adapters/equirectangular-tiles/Queue.js new file mode 100644 index 000000000..ee224bd9c --- /dev/null +++ b/src/adapters/equirectangular-tiles/Queue.js @@ -0,0 +1,67 @@ +import { Task } from './Task'; + +/** + * @summary Loading queue + * @memberOf PSV.adapters.EquirectangularTilesAdapter + * @package + */ +export class Queue { + + /** + * @param {int} concurency + */ + constructor(concurency) { + this.concurency = concurency; + this.runningTasks = {}; + this.tasks = {}; + } + + enqueue(task) { + this.tasks[task.id] = task; + } + + clear() { + Object.values(this.tasks).forEach(task => task.cancel()); + this.tasks = {}; + this.runningTasks = {}; + } + + setPriority(taskId, priority) { + if (this.tasks[taskId]) { + this.tasks[taskId].priority = priority; + } + } + + setAllPriorities(priority) { + Object.values(this.tasks).forEach((task) => { + task.priority = priority; + }); + } + + start() { + if (Object.keys(this.runningTasks).length >= this.concurency) { + return; + } + + const nextTask = Object.values(this.tasks) + .filter(task => task.status === Task.STATUS.PENDING && task.priority > 0) + .sort((a, b) => a.priority - b.priority) + .pop(); + + if (nextTask) { + this.runningTasks[nextTask.id] = true; + + nextTask.start() + .then(() => { + if (!nextTask.isCancelled()) { + delete this.tasks[nextTask.id]; + delete this.runningTasks[nextTask.id]; + this.start(); + } + }); + + this.start(); // start tasks until max concurrency is reached + } + } + +} diff --git a/src/adapters/equirectangular-tiles/Task.js b/src/adapters/equirectangular-tiles/Task.js new file mode 100644 index 000000000..715b4b66a --- /dev/null +++ b/src/adapters/equirectangular-tiles/Task.js @@ -0,0 +1,46 @@ +/** + * @summary Loading task + * @memberOf PSV.adapters.EquirectangularTilesAdapter + * @package + */ +export class Task { + + static STATUS = { + PENDING : 0, + RUNNING : 1, + CANCELLED: 2, + DONE : 3, + ERROR : 4, + }; + + /** + * @param {string} id + * @param {number} priority + * @param {function(Task): Promise} fn + */ + constructor(id, priority, fn) { + this.id = id; + this.priority = priority; + this.fn = fn; + this.status = Task.STATUS.PENDING; + } + + start() { + this.status = Task.STATUS.RUNNING; + return this.fn(this) + .then(() => { + this.status = Task.STATUS.DONE; + }, () => { + this.status = Task.STATUS.ERROR; + }); + } + + cancel() { + this.status = Task.STATUS.CANCELLED; + } + + isCancelled() { + return this.status === Task.STATUS.CANCELLED; + } + +} diff --git a/src/adapters/equirectangular-tiles/index.js b/src/adapters/equirectangular-tiles/index.js new file mode 100644 index 000000000..eacab3447 --- /dev/null +++ b/src/adapters/equirectangular-tiles/index.js @@ -0,0 +1,574 @@ +import * as THREE from 'three'; +import { AbstractAdapter, CONSTANTS, PSVError, SYSTEM, utils } from '../..'; +import { Queue } from './Queue'; +import { Task } from './Task'; + +/** + * @callback TileUrl + * @summary Function called to build a tile url + * @memberOf PSV.adapters.EquirectangularTilesAdapter + * @param {int} col + * @param {int} row + * @returns {string} + */ + +/** + * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Panorama + * @summary Configuration of a tiled panorama + * @property {string} [baseUrl] - low resolution panorama loaded before tiles + * @property {int} width - complete panorama width (height is always width/2) + * @property {int} cols - number of vertical tiles + * @property {int} rows - number of horizontal tiles + * @property {PSV.adapters.EquirectangularTilesAdapter.TileUrl} tileUrl - function to build a tile url + */ + +/** + * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Options + * @property {boolean} [showErrorTile=true] - shows a warning sign on tiles that cannot be loaded + * @property {boolean} [baseBlur=true] - applies a blur to the low resolution panorama + */ + +/** + * @typedef {Object} PSV.adapters.EquirectangularTilesAdapter.Tile + * @private + * @property {int} col + * @property {int} row + * @property {int} angle + */ + +const SPHERE_SEGMENTS = 64; +const NB_VERTICES = 3 * (SPHERE_SEGMENTS * 2 + (SPHERE_SEGMENTS / 2 - 2) * SPHERE_SEGMENTS * 2); +const NB_GROUPS = SPHERE_SEGMENTS * 2 + (SPHERE_SEGMENTS / 2 - 2) * SPHERE_SEGMENTS; +const QUEUE_CONCURENCY = 4; + +function tileId(tile) { + return `${tile.col}x${tile.row}`; +} + +function powerOfTwo(x) { + return (Math.log(x) / Math.log(2)) % 1 === 0; +} + + +/** + * @summary Adapter for tiled panoramas + * @memberof PSV.adapters + */ +export class EquirectangularTilesAdapter extends AbstractAdapter { + + static id = 'equirectangular-tiles'; + static supportsTransition = false; + + /** + * @param {PSV.Viewer} psv + * @param {PSV.adapters.EquirectangularTilesAdapter.Options} options + */ + constructor(psv, options) { + super(psv); + + /** + * @member {PSV.adapters.EquirectangularTilesAdapter.Options} + * @private + */ + this.config = { + showErrorTile: true, + baseBlur : true, + ...options, + }; + + /** + * @member {external:THREE.MeshBasicMaterial[]} + * @private + */ + this.materials = []; + + /** + * @member {PSV.adapters.EquirectangularTilesAdapter.Queue} + * @private + */ + this.queue = new Queue(QUEUE_CONCURENCY); + + /** + * @type {Object} + * @property {int} colSize - size in pixels of a column + * @property {int} rowSize - size in pixels of a row + * @property {int} facesByCol - number of mesh faces by column + * @property {int} facesByRow - number of mesh faces by row + * @property {Record} tiles - loaded tiles + * @property {external:THREE.SphereGeometry} geom + * @property {*} originalUvs + * @property {external:THREE.MeshBasicMaterial} errorMaterial + * @private + */ + this.prop = { + colSize : 0, + rowSize : 0, + facesByCol : 0, + facesByRow : 0, + tiles : {}, + geom : null, + originalUvs : null, + errorMaterial: null, + }; + + /** + * @member {external:THREE.ImageLoader} + * @private + */ + this.loader = new THREE.ImageLoader(); + if (this.psv.config.withCredentials) { + this.loader.setWithCredentials(true); + } + if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'object') { + this.loader.setRequestHeader(this.psv.config.requestHeaders); + } + + this.psv.on(CONSTANTS.EVENTS.POSITION_UPDATED, this); + this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this); + } + + destroy() { + this.psv.off(CONSTANTS.EVENTS.POSITION_UPDATED, this); + this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this); + + this.__cleanup(); + + this.prop.errorMaterial?.map?.dispose(); + this.prop.errorMaterial?.dispose(); + + delete this.queue; + delete this.loader; + delete this.prop.geom; + delete this.prop.originalUvs; + delete this.prop.errorMaterial; + + super.destroy(); + } + + handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + case CONSTANTS.EVENTS.POSITION_UPDATED: + case CONSTANTS.EVENTS.ZOOM_UPDATED: + this.__refresh(); + break; + } + /* eslint-enable */ + } + + /** + * @summary Clears loading queue, dispose all materials + * @private + */ + __cleanup() { + this.queue.clear(); + this.prop.tiles = {}; + + this.materials.forEach((mat) => { + mat?.map?.dispose(); + mat?.dispose(); + }); + this.materials.length = 0; + } + + /** + * @override + * @param {PSV.adapters.EquirectangularTilesAdapter.Panorama} panorama + * @returns {Promise.} + */ + loadTexture(panorama) { + if (typeof panorama !== 'object' || !panorama.width || !panorama.cols || !panorama.rows || !panorama.tileUrl) { + return Promise.reject(new PSVError('Invalid panorama configuration, are you using the right adapter?')); + } + if (panorama.cols > SPHERE_SEGMENTS) { + return Promise.reject(new PSVError(`Panorama cols must not be greater than ${SPHERE_SEGMENTS}.`)); + } + if (panorama.rows > SPHERE_SEGMENTS / 2) { + return Promise.reject(new PSVError(`Panorama rows must not be greater than ${SPHERE_SEGMENTS / 2}.`)); + } + if (!powerOfTwo(panorama.cols) || !powerOfTwo(panorama.rows)) { + return Promise.reject(new PSVError('Panorama cols and rows must be powers of 2.')); + } + + panorama.height = panorama.width / 2; + + this.prop.colSize = panorama.width / panorama.cols; + this.prop.rowSize = panorama.height / panorama.rows; + this.prop.facesByCol = SPHERE_SEGMENTS / panorama.cols; + this.prop.facesByRow = SPHERE_SEGMENTS / 2 / panorama.rows; + + this.__cleanup(); + + if (this.prop.geom) { + this.prop.geom.setAttribute('uv', this.prop.originalUvs.clone()); + } + + const panoData = { + fullWidth : panorama.width, + fullHeight : panorama.height, + croppedWidth : panorama.width, + croppedHeight: panorama.height, + croppedX : 0, + croppedY : 0, + }; + + if (panorama.baseUrl) { + return this.psv.textureLoader.loadImage(panorama.baseUrl, p => this.psv.loader.setProgress(p)) + .then((img) => { + return { + texture : this.__createBaseTexture(img), + panoData: panoData, + }; + }); + } + else { + return Promise.resolve({ + texture : null, + panoData: panoData, + }); + } + } + + /** + * @override + */ + createMesh(scale = 1) { + const geometry = new THREE.SphereGeometry(CONSTANTS.SPHERE_RADIUS * scale, SPHERE_SEGMENTS, SPHERE_SEGMENTS / 2, -Math.PI / 2) + .toNonIndexed(); + + let i = 0; + let k = 0; + + // first row + for (; i < SPHERE_SEGMENTS * 3; i += 3) { + geometry.addGroup(i, 3, k++); + } + + // second to before last rows + for (; i < NB_VERTICES - SPHERE_SEGMENTS * 3; i += 6) { + geometry.addGroup(i, 6, k++); + } + + // last row + for (; i < NB_VERTICES; i += 3) { + geometry.addGroup(i, 3, k++); + } + + this.prop.geom = geometry; + this.prop.originalUvs = geometry.getAttribute('uv').clone(); + + const mesh = new THREE.Mesh(geometry, this.materials); + mesh.scale.set(-1, 1, 1); + + return mesh; + } + + /** + * @summary Applies the base texture and starts the loading of tiles + * @override + */ + setTexture(mesh, textureData) { + if (textureData.texture) { + const material = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + map : textureData.texture, + }); + + for (let i = 0; i < NB_GROUPS; i++) { + this.materials.push(material); + } + } + + setTimeout(() => this.__refresh()); + } + + /** + * @summary Compute visible tiles and load them + * @private + */ + __refresh() { + const viewerSize = this.psv.prop.size; + const panorama = this.psv.config.panorama; + + const tilesToLoad = []; + const tilePosition = new THREE.Vector3(); + + for (let col = 0; col <= panorama.cols; col++) { + for (let row = 0; row <= panorama.rows; row++) { + // TODO prefilter with less complex math if possible + const tileTexturePosition = { x: col * this.prop.colSize, y: row * this.prop.rowSize }; + this.psv.dataHelper.sphericalCoordsToVector3(this.psv.dataHelper.textureCoordsToSphericalCoords(tileTexturePosition), tilePosition); + + if (tilePosition.dot(this.psv.prop.direction) > 0) { + const tileViewerPosition = this.psv.dataHelper.vector3ToViewerCoords(tilePosition); + + if (tileViewerPosition.x >= 0 + && tileViewerPosition.x <= viewerSize.width + && tileViewerPosition.y >= 0 + && tileViewerPosition.y <= viewerSize.height) { + const angle = tilePosition.angleTo(this.psv.prop.direction); + + this.__getAdjacentTiles(col, row) + .forEach((tile) => { + const existingTile = tilesToLoad.find(c => c.row === tile.row && c.col === tile.col); + if (existingTile) { + existingTile.angle = Math.min(existingTile.angle, angle); + } + else { + tilesToLoad.push({ ...tile, angle }); + } + }); + } + } + } + } + + this.__loadTiles(tilesToLoad); + } + + /** + * @summary Get the 4 adjacent tiles + * @private + */ + __getAdjacentTiles(col, row) { + const panorama = this.psv.config.panorama; + + return [ + { col: col - 1, row: row - 1 }, + { col: col, row: row - 1 }, + { col: col, row: row }, // eslint-disable-line object-shorthand + { col: col - 1, row: row }, + ] + .map((tile) => { + // examples are for cols=16 and rows=8 + if (tile.row < 0) { + // wrap on top + tile.row = -tile.row - 1; // -1 => 0, -2 => 1 + tile.col += panorama.cols / 2; // change hemisphere + } + else if (tile.row >= panorama.rows) { + // wrap on bottom + tile.row = (panorama.rows - 1) - (tile.row - panorama.rows); // 8 => 7, 9 => 6 + tile.col += panorama.cols / 2; // change hemisphere + } + if (tile.col < 0) { + // wrap on left + tile.col += panorama.cols; // -1 => 15, -2 => 14 + } + else if (tile.col >= panorama.cols) { + // wrap on right + tile.col -= panorama.cols; // 16 => 0, 17 => 1 + } + + return tile; + }); + } + + /** + * @summary Loads tiles and change existing tiles priority + * @param {PSV.adapters.EquirectangularTilesAdapter.Tile[]} tiles + * @private + */ + __loadTiles(tiles) { + this.queue.setAllPriorities(0); + + tiles.forEach((tile) => { + const id = tileId(tile); + const priority = Math.PI / 2 - tile.angle; + + if (this.prop.tiles[id]) { + this.queue.setPriority(id, priority); + } + else { + this.prop.tiles[id] = true; + this.queue.enqueue(new Task(id, priority, task => this.__loadTile(tile, task))); + } + }); + + this.queue.start(); + } + + /** + * @summary Loads and draw a tile + * @param {PSV.adapters.EquirectangularTilesAdapter.Tile} tile + * @param {PSV.adapters.EquirectangularTilesAdapter.Task} task + * @return {Promise} + * @private + */ + __loadTile(tile, task) { + const panorama = this.psv.config.panorama; + const url = panorama.tileUrl(tile.col, tile.row); + + if (this.psv.config.requestHeaders && typeof this.psv.config.requestHeaders === 'function') { + this.loader.setRequestHeader(this.psv.config.requestHeaders(url)); + } + + return new Promise((resolve, reject) => this.loader.load(url, resolve, undefined, reject)) + .then((image) => { + if (!task.isCancelled()) { + const material = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + map : utils.createTexture(image), + }); + this.__swapMaterial(tile.col, tile.row, material); + this.psv.needsUpdate(); + } + }) + .catch(() => { + if (!task.isCancelled() && this.config.showErrorTile) { + const material = this.__getErrorMaterial(); + this.__swapMaterial(tile.col, tile.row, material); + this.psv.needsUpdate(); + } + }); + } + + /** + * @summary Applies a new texture to the faces + * @param {int} col + * @param {int} row + * @param {external:THREE.MeshBasicMaterial} material + * @private + */ + __swapMaterial(col, row, material) { + const uvs = this.prop.geom.getAttribute('uv'); + + for (let c = 0; c < this.prop.facesByCol; c++) { + for (let r = 0; r < this.prop.facesByRow; r++) { + // position of the face (two triangles of the same square) + const faceCol = col * this.prop.facesByCol + c; + const faceRow = row * this.prop.facesByRow + r; + const isFirstRow = faceRow === 0; + const isLastRow = faceRow === SPHERE_SEGMENTS / 2 - 1; + + // first vertex for this face (3 or 6 vertices in total) + let firstVertex; + if (isFirstRow) { + firstVertex = faceCol * 3; + } + else if (isLastRow) { + firstVertex = NB_VERTICES - SPHERE_SEGMENTS * 3 + faceCol * 3; + } + else { + firstVertex = 3 * (SPHERE_SEGMENTS + (faceRow - 1) * SPHERE_SEGMENTS * 2 + faceCol * 2); + } + + // swap material + const matIndex = this.prop.geom.groups.find(g => g.start === firstVertex).materialIndex; + this.materials[matIndex] = material; + + // define new uvs + const top = 1 - r / this.prop.facesByRow; + const bottom = 1 - (r + 1) / this.prop.facesByRow; + const left = c / this.prop.facesByCol; + const right = (c + 1) / this.prop.facesByCol; + + if (isFirstRow) { + uvs.setXY(firstVertex, (left + right) / 2, top); + uvs.setXY(firstVertex + 1, left, bottom); + uvs.setXY(firstVertex + 2, right, bottom); + } + else if (isLastRow) { + uvs.setXY(firstVertex, right, top); + uvs.setXY(firstVertex + 1, left, top); + uvs.setXY(firstVertex + 2, (left + right) / 2, bottom); + } + else { + uvs.setXY(firstVertex, right, top); + uvs.setXY(firstVertex + 1, left, top); + uvs.setXY(firstVertex + 2, right, bottom); + uvs.setXY(firstVertex + 3, left, top); + uvs.setXY(firstVertex + 4, left, bottom); + uvs.setXY(firstVertex + 5, right, bottom); + } + } + } + + uvs.needsUpdate = true; + } + + /** + * @summary Generates an material for errored tiles + * @return {external:THREE.MeshBasicMaterial} + * @private + */ + __getErrorMaterial() { + if (!this.prop.errorMaterial) { + const canvas = document.createElement('canvas'); + canvas.width = this.prop.colSize; + canvas.height = this.prop.rowSize; + + const ctx = canvas.getContext('2d'); + + ctx.fillStyle = '#333'; + ctx.fillRect(0, 0, canvas.width, canvas.height); + ctx.font = `${canvas.width / 5}px serif`; + ctx.fillStyle = '#a22'; + ctx.textAlign = 'center'; + ctx.textBaseline = 'middle'; + ctx.fillText('⚠', canvas.width / 2, canvas.height / 2); + + const texture = new THREE.CanvasTexture(canvas); + this.prop.errorMaterial = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + map : texture, + }); + } + + return this.prop.errorMaterial; + } + + /** + * @summary Create the texture for the base image + * @param {HTMLImageElement} img + * @return {external:THREE.Texture} + * @private + */ + __createBaseTexture(img) { + if (img.width !== img.height * 2) { + utils.logWarn('Invalid base image, the width should be twice the height'); + } + + if (this.config.baseBlur || img.width > SYSTEM.maxTextureWidth) { + const ratio = Math.min(1, SYSTEM.getMaxCanvasWidth() / img.width); + + const buffer = document.createElement('canvas'); + buffer.width = img.width * ratio; + buffer.height = buffer.width / 2; + + const ctx = buffer.getContext('2d'); + if (this.config.baseBlur) { + ctx.filter = 'blur(1px)'; + } + ctx.drawImage(img, 0, 0, buffer.width, buffer.height); + + return utils.createTexture(buffer); + } + + return utils.createTexture(img); + } + +} + +/* eslint-disable */ + +/** + * UNUSED : Returns the apparent size of a segment on the screen + * @private + */ +// function getSegmentSize() { +// const p1 = this.psv.prop.direction.clone(); +// const p2 = this.psv.prop.direction.clone(); +// +// const angle = Math.PI * 2 / SPHERE_SEGMENTS / 2; +// const dst = Math.atan(angle) * CONSTANTS.SPHERE_RADIUS; +// const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.psv.prop.direction).normalize(); +// +// p1.add(horizontalAxis.clone().multiplyScalar(dst)); +// p2.add(horizontalAxis.clone().multiplyScalar(-dst)); +// +// const p1a = this.psv.dataHelper.vector3ToViewerCoords(p1); +// const p2a = this.psv.dataHelper.vector3ToViewerCoords(p2); +// +// const segmentSize = p2a.x - p1a.x; +// } diff --git a/src/adapters/equirectangular/index.js b/src/adapters/equirectangular/index.js new file mode 100644 index 000000000..7c336bf68 --- /dev/null +++ b/src/adapters/equirectangular/index.js @@ -0,0 +1,204 @@ +import * as THREE from 'three'; +import { SPHERE_RADIUS } from '../../data/constants'; +import { SYSTEM } from '../../data/system'; +import { PSVError } from '../../PSVError'; +import { createTexture, firstNonNull, getXMPValue, logWarn } from '../../utils'; +import { AbstractAdapter } from '../AbstractAdapter'; + +const SPHERE_SEGMENTS = 64; + +/** + * @summary Adapter for equirectangular panoramas + * @memberof PSV.adapters + */ +export class EquirectangularAdapter extends AbstractAdapter { + + static id = 'equirectangular'; + static supportsTransition = true; + + /** + * @override + * @param {string} panorama + * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] + * @returns {Promise.} + */ + loadTexture(panorama, newPanoData) { + 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'); + } + return Promise.reject(new PSVError('Invalid panorama url, are you using the right adapter?')); + } + + return ( + !this.psv.config.useXmpData + ? this.psv.textureLoader.loadImage(panorama, p => this.psv.loader.setProgress(p)) + .then(img => ({ img: img, xmpPanoData: null })) + : this.__loadXMP(panorama, p => this.psv.loader.setProgress(p)) + .then(xmpPanoData => this.psv.textureLoader.loadImage(panorama).then(img => ({ img, xmpPanoData }))) + ) + .then(({ img, xmpPanoData }) => { + if (typeof newPanoData === 'function') { + newPanoData = newPanoData(img); + } + + const panoData = { + fullWidth : firstNonNull(newPanoData?.fullWidth, xmpPanoData?.fullWidth, img.width), + fullHeight : firstNonNull(newPanoData?.fullHeight, xmpPanoData?.fullHeight, img.height), + croppedWidth : firstNonNull(newPanoData?.croppedWidth, xmpPanoData?.croppedWidth, img.width), + croppedHeight: firstNonNull(newPanoData?.croppedHeight, xmpPanoData?.croppedHeight, img.height), + croppedX : firstNonNull(newPanoData?.croppedX, xmpPanoData?.croppedX, 0), + croppedY : firstNonNull(newPanoData?.croppedY, xmpPanoData?.croppedY, 0), + poseHeading : firstNonNull(newPanoData?.poseHeading, xmpPanoData?.poseHeading), + posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch), + poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll), + }; + + if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) { + logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image. + panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`); + } + if (panoData.fullWidth !== panoData.fullHeight * 2) { + logWarn('Invalid panoData, fullWidth should be twice fullHeight'); + } + + const texture = this.__createEquirectangularTexture(img, panoData); + + return { texture, panoData }; + }); + } + + /** + * @summary Loads the XMP data of an image + * @param {string} panorama + * @param {function(number)} [onProgress] + * @returns {Promise} + * @throws {PSV.PSVError} when the image cannot be loaded + * @private + */ + __loadXMP(panorama, onProgress) { + return this.psv.textureLoader.loadFile(panorama, onProgress) + .then(blob => this.__loadBlobAsString(blob)) + .then((binary) => { + const a = binary.indexOf(''); + const data = binary.substring(a, b); + + if (a !== -1 && b !== -1 && data.indexOf('GPano:') !== -1) { + return { + fullWidth : getXMPValue(data, 'FullPanoWidthPixels'), + fullHeight : getXMPValue(data, 'FullPanoHeightPixels'), + croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'), + croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'), + croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'), + croppedY : getXMPValue(data, 'CroppedAreaTopPixels'), + poseHeading : getXMPValue(data, 'PoseHeadingDegrees'), + posePitch : getXMPValue(data, 'PosePitchDegrees'), + poseRoll : getXMPValue(data, 'PoseRollDegrees'), + }; + } + + return null; + }); + } + + /** + * @summmary read a Blob as string + * @param {Blob} blob + * @returns {Promise} + * @private + */ + __loadBlobAsString(blob) { + return new Promise((resolve, reject) => { + const reader = new FileReader(); + reader.onload = () => resolve(reader.result); + reader.onerror = reject; + reader.readAsText(blob); + }); + } + + /** + * @summary Creates the final texture from image and panorama data + * @param {Image} img + * @param {PSV.PanoData} panoData + * @returns {external:THREE.Texture} + * @private + */ + __createEquirectangularTexture(img, panoData) { + let finalImage; + + // resize image / fill cropped parts with black + if (panoData.fullWidth > SYSTEM.maxTextureWidth + || panoData.croppedWidth !== panoData.fullWidth + || panoData.croppedHeight !== panoData.fullHeight + ) { + const resizedPanoData = { ...panoData }; + + const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth; + + if (ratio < 1) { + resizedPanoData.fullWidth *= ratio; + resizedPanoData.fullHeight *= ratio; + resizedPanoData.croppedWidth *= ratio; + resizedPanoData.croppedHeight *= ratio; + resizedPanoData.croppedX *= ratio; + resizedPanoData.croppedY *= ratio; + } + + const buffer = document.createElement('canvas'); + buffer.width = resizedPanoData.fullWidth; + buffer.height = resizedPanoData.fullHeight; + + const ctx = buffer.getContext('2d'); + ctx.drawImage(img, + resizedPanoData.croppedX, resizedPanoData.croppedY, + resizedPanoData.croppedWidth, resizedPanoData.croppedHeight); + + finalImage = buffer; + } + else { + finalImage = img; + } + + return createTexture(finalImage); + } + + /** + * @override + */ + createMesh(scale = 1) { + // The middle of the panorama is placed at longitude=0 + const geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, SPHERE_SEGMENTS, SPHERE_SEGMENTS / 2, -Math.PI / 2); + + const material = new THREE.MeshBasicMaterial({ + side: THREE.BackSide, + }); + + const mesh = new THREE.Mesh(geometry, material); + mesh.scale.set(-1, 1, 1); + + return mesh; + } + + /** + * @override + */ + setTexture(mesh, textureData) { + const { texture } = textureData; + + if (mesh.material.map) { + mesh.material.map.dispose(); + } + + mesh.material.map = texture; + } + + /** + * @override + */ + setTextureOpacity(mesh, opacity) { + mesh.material.opacity = opacity; + mesh.material.transparent = opacity < 1; + } + +} diff --git a/src/buttons/AbstractButton.js b/src/buttons/AbstractButton.js index 16318ccf9..b9b261a19 100644 --- a/src/buttons/AbstractButton.js +++ b/src/buttons/AbstractButton.js @@ -1,6 +1,7 @@ import { AbstractComponent } from '../components/AbstractComponent'; +import { KEY_CODES } from '../data/constants'; import { PSVError } from '../PSVError'; -import { isPlainObject, toggleClass } from '../utils'; +import { getEventKey, isPlainObject, toggleClass } from '../utils'; /** * @namespace PSV.buttons @@ -42,8 +43,9 @@ export class AbstractButton extends AbstractComponent { * @param {PSV.components.Navbar} navbar * @param {string} [className] - Additional CSS classes * @param {boolean} [collapsable=false] - `true` if the button can be moved to menu when the navbar is too small + * @param {boolean} [tabbable=true] - `true` if the button is accessible with Tab key */ - constructor(navbar, className = '', collapsable = false) { + constructor(navbar, className = '', collapsable = false, tabbable = true) { super(navbar, 'psv-button ' + className); /** @@ -74,12 +76,23 @@ export class AbstractButton extends AbstractComponent { this.container.title = this.psv.config.lang[this.prop.id]; } + if (tabbable) { + this.container.tabIndex = 0; + } + this.container.addEventListener('click', (e) => { if (this.prop.enabled) { this.onClick(); } e.stopPropagation(); }); + + this.container.addEventListener('keydown', (e) => { + if (getEventKey(e) === KEY_CODES.Enter && this.prop.enabled) { + this.onClick(); + e.stopPropagation(); + } + }); } /** diff --git a/src/buttons/AbstractMoveButton.js b/src/buttons/AbstractMoveButton.js new file mode 100644 index 000000000..3f6adfae5 --- /dev/null +++ b/src/buttons/AbstractMoveButton.js @@ -0,0 +1,125 @@ +import { KEY_CODES } from '../data/constants'; +import { SYSTEM } from '../data/system'; +import arrow from '../icons/arrow.svg'; +import { getEventKey } from '../utils'; +import { PressHandler } from '../utils/PressHandler'; +import { AbstractButton } from './AbstractButton'; + +export function getOrientedArrow(direction) { + let angle = 0; + switch (direction) { + // @formatter:off + case 'up': angle = 90; break; + case 'right': angle = 180; break; + case 'down': angle = -90; break; + default: angle = 0; break; + // @formatter:on + } + + return arrow.replace('rotate(0', `rotate(${angle}`); +} + +/** + * @summary Navigation bar move button class + * @extends PSV.buttons.AbstractButton + * @memberof PSV.buttons + */ +export class AbstractMoveButton extends AbstractButton { + + /** + * @param {PSV.components.Navbar} navbar + * @param {number} value + */ + constructor(navbar, value) { + super(navbar, 'psv-button--hover-scale psv-move-button'); + + this.container.title = this.psv.config.lang.move; + + /** + * @override + * @property {{longitude: boolean, latitude: boolean}} value + * @property {PressHandler} handler + */ + this.prop = { + ...this.prop, + value : value, + handler: new PressHandler(), + }; + + this.container.addEventListener('mousedown', this); + this.container.addEventListener('keydown', this); + this.container.addEventListener('keyup', this); + this.psv.container.addEventListener('mouseup', this); + this.psv.container.addEventListener('touchend', this); + } + + /** + * @override + */ + destroy() { + this.__onMouseUp(); + + this.psv.container.removeEventListener('mouseup', this); + this.psv.container.removeEventListener('touchend', this); + + super.destroy(); + } + + /** + * @summary Handles events + * @param {Event} e + * @private + */ + handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + // @formatter:off + case 'mousedown': this.__onMouseDown(); break; + case 'mouseup': this.__onMouseUp(); break; + case 'touchend': this.__onMouseUp(); break; + case 'keydown': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break; + case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break; + // @formatter:on + } + /* eslint-enable */ + } + + /** + * @override + */ + isSupported() { + return { initial: true, promise: SYSTEM.isTouchEnabled.then(enabled => !enabled) }; + } + + /** + * @override + */ + onClick() { + // nothing + } + + /** + * @private + */ + __onMouseDown() { + if (!this.prop.enabled) { + return; + } + + this.psv.__stopAll(); + this.psv.dynamics.position.roll(this.prop.value); + this.prop.handler.down(); + } + + /** + * @private + */ + __onMouseUp() { + if (!this.prop.enabled) { + return; + } + + this.prop.handler.up(() => this.psv.dynamics.position.stop()); + } + +} diff --git a/src/buttons/AbstractZoomButton.js b/src/buttons/AbstractZoomButton.js index 45c18c8d0..a4a26bdfe 100644 --- a/src/buttons/AbstractZoomButton.js +++ b/src/buttons/AbstractZoomButton.js @@ -1,5 +1,7 @@ -import { Animation } from '../Animation'; +import { KEY_CODES } from '../data/constants'; import { SYSTEM } from '../data/system'; +import { getEventKey } from '../utils'; +import { PressHandler } from '../utils/PressHandler'; import { AbstractButton } from './AbstractButton'; /** @@ -18,20 +20,18 @@ export class AbstractZoomButton extends AbstractButton { /** * @override - * @property {number} value - * @property {boolean} buttondown - * @property {*} longPressTimeout - * @property {PSV.Animation} longPressAnimation + * @property {boolean} value + * @property {PressHandler} handler */ this.prop = { ...this.prop, - value : value, - buttondown : false, - longPressTimeout : null, - longPressAnimation: null, + value : value, + handler: new PressHandler(), }; this.container.addEventListener('mousedown', this); + this.container.addEventListener('keydown', this); + this.container.addEventListener('keyup', this); this.psv.container.addEventListener('mouseup', this); this.psv.container.addEventListener('touchend', this); } @@ -60,6 +60,8 @@ export class AbstractZoomButton extends AbstractButton { case 'mousedown': this.__onMouseDown(); break; case 'mouseup': this.__onMouseUp(); break; case 'touchend': this.__onMouseUp(); break; + case 'keydown': getEventKey(e) === KEY_CODES.Enter && this.__onMouseDown(); break; + case 'keyup': getEventKey(e) === KEY_CODES.Enter && this.__onMouseUp(); break; // @formatter:on } /* eslint-enable */ @@ -80,8 +82,6 @@ export class AbstractZoomButton extends AbstractButton { } /** - * @summary Handles click events - * @description Zooms in and register long press timer * @private */ __onMouseDown() { @@ -89,56 +89,19 @@ export class AbstractZoomButton extends AbstractButton { return; } - this.prop.buttondown = true; - this.prop.longPressTimeout = setTimeout(() => this.__startLongPressInterval(), 100); + this.psv.dynamics.zoom.roll(this.prop.value); + this.prop.handler.down(); } /** - * @summary Continues zooming as long as the user presses the button - * @private - */ - __startLongPressInterval() { - if (!this.prop.buttondown) { - return; - } - - const end = this.prop.value < 0 ? 0 : 100; - - this.prop.longPressAnimation = new Animation({ - properties: { - zoom: { start: this.psv.prop.zoomLvl, end: end }, - }, - duration : 1500 * Math.abs(this.psv.prop.zoomLvl - end) / 100, - easing : 'linear', - onTick : (properties) => { - this.psv.zoom(properties.zoom); - }, - }) - .catch(() => {}); // ignore cancellation - } - - /** - * @summary Handles mouse up events * @private */ __onMouseUp() { - if (!this.prop.enabled || !this.prop.buttondown) { + if (!this.prop.enabled) { return; } - if (this.prop.longPressAnimation) { - this.prop.longPressAnimation.cancel(); - this.prop.longPressAnimation = null; - } - else { - this.psv.zoom(this.psv.prop.zoomLvl + this.prop.value * this.psv.config.zoomButtonIncrement); - } - - if (this.prop.longPressTimeout) { - clearTimeout(this.prop.longPressTimeout); - } - - this.prop.buttondown = false; + this.prop.handler.up(() => this.psv.dynamics.zoom.stop()); } } diff --git a/src/buttons/CustomButton.js b/src/buttons/CustomButton.js index 79152e513..c35cccc96 100644 --- a/src/buttons/CustomButton.js +++ b/src/buttons/CustomButton.js @@ -41,7 +41,7 @@ export class CustomButton extends AbstractButton { this.container.innerHTML = this.config.content; } - this.width = this.container.offsetWidth; + this.prop.width = this.container.offsetWidth; if (this.config.enabled === false) { this.disable(); diff --git a/src/buttons/MenuButton.js b/src/buttons/MenuButton.js index a6b2908f2..b70b8b565 100644 --- a/src/buttons/MenuButton.js +++ b/src/buttons/MenuButton.js @@ -32,7 +32,7 @@ export class MenuButton extends AbstractButton {

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

    ${buttons.map(button => ` -
  • +
  • ${button.container.innerHTML} ${button.container.title}
  • diff --git a/src/buttons/MoveDownButton.js b/src/buttons/MoveDownButton.js new file mode 100644 index 000000000..ac79b6fd2 --- /dev/null +++ b/src/buttons/MoveDownButton.js @@ -0,0 +1,20 @@ +import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton'; + +/** + * @summary Navigation bar move down button class + * @extends PSV.buttons.AbstractMoveButton + * @memberof PSV.buttons + */ +export class MoveDownButton extends AbstractMoveButton { + + static id = 'moveDown'; + static icon = getOrientedArrow('down'); + + /** + * @param {PSV.components.Navbar} navbar + */ + constructor(navbar) { + super(navbar, { latitude: true }); + } + +} diff --git a/src/buttons/MoveLeftButton.js b/src/buttons/MoveLeftButton.js new file mode 100644 index 000000000..e8352bef2 --- /dev/null +++ b/src/buttons/MoveLeftButton.js @@ -0,0 +1,20 @@ +import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton'; + +/** + * @summary Navigation bar move left button class + * @extends PSV.buttons.AbstractMoveButton + * @memberof PSV.buttons + */ +export class MoveLeftButton extends AbstractMoveButton { + + static id = 'moveLeft'; + static icon = getOrientedArrow('left'); + + /** + * @param {PSV.components.Navbar} navbar + */ + constructor(navbar) { + super(navbar, { longitude: true }); + } + +} diff --git a/src/buttons/MoveRightButton.js b/src/buttons/MoveRightButton.js new file mode 100644 index 000000000..34743d461 --- /dev/null +++ b/src/buttons/MoveRightButton.js @@ -0,0 +1,20 @@ +import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton'; + +/** + * @summary Navigation bar move right button class + * @extends PSV.buttons.AbstractMoveButton + * @memberof PSV.buttons + */ +export class MoveRightButton extends AbstractMoveButton { + + static id = 'moveRight'; + static icon = getOrientedArrow('right'); + + /** + * @param {PSV.components.Navbar} navbar + */ + constructor(navbar) { + super(navbar, { longitude: false }); + } + +} diff --git a/src/buttons/MoveUpButton.js b/src/buttons/MoveUpButton.js new file mode 100644 index 000000000..bdbf5c347 --- /dev/null +++ b/src/buttons/MoveUpButton.js @@ -0,0 +1,20 @@ +import { AbstractMoveButton, getOrientedArrow } from './AbstractMoveButton'; + +/** + * @summary Navigation bar move up button class + * @extends PSV.buttons.AbstractMoveButton + * @memberof PSV.buttons + */ +export class MoveUpButton extends AbstractMoveButton { + + static id = 'moveUp'; + static icon = getOrientedArrow('up'); + + /** + * @param {PSV.components.Navbar} navbar + */ + constructor(navbar) { + super(navbar, { latitude: false }); + } + +} diff --git a/src/buttons/ZoomInButton.js b/src/buttons/ZoomInButton.js index 53c9adc42..ca5a1bda9 100644 --- a/src/buttons/ZoomInButton.js +++ b/src/buttons/ZoomInButton.js @@ -15,7 +15,7 @@ export class ZoomInButton extends AbstractZoomButton { * @param {PSV.components.Navbar} navbar */ constructor(navbar) { - super(navbar, 1); + super(navbar, false); } } diff --git a/src/buttons/ZoomOutButton.js b/src/buttons/ZoomOutButton.js index 4942caac1..3d4393dfd 100644 --- a/src/buttons/ZoomOutButton.js +++ b/src/buttons/ZoomOutButton.js @@ -15,7 +15,7 @@ export class ZoomOutButton extends AbstractZoomButton { * @param {PSV.components.Navbar} navbar */ constructor(navbar) { - super(navbar, -1); + super(navbar, true); } } diff --git a/src/buttons/ZoomRangeButton.js b/src/buttons/ZoomRangeButton.js index a9fc36cd0..c6e69529f 100644 --- a/src/buttons/ZoomRangeButton.js +++ b/src/buttons/ZoomRangeButton.js @@ -16,7 +16,7 @@ export class ZoomRangeButton extends AbstractButton { * @param {PSV.components.Navbar} navbar */ constructor(navbar) { - super(navbar, 'psv-zoom-range'); + super(navbar, 'psv-zoom-range', false, false); /** * @override @@ -59,7 +59,7 @@ export class ZoomRangeButton extends AbstractButton { this.psv.on(EVENTS.ZOOM_UPDATED, this); if (this.psv.prop.ready) { - this.__moveZoomValue(this.psv.prop.zoomLvl); + this.__moveZoomValue(this.psv.getZoomLevel()); } else { this.psv.once(EVENTS.READY, this); @@ -103,7 +103,7 @@ export class ZoomRangeButton extends AbstractButton { case 'mouseup': this.__stopZoomChange(e); break; case 'touchend': this.__stopZoomChange(e); break; case EVENTS.ZOOM_UPDATED: this.__moveZoomValue(e.args[0]); break; - case EVENTS.READY: this.__moveZoomValue(this.psv.prop.zoomLvl); break; + case EVENTS.READY: this.__moveZoomValue(this.psv.getZoomLevel()); break; // @formatter:on } /* eslint-enable */ diff --git a/src/components/Navbar.js b/src/components/Navbar.js index 2fcd89b27..0ccc5441d 100644 --- a/src/components/Navbar.js +++ b/src/components/Navbar.js @@ -3,6 +3,10 @@ import { CustomButton } from '../buttons/CustomButton'; import { DownloadButton } from '../buttons/DownloadButton'; import { FullscreenButton } from '../buttons/FullscreenButton'; import { MenuButton } from '../buttons/MenuButton'; +import { MoveDownButton } from '../buttons/MoveDownButton'; +import { MoveLeftButton } from '../buttons/MoveLeftButton'; +import { MoveRightButton } from '../buttons/MoveRightButton'; +import { MoveUpButton } from '../buttons/MoveUpButton'; import { ZoomInButton } from '../buttons/ZoomInButton'; import { ZoomOutButton } from '../buttons/ZoomOutButton'; import { ZoomRangeButton } from '../buttons/ZoomRangeButton'; @@ -39,6 +43,10 @@ export function registerButton(button) { ZoomOutButton, DownloadButton, FullscreenButton, + MoveRightButton, + MoveLeftButton, + MoveUpButton, + MoveDownButton, ].forEach(registerButton); /** @@ -93,6 +101,12 @@ export class Navbar extends AbstractComponent { new ZoomRangeButton(this); new ZoomInButton(this); } + else if (button === 'move') { + new MoveLeftButton(this); + new MoveRightButton(this); + new MoveUpButton(this); + new MoveDownButton(this); + } else { throw new PSVError('Unknown button ' + button); } diff --git a/src/components/Notification.js b/src/components/Notification.js index fea669a13..a2fae1b20 100644 --- a/src/components/Notification.js +++ b/src/components/Notification.js @@ -65,7 +65,7 @@ export class Notification extends AbstractComponent { } if (typeof config === 'string') { - config = { content: config }; // eslint-disable-line no-param-reassign + config = { content: config }; } this.content.innerHTML = config.content; diff --git a/src/components/Overlay.js b/src/components/Overlay.js index 65c1f87ce..c6d5bd684 100644 --- a/src/components/Overlay.js +++ b/src/components/Overlay.js @@ -1,4 +1,5 @@ -import { EVENTS } from '../data/constants'; +import { EVENTS, KEY_CODES } from '../data/constants'; +import { getEventKey } from '../utils'; import { AbstractComponent } from './AbstractComponent'; import { PSVError } from '../PSVError'; @@ -56,12 +57,9 @@ export class Overlay extends AbstractComponent { this.subtext.className = 'psv-overlay-subtext'; this.container.appendChild(this.subtext); - this.container.addEventListener('mouseup', (e) => { - e.stopPropagation(); - if (this.prop.dissmisable) { - this.hide(); - } - }, true); + this.container.addEventListener('mouseup', this); + + document.addEventListener('keydown', this); super.hide(); } @@ -70,6 +68,8 @@ export class Overlay extends AbstractComponent { * @override */ destroy() { + document.removeEventListener('keydown', this); + delete this.image; delete this.text; delete this.subtext; @@ -77,6 +77,22 @@ export class Overlay extends AbstractComponent { super.destroy(); } + /** + * @summary Handles events + * @param {Event} e + * @private + */ + handleEvent(e) { + /* eslint-disable */ + switch (e.type) { + // @formatter:off + case 'mouseup': this.prop.dissmisable && this.hide(); break; + case 'keydown': getEventKey(e) === KEY_CODES.Escape && this.prop.dissmisable && this.hide(); break; + // @formatter:on + } + /* eslint-enable */ + } + /** * @override * @param {string} [id] @@ -104,7 +120,7 @@ export class Overlay extends AbstractComponent { */ show(config) { if (typeof config === 'string') { - config = { text: config }; // eslint-disable-line no-param-reassign + config = { text: config }; } this.prop.contentId = config.id; diff --git a/src/components/Panel.js b/src/components/Panel.js index b56ff847b..a6f40fe43 100644 --- a/src/components/Panel.js +++ b/src/components/Panel.js @@ -1,7 +1,7 @@ -import { EVENTS } from '../data/constants'; +import { EVENTS, KEY_CODES } from '../data/constants'; import { SYSTEM } from '../data/system'; import { PSVError } from '../PSVError'; -import { toggleClass } from '../utils'; +import { getEventKey, toggleClass } from '../utils'; import { AbstractComponent } from './AbstractComponent'; /** @@ -32,6 +32,7 @@ export class Panel extends AbstractComponent { * @property {number} mouseY * @property {boolean} mousedown * @property {function} clickHandler + * @property {function} keyHandler */ this.prop = { ...this.prop, @@ -41,6 +42,7 @@ export class Panel extends AbstractComponent { mouseY : 0, mousedown : false, clickHandler: null, + keyHandler : null, width : {}, }; @@ -62,7 +64,7 @@ export class Panel extends AbstractComponent { this.content.className = 'psv-panel-content'; this.container.appendChild(this.content); - // Stop wheel event bubling from panel + // Stop wheel event bubbling from panel this.container.addEventListener(SYSTEM.mouseWheelEvent, e => e.stopPropagation()); closeBtn.addEventListener('click', () => this.hide()); @@ -74,6 +76,8 @@ export class Panel extends AbstractComponent { this.psv.container.addEventListener('touchend', this); this.psv.container.addEventListener('mousemove', this); this.psv.container.addEventListener('touchmove', this); + + document.addEventListener('keydown', this); } /** @@ -85,6 +89,8 @@ export class Panel extends AbstractComponent { this.psv.container.removeEventListener('mouseup', this); this.psv.container.removeEventListener('touchend', this); + document.removeEventListener('keydown', this); + delete this.prop; delete this.content; @@ -106,6 +112,7 @@ export class Panel extends AbstractComponent { case 'touchmove': this.__onTouchMove(e); break; case 'mouseup': this.__onMouseUp(e); break; case 'touchend': this.__onMouseUp(e); break; + case 'keydown': getEventKey(e) === KEY_CODES.Escape && this.hide(); break; // @formatter:on } /* eslint-enable */ @@ -133,12 +140,12 @@ export class Panel extends AbstractComponent { * @param {string} config.content - HTML content of the panel * @param {boolean} [config.noMargin=false] - remove the default margins * @param {string} [config.width] - initial width, if not specified the default width will be used - * @param {Function} [config.clickHandler] - called when the user clicks inside the panel + * @param {Function} [config.clickHandler] - called when the user clicks inside the panel or presses the Enter key while an element focused * @fires PSV.open-panel */ show(config) { if (typeof config === 'string') { - config = { content: config }; // eslint-disable-line no-param-reassign + config = { content: config }; } this.prop.contentId = config.id; @@ -146,7 +153,9 @@ export class Panel extends AbstractComponent { if (this.prop.clickHandler) { this.content.removeEventListener('click', this.prop.clickHandler); + this.content.removeEventListener('keydown', this.prop.keyHandler); this.prop.clickHandler = null; + this.prop.keyHandler = null; } if (config.id && this.prop.width[config.id]) { @@ -167,7 +176,18 @@ export class Panel extends AbstractComponent { if (config.clickHandler) { this.prop.clickHandler = config.clickHandler; - this.content.addEventListener('click', config.clickHandler); + this.prop.keyHandler = (e) => { + if (getEventKey(e) === KEY_CODES.Enter) { + config.clickHandler(e); + } + }; + this.content.addEventListener('click', this.prop.clickHandler); + this.content.addEventListener('keydown', this.prop.keyHandler); + + // focus the first element if possible, after animation ends + setTimeout(() => { + this.content.querySelector('a,button,[tabindex]')?.focus(); + }, 300); } this.psv.trigger(EVENTS.OPEN_PANEL, config.id); diff --git a/src/data/config.js b/src/data/config.js index 9468ea86e..cbab727cc 100644 --- a/src/data/config.js +++ b/src/data/config.js @@ -1,6 +1,9 @@ +import { AbstractAdapter } from '../adapters/AbstractAdapter'; +import { EquirectangularAdapter } from '../adapters/equirectangular'; +import { AbstractPlugin } from '../plugins/AbstractPlugin'; import { PSVError } from '../PSVError'; -import { bound, clone, deepmerge, each, logWarn, parseAngle, parseSpeed } from '../utils'; -import { ACTIONS } from './constants'; +import { bound, clone, deepmerge, each, logWarn, parseAngle, parseSpeed, pluginInterop } from '../utils'; +import { ACTIONS, KEY_CODES } from './constants'; /** * @summary Default options @@ -11,6 +14,7 @@ import { ACTIONS } from './constants'; export const DEFAULTS = { panorama : null, container : null, + adapter : null, caption : null, loadingImg : null, loadingTxt : 'Loading...', @@ -22,28 +26,26 @@ export const DEFAULTS = { defaultLong : 0, defaultLat : 0, sphereCorrection : null, - sphereCorrectionReorder: false, moveSpeed : 1, - zoomButtonIncrement: 2, + zoomSpeed : 1, autorotateDelay : null, autorotateSpeed : '2rpm', autorotateLat : null, moveInertia : true, mousewheel : true, - mousewheelSpeed : 1, mousemove : true, captureCursor : false, mousewheelCtrlKey : false, touchmoveTwoFingers: false, useXmpData : true, panoData : null, + requestHeaders : null, canvasBackground : '#000', withCredentials : false, navbar : [ 'autorotate', - 'zoomOut', - 'zoomRange', - 'zoomIn', + 'zoom', + 'move', 'download', 'caption', 'fullscreen', @@ -53,6 +55,7 @@ export const DEFAULTS = { zoom : 'Zoom', zoomOut : 'Zoom out', zoomIn : 'Zoom in', + move : 'Move', download : 'Download', fullscreen: 'Fullscreen', menu : 'Menu', @@ -61,15 +64,15 @@ export const DEFAULTS = { loadError : 'The panorama can\'t be loaded', }, keyboard : { - 'ArrowUp' : ACTIONS.ROTATE_LAT_UP, - 'ArrowDown' : ACTIONS.ROTATE_LAT_DOWN, - 'ArrowRight': ACTIONS.ROTATE_LONG_RIGHT, - 'ArrowLeft' : ACTIONS.ROTATE_LONG_LEFT, - 'PageUp' : ACTIONS.ZOOM_IN, - 'PageDown' : ACTIONS.ZOOM_OUT, - '+' : ACTIONS.ZOOM_IN, - '-' : ACTIONS.ZOOM_OUT, - ' ' : ACTIONS.TOGGLE_AUTOROTATE, + [KEY_CODES.ArrowUp] : ACTIONS.ROTATE_LAT_UP, + [KEY_CODES.ArrowDown] : ACTIONS.ROTATE_LAT_DOWN, + [KEY_CODES.ArrowRight]: ACTIONS.ROTATE_LONG_RIGHT, + [KEY_CODES.ArrowLeft] : ACTIONS.ROTATE_LONG_LEFT, + [KEY_CODES.PageUp] : ACTIONS.ZOOM_IN, + [KEY_CODES.PageDown] : ACTIONS.ZOOM_OUT, + [KEY_CODES.Plus] : ACTIONS.ZOOM_IN, + [KEY_CODES.Minus] : ACTIONS.ZOOM_OUT, + [KEY_CODES.Space] : ACTIONS.TOGGLE_AUTOROTATE, }, plugins : [], }; @@ -82,9 +85,20 @@ export const READONLY_OPTIONS = { panorama : 'Use setPanorama method to change the panorama', panoData : 'Use setPanorama method to change the panorama', container: 'Cannot change viewer container', + adapter : 'Cannot change adapter', plugins : 'Cannot change plugins', }; +/** + * @summary List of deprecated options and their warning messages + * @private + */ +export const DEPRECATED_OPTIONS = { + zoomButtonIncrement : 'zoomButtonIncrement is deprecated, use zoomSpeed', + mousewheelSpeed : 'mousewheelSpeed is deprecated, use zoomSpeed', + sphereCorrectionReorder: 'sphereCorrectionReorder is deprecated', +}; + /** * @summary Parsers/validators for each option * @private @@ -96,6 +110,17 @@ export const CONFIG_PARSERS = { } return container; }, + adapter : (adapter) => { + if (!adapter) { + return [EquirectangularAdapter]; + } + else if (Array.isArray(adapter)) { + return [pluginInterop(adapter[0], AbstractAdapter), adapter[1]]; + } + else { + return [pluginInterop(adapter, AbstractAdapter)]; + } + }, defaultLong : (defaultLong) => { // defaultLat is between 0 and PI return parseAngle(defaultLong); @@ -108,7 +133,6 @@ export const CONFIG_PARSERS = { // minFov and maxFov must be ordered if (config.maxFov < minFov) { logWarn('maxFov cannot be lower than minFov'); - // eslint-disable-next-line no-param-reassign minFov = config.maxFov; } // minFov between 1 and 179 @@ -117,7 +141,6 @@ export const CONFIG_PARSERS = { maxFov : (maxFov, config) => { // minFov and maxFov must be ordered if (maxFov < config.minFov) { - // eslint-disable-next-line no-param-reassign maxFov = config.minFov; } // maxFov between 1 and 179 @@ -167,10 +190,10 @@ export const CONFIG_PARSERS = { return plugins .map((plugin) => { if (Array.isArray(plugin)) { - return plugin; + return [pluginInterop(plugin[0], AbstractPlugin), plugin[1]]; } else { - return [plugin]; + return [pluginInterop(plugin, AbstractPlugin)]; } }) .filter(plugin => !!plugin[0]); @@ -191,6 +214,11 @@ export function getConfig(options) { const config = {}; each(tempConfig, (value, key) => { + if (DEPRECATED_OPTIONS[key]) { + logWarn(DEPRECATED_OPTIONS[key]); + return; + } + if (!Object.prototype.hasOwnProperty.call(DEFAULTS, key)) { throw new PSVError(`Unknown option ${key}`); } diff --git a/src/data/constants.js b/src/data/constants.js index 7392a5258..76a93cec8 100644 --- a/src/data/constants.js +++ b/src/data/constants.js @@ -56,39 +56,7 @@ export const INERTIA_WINDOW = 300; * @type {number} * @constant */ -export const SPHERE_RADIUS = 100; - -/** - * @summary Number of vertice of the THREE.SphereGeometry - * @memberOf PSV.constants - * @type {number} - * @constant - */ -export const SPHERE_VERTICES = 64; - -/** - * @summary Number of vertices of each side of the THREE.BoxGeometry - * @memberOf PSV.constants - * @type {number} - * @constant - */ -export const CUBE_VERTICES = 8; - -/** - * @summary Order of cube textures for arrays - * @memberOf PSV.constants - * @type {number[]} - * @constant - */ -export const CUBE_MAP = [0, 2, 4, 5, 3, 1]; - -/** - * @summary Order of cube textures for maps - * @memberOf PSV.constants - * @type {string[]} - * @constant - */ -export const CUBE_HASHMAP = ['left', 'right', 'top', 'bottom', 'back', 'front']; +export const SPHERE_RADIUS = 10; /** * @summary Property name added to viewer element @@ -133,6 +101,7 @@ export const EVENTS = { * @memberof PSV * @summary Triggered before a render, used to modify the view * @param {number} timestamp - time provided by requestAnimationFrame + * @param {number} elapsed - time elapsed from the previous frame */ BEFORE_RENDER : 'before-render', /** @@ -352,3 +321,25 @@ export const EASINGS = { }; // @formatter:on /* eslint-enable */ + +/** + * @summary Subset of key codes + * @memberOf PSV.constants + * @type {Object} + * @constant + */ +export const KEY_CODES = { + Enter : 'Enter', + Control : 'Control', + Escape : 'Escape', + Space : ' ', + PageUp : 'PageUp', + PageDown : 'PageDown', + ArrowLeft : 'ArrowLeft', + ArrowUp : 'ArrowUp', + ArrowRight: 'ArrowRight', + ArrowDown : 'ArrowDown', + Delete : 'Delete', + Plus : '+', + Minus : '-', +}; diff --git a/src/icons/arrow.svg b/src/icons/arrow.svg new file mode 100644 index 000000000..8476dc67e --- /dev/null +++ b/src/icons/arrow.svg @@ -0,0 +1 @@ + diff --git a/src/index.js b/src/index.js index 752ed9647..e53344825 100644 --- a/src/index.js +++ b/src/index.js @@ -7,6 +7,7 @@ import './data/constants'; // for jsdoc import { SYSTEM } from './data/system'; import { AbstractPlugin } from './plugins/AbstractPlugin'; import { PSVError } from './PSVError'; +import { AbstractAdapter } from './adapters/AbstractAdapter'; import './styles/index.scss'; import * as utils from './utils'; import { Viewer } from './Viewer'; @@ -14,6 +15,7 @@ import { Viewer } from './Viewer'; export { AbstractButton, AbstractPlugin, + AbstractAdapter, Animation, CONSTANTS, DEFAULTS, @@ -81,17 +83,6 @@ export { * @property {number} [zoom] - new zoom level between 0 and 100 */ -/** - * @typedef {Object} PSV.Cubemap - * @summary Object defining a cubemap - * @property {string} top - * @property {string} right - * @property {string} bottom - * @property {string} left - * @property {string} front - * @property {string} back - */ - /** * @typedef {Object} PSV.PanoData * @summary Crop information of the panorama @@ -115,18 +106,19 @@ export { */ /** - * @typedef {PSV.AnimateOptions} PSV.PanoramaOptions + * @typedef {PSV.ExtendedPosition} PSV.PanoramaOptions * @summary Object defining panorama and animation options * @property {boolean|number} [transition=1500] - duration of the transition between all and new panorama * @property {boolean} [showLoader=true] - show the loader + * @property {number} [zoom] - new zoom level between 0 and 100 * @property {PSV.SphereCorrection} [sphereCorrection] - new sphere correction to apply to the panorama * @property {PSV.PanoData | PSV.PanoDataProvider} [panoData] - new panorama data used for this panorama */ /** * @typedef {Object} PSV.TextureData - * @summary Result of the {@link PSV.TextureLoader#loadTexture} method - * @property {external:THREE.Texture|external:THREE.Texture[]} texture + * @summary Result of the {@link PSV.adapters.AbstractAdapter#loadTexture} method + * @property {external:THREE.Texture|external:THREE.Texture[]|Record} texture * @property {PSV.PanoData} [panoData] */ diff --git a/src/plugins/autorotate-keypoints/index.js b/src/plugins/autorotate-keypoints/index.js index 89a16b222..de7baf758 100644 --- a/src/plugins/autorotate-keypoints/index.js +++ b/src/plugins/autorotate-keypoints/index.js @@ -1,4 +1,4 @@ -import { AbstractPlugin, CONSTANTS, PSVError, utils } from 'photo-sphere-viewer'; +import { AbstractPlugin, CONSTANTS, PSVError, utils } from '../..'; /** * @typedef {PSV.ExtendedPosition|string|Object} PSV.plugins.AutorotateKeypointsPlugin.Keypoints @@ -31,7 +31,7 @@ const serializePt = position => [position.longitude, position.latitude]; * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class AutorotateKeypointsPlugin extends AbstractPlugin { +export class AutorotateKeypointsPlugin extends AbstractPlugin { static id = 'autorotate-keypoints'; @@ -78,10 +78,12 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { } this.psv.on(CONSTANTS.EVENTS.AUTOROTATE, this); + this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this); } destroy() { this.psv.off(CONSTANTS.EVENTS.AUTOROTATE, this); + this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this); delete this.keypoints; delete this.state; @@ -93,6 +95,9 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { if (e.type === CONSTANTS.EVENTS.AUTOROTATE) { this.__configure(); } + else if (e.type === CONSTANTS.EVENTS.BEFORE_RENDER) { + this.__beforeRender(e.args[0]); + } } /** @@ -109,11 +114,9 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { if (this.keypoints) { this.keypoints.forEach((pt, i) => { if (typeof pt === 'string') { - // eslint-disable-next-line no-param-reassign pt = { markerId: pt }; } else if (utils.isExtendedPosition(pt)) { - // eslint-disable-next-line no-param-reassign pt = { position: pt }; } if (pt.markerId) { @@ -151,6 +154,9 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { return; } + // cancel core rotation + this.psv.dynamics.position.stop(); + this.state = { idx : -1, curve : [], @@ -164,17 +170,23 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { }; if (this.config.startFromClosest) { + const currentPosition = serializePt(this.psv.getPosition()); const index = this.__findMinIndex(this.keypoints, (keypoint) => { - return utils.greatArcDistance(keypoint.position, serializePt(this.psv.prop.position)); + return utils.greatArcDistance(keypoint.position, currentPosition); }); this.keypoints.push(...this.keypoints.splice(0, index)); } + } - const autorotateCb = (e, timestamp) => { + /** + * @private + */ + __beforeRender(timestamp) { + if (this.psv.isAutorotateEnabled()) { // initialisation if (!this.state.startTime) { - this.state.endPt = serializePt(this.psv.prop.position); + this.state.endPt = serializePt(this.psv.getPosition()); this.__nextStep(); this.state.startTime = timestamp; @@ -182,11 +194,7 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { } this.__nextFrame(timestamp); - }; - - this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this.psv.prop.autorotateCb); - this.psv.prop.autorotateCb = autorotateCb; - this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this.psv.prop.autorotateCb); + } } /** @@ -249,9 +257,10 @@ export default class AutorotateKeypointsPlugin extends AbstractPlugin { // one point before and two points before current const workPoints = []; if (this.state.idx === -1) { + const currentPosition = serializePt(this.psv.getPosition()); workPoints.push( - serializePt(this.psv.prop.position), - serializePt(this.psv.prop.position), + currentPosition, + currentPosition, this.keypoints[0].position, this.keypoints[1].position ); diff --git a/src/plugins/gyroscope/GyroscopeButton.js b/src/plugins/gyroscope/GyroscopeButton.js index 9b1dab6c4..03e7e1003 100644 --- a/src/plugins/gyroscope/GyroscopeButton.js +++ b/src/plugins/gyroscope/GyroscopeButton.js @@ -1,6 +1,6 @@ -import { AbstractButton } from 'photo-sphere-viewer'; +import { AbstractButton } from '../..'; import compass from './compass.svg'; -import GyroscopePlugin from './index'; +import { GyroscopePlugin } from './index'; /** * @summary Navigation bar gyroscope button class diff --git a/src/plugins/gyroscope/compass.svg b/src/plugins/gyroscope/compass.svg index 2a86ba894..a2587a963 100644 --- a/src/plugins/gyroscope/compass.svg +++ b/src/plugins/gyroscope/compass.svg @@ -1 +1 @@ - + diff --git a/src/plugins/gyroscope/index.js b/src/plugins/gyroscope/index.js index 9bc01ebc7..de0b130d1 100644 --- a/src/plugins/gyroscope/index.js +++ b/src/plugins/gyroscope/index.js @@ -1,12 +1,8 @@ -import { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from 'photo-sphere-viewer'; import * as THREE from 'three'; import { DeviceOrientationControls } from 'three/examples/jsm/controls/DeviceOrientationControls'; +import { AbstractPlugin, CONSTANTS, DEFAULTS, registerButton, utils } from '../..'; import { GyroscopeButton } from './GyroscopeButton'; -/** - * @typedef {Object} external:THREE.DeviceOrientationControls - * @summary {@link https://github.com/mrdoob/three.js/blob/dev/examples/jsm/controls/DeviceOrientationControls.js} - */ /** * @typedef {Object} PSV.plugins.GyroscopePlugin.Options @@ -20,13 +16,14 @@ DEFAULTS.navbar.splice(-1, 0, GyroscopeButton.id); DEFAULTS.lang[GyroscopeButton.id] = 'Gyroscope'; registerButton(GyroscopeButton); +const direction = new THREE.Vector3(); /** * @summary Adds gyroscope controls on mobile devices * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class GyroscopePlugin extends AbstractPlugin { +export class GyroscopePlugin extends AbstractPlugin { static id = 'gyroscope'; @@ -37,6 +34,12 @@ export default class GyroscopePlugin extends AbstractPlugin { * @constant */ static EVENTS = { + /** + * @event gyroscope-updated + * @memberof PSV.plugins.GyroscopePlugin + * @summary Triggered when the gyroscope mode is enabled/disabled + * @param {boolean} enabled + */ GYROSCOPE_UPDATED: 'gyroscope-updated', }; @@ -52,13 +55,13 @@ export default class GyroscopePlugin extends AbstractPlugin { * @private * @property {Promise} isSupported - indicates of the gyroscope API is available * @property {number} alphaOffset - current alpha offset for gyroscope controls - * @property {Function} orientationCb - update callback of the device orientation + * @property {boolean} enabled * @property {boolean} config_moveInertia - original config "moveInertia" */ this.prop = { isSupported : this.__checkSupport(), alphaOffset : 0, - orientationCb : null, + enabled : false, config_moveInertia: true, }; @@ -80,6 +83,7 @@ export default class GyroscopePlugin extends AbstractPlugin { this.psv.on(CONSTANTS.EVENTS.STOP_ALL, this); this.psv.on(CONSTANTS.EVENTS.BEFORE_ROTATE, this); + this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this); } /** @@ -88,6 +92,7 @@ export default class GyroscopePlugin extends AbstractPlugin { destroy() { this.psv.off(CONSTANTS.EVENTS.STOP_ALL, this); this.psv.off(CONSTANTS.EVENTS.BEFORE_ROTATE, this); + this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this); this.stop(); @@ -105,8 +110,11 @@ export default class GyroscopePlugin extends AbstractPlugin { case CONSTANTS.EVENTS.STOP_ALL: this.stop(); break; + case CONSTANTS.EVENTS.BEFORE_RENDER: + this.__onBeforeRender(); + break; case CONSTANTS.EVENTS.BEFORE_ROTATE: - this.__onRotate(e); + this.__onBeforeRotate(e); break; default: break; @@ -118,7 +126,7 @@ export default class GyroscopePlugin extends AbstractPlugin { * @returns {boolean} */ isEnabled() { - return !!this.prop.orientationCb; + return this.prop.enabled; } /** @@ -154,14 +162,22 @@ export default class GyroscopePlugin extends AbstractPlugin { this.prop.config_moveInertia = this.psv.config.moveInertia; this.psv.config.moveInertia = false; - this.__configure(); + // enable gyro controls + if (!this.controls) { + this.controls = new DeviceOrientationControls(new THREE.Object3D()); + } + else { + this.controls.connect(); + } + + // force reset + this.controls.deviceOrientation = null; + this.controls.screenOrientation = 0; + this.controls.alphaOffset = 0; + + this.prop.alphaOffset = this.config.absolutePosition ? 0 : null; + this.prop.enabled = true; - /** - * @event gyroscope-updated - * @memberof PSV.plugins.GyroscopePlugin - * @summary Triggered when the gyroscope mode is enabled/disabled - * @param {boolean} enabled - */ this.trigger(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, true); }); } @@ -174,9 +190,7 @@ export default class GyroscopePlugin extends AbstractPlugin { if (this.isEnabled()) { this.controls.disconnect(); - this.psv.off(CONSTANTS.EVENTS.BEFORE_RENDER, this.prop.orientationCb); - this.prop.orientationCb = null; - + this.prop.enabled = false; this.psv.config.moveInertia = this.prop.config_moveInertia; this.trigger(GyroscopePlugin.EVENTS.GYROSCOPE_UPDATED, false); @@ -196,54 +210,38 @@ export default class GyroscopePlugin extends AbstractPlugin { } /** - * @summary Attaches the {@link external:THREE.DeviceOrientationControls} to the camera + * @summary Handles gyro movements * @private */ - __configure() { - if (!this.controls) { - this.controls = new DeviceOrientationControls(this.psv.renderer.camera); + __onBeforeRender() { + if (!this.isEnabled()) { + return; } - else { - this.controls.connect(); - } - - // force reset - this.controls.deviceOrientation = null; - this.controls.screenOrientation = 0; - this.controls.alphaOffset = 0; - this.prop.alphaOffset = this.config.absolutePosition ? 0 : null; - this.prop.orientationCb = () => { - if (!this.controls.deviceOrientation) { - return; - } - - // on first run compute the offset depending on the current viewer position and device orientation - if (this.prop.alphaOffset === null) { - this.controls.update(); - - const direction = new THREE.Vector3(); - this.psv.renderer.camera.getWorldDirection(direction); - - const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction); - this.prop.alphaOffset = sphericalCoords.longitude - this.psv.prop.position.longitude; - } - else { - this.controls.alphaOffset = this.prop.alphaOffset; - this.controls.update(); - - this.psv.renderer.camera.getWorldDirection(this.psv.prop.direction); - this.psv.prop.direction.multiplyScalar(CONSTANTS.SPHERE_RADIUS); - - const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(this.psv.prop.direction); - this.psv.prop.position.longitude = sphericalCoords.longitude; - this.psv.prop.position.latitude = sphericalCoords.latitude; + if (!this.controls.deviceOrientation) { + return; + } - this.psv.needsUpdate(); - } - }; + // on first run compute the offset depending on the current viewer position and device orientation + if (this.prop.alphaOffset === null) { + this.controls.update(); + this.controls.object.getWorldDirection(direction); - this.psv.on(CONSTANTS.EVENTS.BEFORE_RENDER, this.prop.orientationCb); + const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction); + this.prop.alphaOffset = sphericalCoords.longitude - this.psv.getPosition().longitude; + } + else { + this.controls.alphaOffset = this.prop.alphaOffset; + this.controls.update(); + this.controls.object.getWorldDirection(direction); + + const sphericalCoords = this.psv.dataHelper.vector3ToSphericalCoords(direction); + // TODO use dynamic goto for smooth movement + this.psv.dynamics.position.setValue({ + longitude: sphericalCoords.longitude, + latitude : -sphericalCoords.latitude, + }); + } } /** @@ -251,12 +249,12 @@ export default class GyroscopePlugin extends AbstractPlugin { * @param {external:uEvent.Event} e * @private */ - __onRotate(e) { + __onBeforeRotate(e) { if (this.isEnabled()) { e.preventDefault(); if (this.config.touchmove) { - this.prop.alphaOffset -= e.args[0].longitude - this.psv.prop.position.longitude; + this.prop.alphaOffset -= e.args[0].longitude - this.psv.getPosition().longitude; } } } diff --git a/src/plugins/markers/Marker.js b/src/plugins/markers/Marker.js index e0b12bb4d..a679331bb 100644 --- a/src/plugins/markers/Marker.js +++ b/src/plugins/markers/Marker.js @@ -1,5 +1,5 @@ -import { CONSTANTS, PSVError, utils } from 'photo-sphere-viewer'; -import MarkersPlugin from './index'; +import { CONSTANTS, PSVError, utils } from '../..'; +import { MarkersPlugin } from './index'; import { getPolygonCenter, getPolylineCenter } from './utils'; /** diff --git a/src/plugins/markers/MarkersButton.js b/src/plugins/markers/MarkersButton.js index 692ed7297..4fa98c657 100644 --- a/src/plugins/markers/MarkersButton.js +++ b/src/plugins/markers/MarkersButton.js @@ -1,5 +1,5 @@ -import { AbstractButton } from 'photo-sphere-viewer'; -import MarkersPlugin from './index'; +import { AbstractButton } from '../..'; +import { MarkersPlugin } from './index'; import pin from './pin.svg'; /** diff --git a/src/plugins/markers/MarkersListButton.js b/src/plugins/markers/MarkersListButton.js index 4ab9edfb9..2f95d2479 100644 --- a/src/plugins/markers/MarkersListButton.js +++ b/src/plugins/markers/MarkersListButton.js @@ -1,5 +1,5 @@ -import { AbstractButton, CONSTANTS } from 'photo-sphere-viewer'; -import MarkersPlugin from './index'; +import { AbstractButton, CONSTANTS } from '../..'; +import { MarkersPlugin } from './index'; import pinList from './pin-list.svg'; /** diff --git a/src/plugins/markers/index.js b/src/plugins/markers/index.js index 1930d69cb..cffb0ef3c 100644 --- a/src/plugins/markers/index.js +++ b/src/plugins/markers/index.js @@ -1,5 +1,5 @@ -import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer'; import * as THREE from 'three'; +import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..'; import { Marker } from './Marker'; import { MarkersButton } from './MarkersButton'; import { MarkersListButton } from './MarkersListButton'; @@ -33,7 +33,7 @@ registerButton(MarkersListButton); * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class MarkersPlugin extends AbstractPlugin { +export class MarkersPlugin extends AbstractPlugin { static id = 'markers'; @@ -43,14 +43,69 @@ export default class MarkersPlugin extends AbstractPlugin { * @constant */ static EVENTS = { + /** + * @event goto-marker-done + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the animation to a marker is done + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ GOTO_MARKER_DONE : 'goto-marker-done', + /** + * @event leave-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the user puts the cursor away from a marker + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ LEAVE_MARKER : 'leave-marker', + /** + * @event over-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the user puts the cursor hover a marker + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ OVER_MARKER : 'over-marker', + /** + * @event filter:render-markers-list + * @memberof PSV.plugins.MarkersPlugin + * @summary Used to alter the list of markers displayed on the side-panel + * @param {PSV.plugins.MarkersPlugin.Marker[]} markers + * @returns {PSV.plugins.MarkersPlugin.Marker[]} + */ RENDER_MARKERS_LIST: 'render-markers-list', + /** + * @event select-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler + * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker} + * @param {PSV.plugins.MarkersPlugin.Marker} marker + * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data + */ SELECT_MARKER : 'select-marker', + /** + * @event select-marker-list + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when a marker is selected from the side panel + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ SELECT_MARKER_LIST : 'select-marker-list', + /** + * @event unselect-marker + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when a marker was selected and the user clicks elsewhere + * @param {PSV.plugins.MarkersPlugin.Marker} marker + */ UNSELECT_MARKER : 'unselect-marker', + /** + * @event hide-markers + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the markers are hidden + */ HIDE_MARKERS : 'hide-markers', + /** + * @event show-markers + * @memberof PSV.plugins.MarkersPlugin + * @summary Triggered when the markers are shown + */ SHOW_MARKERS : 'show-markers', }; @@ -94,7 +149,7 @@ export default class MarkersPlugin extends AbstractPlugin {

    ${icon} ${title}

      ${markers.map(marker => ` -
    • +
    • ${marker.type === 'image' ? `` : ''} ${marker.getListContent()}
    • @@ -232,11 +287,6 @@ export default class MarkersPlugin extends AbstractPlugin { this.renderMarkers(); - /** - * @event show-markers - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the markers are shown - */ this.trigger(MarkersPlugin.EVENTS.SHOW_MARKERS); } @@ -249,11 +299,6 @@ export default class MarkersPlugin extends AbstractPlugin { this.renderMarkers(); - /** - * @event hide-markers - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the markers are hidden - */ this.trigger(MarkersPlugin.EVENTS.HIDE_MARKERS); } @@ -441,12 +486,6 @@ export default class MarkersPlugin extends AbstractPlugin { speed, }) .then(() => { - /** - * @event goto-marker-done - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the animation to a marker is done - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.GOTO_MARKER_DONE, marker); }); } @@ -520,13 +559,6 @@ export default class MarkersPlugin extends AbstractPlugin { } }); - /** - * @event filter:render-markers-list - * @memberof PSV.plugins.MarkersPlugin - * @summary Used to alter the list of markers displayed on the side-panel - * @param {PSV.plugins.MarkersPlugin.Marker[]} markers - * @returns {PSV.plugins.MarkersPlugin.Marker[]} - */ markers = this.change(MarkersPlugin.EVENTS.RENDER_MARKERS_LIST, markers); this.psv.panel.show({ @@ -544,12 +576,6 @@ export default class MarkersPlugin extends AbstractPlugin { if (markerId) { const marker = this.getMarker(markerId); - /** - * @event select-marker-list - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when a marker is selected from the side panel - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.SELECT_MARKER_LIST, marker); this.gotoMarker(marker, 1000); @@ -694,7 +720,7 @@ export default class MarkersPlugin extends AbstractPlugin { */ __getMarkerPosition(marker, scale = 1) { if (marker.isPoly()) { - return this.psv.dataHelper.vector3ToViewerCoords(this.psv.dataHelper.sphericalCoordsToVector3(marker.props.position)); + return this.psv.dataHelper.sphericalCoordsToViewerCoords(marker.props.position); } else { const position = this.psv.dataHelper.vector3ToViewerCoords(marker.props.positions3D[0]); @@ -816,12 +842,6 @@ export default class MarkersPlugin extends AbstractPlugin { if (marker && !marker.isPoly()) { this.prop.hoveringMarker = marker; - /** - * @event over-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the user puts the cursor hover a marker - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.OVER_MARKER, marker); if (!this.prop.showAllTooltips) { @@ -841,12 +861,6 @@ export default class MarkersPlugin extends AbstractPlugin { // do not hide if we enter the tooltip itself while hovering a polygon if (marker && !(marker.isPoly() && this.__targetOnTooltip(e.relatedTarget, marker.tooltip))) { - /** - * @event leave-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the user puts the cursor away from a marker - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.LEAVE_MARKER, marker); this.prop.hoveringMarker = null; @@ -927,14 +941,6 @@ export default class MarkersPlugin extends AbstractPlugin { if (marker) { this.prop.currentMarker = marker; - /** - * @event select-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler - * with {@link PSV.plugins.MarkersPlugin.getCurrentMarker} - * @param {PSV.plugins.MarkersPlugin.Marker} marker - * @param {PSV.plugins.MarkersPlugin.SelectMarkerData} data - */ this.trigger(MarkersPlugin.EVENTS.SELECT_MARKER, marker, { dblclick : dblclick, rightclick: data.rightclick, @@ -954,12 +960,6 @@ export default class MarkersPlugin extends AbstractPlugin { } } else if (this.prop.currentMarker) { - /** - * @event unselect-marker - * @memberof PSV.plugins.MarkersPlugin - * @summary Triggered when a marker was selected and the user clicks elsewhere - * @param {PSV.plugins.MarkersPlugin.Marker} marker - */ this.trigger(MarkersPlugin.EVENTS.UNSELECT_MARKER, this.prop.currentMarker); this.psv.panel.hide(MarkersPlugin.ID_PANEL_MARKER); diff --git a/src/plugins/markers/utils.js b/src/plugins/markers/utils.js index 731b7fc61..bbeedfaf2 100644 --- a/src/plugins/markers/utils.js +++ b/src/plugins/markers/utils.js @@ -1,4 +1,4 @@ -import { CONSTANTS, utils } from 'photo-sphere-viewer'; +import { CONSTANTS, utils } from '../..'; /** * Returns intermediary point between two points on the sphere diff --git a/src/plugins/resolution/index.js b/src/plugins/resolution/index.js index af59c8ed2..0998c31eb 100644 --- a/src/plugins/resolution/index.js +++ b/src/plugins/resolution/index.js @@ -1,5 +1,5 @@ -import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError } from 'photo-sphere-viewer'; -import SettingsPlugin from 'photo-sphere-viewer/dist/plugins/settings'; +import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError } from '../..'; +import { SettingsPlugin } from '../settings'; import { deepEqual } from './utils'; @@ -10,7 +10,7 @@ DEFAULTS.lang.resolution = 'Quality'; * @typedef {Object} PSV.plugins.ResolutionPlugin.Resolution * @property {string} id * @property {string} label - * @property {string|string[]|PSV.Cubemap} panorama + * @property {*} panorama */ /** @@ -23,7 +23,7 @@ DEFAULTS.lang.resolution = 'Quality'; * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class ResolutionPlugin extends AbstractPlugin { +export class ResolutionPlugin extends AbstractPlugin { static id = 'resolution'; diff --git a/src/plugins/settings/SettingsButton.js b/src/plugins/settings/SettingsButton.js index 4ca9bc11d..26f2681ec 100644 --- a/src/plugins/settings/SettingsButton.js +++ b/src/plugins/settings/SettingsButton.js @@ -1,5 +1,5 @@ -import { AbstractButton, CONSTANTS } from 'photo-sphere-viewer'; -import SettingsPlugin from './index'; +import { AbstractButton, CONSTANTS } from '../..'; +import { SettingsPlugin } from './index'; import icon from './settings.svg'; /** diff --git a/src/plugins/settings/index.js b/src/plugins/settings/index.js index 09b8fca96..4f3f29466 100644 --- a/src/plugins/settings/index.js +++ b/src/plugins/settings/index.js @@ -1,4 +1,4 @@ -import { AbstractPlugin, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer'; +import { AbstractPlugin, DEFAULTS, PSVError, registerButton, utils } from '../..'; import check from './check.svg'; import chevron from './chevron.svg'; import icon from './settings.svg'; @@ -50,7 +50,7 @@ registerButton(SettingsButton); * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class SettingsPlugin extends AbstractPlugin { +export class SettingsPlugin extends AbstractPlugin { static id = 'settings'; diff --git a/src/plugins/stereo/StereoButton.js b/src/plugins/stereo/StereoButton.js index f6a7f0c21..64af7cd3e 100644 --- a/src/plugins/stereo/StereoButton.js +++ b/src/plugins/stereo/StereoButton.js @@ -1,5 +1,5 @@ -import { AbstractButton } from 'photo-sphere-viewer'; -import StereoPlugin from './index'; +import { AbstractButton } from '../..'; +import { StereoPlugin } from './index'; import stereo from './stereo.svg'; /** diff --git a/src/plugins/stereo/index.js b/src/plugins/stereo/index.js index 56958b5f2..d337bb05e 100644 --- a/src/plugins/stereo/index.js +++ b/src/plugins/stereo/index.js @@ -1,15 +1,10 @@ -import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from 'photo-sphere-viewer'; -import GyroscopePlugin from 'photo-sphere-viewer/dist/plugins/gyroscope'; import { StereoEffect } from 'three/examples/jsm/effects/StereoEffect'; +import { AbstractPlugin, CONSTANTS, DEFAULTS, PSVError, registerButton, utils } from '../..'; +import { GyroscopePlugin } from '../gyroscope'; import mobileRotateIcon from './mobile-rotate.svg'; import { StereoButton } from './StereoButton'; -/** - * @typedef {Object} external:THREE.StereoEffect - * @summary {@link https://github.com/mrdoob/three.js/blob/dev/examples/jsm/effects/StereoEffect.js} - */ - /** * @external NoSleep * @description {@link https://github.com/richtr/NoSleep.js} @@ -31,7 +26,7 @@ DEFAULTS.lang.pleaseRotate = ['Please rotate your device', '(or tap to continue) * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class StereoPlugin extends AbstractPlugin { +export class StereoPlugin extends AbstractPlugin { static id = 'stereo'; @@ -49,6 +44,12 @@ export default class StereoPlugin extends AbstractPlugin { * @constant */ static EVENTS = { + /** + * @event stereo-updated + * @memberof PSV.plugins.StereoPlugin + * @summary Triggered when the stereo view is enabled/disabled + * @param {boolean} enabled + */ STEREO_UPDATED: 'stereo-updated', }; @@ -163,12 +164,6 @@ export default class StereoPlugin extends AbstractPlugin { this.psv.navbar.hide(); this.psv.panel.hide(); - /** - * @event stereo-updated - * @memberof PSV.plugins.StereoPlugin - * @summary Triggered when the stereo view is enabled/disabled - * @param {boolean} enabled - */ this.trigger(StereoPlugin.EVENTS.STEREO_UPDATED, true); this.psv.notification.show({ diff --git a/src/plugins/visible-range/index.js b/src/plugins/visible-range/index.js index 1926082f2..e1065431b 100644 --- a/src/plugins/visible-range/index.js +++ b/src/plugins/visible-range/index.js @@ -1,5 +1,5 @@ -import { AbstractPlugin, utils, CONSTANTS, Animation } from 'photo-sphere-viewer'; import * as THREE from 'three'; +import { AbstractPlugin, Animation, CONSTANTS, utils } from '../..'; /** * @typedef {Object} PSV.plugins.VisibleRangePlugin.Options @@ -13,7 +13,7 @@ import * as THREE from 'three'; * @extends PSV.plugins.AbstractPlugin * @memberof PSV.plugins */ -export default class VisibleRangePlugin extends AbstractPlugin { +export class VisibleRangePlugin extends AbstractPlugin { static id = 'visible-range'; @@ -31,7 +31,7 @@ export default class VisibleRangePlugin extends AbstractPlugin { this.config = { latitudeRange : null, longitudeRange: null, - usePanoData: false, + usePanoData : false, }; if (options) { @@ -41,6 +41,7 @@ export default class VisibleRangePlugin extends AbstractPlugin { } this.psv.on(CONSTANTS.EVENTS.PANORAMA_LOADED, this); + this.psv.on(CONSTANTS.EVENTS.ZOOM_UPDATED, this); this.psv.on(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this); this.psv.on(CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this); } @@ -50,6 +51,7 @@ export default class VisibleRangePlugin extends AbstractPlugin { */ destroy() { this.psv.off(CONSTANTS.EVENTS.PANORAMA_LOADED, this); + this.psv.off(CONSTANTS.EVENTS.ZOOM_UPDATED, this); this.psv.off(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, this); this.psv.off(CONSTANTS.CHANGE_EVENTS.GET_ROTATE_POSITION, this); @@ -80,6 +82,13 @@ export default class VisibleRangePlugin extends AbstractPlugin { this.setRangesFromPanoData(); } } + else if (e.type === CONSTANTS.EVENTS.ZOOM_UPDATED) { + const currentPosition = this.psv.getPosition(); + const { rangedPosition } = this.applyRanges(currentPosition); + if (currentPosition.longitude !== rangedPosition.longitude || currentPosition.latitude !== rangedPosition.latitude) { + this.psv.rotate(rangedPosition); + } + } } /** @@ -90,13 +99,11 @@ export default class VisibleRangePlugin extends AbstractPlugin { // latitude range must have two values if (range && range.length !== 2) { utils.logWarn('latitude range must have exactly two elements'); - // eslint-disable-next-line no-param-reassign range = null; } // latitude range must be ordered else if (range && range[0] > range[1]) { utils.logWarn('latitude range values must be ordered'); - // eslint-disable-next-line no-param-reassign range = [range[1], range[0]]; } // latitude range is between -PI/2 and PI/2 @@ -120,7 +127,6 @@ export default class VisibleRangePlugin extends AbstractPlugin { // longitude range must have two values if (range && range.length !== 2) { utils.logWarn('longitude range must have exactly two elements'); - // eslint-disable-next-line no-param-reassign range = null; } // longitude range is between 0 and 2*PI diff --git a/src/services/DataHelper.js b/src/services/DataHelper.js index 5c2fbad40..8dc7deeec 100644 --- a/src/services/DataHelper.js +++ b/src/services/DataHelper.js @@ -4,6 +4,9 @@ import { PSVError } from '../PSVError'; import { parseAngle, parseSpeed } from '../utils'; import { AbstractService } from './AbstractService'; +const vector2 = new THREE.Vector2(); +const vector3 = new THREE.Vector3(); + /** * @summary Collections of data converters for the current viewer * @extends PSV.services.AbstractService @@ -70,11 +73,11 @@ export class DataHelper extends AbstractService { * @returns {PSV.Position} */ textureCoordsToSphericalCoords(point) { - if (this.prop.isCubemap) { - throw new PSVError('Unable to use texture coords with cubemap.'); + const panoData = this.prop.panoData; + if (!panoData) { + throw new PSVError('Current adapter does not support texture coordinates.'); } - const panoData = this.prop.panoData; const relativeX = (point.x + panoData.croppedX) / panoData.fullWidth * Math.PI * 2; const relativeY = (point.y + panoData.croppedY) / panoData.fullHeight * Math.PI; @@ -90,11 +93,11 @@ export class DataHelper extends AbstractService { * @returns {PSV.Point} */ sphericalCoordsToTextureCoords(position) { - if (this.prop.isCubemap) { - throw new PSVError('Unable to use texture coords with cubemap.'); + const panoData = this.prop.panoData; + if (!panoData) { + throw new PSVError('Current adapter does not support texture coordinates.'); } - const panoData = this.prop.panoData; const relativeLong = position.longitude / Math.PI / 2 * panoData.fullWidth; const relativeLat = position.latitude / Math.PI * panoData.fullHeight; @@ -107,14 +110,17 @@ export class DataHelper extends AbstractService { /** * @summary Converts spherical radians coordinates to a THREE.Vector3 * @param {PSV.Position} position + * @param {external:THREE.Vector3} [vector] * @returns {external:THREE.Vector3} */ - sphericalCoordsToVector3(position) { - return new THREE.Vector3( - SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude), - SPHERE_RADIUS * Math.sin(position.latitude), - SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude) - ); + sphericalCoordsToVector3(position, vector) { + if (!vector) { + vector = new THREE.Vector3(); + } + vector.x = SPHERE_RADIUS * -Math.cos(position.latitude) * Math.sin(position.longitude); + vector.y = SPHERE_RADIUS * Math.sin(position.latitude); + vector.z = SPHERE_RADIUS * Math.cos(position.latitude) * Math.cos(position.longitude); + return vector; } /** @@ -138,12 +144,10 @@ export class DataHelper extends AbstractService { * @returns {external:THREE.Vector3} */ viewerCoordsToVector3(viewerPoint) { - const screen = new THREE.Vector2( - 2 * viewerPoint.x / this.prop.size.width - 1, - -2 * viewerPoint.y / this.prop.size.height + 1 - ); + vector2.x = 2 * viewerPoint.x / this.prop.size.width - 1; + vector2.y = -2 * viewerPoint.y / this.prop.size.height + 1; - this.psv.renderer.raycaster.setFromCamera(screen, this.psv.renderer.camera); + this.psv.renderer.raycaster.setFromCamera(vector2, this.psv.renderer.camera); const intersects = this.psv.renderer.raycaster.intersectObjects(this.psv.renderer.scene.children, true); @@ -170,6 +174,15 @@ export class DataHelper extends AbstractService { }; } + /** + * @summary Converts spherical radians coordinates to position on the viewer + * @param {PSV.Position} position + * @returns {PSV.Point} + */ + sphericalCoordsToViewerCoords(position) { + return this.vector3ToViewerCoords(this.sphericalCoordsToVector3(position, vector3)); + } + /** * @summary Converts x/y to latitude/longitude if present and ensure boundaries * @param {PSV.ExtendedPosition} position diff --git a/src/services/EventsHandler.js b/src/services/EventsHandler.js index d0c51d201..0f6b38e83 100644 --- a/src/services/EventsHandler.js +++ b/src/services/EventsHandler.js @@ -1,3 +1,4 @@ +import * as THREE from 'three'; import { Animation } from '../Animation'; import { ACTIONS, @@ -6,14 +7,16 @@ import { EVENTS, IDS, INERTIA_WINDOW, + KEY_CODES, LONGTOUCH_DELAY, - TWOFINGERSOVERLAY_DELAY, - MOVE_THRESHOLD + MOVE_THRESHOLD, + TWOFINGERSOVERLAY_DELAY } from '../data/constants'; import { SYSTEM } from '../data/system'; import gestureIcon from '../icons/gesture.svg'; import mousewheelIcon from '../icons/mousewheel.svg'; import { clone, distance, getClosest, getEventKey, isFullscreenEnabled, normalizeWheel, throttle } from '../utils'; +import { PressHandler } from '../utils/PressHandler'; import { AbstractService } from './AbstractService'; /** @@ -40,6 +43,7 @@ export class EventsHandler extends AbstractService { * @property {number} mouseY - current y position of the cursor * @property {number[][]} mouseHistory - list of latest positions of the cursor, [time, x, y] * @property {number} pinchDist - distance between fingers when zooming + * @property {PressHandler} keyHandler * @property {boolean} ctrlKeyDown - when the Ctrl key is pressed * @property {PSV.ClickData} dblclickData - temporary storage of click data between two clicks * @property {number} dblclickTimeout - timeout id for double click @@ -57,6 +61,7 @@ export class EventsHandler extends AbstractService { mouseY : 0, mouseHistory : [], pinchDist : 0, + keyHandler : new PressHandler(), ctrlKeyDown : false, dblclickData : null, dblclickTimeout : null, @@ -188,7 +193,7 @@ export class EventsHandler extends AbstractService { const key = getEventKey(evt); if (this.config.mousewheelCtrlKey) { - this.state.ctrlKeyDown = key === 'Control'; + this.state.ctrlKeyDown = key === KEY_CODES.Control; if (this.state.ctrlKeyDown) { clearTimeout(this.state.ctrlZoomTimeout); @@ -200,32 +205,24 @@ export class EventsHandler extends AbstractService { return; } - let dLong = 0; - let dLat = 0; - let dZoom = 0; - - /* eslint-disable */ - switch (this.config.keyboard[key]) { - // @formatter:off - case ACTIONS.ROTATE_LAT_UP : dLat = 0.01; break; - case ACTIONS.ROTATE_LAT_DOWN : dLat = -0.01; break; - case ACTIONS.ROTATE_LONG_RIGHT: dLong = 0.01; break; - case ACTIONS.ROTATE_LONG_LEFT : dLong = -0.01; break; - case ACTIONS.ZOOM_IN : dZoom = 1; break; - case ACTIONS.ZOOM_OUT : dZoom = -1; break; - case ACTIONS.TOGGLE_AUTOROTATE: this.psv.toggleAutorotate(); break; - // @formatter:on + if (this.config.keyboard[key] === ACTIONS.TOGGLE_AUTOROTATE) { + this.psv.toggleAutorotate(); } - /* eslint-enable */ + else if (this.config.keyboard[key] && !this.state.keyHandler.time) { + /* eslint-disable */ + switch (this.config.keyboard[key]) { + // @formatter:off + case ACTIONS.ROTATE_LAT_UP: this.psv.dynamics.position.roll({latitude: false}); break; + case ACTIONS.ROTATE_LAT_DOWN: this.psv.dynamics.position.roll({latitude: true}); break; + case ACTIONS.ROTATE_LONG_RIGHT: this.psv.dynamics.position.roll({longitude: false}); break; + case ACTIONS.ROTATE_LONG_LEFT: this.psv.dynamics.position.roll({longitude: true}); break; + case ACTIONS.ZOOM_IN: this.psv.dynamics.zoom.roll(false); break; + case ACTIONS.ZOOM_OUT: this.psv.dynamics.zoom.roll(true); break; + // @formatter:on + } + /* eslint-enable */ - if (dZoom !== 0) { - this.psv.zoom(this.prop.zoomLvl + dZoom * this.config.zoomButtonIncrement); - } - else if (dLat !== 0 || dLong !== 0) { - this.psv.rotate({ - longitude: this.prop.position.longitude + dLong * this.prop.moveSpeed * this.prop.hFov, - latitude : this.prop.position.latitude + dLat * this.prop.moveSpeed * this.prop.vFov, - }); + this.state.keyHandler.down(); } } @@ -235,6 +232,15 @@ export class EventsHandler extends AbstractService { */ __onKeyUp() { this.state.ctrlKeyDown = false; + + if (!this.state.keyboardEnabled) { + return; + } + + this.state.keyHandler.up(() => { + this.psv.dynamics.position.stop(); + this.psv.dynamics.zoom.stop(); + }); } /** @@ -378,9 +384,9 @@ export class EventsHandler extends AbstractService { if (!this.prop.twofingersTimeout) { this.prop.twofingersTimeout = setTimeout(() => { this.psv.overlay.show({ - id: IDS.TWO_FINGERS, + id : IDS.TWO_FINGERS, image: gestureIcon, - text: this.config.lang.twoFingers, + text : this.config.lang.twoFingers, }); }, TWOFINGERSOVERLAY_DELAY); } @@ -433,9 +439,9 @@ export class EventsHandler extends AbstractService { if (this.config.mousewheelCtrlKey && !this.state.ctrlKeyDown) { this.psv.overlay.show({ - id: IDS.CTRL_ZOOM, + id : IDS.CTRL_ZOOM, image: mousewheelIcon, - text: this.config.lang.ctrlZoom, + text : this.config.lang.ctrlZoom, }); clearTimeout(this.state.ctrlZoomTimeout); @@ -447,10 +453,9 @@ export class EventsHandler extends AbstractService { evt.preventDefault(); evt.stopPropagation(); - const delta = normalizeWheel(evt).spinY * 5; - + const delta = normalizeWheel(evt).spinY * 5 * this.config.zoomSpeed; if (delta !== 0) { - this.psv.zoom(this.prop.zoomLvl - delta * this.config.mousewheelSpeed); + this.psv.dynamics.zoom.step(-delta, 5); } } @@ -618,12 +623,15 @@ export class EventsHandler extends AbstractService { data.longitude = sphericalCoords.longitude; data.latitude = sphericalCoords.latitude; - // TODO: for cubemap, computes texture's index and coordinates - if (!this.prop.isCubemap) { + try { const textureCoords = this.psv.dataHelper.sphericalCoordsToTextureCoords(data); data.textureX = textureCoords.x; data.textureY = textureCoords.y; } + catch (e) { + data.textureX = NaN; + data.textureY = NaN; + } if (!this.state.dblclickTimeout) { this.psv.trigger(EVENTS.CLICK, data); @@ -659,13 +667,14 @@ export class EventsHandler extends AbstractService { const y = evt.clientY; const rotation = { - longitude: (x - this.state.mouseX) / this.prop.size.width * this.prop.moveSpeed * this.prop.hFov * SYSTEM.pixelRatio, - latitude : (y - this.state.mouseY) / this.prop.size.height * this.prop.moveSpeed * this.prop.vFov * SYSTEM.pixelRatio, + longitude: (x - this.state.mouseX) / this.prop.size.width * this.config.moveSpeed * THREE.Math.degToRad(this.prop.hFov), + latitude : (y - this.state.mouseY) / this.prop.size.height * this.config.moveSpeed * THREE.Math.degToRad(this.prop.vFov), }; + const currentPosition = this.psv.getPosition(); this.psv.rotate({ - longitude: this.prop.position.longitude - rotation.longitude, - latitude : this.prop.position.latitude + rotation.latitude, + longitude: currentPosition.longitude - rotation.longitude, + latitude : currentPosition.latitude + rotation.latitude, }); this.state.mouseX = x; @@ -685,10 +694,10 @@ export class EventsHandler extends AbstractService { __moveAbsolute(evt) { if (this.state.moving) { const containerRect = this.psv.container.getBoundingClientRect(); - this.psv.rotate({ + this.psv.dynamics.position.goto({ longitude: ((evt.clientX - containerRect.left) / containerRect.width - 0.5) * Math.PI * 2, latitude : -((evt.clientY - containerRect.top) / containerRect.height - 0.5) * Math.PI, - }); + }, 10); } } @@ -703,9 +712,9 @@ export class EventsHandler extends AbstractService { const p2 = { x: evt.touches[1].clientX, y: evt.touches[1].clientY }; const p = distance(p1, p2); - const delta = 80 * (p - this.state.pinchDist) / this.prop.size.width; + const delta = 80 * (p - this.state.pinchDist) / this.prop.size.width * this.config.zoomSpeed; - this.psv.zoom(this.prop.zoomLvl + delta); + this.psv.zoom(this.psv.getZoomLevel() + delta); this.__move({ clientX: (p1.x + p2.x) / 2, diff --git a/src/services/Renderer.js b/src/services/Renderer.js index 09972aa38..03bddea05 100644 --- a/src/services/Renderer.js +++ b/src/services/Renderer.js @@ -1,8 +1,8 @@ import * as THREE from 'three'; import { Animation } from '../Animation'; -import { CUBE_VERTICES, EVENTS, SPHERE_RADIUS, SPHERE_VERTICES } from '../data/constants'; +import { EVENTS, SPHERE_RADIUS } from '../data/constants'; import { SYSTEM } from '../data/system'; -import { isExtendedPosition, isNil, logWarn } from '../utils'; +import { each, isExtendedPosition, isNil } from '../utils'; import { AbstractService } from './AbstractService'; /** @@ -66,6 +66,12 @@ export class Renderer extends AbstractService { */ this.raycaster = null; + /** + * @member {number} + * @private + */ + this.timestamp = null; + /** * @member {HTMLElement} * @readonly @@ -139,7 +145,11 @@ export class Renderer extends AbstractService { * @package */ __renderLoop(timestamp) { - this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp); + const elapsed = this.timestamp !== null ? timestamp - this.timestamp : 0; + this.timestamp = timestamp; + + this.psv.trigger(EVENTS.BEFORE_RENDER, timestamp, elapsed); + each(this.psv.dynamics, d => d.update(elapsed)); if (this.prop.needsUpdate) { this.render(); @@ -156,7 +166,6 @@ export class Renderer extends AbstractService { * @fires PSV.render */ render() { - this.prop.direction = this.psv.dataHelper.sphericalCoordsToVector3(this.prop.position); this.camera.position.set(0, 0, 0); this.camera.lookAt(this.prop.direction); @@ -164,15 +173,25 @@ export class Renderer extends AbstractService { this.camera.position.copy(this.prop.direction).multiplyScalar(this.config.fisheye / 2).negate(); } - this.camera.aspect = this.prop.aspect; - this.camera.fov = this.prop.vFov; - this.camera.updateProjectionMatrix(); + this.updateCameraMatrix(); this.renderer.render(this.scene, this.camera); this.psv.trigger(EVENTS.RENDER); } + /** + * @summary Updates the camera matrix + * @package + */ + updateCameraMatrix() { + if (this.camera) { + this.camera.aspect = this.prop.aspect; + this.camera.fov = this.prop.vFov; + this.camera.updateProjectionMatrix(); + } + } + /** * @summary Applies the texture to the scene, creates the scene if needed * @param {PSV.TextureData} textureData @@ -180,29 +199,13 @@ export class Renderer extends AbstractService { * @package */ setTexture(textureData) { - const { texture, panoData } = textureData; - this.prop.panoData = panoData; - if (!this.scene) { this.__createScene(); } - if (this.prop.isCubemap) { - for (let i = 0; i < 6; i++) { - if (this.mesh.material[i].map) { - this.mesh.material[i].map.dispose(); - } - - this.mesh.material[i].map = texture[i]; - } - } - else { - if (this.mesh.material.map) { - this.mesh.material.map.dispose(); - } + this.prop.panoData = textureData.panoData; - this.mesh.material.map = texture; - } + this.psv.adapter.setTexture(this.mesh, textureData); this.psv.needsUpdate(); @@ -241,19 +244,11 @@ export class Renderer extends AbstractService { if (sphereCorrection) { const cleanCorrection = this.psv.dataHelper.cleanSphereCorrection(sphereCorrection); - if (!this.config.sphereCorrectionReorder) { - const nonZeros = (cleanCorrection.tilt !== 0) + (cleanCorrection.pan !== 0) + (cleanCorrection.roll !== 0); - if (nonZeros > 1) { - logWarn(`"sphereCorrection" computation will change in a future version. - Please set "sphereCorrectionReorder: true" and modify your correction accordingly.`); - } - } - mesh.rotation.set( cleanCorrection.tilt, cleanCorrection.pan, cleanCorrection.roll, - this.config.sphereCorrectionReorder ? 'ZXY' : 'XYZ' + 'ZXY' ); } else { @@ -272,18 +267,13 @@ export class Renderer extends AbstractService { this.renderer.setSize(this.prop.size.width, this.prop.size.height); this.renderer.setPixelRatio(SYSTEM.pixelRatio); - this.camera = new THREE.PerspectiveCamera(this.prop.vFov, this.prop.size.width / this.prop.size.height, 1, 3 * SPHERE_RADIUS); + this.camera = new THREE.PerspectiveCamera(this.prop.vFov, this.prop.size.width / this.prop.size.height, 1, 2 * SPHERE_RADIUS); this.camera.position.set(0, 0, 0); this.scene = new THREE.Scene(); this.scene.add(this.camera); - if (this.prop.isCubemap) { - this.mesh = this.__createCubemap(); - } - else { - this.mesh = this.__createSphere(); - } + this.mesh = this.psv.adapter.createMesh(); this.meshContainer = new THREE.Group(); this.meshContainer.add(this.mesh); @@ -294,49 +284,6 @@ export class Renderer extends AbstractService { this.canvasContainer.appendChild(this.renderer.domElement); } - /** - * @summary Creates the sphere mesh - * @param {number} [scale=1] - * @returns {external:THREE.Mesh} - * @private - */ - __createSphere(scale = 1) { - // The middle of the panorama is placed at longitude=0 - const geometry = new THREE.SphereGeometry(SPHERE_RADIUS * scale, SPHERE_VERTICES, SPHERE_VERTICES, -Math.PI / 2); - - const material = new THREE.MeshBasicMaterial({ - side: THREE.BackSide, - }); - - const mesh = new THREE.Mesh(geometry, material); - mesh.scale.set(-1, 1, 1); - - return mesh; - } - - /** - * @summary Creates the cube mesh - * @param {number} [scale=1] - * @returns {external:THREE.Mesh} - * @private - */ - __createCubemap(scale = 1) { - const cubeSize = SPHERE_RADIUS * 2 * scale; - const geometry = new THREE.BoxGeometry(cubeSize, cubeSize, cubeSize, CUBE_VERTICES, CUBE_VERTICES, CUBE_VERTICES); - - const materials = []; - for (let i = 0; i < 6; i++) { - materials.push(new THREE.MeshBasicMaterial({ - side: THREE.BackSide, - })); - } - - const mesh = new THREE.Mesh(geometry, materials); - mesh.scale.set(1, 1, -1); - - return mesh; - } - /** * @summary Performs transition between the current and a new texture * @param {PSV.TextureData} textureData @@ -345,57 +292,29 @@ export class Renderer extends AbstractService { * @package */ transition(textureData, options) { - const { texture, panoData } = textureData; - - let positionProvided = isExtendedPosition(options); + const positionProvided = isExtendedPosition(options); const zoomProvided = 'zoom' in options; const group = new THREE.Group(); - let mesh; - - if (this.prop.isCubemap) { - if (positionProvided) { - logWarn('cannot perform cubemap transition to different position'); - positionProvided = false; - } - - mesh = this.__createCubemap(0.9); - mesh.material.forEach((material, i) => { - material.map = texture[i]; - material.transparent = true; - material.opacity = 0; - }); - } - else { - mesh = this.__createSphere(0.9); - - mesh.material.map = texture; - mesh.material.transparent = true; - mesh.material.opacity = 0; - - this.setPanoramaPose(panoData, mesh); - this.setSphereCorrection(options.sphereCorrection, group); - } + const mesh = this.psv.adapter.createMesh(0.5); + this.psv.adapter.setTexture(mesh, textureData); + this.psv.adapter.setTextureOpacity(mesh, 0); + this.setPanoramaPose(options.panoData, mesh); + this.setSphereCorrection(options.sphereCorrection, group); // rotate the new sphere to make the target position face the camera if (positionProvided) { const cleanPosition = this.psv.dataHelper.cleanPosition(options); + const currentPosition = this.psv.getPosition(); // Longitude rotation along the vertical axis const verticalAxis = new THREE.Vector3(0, 1, 0); - group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - this.prop.position.longitude); + group.rotateOnWorldAxis(verticalAxis, cleanPosition.longitude - currentPosition.longitude); // Latitude rotation along the camera horizontal axis const horizontalAxis = new THREE.Vector3(0, 1, 0).cross(this.camera.getWorldDirection(new THREE.Vector3())).normalize(); - group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - this.prop.position.latitude); - - // TODO: find a better way to handle ranges - if (this.config.latitudeRange || this.config.longitudeRange) { - this.config.longitudeRange = null; - this.config.latitudeRange = null; - logWarn('trying to perform transition with longitudeRange and/or latitudeRange, ranges cleared'); - } + group.rotateOnWorldAxis(horizontalAxis, cleanPosition.latitude - currentPosition.latitude); } group.add(mesh); @@ -405,19 +324,12 @@ export class Renderer extends AbstractService { return new Animation({ properties: { opacity: { start: 0.0, end: 1.0 }, - zoom : zoomProvided ? { start: this.prop.zoomLvl, end: options.zoom } : undefined, + zoom : zoomProvided ? { start: this.psv.getZoomLevel(), end: options.zoom } : undefined, }, duration : options.transition, easing : 'outCubic', onTick : (properties) => { - if (this.prop.isCubemap) { - for (let i = 0; i < 6; i++) { - mesh.material[i].opacity = properties.opacity; - } - } - else { - mesh.material.opacity = properties.opacity; - } + this.psv.adapter.setTextureOpacity(mesh, properties.opacity); if (zoomProvided) { this.psv.zoom(properties.zoom); @@ -429,16 +341,13 @@ export class Renderer extends AbstractService { .then(() => { // remove temp sphere and transfer the texture to the main sphere this.setTexture(textureData); - this.scene.remove(group); + this.setPanoramaPose(options.panoData); + this.setSphereCorrection(options.sphereCorrection); + this.scene.remove(group); mesh.geometry.dispose(); mesh.geometry = null; - if (!this.prop.isCubemap) { - this.setPanoramaPose(panoData); - this.setSphereCorrection(options.sphereCorrection); - } - // actually rotate the camera if (positionProvided) { this.psv.rotate(options); diff --git a/src/services/TextureLoader.js b/src/services/TextureLoader.js index b790b4d10..2eef958c9 100644 --- a/src/services/TextureLoader.js +++ b/src/services/TextureLoader.js @@ -1,8 +1,4 @@ import * as THREE from 'three'; -import { CUBE_HASHMAP, CUBE_MAP } from '../data/constants'; -import { SYSTEM } from '../data/system'; -import { PSVError } from '../PSVError'; -import { firstNonNull, getXMPValue, logWarn, sum } from '../utils'; import { AbstractService } from './AbstractService'; /** @@ -24,6 +20,20 @@ export class TextureLoader extends AbstractService { * @private */ this.requests = []; + + /** + * @summary THREE file loader + * @type {external:THREE:FileLoader} + * @private + */ + this.loader = new THREE.FileLoader(); + this.loader.setResponseType('blob'); + if (this.config.withCredentials) { + this.loader.setWithCredentials(true); + } + if (this.config.requestHeaders && typeof this.config.requestHeaders === 'object') { + this.loader.setRequestHeader(this.config.requestHeaders); + } } /** @@ -36,42 +46,14 @@ export class TextureLoader extends AbstractService { /** * @summary Loads the panorama texture(s) - * @param {string|string[]|PSV.Cubemap} panorama + * @param {*} panorama * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] * @returns {Promise.} * @throws {PSV.PSVError} when the image cannot be loaded * @package */ loadTexture(panorama, newPanoData) { - const tempPanorama = []; - - if (Array.isArray(panorama)) { - if (panorama.length !== 6) { - throw new PSVError('Must provide exactly 6 image paths when using cubemap.'); - } - - // reorder images - for (let i = 0; i < 6; i++) { - tempPanorama[i] = panorama[CUBE_MAP[i]]; - } - - return this.__loadCubemapTexture(tempPanorama); - } - else if (typeof panorama === 'object') { - if (!CUBE_HASHMAP.every(side => !!panorama[side])) { - throw new PSVError('Must provide exactly left, front, right, back, top, bottom when using cubemap.'); - } - - // transform into array - CUBE_HASHMAP.forEach((side, i) => { - tempPanorama[i] = panorama[side]; - }); - - return this.__loadCubemapTexture(tempPanorama); - } - else { - return this.__loadEquirectangularTexture(panorama, newPanoData); - } + return this.psv.adapter.loadTexture(panorama, newPanoData); } /** @@ -87,22 +69,17 @@ export class TextureLoader extends AbstractService { * @param {string} url * @param {function(number)} [onProgress] * @returns {Promise} - * @private */ - __loadFile(url, onProgress) { + loadFile(url, onProgress) { + if (this.config.requestHeaders && typeof this.config.requestHeaders === 'function') { + this.loader.setRequestHeader(this.config.requestHeaders(url)); + } + return new Promise((resolve, reject) => { let progress = 0; onProgress && onProgress(progress); - const loader = new THREE.FileLoader(); - - if (this.config.withCredentials) { - loader.setWithCredentials(true); - } - - loader.setResponseType('blob'); - - const request = loader.load( + const request = this.loader.load( url, (result) => { const rIdx = this.requests.indexOf(request); @@ -140,11 +117,10 @@ export class TextureLoader extends AbstractService { * @summary Loads an Image using FileLoader to have progress events * @param {string} url * @param {function(number)} [onProgress] - * @returns {Promise} - * @private + * @returns {Promise} */ - __loadImage(url, onProgress) { - return this.__loadFile(url, onProgress) + loadImage(url, onProgress) { + return this.loadFile(url, onProgress) .then(result => new Promise((resolve, reject) => { const img = document.createElementNS('http://www.w3.org/1999/xhtml', 'img'); img.onload = () => { @@ -156,231 +132,13 @@ export class TextureLoader extends AbstractService { })); } - /** - * @summmary read a Blob as string - * @param {Blob} blob - * @returns {Promise} - * @private - */ - __loadBlobAsString(blob) { - return new Promise((resolve, reject) => { - const reader = new FileReader(); - reader.onload = () => resolve(reader.result); - reader.onerror = reject; - reader.readAsText(blob); - }); - } - - /** - * @summary Loads the sphere texture - * @param {string} panorama - * @param {PSV.PanoData | PSV.PanoDataProvider} [newPanoData] - * @returns {Promise.} - * @throws {PSV.PSVError} when the image cannot be loaded - * @private - */ - __loadEquirectangularTexture(panorama, newPanoData) { - if (this.prop.isCubemap === true) { - throw new PSVError('The viewer was initialized with an cubemap, cannot switch to equirectangular panorama.'); - } - - this.prop.isCubemap = false; - - return ( - !this.config.useXmpData - ? this.__loadImage(panorama, p => this.psv.loader.setProgress(p)) - .then(img => ({ img: img, xmpPanoData: null })) - : this.__loadXMP(panorama, p => this.psv.loader.setProgress(p)) - .then(xmpPanoData => this.__loadImage(panorama).then(img => ({ img, xmpPanoData }))) - ) - .then(({ img, xmpPanoData }) => { - if (typeof newPanoData === 'function') { - // eslint-disable-next-line no-param-reassign - newPanoData = newPanoData(img); - } - - const panoData = { - fullWidth : firstNonNull(newPanoData?.fullWidth, xmpPanoData?.fullWidth, img.width), - fullHeight : firstNonNull(newPanoData?.fullHeight, xmpPanoData?.fullHeight, img.height), - croppedWidth : firstNonNull(newPanoData?.croppedWidth, xmpPanoData?.croppedWidth, img.width), - croppedHeight: firstNonNull(newPanoData?.croppedHeight, xmpPanoData?.croppedHeight, img.height), - croppedX : firstNonNull(newPanoData?.croppedX, xmpPanoData?.croppedX, 0), - croppedY : firstNonNull(newPanoData?.croppedY, xmpPanoData?.croppedY, 0), - poseHeading : firstNonNull(newPanoData?.poseHeading, xmpPanoData?.poseHeading), - posePitch : firstNonNull(newPanoData?.posePitch, xmpPanoData?.posePitch), - poseRoll : firstNonNull(newPanoData?.poseRoll, xmpPanoData?.poseRoll), - }; - - if (panoData.croppedWidth !== img.width || panoData.croppedHeight !== img.height) { - logWarn(`Invalid panoData, croppedWidth and/or croppedHeight is not coherent with loaded image - panoData: ${panoData.croppedWidth}x${panoData.croppedHeight}, image: ${img.width}x${img.height}`); - } - - const texture = this.__createEquirectangularTexture(img, panoData); - - return { texture, panoData }; - }); - } - - /** - * @summary Loads the XMP data of an image - * @param {string} panorama - * @param {function(number)} [onProgress] - * @returns {Promise} - * @throws {PSV.PSVError} when the image cannot be loaded - * @private - */ - __loadXMP(panorama, onProgress) { - return this.__loadFile(panorama, onProgress) - .then(blob => this.__loadBlobAsString(blob)) - .then((binary) => { - const a = binary.indexOf(''); - const data = binary.substring(a, b); - - if (a !== -1 && b !== -1 && data.indexOf('GPano:') !== -1) { - return { - fullWidth : getXMPValue(data, 'FullPanoWidthPixels'), - fullHeight : getXMPValue(data, 'FullPanoHeightPixels'), - croppedWidth : getXMPValue(data, 'CroppedAreaImageWidthPixels'), - croppedHeight: getXMPValue(data, 'CroppedAreaImageHeightPixels'), - croppedX : getXMPValue(data, 'CroppedAreaLeftPixels'), - croppedY : getXMPValue(data, 'CroppedAreaTopPixels'), - poseHeading : getXMPValue(data, 'PoseHeadingDegrees'), - posePitch : getXMPValue(data, 'PosePitchDegrees'), - poseRoll : getXMPValue(data, 'PoseRollDegrees'), - }; - } - - return null; - }); - } - - /** - * @summary Creates the final texture from image and panorama data - * @param {Image} img - * @param {PSV.PanoData} panoData - * @returns {external:THREE.Texture} - * @private - */ - __createEquirectangularTexture(img, panoData) { - let texture; - - // resize image / fill cropped parts with black - if (panoData.fullWidth > SYSTEM.maxTextureWidth - || panoData.croppedWidth !== panoData.fullWidth - || panoData.croppedHeight !== panoData.fullHeight - ) { - const resizedPanoData = { ...panoData }; - - const ratio = SYSTEM.getMaxCanvasWidth() / panoData.fullWidth; - - if (ratio < 1) { - resizedPanoData.fullWidth *= ratio; - resizedPanoData.fullHeight *= ratio; - resizedPanoData.croppedWidth *= ratio; - resizedPanoData.croppedHeight *= ratio; - resizedPanoData.croppedX *= ratio; - resizedPanoData.croppedY *= ratio; - } - - const buffer = document.createElement('canvas'); - buffer.width = resizedPanoData.fullWidth; - buffer.height = resizedPanoData.fullHeight; - - const ctx = buffer.getContext('2d'); - ctx.drawImage(img, - resizedPanoData.croppedX, resizedPanoData.croppedY, - resizedPanoData.croppedWidth, resizedPanoData.croppedHeight); - - texture = new THREE.Texture(buffer); - } - else { - texture = new THREE.Texture(img); - } - - texture.needsUpdate = true; - texture.minFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - - return texture; - } - - /** - * @summary Load the six textures of the cube - * @param {string[]} panorama - * @returns {Promise.} - * @throws {PSV.PSVError} when the image cannot be loaded - * @private - */ - __loadCubemapTexture(panorama) { - if (this.prop.isCubemap === false) { - throw new PSVError('The viewer was initialized with an equirectangular panorama, cannot switch to cubemap.'); - } - - if (this.config.fisheye) { - logWarn('fisheye effect with cubemap texture can generate distorsion'); - } - - this.prop.isCubemap = true; - - const promises = []; - const progress = [0, 0, 0, 0, 0, 0]; - - for (let i = 0; i < 6; i++) { - promises.push( - this.__loadImage(panorama[i], (p) => { - progress[i] = p; - this.psv.loader.setProgress(sum(progress) / 6); - }) - .then(img => this.__createCubemapTexture(img)) - ); - } - - return Promise.all(promises) - .then(texture => ({ texture })); - } - - /** - * @summary Creates the final texture from image - * @param {Image} img - * @returns {external:THREE.Texture} - * @private - */ - __createCubemapTexture(img) { - let texture; - - // resize image - if (img.width > SYSTEM.maxTextureWidth) { - const buffer = document.createElement('canvas'); - const ratio = SYSTEM.getMaxCanvasWidth() / img.width; - - buffer.width = img.width * ratio; - buffer.height = img.height * ratio; - - const ctx = buffer.getContext('2d'); - ctx.drawImage(img, 0, 0, buffer.width, buffer.height); - - texture = new THREE.Texture(buffer); - } - else { - texture = new THREE.Texture(img); - } - - texture.needsUpdate = true; - texture.minFilter = THREE.LinearFilter; - texture.generateMipmaps = false; - - return texture; - } - /** * @summary Preload a panorama file without displaying it - * @param {string|string[]|PSV.Cubemap} panorama + * @param {*} panorama * @returns {Promise} */ preloadPanorama(panorama) { - return this.loadTexture(panorama); + return this.psv.adapter.loadTexture(panorama); } } diff --git a/src/styles/navbar.scss b/src/styles/navbar.scss index 58b8a16e8..29ba3ecdd 100644 --- a/src/styles/navbar.scss +++ b/src/styles/navbar.scss @@ -71,6 +71,19 @@ } } +.psv-button:not(.psv-button--disabled):focus-visible { + outline: 2px dotted currentColor; + outline-offset: -2px; +} + .psv-container:not(.psv--is-touch) .psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button-svg { transform: scale($psv-buttons-hover-scale); } + +.psv-move-button + .psv-move-button { + margin-left: -$psv-buttons-padding; +} + +.psv-custom-button { + width: auto; +} diff --git a/src/styles/panel.scss b/src/styles/panel.scss index 8ace6e41b..98053b314 100644 --- a/src/styles/panel.scss +++ b/src/styles/panel.scss @@ -191,6 +191,11 @@ height: 100%; } } + + &:focus-visible { + outline: 1px dotted currentColor; + outline-offset: -1px; + } } &--stripped &-item { diff --git a/src/utils/Dynamic.js b/src/utils/Dynamic.js new file mode 100644 index 000000000..ba4283a02 --- /dev/null +++ b/src/utils/Dynamic.js @@ -0,0 +1,191 @@ +import { bound } from './index'; + +/** + * @summary Represents a variable that can dynamically change with time (using requestAnimationFrame) + * @memberOf PSV + * @package + */ +export class Dynamic { + + static STOP = 0; + static INFINITE = 1; + static POSITION = 2; + + /** + * @param {Function} fn Callback function + * @param {number} [min] Minimum position + * @param {number} [max] Maximum position + */ + constructor(fn, min = -Infinity, max = Infinity) { + /** + * @type {Function} + * @private + * @readonly + */ + this.fn = fn; + + /** + * @type {number} + * @private + */ + this.mode = Dynamic.STOP; + + /** + * @type {number} + * @private + */ + this.speed = 0; + + /** + * @type {number} + * @private + */ + this.speedMult = 1; + + /** + * @type {number} + * @private + */ + this.currentSpeed = 0; + + /** + * @type {number} + * @private + */ + this.target = 0; + + /** + * @type {number} + * @readonly + */ + this.current = 0; + + /** + * @type {number} + * @private + */ + this.min = min; + + /** + * @type {number} + * @private + */ + this.max = max; + } + + /** + * Changes base speed + * @param {number} speed + */ + setSpeed(speed) { + this.speed = speed; + } + + /** + * Defines the target position + * @param {number} position + * @param {number} [speedMult=1] + */ + goto(position, speedMult = 1) { + this.mode = Dynamic.POSITION; + this.target = bound(position, this.min, this.max); + this.speedMult = speedMult; + } + + /** + * Increase/decrease the target position + * @param {number} step + * @param {number} [speedMult=1] + */ + step(step, speedMult = 1) { + if (this.mode !== Dynamic.POSITION) { + this.target = this.current; + } + this.goto(this.target + step, speedMult); + } + + /** + * Starts infinite movement + * @param {boolean} [invert=false] + * @param {number} [speedMult=1] + */ + roll(invert = false, speedMult = 1) { + this.mode = Dynamic.INFINITE; + this.target = invert ? -Infinity : Infinity; + this.speedMult = speedMult; + } + + /** + * Stops movement + */ + stop() { + this.mode = Dynamic.STOP; + } + + /** + * Defines the current position and immediately stops movement + * @param {number} values + */ + setValue(values) { + const next = bound(values, this.min, this.max); + this.target = next; + this.mode = Dynamic.STOP; + if (next !== this.current) { + this.current = next; + if (this.fn) { + this.fn(this.current); + } + return true; + } + return false; + } + + /** + * @package + */ + update(elapsed) { + // in position mode switch to stop mode when in the decceleration window + if (this.mode === Dynamic.POSITION) { + const dstStop = this.currentSpeed * this.currentSpeed / (this.speed * this.speedMult * 4); + if (Math.abs(this.target - this.current) <= dstStop) { + this.mode = Dynamic.STOP; + } + } + + // compute speed + let targetSpeed = this.mode === Dynamic.STOP ? 0 : this.speed * this.speedMult; + if (this.target < this.current) { + targetSpeed = -targetSpeed; + } + if (this.currentSpeed < targetSpeed) { + this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsed / 1000 * this.speed * this.speedMult * 2); + } + else if (this.currentSpeed > targetSpeed) { + this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsed / 1000 * this.speed * this.speedMult * 2); + } + + // compute new position + let next = null; + if (this.current > this.target && this.currentSpeed) { + next = Math.max(this.target, this.current + this.currentSpeed * elapsed / 1000); + } + else if (this.current < this.target && this.currentSpeed) { + next = Math.min(this.target, this.current + this.currentSpeed * elapsed / 1000); + } + + // apply value + if (next !== null) { + next = bound(next, this.min, this.max); + if (next !== this.current) { + this.current = next; + if (this.fn) { + this.fn(this.current); + } + return true; + } + } + + return false; + } + +} diff --git a/src/utils/DynamicXD.js b/src/utils/DynamicXD.js new file mode 100644 index 000000000..ae379af00 --- /dev/null +++ b/src/utils/DynamicXD.js @@ -0,0 +1,191 @@ +import { bound } from './math'; +import { each } from './misc'; + +/** + * @summary Implementation of {@link PSV.Dynamic} for any number of variables, unused + * @memberOf PSV + * @package + */ +export class DynamicXD { + + static STOP = 0; + static INFINITE = 1; + static POSITION = 2; + + get current() { + return this.reduce((values, _) => { + values[_.name] = _.current; + return values; + }, {}); + } + + constructor(fn, _) { + this.fn = fn; + this.mode = DynamicXD.STOP; + this.speed = 0; + this.speedMult = 1; + this.currentSpeed = 0; + this._ = {}; + each(_, (dim, name) => { + this._[name] = { + min : -Infinity, + max : Infinity, + ...dim, + name : name, + target : 0, + current: 0, + }; + }); + } + + forEach(fn) { + each(this._, fn); + } + + reduce(fn, init) { + return Object.keys(this._).reduce((acc, name) => fn(acc, this._[name]), init); + } + + /** + * Defines the target position + */ + goto(positions, speedMult = 1) { + this.mode = DynamicXD.POSITION; + this.speedMult = speedMult; + this.forEach((_) => { + if (_.name in positions) { + _.target = bound(positions[_.name], _.min, _.max); + } + }); + } + + /** + * Increase/decrease the target position + */ + step(steps, speedMult = 1) { + if (this.mode !== DynamicXD.POSITION) { + this.forEach((_) => { + _.target = _.current; + }); + } + this.mode = DynamicXD.POSITION; + this.speedMult = speedMult; + this.forEach((_) => { + if (_.name in steps) { + _.target = bound(_.target + steps[_.name], _.min, _.max); + } + }); + } + + /** + * Starts infinite movement + */ + roll(rolls, speedMult = 1) { + this.mode = DynamicXD.INFINITE; + this.speedMult = speedMult; + this.forEach((_) => { + if (_.name in rolls) { + _.target = rolls[_.name] ? -Infinity : Infinity; + } + else { + _.target = _.current; + } + }); + } + + /** + * Stops movement + */ + stop() { + this.mode = DynamicXD.STOP; + } + + /** + * Defines the current position and immediately stops movement + */ + setValue(values) { + this.mode = DynamicXD.STOP; + + const hasChanges = this.reduce((changes, _) => { + let changed = false; + if (_.name in values) { + const next = bound(values[_.name], _.min, _.max); + changed = next !== _.current; + _.current = next; + } + _.target = _.current; + return changes || changed; + }, false); + + if (hasChanges && this.fn) { + this.fn(this.current); + } + + return hasChanges; + } + + /** + * @package + */ + update(elapsed) { + const elapsedS = elapsed / 1000; + const acceleration = this.speed * this.speedMult * 2; + + // in position mode switch to stop mode when in the decceleration window + if (this.mode === DynamicXD.POSITION) { + const dstStop = this.currentSpeed * this.currentSpeed / (acceleration * 2); + const dstCurr = this.reduce((dst, _) => { + return dst + (_.target - _.current) * (_.target - _.current); + }, 0); + + if (dstCurr <= dstStop * dstStop) { // no Math.sqrt on dstCurr + this.mode = DynamicXD.STOP; + } + } + + // FIXME the speed should be different for each component (with sum = global speed) + // FIXME implement signed speed for smooth changes of direction + + // compute speed + const targetSpeed = this.mode === DynamicXD.STOP ? 0 : this.speed * this.speedMult; + if (this.currentSpeed < targetSpeed) { + this.currentSpeed = Math.min(targetSpeed, this.currentSpeed + elapsedS * acceleration); + } + else if (this.currentSpeed > targetSpeed) { + this.currentSpeed = Math.max(targetSpeed, this.currentSpeed - elapsedS * acceleration); + } + + if (this.currentSpeed) { + // compute position + const hasChanges = this.reduce((changes, _) => { + let next = null; + if (_.current > _.target) { + next = Math.max(_.target, _.current - this.currentSpeed * elapsedS); + } + else if (_.current < _.target) { + next = Math.min(_.target, _.current + this.currentSpeed * elapsedS); + } + + if (next !== null) { + next = bound(next, _.min, _.max); + if (next !== _.current) { + _.current = next; + return true; + } + } + + return changes; + }, false); + + // apply + if (hasChanges && this.fn) { + this.fn(this.current); + } + + return hasChanges; + } + + return false; + } + +} diff --git a/src/utils/MultiDynamic.js b/src/utils/MultiDynamic.js new file mode 100644 index 000000000..86c7d7ad0 --- /dev/null +++ b/src/utils/MultiDynamic.js @@ -0,0 +1,125 @@ +import { each } from './index'; + +/** + * @summary Wrapper for multiple {@link PSV.Dynamic} evolving together + * @memberOf PSV + * @package + */ +export class MultiDynamic { + + /** + * @type {Object} + * @readonly + */ + get current() { + const values = {}; + each(this.dynamics, (dynamic, name) => { + values[name] = dynamic.current; + }); + return values; + } + + /** + * @param {Record} dynamics + * @param {Function} fn Callback function + */ + constructor(dynamics, fn) { + /** + * @type {Function} + * @private + * @readonly + */ + this.fn = fn; + + /** + * @type {Record} + * @private + * @readonly + */ + this.dynamics = dynamics; + } + + /** + * Changes base speed + * @param {number} speed + */ + setSpeed(speed) { + each(this.dynamics, (d) => { + d.setSpeed(speed); + }); + } + + /** + * Defines the target positions + * @param {Record} positions + * @param {number} [speedMult=1] + */ + goto(positions, speedMult = 1) { + each(positions, (position, name) => { + this.dynamics[name].goto(position, speedMult); + }); + } + + /** + * Increase/decrease the target positions + * @param {Record} steps + * @param {number} [speedMult=1] + */ + step(steps, speedMult = 1) { + each(steps, (step, name) => { + this.dynamics[name].step(step, speedMult); + }); + } + + /** + * Starts infinite movements + * @param {Record} rolls + * @param {number} [speedMult=1] + */ + roll(rolls, speedMult = 1) { + each(rolls, (roll, name) => { + this.dynamics[name].roll(roll, speedMult); + }); + } + + /** + * Stops movements + */ + stop() { + each(this.dynamics, d => d.stop()); + } + + /** + * Defines the current positions and immediately stops movements + * @param {Record} values + */ + setValue(values) { + let hasUpdates = false; + each(values, (value, name) => { + hasUpdates |= this.dynamics[name].setValue(value); + }); + + if (hasUpdates && this.fn) { + this.fn(this.current); + } + + return hasUpdates; + } + + /** + * @package + */ + update(elapsed) { + let hasUpdates = false; + each(this.dynamics, (dynamic) => { + hasUpdates |= dynamic.update(elapsed); + }); + + if (hasUpdates && this.fn) { + this.fn(this.current); + } + + return hasUpdates; + } + +} diff --git a/src/utils/PressHandler.js b/src/utils/PressHandler.js new file mode 100644 index 000000000..e07184ab1 --- /dev/null +++ b/src/utils/PressHandler.js @@ -0,0 +1,43 @@ +/** + * @summary Helper for pressable things (buttons, keyboard) + * @description When the pressed thing goes up and was not pressed long enough, wait a bit more before execution + * @package + * @package + */ +export class PressHandler { + + constructor(delay = 200) { + this.delay = delay; + this.time = 0; + this.timeout = null; + } + + down() { + if (this.timeout) { + clearTimeout(this.timeout); + this.timeout = null; + } + + this.time = new Date().getTime(); + } + + up(cb) { + if (!this.time) { + return; + } + + const elapsed = new Date().getTime() - this.time; + if (elapsed < this.delay) { + this.timeout = setTimeout(() => { + cb(); + this.timeout = null; + this.time = 0; + }, this.delay); + } + else { + cb(); + this.time = 0; + } + } + +} diff --git a/src/utils/PressHandler.spec.js b/src/utils/PressHandler.spec.js new file mode 100644 index 000000000..5c6c649c9 --- /dev/null +++ b/src/utils/PressHandler.spec.js @@ -0,0 +1,32 @@ +import assert from 'assert'; +import { PressHandler } from './PressHandler'; + +describe('utils:PressHandler', () => { + it('should wait at least X ms before exec', (done) => { + const handler = new PressHandler(100); + + const start = new Date().getTime(); + + handler.down(); + handler.up(() => { + const elapsed = new Date().getTime() - start; + assert.ok(elapsed >= 100); + done(); + }); + }); + + it('should exec immediately if X ms already elapsed', (done) => { + const handler = new PressHandler(100); + + handler.down(); + + setTimeout(() => { + const start = new Date().getTime(); + handler.up(() => { + const elapsed = new Date().getTime() - start; + assert.ok(elapsed < 5); + done(); + }); + }, 200); + }); +}); diff --git a/src/utils/index.js b/src/utils/index.js index 7101b875a..54ea944e5 100644 --- a/src/utils/index.js +++ b/src/utils/index.js @@ -2,7 +2,7 @@ * @namespace PSV.utils */ -export * from './browser.js'; -export * from './math.js'; -export * from './misc.js'; -export * from './psv.js'; +export * from './browser'; +export * from './math'; +export * from './misc'; +export * from './psv'; diff --git a/src/utils/math.js b/src/utils/math.js index b4323be2b..d99615885 100644 --- a/src/utils/math.js +++ b/src/utils/math.js @@ -83,7 +83,7 @@ export function getAngle(position1, position2) { } /** - * Returns the distance between two points on a sphere of radius one + * @summary Returns the distance between two points on a sphere of radius one * @memberOf PSV.utils * @param {number[]} p1 * @param {number[]} p2 diff --git a/src/utils/misc.js b/src/utils/misc.js index a20e750f4..55ed11ed1 100644 --- a/src/utils/misc.js +++ b/src/utils/misc.js @@ -1,5 +1,5 @@ /** - * @summary Transforms a string to dash-case{@link https://github.com/shahata/dasherize} + * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize} * @memberOf PSV.utils * @param {string} str * @returns {string} @@ -185,6 +185,7 @@ export function intersect(array1, array2) { /** * @summary Returns if a valu is null or undefined + * @memberOf PSV.utils * @param {*} val * @return {boolean} */ diff --git a/src/utils/psv.js b/src/utils/psv.js index a33ebb083..bee87be0f 100644 --- a/src/utils/psv.js +++ b/src/utils/psv.js @@ -2,6 +2,23 @@ import * as THREE from 'three'; import { PSVError } from '../PSVError'; import { bound } from './math'; +/** + * @summary Returns the plugin constructor from the imported object + * For retrocompatibility with previous default exports + * @memberOf PSV.utils + * @package + */ +export function pluginInterop(plugin, target) { + if (plugin) { + for (const [, p] of [['_', plugin], ...Object.entries(plugin)]) { + if (p.prototype instanceof target) { + return p; + } + } + } + return null; +} + /** * @summary Displays a warning in the console * @memberOf PSV.utils @@ -66,7 +83,7 @@ const CSS_POSITIONS = { * @memberOf PSV.utils * @description The implementation is as close as possible to the "background-position" specification * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position} - * @param {string|object} value + * @param {string|PSV.Point} value * @returns {PSV.Point} */ export function parsePosition(value) { @@ -225,3 +242,17 @@ export function parseAngle(angle, zeroCenter = false, halfCircle = zeroCenter) { return zeroCenter ? bound(parsed - Math.PI, -Math.PI / (halfCircle ? 2 : 1), Math.PI / (halfCircle ? 2 : 1)) : parsed; } + +/** + * @summary Creates a THREE texture from an image + * @memberOf PSV.utils + * @param {HTMLImageElement | HTMLCanvasElement} img + * @return {external:THREE.Texture} + */ +export function createTexture(img) { + const texture = new THREE.Texture(img); + texture.needsUpdate = true; + texture.minFilter = THREE.LinearFilter; + texture.generateMipmaps = false; + return texture; +} diff --git a/tests/package.json b/tests/package.json new file mode 100644 index 000000000..a691b573c --- /dev/null +++ b/tests/package.json @@ -0,0 +1,10 @@ +{ + "name": "photo-sphere-viewer-tests", + "version": "1.0.0", + "license": "MIT", + "private": true, + "scripts": { + "pretest": "cpx \"../dist/**\" \"node_modules/photo-sphere-viewer/dist\" && cpx \"../package.json\" \"node_modules/photo-sphere-viewer\"", + "test": "tsc types/index.ts" + } +} diff --git a/tests/types/.gitignore b/tests/types/.gitignore new file mode 100644 index 000000000..a6c7c2852 --- /dev/null +++ b/tests/types/.gitignore @@ -0,0 +1 @@ +*.js diff --git a/tests/types/CustomPlugin.ts b/tests/types/CustomPlugin.ts new file mode 100644 index 000000000..7314512d6 --- /dev/null +++ b/tests/types/CustomPlugin.ts @@ -0,0 +1,15 @@ +import { AbstractPlugin, Viewer } from 'photo-sphere-viewer'; + +export class CustomPlugin extends AbstractPlugin { + + static id = 'custom'; + + constructor(psv: Viewer) { + super(psv); + } + + doSomething() { + + } + +} diff --git a/tests/types/index.ts b/tests/types/index.ts new file mode 100644 index 000000000..a6e990891 --- /dev/null +++ b/tests/types/index.ts @@ -0,0 +1,77 @@ +import { CONSTANTS, Viewer } from 'photo-sphere-viewer'; +import { EquirectangularTilesAdapter, EquirectangularTilesPanorama } from 'photo-sphere-viewer/dist/adapters/equirectangular-tiles'; +import { MarkersPlugin, MarkersPluginOptions } from 'photo-sphere-viewer/dist/plugins/markers'; +import { CustomPlugin } from './CustomPlugin'; + +const viewer = new Viewer({ + container: 'container', + adapter: EquirectangularTilesAdapter, + plugins: [ + [MarkersPlugin, { + clickEventOnMarker: true, + } as MarkersPluginOptions], + CustomPlugin, + ], +}); + +viewer.setPanorama({ + baseUrl: 'small.jpg', + width: 16000, + cols: 8, + rows: 4, +} as EquirectangularTilesPanorama, { + transition: false, +}) + .then(() => { + + }); + +viewer.animate({ + longitude: 0, + latitude: 0, + speed: '2rpm', +}) + .then(() => { + + }); + +viewer.zoom(50); + +viewer.setOption('useXmpData', true); + +viewer.setOptions({ + useXmpData: false, +}); + +viewer.navbar.setCaption('Test'); + +viewer.panel.show({ + content: 'Content', + clickHandler: (e: MouseEvent) => null, +}); + +viewer.once('ready', e => { + +}); + +viewer.on('position-updated', (e, position) => { + const longitude: number = position.longitude; +}); + +viewer.on(CONSTANTS.CHANGE_EVENTS.GET_ANIMATE_POSITION, (e, position) => { + return {longitude: position.longitude + 0.1, latitude: position.latitude + 0.1}; +}); + +const markers = viewer.getPlugin(MarkersPlugin); +markers.on('select-marker', (e, marker) => { + const markerId: string = marker.id; +}); +markers.on(MarkersPlugin.EVENTS.UNSELECT_MARKER, (e, marker) => { + const markerId: string = marker.id; +}); + +const customPlugin = viewer.getPlugin(CustomPlugin); +customPlugin.doSomething(); + +const customPluginAgain = viewer.getPlugin('custom'); +customPluginAgain.doSomething(); diff --git a/types/Animation.d.ts b/types/Animation.d.ts new file mode 100644 index 000000000..af6f5cff0 --- /dev/null +++ b/types/Animation.d.ts @@ -0,0 +1,35 @@ +export type AnimationOptions = { + properties: { [K: string]: { start: number, end: number } }; + duration: number; + delay?: number; + easing?: string | ((progress: number) => number); + onTick: (properties: { [K: string]: number }, progress: number) => void; +}; + +/** + * @summary Interpolation helper for animations + * @description + * Implements the Promise API with an additional "cancel" and "finally" methods. + * The promise is resolved when the animation is complete and rejected if the animation is cancelled. + */ +export class Animation implements Promise { + + constructor(options: AnimationOptions); + + // @ts-ignore + then(onFulfilled?: (() => void | Animation | PromiseLike) | undefined | null, onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + // @ts-ignore + catch(onRejected?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + // @ts-ignore + finally(onFinally?: (() => void | Animation | PromiseLike) | undefined | null): Animation; + + cancel(); + + /** + * @summary Returns a resolved animation promise + */ + static resolve(): Animation; + +} diff --git a/types/PSVError.d.ts b/types/PSVError.d.ts new file mode 100644 index 000000000..7300a10b1 --- /dev/null +++ b/types/PSVError.d.ts @@ -0,0 +1,6 @@ +/** + * @summary Custom error used in the lib + */ +export class PSVError extends Error { + name: 'PSVError'; +} diff --git a/types/Viewer.d.ts b/types/Viewer.d.ts new file mode 100644 index 000000000..b32f18605 --- /dev/null +++ b/types/Viewer.d.ts @@ -0,0 +1,391 @@ +import { Vector3 } from 'three'; +import { Event, EventEmitter } from 'uevent'; +import { AdapterConstructor } from './adapters/AbstractAdapter'; +import { Animation } from './Animation'; +import { Loader } from './components/Loader'; +import { Navbar } from './components/Navbar'; +import { Notification } from './components/Notification'; +import { Overlay } from './components/Overlay'; +import { Panel } from './components/Panel'; +import { Tooltip } from './components/Tooltip'; +import { + AnimateOptions, + ClickData, + CssSize, + ExtendedPosition, + NavbarCustomButton, + PanoData, + PanoDataProvider, + PanoramaOptions, + Position, + Size +} from './models'; +import { AbstractPlugin, PluginConstructor } from './plugins/AbstractPlugin'; +import { DataHelper } from './services/DataHelper'; +import { TextureLoader } from './services/TextureLoader'; +import { TooltipRenderer } from './services/TooltipRenderer'; + +/** + * @summary Viewer options, see {@link http://photo-sphere-viewer.js.org/guide/config.html} + */ +export type ViewerOptions = { + container: HTMLElement | string; + panorama?: string; + adapter?: AdapterConstructor | [AdapterConstructor, any]; + caption?: string; + loadingImg?: string; + loadingTxt?: string; + size?: Size; + fisheye?: boolean; + minFov?: number; + maxFov?: number; + defaultZoomLvl?: number; + defaultLong?: number; + defaultLat?: number; + sphereCorrection?: { pan?: number, tilt?: number, roll?: number }, + moveSpeed?: number; + zoomSpeed?: number; + autorotateDelay?: null, + autorotateSpeed?: string | number; + autorotateLat?: number; + moveInertia?: boolean; + mousewheel?: boolean; + mousemove?: boolean; + captureCursor?: boolean; + mousewheelCtrlKey?: boolean; + touchmoveTwoFingers?: boolean; + useXmpData?: boolean; + panoData?: PanoData | PanoDataProvider; + requestHeaders?: Record | ((url: string) => Record); + canvasBackground?: string; + withCredentials?: boolean; + navbar?: string | Array, + lang?: Record, + keyboard?: Record, + plugins?: Array | [PluginConstructor, any]>, +}; + +/** + * Internal properties of the viewer + */ +export type ViewerProps = { + ready: boolean; + uiRefresh: boolean; + needsUpdate: boolean; + fullscreen: boolean; + direction: Vector3; + vFov: number; + hFov: number; + aspect: number; + autorotateEnabled: boolean; + animationPromise: Animation; + loadingPromise: Promise; + startTimeout: any; + size: Size; + panoData: PanoData; +}; + +/** + * Main class + */ +export class Viewer extends EventEmitter { + + /** + * Configuration holder + */ + readonly config: ViewerOptions; + + /** + * Internal properties + */ + prop: ViewerProps; + + /** + * Top most parent + */ + readonly parent: HTMLElement; + + /** + * Main container + */ + readonly container: HTMLElement; + + /** + * Textures loader + */ + readonly textureLoader: TextureLoader; + + /** + * Utilities to help converting data + */ + readonly dataHelper: DataHelper; + + readonly loader: Loader; + + readonly navbar: Navbar; + + readonly panel: Panel; + + readonly tooltip: TooltipRenderer; + + readonly notification: Notification; + + readonly overlay: Overlay; + + /** + * @throws {PSVError} when the configuration is incorrect + */ + constructor(options: ViewerOptions); + + /** + * @summary Destroys the viewer + * @description The memory used by the ThreeJS context is not totally cleared. This will be fixed as soon as possible. + */ + destroy(); + + /** + * @summary Returns the instance of a plugin if it exists + */ + getPlugin(pluginId: string | PluginConstructor): T; + + /** + * @summary Returns the current position of the camera + */ + getPosition(): Position; + + /** + * @summary Returns the current zoom level + */ + getZoomLevel(): number; + + /** + * @summary Returns the current viewer size + */ + getSize(): Size; + + /** + * @summary Checks if the automatic rotation is enabled + */ + isAutorotateEnabled(): boolean; + + /** + * @summary Checks if the viewer is in fullscreen + */ + isFullscreenEnabled(): boolean; + + /** + * @summary Flags the view has changed for the next render + */ + needsUpdate(); + + /** + * @summary Resizes the canvas when the window is resized + */ + autoSize(); + + /** + * @summary Loads a new panorama file + * @description Loads a new panorama file, optionally changing the camera position/zoom and activating the transition animation.
      + * If the "options" parameter is not defined, the camera will not move and the ongoing animation will continue.
      + * If another loading is already in progress it will be aborted. + */ + setPanorama(panorama: any, options?: PanoramaOptions): Promise; + + /** + * @summary Update options + */ + setOptions(options: Partial); + + /** + * @summary Update options + */ + setOption(option: K, value: ViewerOptions[K]); + + /** + * @summary Starts the automatic rotation + */ + startAutorotate(); + + /** + * @summary Stops the automatic rotation + */ + stopAutorotate(); + + /** + * @summary Starts or stops the automatic rotation + */ + toggleAutorotate(); + + /** + * @summary Displays an error message + */ + showError(message: string); + + /** + * @summary Hides the error message + */ + hideError(); + + /** + * @summary Rotates the view to specific longitude and latitude + */ + rotate(position: ExtendedPosition); + + /** + * @summary Rotates and zooms the view with a smooth animation + */ + animate(options: AnimateOptions): Animation; + + /** + * @summary Stops the ongoing animation + * @description The return value is a Promise because the is no guaranty the animation can be stopped synchronously. + */ + stopAnimation(): Promise; + + /** + * @summary Zooms to a specific level between `max_fov` and `min_fov` + */ + zoom(level: number); + + /** + * @summary Increases the zoom level + * @param {number} [step=1] + */ + zoomIn(step?: number); + + /** + * @summary Decreases the zoom level + * @param {number} [step=1] + */ + zoomOut(step?: number); + + /** + * @summary Resizes the viewer + */ + resize(size: CssSize); + + /** + * @summary Enters the fullscreen mode + */ + enterFullscreen(); + + /** + * @summary Exits the fullscreen mode + */ + exitFullscreen(); + + /** + * @summary Enters or exits the fullscreen mode + */ + toggleFullscreen(); + + /** + * @summary Enables the keyboard controls (done automatically when entering fullscreen) + */ + startKeyboardControl(); + + /** + * @summary Disables the keyboard controls (done automatically when exiting fullscreen) + */ + stopKeyboardControl(); + + /** + * @summary Triggered when the automatic rotation is enabled/disabled + */ + on(e: 'autorotate', cb: (e: Event, enabled: true) => void): this; + /** + * @summary Triggered before a render, used to modify the view + */ + on(e: 'before-render', cb: (e: Event, timestamp: number, elapsed: number) => void): this; + /** + * @summary Triggered before a rotate operation, can be cancelled + */ + on(e: 'before-rotate', cb: (e: Event, position: ExtendedPosition) => void): this; + /** + * @summary Triggered when the user clicks on the viewer (everywhere excluding the navbar and the side panel) + */ + on(e: 'click', cb: (e: Event, data: ClickData) => void): this; + /** + * @summary Trigered when the panel is closed + */ + on(e: 'close-panel', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Triggered after a call to setOption/setOptions + */ + on(e: 'config-changed', cb: (e: Event, options: string[]) => void): this; + /** + * @summary Triggered when the user double clicks on the viewer. The simple `click` event is always fired before `dblclick` + */ + on(e: 'dblclick', cb: (e: Event, data: ClickData) => void): this; + /** + * @summary Triggered when the fullscreen mode is enabled/disabled + */ + on(e: 'fullscreen-updated', cb: (e: Event, enabled: true) => void): this; + /** + * @summary Called to alter the target position of an animation + */ + on(e: 'get-animate-position', cb: (e: Event, position: Position) => Position): this; + /** + * @summary Called to alter the target position of a rotation + */ + on(e: 'get-rotate-position', cb: (e: Event, position: Position) => Position): this; + /** + * @summary Triggered when the notification is hidden + */ + on(e: 'hide-notification', cb: (e: Event) => void): this; + /** + * @summary Triggered when the overlay is hidden + */ + on(e: 'hide-overlay', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Trigered when the tooltip is hidden + */ + on(e: 'hide-tooltip', cb: (e: Event, data: any) => void): this; + /** + * @summary Triggered when the panel is opened + */ + on(e: 'open-panel', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Triggered when a panorama image has been loaded + */ + on(e: 'panorama-loaded', cb: (e: Event) => void): this; + /** + * @summary Triggered when the view longitude and/or latitude changes + */ + on(e: 'position-updated', cb: (e: Event, position: Position) => void): this; + + /** + * @summary Triggered when the panorama image has been loaded and the viewer is ready to perform the first render + */ + once(e: 'ready', cb: (e: Event) => void): this; + + /** + * @summary Triggered on each viewer render, **this event is triggered very often** + */ + on(e: 'render', cb: (e: Event) => void): this; + /** + * @summary Trigered when the notification is shown + */ + on(e: 'show-notification', cb: (e: Event) => void): this; + /** + * @summary Trigered when the overlay is shown + */ + on(e: 'show-overlay', cb: (e: Event, id: string | undefined) => void): this; + /** + * @summary Trigered when the tooltip is shown + */ + on(e: 'show-tooltip', cb: (e: Event, data: any, tooltip: Tooltip) => void): this; + /** + * @summary Triggered when the viewer size changes + */ + on(e: 'size-updated', cb: (e: Event, size: Size) => void): this; + /** + * @summary Triggered when all current animations are stopped + */ + on(e: 'stop-all', cb: (e: Event) => void): this; + /** + * @summary Triggered when the zoom level changes + */ + on(e: 'zoom-updated', cb: (e: Event, zoom: number) => void): this; + +} diff --git a/types/adapters/AbstractAdapter.d.ts b/types/adapters/AbstractAdapter.d.ts new file mode 100644 index 000000000..ccea98e2f --- /dev/null +++ b/types/adapters/AbstractAdapter.d.ts @@ -0,0 +1,50 @@ +import { Mesh } from 'three'; +import { PanoData, PanoDataProvider, TextureData } from '../models'; +import { Viewer } from '../Viewer'; + +/** + * @summary Base adapters class + */ +export abstract class AbstractAdapter { + + /** + * @summary Unique identifier of the adapter + */ + static id: string; + + /** + * @summary Indicates if the adapter supports transitions between panoramas + */ + static supportsTransition: boolean; + + constructor(parent: Viewer); + + /** + * @summary Destroys the adapter + */ + destroy(); + + /** + * @summary Loads the panorama texture(s) + */ + loadTexture(panorama: any, newPanoData?: PanoData | PanoDataProvider): Promise; + + /** + * @summary Creates the cube mesh + * @param {number} [scale=1] + */ + createMesh(scale?: number): Mesh; + + /** + * @summary Applies the texture to the mesh + */ + setTexture(mesh: Mesh, textureData: TextureData); + + /** + * @summary Changes the opacity of the mesh + */ + setTextureOpacity(mesh: Mesh, opacity: number); + +} + +export type AdapterConstructor = new (psv: Viewer, options?: any) => T; diff --git a/types/adapters/cubemap/index.d.ts b/types/adapters/cubemap/index.d.ts new file mode 100644 index 000000000..e6df849d5 --- /dev/null +++ b/types/adapters/cubemap/index.d.ts @@ -0,0 +1,22 @@ +import { AbstractAdapter, TextureData } from '../..'; + +/** + * @summary Object defining a cubemap + */ +export type Cubemap = string[6] | { + top: string; + right: string; + bottom: string; + left: string; + front: string; + back: string; +}; + +/** + * @summary Adapter for cubemaps + */ +export class CubemapAdapter extends AbstractAdapter { + + loadTexture(panorama: Cubemap): Promise; + +} diff --git a/types/adapters/equirectangular-tiles/index.d.ts b/types/adapters/equirectangular-tiles/index.d.ts new file mode 100644 index 000000000..b68f619fa --- /dev/null +++ b/types/adapters/equirectangular-tiles/index.d.ts @@ -0,0 +1,28 @@ +import { AbstractAdapter, TextureData, Viewer } from '../..'; + +/** + * @summary Configuration of a tiled panorama + */ +export type EquirectangularTilesPanorama = { + baseUrl?: string; + width: number; + cols: number; + rows: number; + tileUrl: (col: number, row: number) => string; +}; + +export type EquirectangularTilesAdapterOptions = { + showErrorTile?: boolean; + baseBlur?: boolean; +} + +/** + * @summary Adapter for tiled panoramas + */ +export class EquirectangularTilesAdapter extends AbstractAdapter { + + constructor(psv: Viewer, options: EquirectangularTilesAdapterOptions); + + loadTexture(panorama: EquirectangularTilesPanorama): Promise; + +} diff --git a/types/adapters/equirectangular/index.d.ts b/types/adapters/equirectangular/index.d.ts new file mode 100644 index 000000000..6fbc26138 --- /dev/null +++ b/types/adapters/equirectangular/index.d.ts @@ -0,0 +1,10 @@ +import { AbstractAdapter, PanoData, PanoDataProvider, TextureData } from '../..'; + +/** + * @summary Adapter for equirectangular panoramas + */ +export class EquirectangularAdapter extends AbstractAdapter { + + loadTexture(panorama: string, newPanoData?: PanoData | PanoDataProvider): Promise; + +} diff --git a/types/buttons/AbstractButton.d.ts b/types/buttons/AbstractButton.d.ts new file mode 100644 index 000000000..aa643ae00 --- /dev/null +++ b/types/buttons/AbstractButton.d.ts @@ -0,0 +1,56 @@ +import { AbstractComponent } from '../components/AbstractComponent'; +import { Navbar } from '../components/Navbar'; + +/** + * @summary Base navbar button class + */ +export abstract class AbstractButton extends AbstractComponent { + + /** + * @summary Unique identifier of the button + */ + static id: string; + + /** + * @summary SVG icon name injected in the button + */ + static icon?: string; + + /** + * @summary SVG icon name injected in the button when it is active + */ + static iconActive?: string; + + constructor(navbar: Navbar, className?: string, collapsable?: boolean); + + /** + * @summary Checks if the button can be displayed + */ + isSupported(): boolean | { initial: boolean, promise: Promise }; + + /** + * @summary Changes the active state of the button + */ + toggleActive(active?: boolean); + + /** + * @summary Disables the button + */ + disable(); + + /** + * @summary Enables the button + */ + enable(); + + /** + * @summary Collapses the button in the navbar menu + */ + collapse(); + + /** + * @summary Uncollapses the button from the navbar menu + */ + uncollapse(); + +} diff --git a/types/components/AbstractComponent.d.ts b/types/components/AbstractComponent.d.ts new file mode 100644 index 000000000..6c57b28b4 --- /dev/null +++ b/types/components/AbstractComponent.d.ts @@ -0,0 +1,30 @@ +import { Viewer } from '../Viewer'; + +/** + * @summary Base component class + */ +export abstract class AbstractComponent { + + constructor(parent: Viewer | AbstractComponent, className?: string); + + /** + * @summary Displays the component + */ + show(options?: any); + + /** + * @summary Hides the component + */ + hide(options?: any); + + /** + * @summary Displays or hides the component + */ + toggle(); + + /** + * @summary Check if the component is visible + */ + isVisible(options?: any): boolean; + +} diff --git a/types/components/Loader.d.ts b/types/components/Loader.d.ts new file mode 100644 index 000000000..6b2186a5b --- /dev/null +++ b/types/components/Loader.d.ts @@ -0,0 +1,14 @@ +import { AbstractComponent } from './AbstractComponent'; + +/** + * @summary Loader class + */ +export class Loader extends AbstractComponent { + + /** + * @summary Sets the loader progression + * @param value + */ + setProgress(value: number); + +} diff --git a/types/components/Navbar.d.ts b/types/components/Navbar.d.ts new file mode 100644 index 000000000..2a45e21ff --- /dev/null +++ b/types/components/Navbar.d.ts @@ -0,0 +1,30 @@ +import { AbstractButton } from '../buttons/AbstractButton'; +import { NavbarCustomButton } from '../models'; +import { AbstractComponent } from './AbstractComponent'; + +/** + * @summary Register a new button available for all viewers + */ +export function registerButton(button: typeof AbstractButton); + +/** + * @summary Navigation bar class + */ +export class Navbar extends AbstractComponent { + + /** + * @summary Change the buttons visible on the navbar + */ + setButtons(buttons: string | Array); + + /** + * @summary Sets the bar caption + */ + setCaption(html: string); + + /** + * @summary Returns a button by its identifier + */ + getButton(id: string): AbstractButton; + +} diff --git a/types/components/Notification.d.ts b/types/components/Notification.d.ts new file mode 100644 index 000000000..6b040321a --- /dev/null +++ b/types/components/Notification.d.ts @@ -0,0 +1,15 @@ +import { AbstractComponent } from './AbstractComponent'; + +export type NotificationOptions = { + content: string; + timeout?: number; +}; + +/** + * @summary Notification class + */ +export class Notification extends AbstractComponent { + + show(config: string | NotificationOptions); + +} diff --git a/types/components/Overlay.d.ts b/types/components/Overlay.d.ts new file mode 100644 index 000000000..3701e0d08 --- /dev/null +++ b/types/components/Overlay.d.ts @@ -0,0 +1,22 @@ +import { AbstractComponent } from './AbstractComponent'; + +export type OverlayOptions = { + id?: string; + image: string; + text: string; + subtext?: string; + dissmisable?: boolean; +}; + +/** + * @summary Overlay class + */ +export class Overlay extends AbstractComponent { + + show(config: string | OverlayOptions); + + hide(id?: string); + + isVisible(id?: string): boolean; + +} diff --git a/types/components/Panel.d.ts b/types/components/Panel.d.ts new file mode 100644 index 000000000..42180a39a --- /dev/null +++ b/types/components/Panel.d.ts @@ -0,0 +1,22 @@ +import { AbstractComponent } from './AbstractComponent'; + +export type PanelOptions = { + id?: string; + content: string; + noMargin?: boolean; + width?: string; + clickHandler?: (e: MouseEvent) => {}; +}; + +/** + * @summary Panel class + */ +export class Panel extends AbstractComponent { + + show(config: string | PanelOptions); + + hide(id?: string); + + isVisible(id?: string): boolean; + +} diff --git a/types/components/Tooltip.d.ts b/types/components/Tooltip.d.ts new file mode 100644 index 000000000..d2386737c --- /dev/null +++ b/types/components/Tooltip.d.ts @@ -0,0 +1,35 @@ +import { AbstractComponent } from './AbstractComponent'; + +/** + * Object defining the tooltip position + */ +export type TooltipPosition = { + top: number; + left: number; + position?: string | string[]; + box?: { width: number, height: number }; +}; + +/** + * Object defining the tooltip configuration + */ +export type TooltipOptions = TooltipPosition & { + content: string; + className?: string; + data?: any; +}; + +export class Tooltip extends AbstractComponent { + + /** + * Do not call this method directly, use {@link TooltipRenderer} instead. + */ + show(options: TooltipOptions); + + /** + * @summary Moves the tooltip to a new position + * @throws {PSVError} when the configuration is incorrect + */ + move(position: TooltipPosition); + +} diff --git a/types/data/config.d.ts b/types/data/config.d.ts new file mode 100644 index 000000000..4a6d644a2 --- /dev/null +++ b/types/data/config.d.ts @@ -0,0 +1,6 @@ +import { ViewerOptions } from '../Viewer'; + +/** + * @summary Default options + */ +export const DEFAULTS: ViewerOptions; diff --git a/types/data/constants.d.ts b/types/data/constants.d.ts new file mode 100644 index 000000000..457157d18 --- /dev/null +++ b/types/data/constants.d.ts @@ -0,0 +1,108 @@ +/** + * @summary Property name added to viewer element + */ +export const VIEWER_DATA: 'photoSphereViewer'; + +/** + * @summary Available actions + */ +export const ACTIONS: { + ROTATE_LAT_UP: 'rotateLatitudeUp', + ROTATE_LAT_DOWN: 'rotateLatitudeDown', + ROTATE_LONG_RIGHT: 'rotateLongitudeRight', + ROTATE_LONG_LEFT: 'rotateLongitudeLeft', + ZOOM_IN: 'zoomIn', + ZOOM_OUT: 'zoomOut', + TOGGLE_AUTOROTATE: 'toggleAutorotate', +}; + +/** + * @summary Available events names + */ +export const EVENTS: { + AUTOROTATE: 'autorotate', + BEFORE_RENDER: 'before-render', + BEFORE_ROTATE: 'before-rotate', + CLICK: 'click', + CLOSE_PANEL: 'close-panel', + CONFIG_CHANGED: 'config-changed', + DOUBLE_CLICK: 'dblclick', + FULLSCREEN_UPDATED: 'fullscreen-updated', + HIDE_NOTIFICATION: 'hide-notification', + HIDE_OVERLAY: 'hide-overlay', + HIDE_TOOLTIP: 'hide-tooltip', + OPEN_PANEL: 'open-panel', + PANORAMA_LOADED: 'panorama-loaded', + POSITION_UPDATED: 'position-updated', + READY: 'ready', + RENDER: 'render', + SHOW_NOTIFICATION: 'show-notification', + SHOW_OVERLAY: 'show-overlay', + SHOW_TOOLTIP: 'show-tooltip', + SIZE_UPDATED: 'size-updated', + STOP_ALL: 'stop-all', + ZOOM_UPDATED: 'zoom-updated', +}; + +/** + * @summary Available change events names + */ +export const CHANGE_EVENTS: { + GET_ANIMATE_POSITION: 'get-animate-position', + GET_ROTATE_POSITION: 'get-rotate-position', +}; + +/** + * @summary Collection of easing functions + * @see {@link https://gist.github.com/frederickk/6165768} + */ +export const EASINGS: { + linear: (t: number) => number, + + inQuad: (t: number) => number, + outQuad: (t: number) => number, + inOutQuad: (t: number) => number, + + inCubic: (t: number) => number, + outCubic: (t: number) => number, + inOutCubic: (t: number) => number, + + inQuart: (t: number) => number, + outQuart: (t: number) => number, + inOutQuart: (t: number) => number, + + inQuint: (t: number) => number, + outQuint: (t: number) => number, + inOutQuint: (t: number) => number, + + inSine: (t: number) => number, + outSine: (t: number) => number, + inOutSine: (t: number) => number, + + inExpo: (t: number) => number, + outExpo: (t: number) => number, + inOutExpo: (t: number) => number, + + inCirc: (t: number) => number, + outCirc: (t: number) => number, + inOutCirc: (t: number) => number, +}; + +/** + * @summary Subset of key codes + */ +export const KEY_CODES: { + Enter : 'Enter', + Control : 'Control', + Escape : 'Escape', + Space : ' ', + PageUp : 'PageUp', + PageDown : 'PageDown', + ArrowLeft : 'ArrowLeft', + ArrowUp : 'ArrowUp', + ArrowRight: 'ArrowRight', + ArrowDown : 'ArrowDown', + Delete : 'Delete', + Plus : '+', + Minus : '-', +}; diff --git a/types/data/system.d.ts b/types/data/system.d.ts new file mode 100644 index 000000000..093f87f0a --- /dev/null +++ b/types/data/system.d.ts @@ -0,0 +1,13 @@ +/** + * @summary General information about the system + */ +export const SYSTEM: { + loaded: boolean; + pixelRatio: number; + isWebGLSupported: boolean; + maxTextureWidth: number; + mouseWheelEvent: string; + fullscreenEvent: string; + getMaxCanvasWidth: () => number; + isTouchEnabled: Promise; +}; diff --git a/types/index.d.ts b/types/index.d.ts new file mode 100644 index 000000000..9bab38fd8 --- /dev/null +++ b/types/index.d.ts @@ -0,0 +1,23 @@ +import * as CONSTANTS from './/data/constants'; +import * as utils from './utils'; + +export * from './models'; +export * from './data/constants'; +export * from './data/config'; +export * from './data/system'; +export * from './adapters/AbstractAdapter'; +export * from './buttons/AbstractButton'; +export * from './plugins/AbstractPlugin'; +export * from './Animation'; +export * from './PSVError'; +export * from './components/Navbar'; +export * from './components/Loader'; +export * from './components/Notification'; +export * from './components/Overlay'; +export * from './components/Panel'; +export * from './components/Tooltip'; +export * from './services/DataHelper'; +export * from './services/TextureLoader'; +export * from './services/TooltipRenderer'; +export * from './Viewer'; +export { CONSTANTS, utils }; diff --git a/types/models.d.ts b/types/models.d.ts new file mode 100644 index 000000000..0ab07a259 --- /dev/null +++ b/types/models.d.ts @@ -0,0 +1,121 @@ +import { Texture } from 'three'; + +/** + * Object defining a point + */ +export type Point = { + x: number; + y: number; +} + +/** + * Object defining a size + */ +export type Size = { + width: number; + height: number; +} + +/** + * Object defining a size in CSS (px, % or auto) + */ +export type CssSize = { + width: string; + height: string; +} + +export type SphereCorrection = { + pan?: number; + tilt?: number; + roll?: number; +} + +/** + * Object defining a spherical position + */ +export type Position = { + longitude: number; + latitude: number; +} + +/** + * Object defining a spherical or texture position + */ +export type ExtendedPosition = Position | Point; + +/** + * Object defining animation options + */ +export type AnimateOptions = ExtendedPosition & { + speed: string | number; + zoom?: number; +}; + +/** + * Crop information of the panorama + */ +export type PanoData = { + fullWidth: number; + fullHeight: number; + croppedWidth: number; + croppedHeight: number; + croppedX: number; + croppedY: number; + poseHeading?: number; + posePitch?: number; + poseRoll?: number; +} + +/** + * Function to compute panorama data once the image is loaded + */ +export type PanoDataProvider = (image: HTMLImageElement) => PanoData; + +/** + * Object defining panorama and animation options + */ +export type PanoramaOptions = (ExtendedPosition | {}) & { + zoom?: number; + transition?: boolean | number; + showLoader?: boolean; + sphereCorrection?: SphereCorrection; + panoData?: PanoData | PanoDataProvider; +}; + +/** + * Result of the AbstractAdapter#loadTexture method + */ +export type TextureData = { + texture: Texture | Texture[] | Record; + panoData?: PanoData; +}; + +/** + * Data of the `click` event + */ +export type ClickData = { + rightclick: boolean; + clientX: number; + clientY: number; + viewerX: number; + viewerY: number; + longitude: number; + latitude: number; + textureX?: number; + textureY?: number; + marker?: any; +} + +/** + * Definition of a custom navbar button + */ +export type NavbarCustomButton = { + id?: string; + title?: string; + content?: string; + className?: string; + onClick: () => void; + disabled?: boolean; + visible?: boolean; + collapsable?: boolean; +}; diff --git a/types/plugins/AbstractPlugin.d.ts b/types/plugins/AbstractPlugin.d.ts new file mode 100644 index 000000000..a14b4aa2e --- /dev/null +++ b/types/plugins/AbstractPlugin.d.ts @@ -0,0 +1,23 @@ +import { EventEmitter } from 'uevent'; +import { Viewer } from '../Viewer'; + +/** + * @summary Base plugins class + */ +export abstract class AbstractPlugin extends EventEmitter { + + /** + * @summary Unique identifier of the plugin + */ + static id: string; + + constructor(psv: Viewer); + + /** + * @summary Destroys the plugin + */ + destroy(); + +} + +export type PluginConstructor = new (psv: Viewer, options?: any) => T; diff --git a/types/plugins/autorotate-keypoints/index.d.ts b/types/plugins/autorotate-keypoints/index.d.ts new file mode 100644 index 000000000..d43afd4e5 --- /dev/null +++ b/types/plugins/autorotate-keypoints/index.d.ts @@ -0,0 +1,30 @@ +import { AbstractPlugin, ExtendedPosition, Viewer } from '../..'; + +/** + * @summary Definition of keypoints for automatic rotation, can be a position object, a marker id or an object with the following properties + */ +export type AutorotateKeypoint = string | ExtendedPosition | { + markerId?: string; + position?: ExtendedPosition; + tooltip?: string | { content: string, position: string }; + pause?: number; +}; + +export type AutorotateKeypointsPluginOptions = { + startFromClosest?: boolean; + keypoints?: AutorotateKeypoint[]; +} + +/** + * @summary Replaces the standard autorotate animation by a smooth transition between multiple points + */ +export class AutorotateKeypointsPlugin extends AbstractPlugin { + + constructor(psv: Viewer, options: AutorotateKeypointsPluginOptions); + + /** + * @summary Changes the keypoints + */ + setKeypoints(keypoints: AutorotateKeypoint[]); + +} diff --git a/types/plugins/gyroscope/index.d.ts b/types/plugins/gyroscope/index.d.ts new file mode 100644 index 000000000..329a584e8 --- /dev/null +++ b/types/plugins/gyroscope/index.d.ts @@ -0,0 +1,46 @@ +import { AbstractPlugin, Viewer, PSVError } from '../..'; +import { Event } from 'uevent'; + +export type GyroscopePluginOptions = { + touchmove?: boolean; + absolutePosition?: boolean; +}; + +/** + * @summary Adds gyroscope controls on mobile devices + */ +export class GyroscopePlugin extends AbstractPlugin { + + static EVENTS: { + GYROSCOPE_UPDATED: 'gyroscope-updated', + }; + + constructor(psv: Viewer, options: GyroscopePluginOptions); + + /** + * @summary Checks if the gyroscope is enabled + */ + isEnabled(): boolean; + + /** + * @summary Enables the gyroscope navigation if available + * @throws {PSVError} if the gyroscope API is not available/granted + */ + start(): Promise; + + /** + * @summary Disables the gyroscope navigation + */ + stop(); + + /** + * @summary Enables or disables the gyroscope navigation + */ + toggle(); + + /** + * @summary Triggered when the gyroscope mode is enabled/disabled + */ + on(e: 'gyroscope-updated', cb: (e: Event, enabled: boolean) => void): this; + +} diff --git a/types/plugins/markers/index.d.ts b/types/plugins/markers/index.d.ts new file mode 100644 index 000000000..497ae69e3 --- /dev/null +++ b/types/plugins/markers/index.d.ts @@ -0,0 +1,281 @@ +import { AbstractPlugin, Animation, ExtendedPosition, PSVError, Viewer } from '../..'; +import { Event } from 'uevent'; + +export type MarkerType = + 'image' + | 'html' + | 'square' + | 'rect' + | 'circle' + | 'ellipse' + | 'path' + | 'polygonPx' + | 'polygonRad' + | 'polylinePx' + | 'polylineRad'; + +/** + * @summary Marker properties + */ +export type MarkerProperties = Partial & { + image?: string; + html?: string; + square?: number; + rect?: [number, number] | { width: number, height: number }; + circle?: number; + ellipse?: [number, number] | { cx: number, cy: number }; + path?: string; + polygonPx?: [number, number][]; + polygonRad?: [number, number][]; + polylinePx?: [number, number][]; + polylineRad?: [number, number][]; + + id: string; + width?: number; + height?: number; + scale?: number | [number, number]; + className?: string; + style?: Record; + svgStyle?: Record; + anchor?: string; + visible?: boolean; + tooltip?: string | { content: string, position?: string }; + content?: string; + hideList?: boolean; + data?: any; +}; + +/** + * @summary Data of the `select-marker` event + */ +export type SelectMarkerData = { + dblclick: boolean; + rightclick: boolean; +}; + +export type MarkersPluginOptions = { + clickEventOnMarker?: boolean; + markers?: MarkerProperties[]; +}; + +/** + * @summary Object representing a marker + */ +export class Marker { + + private constructor(); + + readonly id: string; + readonly type: MarkerType; + readonly visible: boolean; + readonly config: MarkerProperties; + readonly data?: any; + + /** + * @summary Checks if it is a normal marker (image or html) + */ + isNormal(): boolean; + + /** + * @summary Checks if it is a polygon/polyline marker + */ + isPoly(): boolean; + + /** + * @summary Checks if it is a polygon/polyline using pixel coordinates + */ + isPolyPx(): boolean; + + /** + * @summary Checks if it is a polygon/polyline using radian coordinates + */ + isPolyRad(): boolean; + + /** + * @summary Checks if it is a polygon marker + */ + isPolygon(): boolean; + + /** + * @summary Checks if it is a polyline marker + */ + isPolyline(): boolean; + + /** + * @summary Checks if it is an SVG marker + */ + isSvg(): boolean; + +} + +/** + * @summary Displays various markers on the viewer + */ +export class MarkersPlugin extends AbstractPlugin { + + static EVENTS: { + GOTO_MARKER_DONE : 'goto-marker-done', + LEAVE_MARKER : 'leave-marker', + OVER_MARKER : 'over-marker', + RENDER_MARKERS_LIST: 'render-markers-list', + SELECT_MARKER : 'select-marker', + SELECT_MARKER_LIST : 'select-marker-list', + UNSELECT_MARKER : 'unselect-marker', + HIDE_MARKERS : 'hide-markers', + SHOW_MARKERS : 'show-markers', + }; + + constructor(psv: Viewer, options: MarkersPluginOptions); + + /** + * @summary Toggles the visibility of all tooltips + */ + toggleAllTooltips(); + + /** + * @summary Displays all tooltips + */ + showAllTooltips(); + + /** + * @summary Hides all tooltips + */ + hideAllTooltips(); + + /** + * @summary Return the total number of markers + * @returns {number} + */ + getNbMarkers(): number; + + /** + * @summary Adds a new marker to viewer + * @returns {PSV.plugins.MarkersPlugin.Marker} + * @throws {PSVError} when the marker's id is missing or already exists + */ + addMarker(properties: MarkerProperties, render?: boolean): Marker; + + /** + * @summary Returns the internal marker object for a marker id + * @throws {PSVError} when the marker cannot be found + */ + getMarker(markerId: string): Marker; + + /** + * @summary Returns the last marker selected by the user + */ + getCurrentMarker(): Marker; + + /** + * @summary Updates the existing marker with the same id + * @description Every property can be changed but you can't change its type (Eg: `image` to `html`). + */ + updateMarker(properties: MarkerProperties, render?: boolean): Marker; + + /** + * @summary Removes a marker from the viewer + */ + removeMarker(markerId: string, render?: boolean); + + /** + * @summary Replaces all markers + */ + setMarkers(markers: MarkerProperties[], render?: boolean); + + /** + * @summary Removes all markers + */ + clearMarkers(render?: boolean); + + /** + * @summary Rotate the view to face the marker + */ + gotoMarker(markerId: string, speed: string | number): Animation; + + /** + * @summary Hides a marker + */ + hideMarker(markerId: string); + + /** + * @summary Shows a marker + */ + showMarker(markerId: string); + + /** + * @summary Toggles a marker + */ + toggleMarker(markerId: string); + + /** + * @summary Opens the panel with the content of the marker + */ + showMarkerPanel(markerId: string); + + /** + * @summary Toggles the visibility of markers list + */ + toggleMarkersList(); + + /** + * @summary Opens side panel with list of markers + */ + showMarkersList(); + + /** + * @summary Closes side panel if it contains the list of markers + */ + hideMarkersList(); + + /** + * @summary Updates the visibility and the position of all markers + */ + renderMarkers(); + + /** + * @summary Triggered when the animation to a marker is done + */ + on(e: 'goto-marker-done', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when the user puts the cursor away from a marker + */ + on(e: 'leave-marker', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when the user puts the cursor hover a marker + */ + on(e: 'over-marker', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Used to alter the list of markers displayed on the side-panel + */ + on(e: 'render-markers-list', cb: (e: Event, markers: Marker[]) => Marker[]): this; + + /** + * @summary Triggered when the user clicks on a marker. The marker can be retrieved from outside the event handler + * with {@link MarkersPlugin.getCurrentMarker} + */ + on(e: 'select-marker', cb: (e: Event, marker: Marker, data: SelectMarkerData) => void): this; + + /** + * @summary Triggered when a marker is selected from the side panel + */ + on(e: 'select-marker-list', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when a marker was selected and the user clicks elsewhere + */ + on(e: 'unselect-marker', cb: (e: Event, marker: Marker) => void): this; + + /** + * @summary Triggered when the markers are hidden + */ + on(e: 'hide-markers', cb: (e: Event) => void): this; + + /** + * @summary Triggered when the markers are shown + */ + on(e: 'show-markers', cb: (e: Event) => void): this; + +} diff --git a/types/plugins/resolution/index.d.ts b/types/plugins/resolution/index.d.ts new file mode 100644 index 000000000..8bf38042a --- /dev/null +++ b/types/plugins/resolution/index.d.ts @@ -0,0 +1,45 @@ +import { AbstractPlugin, Viewer } from '../..'; +import { Event } from 'uevent'; + +export type Resolution = { + id: string; + label: string; + panorama: any; +}; + +export type ResolutionPluginOptions = { + resolutions: Resolution[]; +}; + +/** + * @summary Adds a setting to choose between multiple resolutions of the panorama. + */ +export class ResolutionPlugin extends AbstractPlugin { + + static EVENTS: { + RESOLUTION_CHANGED: 'resolution-changed', + }; + + constructor(psv: Viewer, options: ResolutionPluginOptions); + + /** + * @summary Changes the available resolutions + */ + setResolutions(resolutions: Resolution[]); + + /** + * @summary Changes the current resolution + */ + setResolution(id: string); + + /** + * @summary Returns the current resolution + */ + getResolution(): string; + + /** + * @summary Triggered when the resolution is changed + */ + on(e: 'resolution-changed', cb: (e: Event, resolutionId: string) => void): this; + +} diff --git a/types/plugins/settings/index.d.ts b/types/plugins/settings/index.d.ts new file mode 100644 index 000000000..9fbea11a4 --- /dev/null +++ b/types/plugins/settings/index.d.ts @@ -0,0 +1,73 @@ +import { AbstractPlugin, Viewer } from '../..'; + +/** + * @summary Description of a setting + */ +export type BaseSetting = { + id: string; + label: string; +}; + +/** + * @summary Description of a 'options' setting + */ +export type OptionsSetting = BaseSetting & { + type: 'options'; + current: () => string; + options: () => SettingOption[] + apply: (string) => void; +}; + +/** + * @summary Description of a 'toggle' setting + */ +export type ToggleSetting = BaseSetting & { + type: 'toggle'; + active: () => boolean; + toggle: () => void; +}; + +/** + * @summary Option of an 'option' setting + */ +export type SettingOption = { + id: string; + label: string; +}; + +export type Setting = OptionsSetting | ToggleSetting; + +/** + * @summary Adds a button to access various settings. + */ +export class SettingsPlugin extends AbstractPlugin { + + constructor(psv: Viewer); + + /** + * @summary Registers a new setting + */ + addSetting(setting: Setting); + + /** + * @summary Removes a setting + * @param {string} id + */ + removeSetting(id: string); + + /** + * @summary Toggles the settings panel + */ + toggleSettings(); + + /** + * @summary Hides the settings panel + */ + hideSettings(); + + /** + * @summary Shows the settings panel + */ + showSettings(); + +} diff --git a/types/plugins/stereo/index.d.ts b/types/plugins/stereo/index.d.ts new file mode 100644 index 000000000..b29851434 --- /dev/null +++ b/types/plugins/stereo/index.d.ts @@ -0,0 +1,41 @@ +import { AbstractPlugin, Viewer, PSVError } from '../..'; +import { Event } from 'uevent'; + +/** + * @summary Adds stereo view on mobile devices + */ +export class StereoPlugin extends AbstractPlugin { + + static EVENTS: { + STEREO_UPDATED: 'stereo-updated', + }; + + constructor(psv: Viewer); + + /** + * @summary Checks if the stereo view is enabled + */ + isEnabled(): boolean; + + /** + * @summary Enables the stereo view + * @throws {PSVError} if the gyroscope API is not available/granted + */ + start(): Promise; + + /** + * @summary Disables the stereo view + */ + stop(); + + /** + * @summary Enables or disables the stereo view + */ + toggle(); + + /** + * @summary Triggered when the stereo view is enabled/disabled + */ + on(e: 'stereo-updated', cb: (e: Event, enabled: boolean) => void): this; + +} diff --git a/types/plugins/visible-range/index.d.ts b/types/plugins/visible-range/index.d.ts new file mode 100644 index 000000000..3b3001690 --- /dev/null +++ b/types/plugins/visible-range/index.d.ts @@ -0,0 +1,31 @@ +import { AbstractPlugin, Viewer } from '../..'; + +export type VisibleRangePluginOptions = { + latitudeRange?: number[] | string[]; + longitudeRange?: number[] | string[]; + usePanoData: boolean; +}; + +/** + * @summary Locks visible longitude and/or latitude + */ +export class VisibleRangePlugin extends AbstractPlugin { + + constructor(psv: Viewer, options: VisibleRangePluginOptions); + + /** + * @summary Changes the latitude range + */ + setLatitudeRange(range: number[] | string[]); + + /** + * @summary Changes the longitude range + */ + setLongitudeRange(range: number[] | string[]); + + /** + * @summary Changes the latitude and longitude ranges according the current panorama cropping data + */ + setRangesFromPanoData() + +} diff --git a/types/services/DataHelper.d.ts b/types/services/DataHelper.d.ts new file mode 100644 index 000000000..e78c3834b --- /dev/null +++ b/types/services/DataHelper.d.ts @@ -0,0 +1,74 @@ +import { Vector3 } from 'three'; +import { ExtendedPosition, Point, Position, SphereCorrection } from '../models'; + +/** + * @summary Collections of data converters for the current viewer + */ +export class DataHelper { + + /** + * @summary Converts vertical FOV to zoom level + */ + fovToZoomLevel(fov: number): number; + + /** + * @summary Converts zoom level to vertical FOV + */ + zoomLevelToFov(level: number): number; + + /** + * @summary Convert vertical FOV to horizontal FOV + */ + vFovToHFov(vFov: number): number; + + /** + * @summary Converts a speed into a duration from current position to a new position + */ + speedToDuration(value: string | number, angle: number): number; + + /** + * @summary Converts pixel texture coordinates to spherical radians coordinates + */ + textureCoordsToSphericalCoords(point: Point): Position; + + /** + * @summary Converts spherical radians coordinates to pixel texture coordinates + */ + sphericalCoordsToTextureCoords(position: Position): Point; + + /** + * @summary Converts spherical radians coordinates to a THREE.Vector3 + */ + sphericalCoordsToVector3(position: Position): Vector3; + + /** + * @summary Converts a THREE.Vector3 to spherical radians coordinates + */ + vector3ToSphericalCoords(vector: Vector3): Position; + + /** + * @summary Converts position on the viewer to a THREE.Vector3 + */ + viewerCoordsToVector3(point: Point): Vector3; + + /** + * @summary Converts a THREE.Vector3 to position on the viewer + */ + vector3ToViewerCoords(vector: Vector3): Point; + + /** + * @summary Converts spherical radians coordinates to position on the viewer + */ + sphericalCoordsToViewerCoords(position: Position): Point; + + /** + * @summary Converts x/y to latitude/longitude if present and ensure boundaries + */ + cleanPosition(position: ExtendedPosition): Position; + + /** + * @summary Ensure a SphereCorrection object is valid + */ + cleanSphereCorrection(sphere: SphereCorrection): SphereCorrection; + +} diff --git a/types/services/TextureLoader.d.ts b/types/services/TextureLoader.d.ts new file mode 100644 index 000000000..760e3ac67 --- /dev/null +++ b/types/services/TextureLoader.d.ts @@ -0,0 +1,11 @@ +/** + * @summary Texture loader + */ +export class TextureLoader { + + /** + * @summary Preload a panorama file without displaying it + */ + preloadPanorama(panorama: any): Promise; + +} diff --git a/types/services/TooltipRenderer.d.ts b/types/services/TooltipRenderer.d.ts new file mode 100644 index 000000000..00587c7a9 --- /dev/null +++ b/types/services/TooltipRenderer.d.ts @@ -0,0 +1,15 @@ +import { Tooltip, TooltipOptions } from '../components/Tooltip'; +import { AbstractComponent } from '../components/AbstractComponent'; + +/** + * @summary Tooltip renderer + */ +export class TooltipRenderer extends AbstractComponent { + + /** + * @summary Displays a tooltip on the viewer + * @throws {PSVError} when the configuration is incorrect + */ + create(config: TooltipOptions): Tooltip; + +} diff --git a/types/utils/browser.d.ts b/types/utils/browser.d.ts new file mode 100644 index 000000000..459e9c0ff --- /dev/null +++ b/types/utils/browser.d.ts @@ -0,0 +1,57 @@ +/** + * @summary Toggles a CSS class + */ +export function toggleClass(element: HTMLElement | SVGElement, className: string, active?: boolean); + +/** + * @summary Adds one or several CSS classes to an element + */ +export function addClasses(element: HTMLElement, className: string); + +/** + * @summary Removes one or several CSS classes to an element + */ +export function removeClasses(element: HTMLElement, className: string); + +/** + * @summary Searches if an element has a particular parent at any level including itself + */ +export function hasParent(el: HTMLElement, parent: HTMLElement): boolean; + +/** + * @summary Gets the closest parent (can by itself) + */ +export function getClosest(el: HTMLElement | SVGElement, selector: string): HTMLElement; + +/** + * @summary Returns the key name of a KeyboardEvent + */ +export function getEventKey(evt: KeyboardEvent): string; + +/** + * @summary Detects if fullscreen is enabled + */ +export function isFullscreenEnabled(elt: HTMLElement): boolean; + +/** + * @summary Enters fullscreen mode + */ +export function requestFullscreen(elt: HTMLElement); + +/** + * @summary Exits fullscreen mode + */ +export function exitFullscreen(); + +/** + * @summary Gets an element style + */ +export function getStyle(elt: HTMLElement, prop: string): any; + +/** + * @summary Normalize mousewheel values accross browsers + * @description From Facebook's Fixed Data Table + * {@link https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js} + * @copyright Facebook + */ +export function normalizeWheel(event: WheelEvent): { spinX: number, spinY: number, pixelX: number, pixelY: number }; diff --git a/types/utils/index.d.ts b/types/utils/index.d.ts new file mode 100644 index 000000000..cbba0232b --- /dev/null +++ b/types/utils/index.d.ts @@ -0,0 +1,4 @@ +export * from './browser.d.js'; +export * from './math.d.js'; +export * from './misc.d.js'; +export * from './psv.d.js'; diff --git a/types/utils/math.d.ts b/types/utils/math.d.ts new file mode 100644 index 000000000..de9db6ff8 --- /dev/null +++ b/types/utils/math.d.ts @@ -0,0 +1,36 @@ +import { Point, Position } from '../models'; + +/** + * @summary Ensures that a number is in a given interval + */ +export function bound(x: number, min: number, max: number): number; + +/** + * @summary Checks if a value is an integer + */ +export function isInteger(value: any): boolean; + +/** + * @summary Computes the sum of an array + */ +export function sum(array: number[]): number; + +/** + * @summary Computes the distance between two points + */ +export function distance(p1: Point, p2: Point): number; + +/** + * @summary Compute the shortest offset between two longitudes + */ +export function getShortestArc(from: number, to: number): number; + +/** + * @summary Computes the angle between the current position and a target position + */ +export function getAngle(position1: Position, position2: Position): number; + +/** + * @summary Returns the distance between two points on a sphere of radius one + */ +export function greatArcDistance(p1: number[], p2: number[]): number; diff --git a/types/utils/misc.d.ts b/types/utils/misc.d.ts new file mode 100644 index 000000000..feb96cfc8 --- /dev/null +++ b/types/utils/misc.d.ts @@ -0,0 +1,58 @@ +/** + * @summary Transforms a string to dash-case {@link https://github.com/shahata/dasherize} + */ + +export function dasherize(str: string): string; + +/** + * @summary Returns a function, that, when invoked, will only be triggered at most once during a given window of time. + * @copyright underscore.js - modified by Clément Prévost {@link http://stackoverflow.com/a/27078401} + */ +export function throttle(func: Function, wait: number): Function; + +/** + * @summary Test if an object is a plain object + * @description Test if an object is a plain object, i.e. is constructed + * by the built-in Object constructor and inherits directly from Object.prototype + * or null. Some built-in objects pass the test, e.g. Math which is a plain object + * and some host or exotic objects may pass also. + * {@link http://stackoverflow.com/a/5878101/1207670} + */ +export function isPlainObject(obj: any): boolean; + +/** + * @summary Merges the enumerable attributes of two objects + * @description Replaces arrays and alters the target object. + * @copyright Nicholas Fisher + */ +export function deepmerge(target: object, src: object): object; + +/** + * @summary Deeply clones an object + */ +export function clone(src: object): object; + +/** + * @summery Test of an object is empty + */ +export function isEmpty(obj: object): boolean; + +/** + * @summary Loops over enumerable properties of an object + */ +export function each(object: object, callback: (value: any, key: string) => void); + +/** + * @summary Returns the intersection between two arrays + */ +export function intersect(array1: T[], array2: T[]): T[]; + +/** + * @summary Returns if a valu is null or undefined + */ +export function isNil(val: any): val is null | undefined; + +/** + * @summary Returns the first non null non undefined parameter + */ +export function firstNonNull(...values: any[]): any; diff --git a/types/utils/psv.d.ts b/types/utils/psv.d.ts new file mode 100644 index 000000000..1ef152f9a --- /dev/null +++ b/types/utils/psv.d.ts @@ -0,0 +1,46 @@ +import { Texture } from 'three'; +import { ExtendedPosition, Point } from '../models'; + +/** + * @summary Displays a warning in the console + */ +export function logWarn(message: string); + +/** + * @summary Checks if an object is a {PSV.ExtendedPosition}, ie has x/y or longitude/latitude + */ +export function isExtendedPosition(object: any): object is ExtendedPosition; + +/** + * @summary Returns the value of a given attribute in the panorama metadata + */ +export function getXMPValue(data: string, attr: string): number | null; + +/** + * @summary Translate CSS values like "top center" or "10% 50%" as top and left positions + * @description The implementation is as close as possible to the "background-position" specification + * {@link https://developer.mozilla.org/en-US/docs/Web/CSS/background-position} + */ +export function parsePosition(value: string | Point): Point; + +/** + * @summary Parses an speed + * @param speed - The speed, in radians/degrees/revolutions per second/minute + * @returns radians per second + * @throws {PSVError} when the speed cannot be parsed + */ +export function parseSpeed(speed: string | number): number; + +/** + * @summary Parses an angle value in radians or degrees and returns a normalized value in radians + * @param {string|number} angle - eg: 3.14, 3.14rad, 180deg + * @param {boolean} [zeroCenter=false] - normalize between -Pi - Pi instead of 0 - 2*Pi + * @param {boolean} [halfCircle=zeroCenter] - normalize between -Pi/2 - Pi/2 instead of -Pi - Pi + * @throws {PSVError} when the angle cannot be parsed + */ +export function parseAngle(angle: string | number, zeroCenter?: boolean, halfCircle?: boolean): number; + +/** + * @summary Creates a THREE texture from an image + */ +export function createTexture(img: HTMLImageElement | HTMLCanvasElement): Texture;