diff --git a/.sass-lint.yml b/.sass-lint.yml new file mode 100644 index 000000000..d5b5d03f6 --- /dev/null +++ b/.sass-lint.yml @@ -0,0 +1,13 @@ +rules: + property-sort-order: [0] + force-pseudo-nesting: [0] + force-element-nesting: [0] + force-attribute-nesting: [0] + no-important: [0] + no-qualifying-elements: [0] + no-transition-all: [0] + shorthand-values: [1, {allowed-shorthands: [1, 2, 4]}] + +files: + ignore: + - 'src/scss/_mixins.scss' diff --git a/.scss-lint.yml b/.scss-lint.yml deleted file mode 100644 index 545631c23..000000000 --- a/.scss-lint.yml +++ /dev/null @@ -1,19 +0,0 @@ -linters: - PropertySortOrder: - enabled: false - - SingleLinePerSelector: - enabled: false - - SelectorDepth: - max_depth: 4 - - NestingDepth: - max_depth: 4 - - HexLength: - enabled: false - - VendorPrefix: - exclude: - - src/scss/_mixins.scss diff --git a/.travis.yml b/.travis.yml index cb9c05917..4fff14554 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,8 +2,6 @@ language: node_js node_js: - "5" before_install: - - gem install sass - - gem install scss_lint -v 0.49.0 - npm install -g grunt-cli - npm install -g bower before_script: diff --git a/Gruntfile.js b/Gruntfile.js index 9a7dd8019..76397d2c2 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,7 @@ module.exports = function(grunt) { require('time-grunt')(grunt); require('jit-grunt')(grunt, { - scsslint: 'grunt-scss-lint', + sasslint: 'grunt-sass-lint', usebanner: 'grunt-banner' }); @@ -61,7 +61,7 @@ module.exports = function(grunt) { wrap: { dist: { src: 'dist/photo-sphere-viewer.js', - dest: '', + dest: 'dist/photo-sphere-viewer.js', options: { separator: '', wrapper: function() { @@ -98,8 +98,8 @@ module.exports = function(grunt) { */ sass: { options: { - sourcemap: 'none', - style: 'expanded' + sourceMap: false, + outputStyle: 'expanded' }, lib: { src: 'src/scss/photo-sphere-viewer.scss', @@ -150,10 +150,9 @@ module.exports = function(grunt) { /** * SCSSLint test on src files */ - scsslint: { + sasslint: { options: { - colorizeOutput: true, - config: '.scss-lint.yml' + configFile: '.sass-lint.yml' }, lib: { src: ['src/scss/**/*.scss'] @@ -297,7 +296,7 @@ module.exports = function(grunt) { grunt.registerTask('test', [ 'jshint', 'jscs', - 'scsslint', + 'sasslint', 'mochaTest' ]); diff --git a/README.md b/README.md index 899532108..b3f60ed09 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,7 @@ [![Bower version](https://img.shields.io/bower/v/Photo-Sphere-Viewer.svg?style=flat-square)](http://photo-sphere-viewer.js.org) [![NPM version](https://img.shields.io/npm/v/photo-sphere-viewer.svg?style=flat-square)](https://www.npmjs.com/package/photo-sphere-viewer) +[![jsDelivr Hits](https://data.jsdelivr.com/v1/package/npm/photo-sphere-viewer/badge)](https://www.jsdelivr.com/package/npm/photo-sphere-viewer) [![Build Status](https://img.shields.io/travis/mistic100/Photo-Sphere-Viewer/master.svg?style=flat-square)](https://travis-ci.org/mistic100/Photo-Sphere-Viewer) [![Dependencies Status](https://david-dm.org/mistic100/Photo-Sphere-Viewer/status.svg?style=flat-square)](https://david-dm.org/mistic100/Photo-Sphere-Viewer) @@ -44,10 +45,8 @@ Photo Sphere Viewer is available on [jsDelivr](https://cdn.jsdelivr.net/npm/phot #### Prerequisites * NodeJS + NPM: `apt-get install nodejs-legacy npm` - * Ruby Dev: `apt-get install ruby-dev` * Grunt CLI: `npm install -g grunt-cli` * Bower: `npm install -g bower` - * SASS: `gem install sass` #### Run diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index 1f886d217..7c979e1a8 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,7 +1,7 @@ /*! - * Photo Sphere Viewer 3.2.3 + * Photo Sphere Viewer 3.2.4 * Copyright (c) 2014-2015 Jérémy Heleine - * Copyright (c) 2015-2017 Damien "Mistic" Sorel + * Copyright (c) 2015-2018 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) */ .psv-container { @@ -10,7 +10,7 @@ margin: 0; padding: 0; position: relative; - background: radial-gradient(#ffffff, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%); + background: radial-gradient(#fff 0%, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%); overflow: hidden; } @@ -289,7 +289,7 @@ font: 24px sans-serif; margin: 1em 0; text-align: center; - text-shadow: 2px 1px #000000; + text-shadow: 2px 1px #000; } .psv-markers-list { @@ -414,7 +414,7 @@ left: 4px; width: 15px; height: 1px; - background-color: #ffffff; + background-color: #fff; transition: .2s ease-in-out; transition-property: width, left, transform; } @@ -452,7 +452,7 @@ margin-top: -14.5px; width: 1px; height: 1px; - box-shadow: 1px 0 #ffffff, 3px 0px #ffffff, 5px 0px #ffffff, 1px 2px #ffffff, 3px 2px #ffffff, 5px 2px #ffffff, 1px 4px #ffffff, 3px 4px #ffffff, 5px 4px #ffffff, 1px 6px #ffffff, 3px 6px #ffffff, 5px 6px #ffffff, 1px 8px #ffffff, 3px 8px #ffffff, 5px 8px #ffffff, 1px 10px #ffffff, 3px 10px #ffffff, 5px 10px #ffffff, 1px 12px #ffffff, 3px 12px #ffffff, 5px 12px #ffffff, 1px 14px #ffffff, 3px 14px #ffffff, 5px 14px #ffffff, 1px 16px #ffffff, 3px 16px #ffffff, 5px 16px #ffffff, 1px 18px #ffffff, 3px 18px #ffffff, 5px 18px #ffffff, 1px 20px #ffffff, 3px 20px #ffffff, 5px 20px #ffffff, 1px 22px #ffffff, 3px 22px #ffffff, 5px 22px #ffffff, 1px 24px #ffffff, 3px 24px #ffffff, 5px 24px #ffffff, 1px 26px #ffffff, 3px 26px #ffffff, 5px 26px #ffffff, 1px 28px #ffffff, 3px 28px #ffffff, 5px 28px #ffffff; + 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; background: transparent; } .psv-panel-content { @@ -480,7 +480,8 @@ opacity: 1; transition-duration: .2s; } -.psv-panel--open .psv-panel-close-button, .psv-panel--open .psv-panel-resizer { +.psv-panel--open .psv-panel-close-button, +.psv-panel--open .psv-panel-resizer { display: block; } @@ -500,7 +501,7 @@ .psv-tooltip-content { color: white; font: 14px sans-serif; - text-shadow: 0 1px #000000; + text-shadow: 0 1px #000; } .psv-tooltip-arrow { position: absolute; diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index ecc58b572..e581a7c0f 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,15 +1,15 @@ /*! - * Photo Sphere Viewer 3.2.3 + * Photo Sphere Viewer 3.2.4 * Copyright (c) 2014-2015 Jérémy Heleine - * Copyright (c) 2015-2017 Damien "Mistic" Sorel + * Copyright (c) 2015-2018 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) */ (function(root, factory) { if (typeof define === 'function' && define.amd) { - define(['three', 'D.js', 'uevent', 'doT'], factory); + define(['three', 'd.js', 'uevent', 'dot/doT'], factory); } else if (typeof module === 'object' && module.exports) { - module.exports = factory(require('three'), require('d.js'), require('uevent'), require('dot')); + module.exports = factory(require('three'), require('d.js'), require('uevent'), require('dot/doT')); } else { root.PhotoSphereViewer = factory(root.THREE, root.D, root.uEvent, root.doT); @@ -31,6 +31,13 @@ * @property {int} height */ +/** + * @typedef {Object} PhotoSphereViewer.CssSize + * @summary Object defining a size in CSS (px, % or auto) + * @property {string} [width] + * @property {string} [height] + */ + /** * @typedef {Object} PhotoSphereViewer.Position * @summary Object defining a spherical position @@ -179,8 +186,10 @@ function PhotoSphereViewer(options) { this.config.default_long = PSVUtils.parseAngle(this.config.default_long); // parse default_lat, is between -PI/2 and PI/2 - this.config.default_lat = PSVUtils.parseAngle(this.config.default_lat, -Math.PI); - this.config.default_lat = PSVUtils.bound(this.config.default_lat, -PSVUtils.HalfPI, PSVUtils.HalfPI); + this.config.default_lat = PSVUtils.parseAngle(this.config.default_lat, true); + + // parse panorama_roll, is between -PI/2 and PI/2 + this.config.panorama_roll = PSVUtils.parseAngle(this.config.panorama_roll, true); // default anim_lat is default_lat if (this.config.anim_lat === null) { @@ -188,8 +197,7 @@ function PhotoSphereViewer(options) { } // parse anim_lat, is between -PI/2 and PI/2 else { - this.config.anim_lat = PSVUtils.parseAngle(this.config.anim_lat, -Math.PI); - this.config.anim_lat = PSVUtils.bound(this.config.anim_lat, -PSVUtils.HalfPI, PSVUtils.HalfPI); + this.config.anim_lat = PSVUtils.parseAngle(this.config.anim_lat, true); } // parse longitude_range, between 0 and 2*PI @@ -202,8 +210,7 @@ function PhotoSphereViewer(options) { // parse latitude_range, between -PI/2 and PI/2 if (this.config.latitude_range) { this.config.latitude_range = this.config.latitude_range.map(function(angle) { - angle = PSVUtils.parseAngle(angle, -Math.PI); - return PSVUtils.bound(angle, -PSVUtils.HalfPI, PSVUtils.HalfPI); + return PSVUtils.parseAngle(angle, true); }); } @@ -1018,6 +1025,7 @@ PhotoSphereViewer.prototype._createSphere = function() { this.mesh = new THREE.Mesh(geometry, material); this.mesh.scale.x = -1; + this.mesh.rotation.z = this.config.panorama_roll; this.scene.add(this.mesh); }; @@ -1348,6 +1356,7 @@ PhotoSphereViewer.DEFAULTS = { default_fov: null, default_long: 0, default_lat: 0, + panorama_roll: 0, longitude_range: null, latitude_range: null, move_speed: 1, @@ -2411,6 +2420,21 @@ PhotoSphereViewer.prototype.zoomOut = function() { } }; +/** + * @summary Resizes the viewer + * @param {PhotoSphereViewer.CssSize} size + */ +PhotoSphereViewer.prototype.resize = function(size) { + if (size.width) { + this.container.style.width = size.width; + } + if (size.height) { + this.container.style.height = size.height; + } + + this._onResize(); +}; + /** * @summary Enters or exits the fullscreen mode */ @@ -2660,7 +2684,7 @@ PhotoSphereViewer.prototype.cleanPosition = function(position) { } position.longitude = PSVUtils.parseAngle(position.longitude); - position.latitude = PSVUtils.bound(PSVUtils.parseAngle(position.latitude, -Math.PI), -PSVUtils.HalfPI, PSVUtils.HalfPI); + position.latitude = PSVUtils.parseAngle(position.latitude, true); }; /** @@ -2707,8 +2731,8 @@ PhotoSphereViewer.prototype.applyRanges = function(position) { range = PSVUtils.clone(this.config.latitude_range); offset = THREE.Math.degToRad(this.prop.vFov) / 2; - range[0] = PSVUtils.parseAngle(Math.min(range[0] + offset, range[1]), -Math.PI); - range[1] = PSVUtils.parseAngle(Math.max(range[1] - offset, range[0]), -Math.PI); + range[0] = PSVUtils.parseAngle(Math.min(range[0] + offset, range[1]), true); + range[1] = PSVUtils.parseAngle(Math.max(range[1] - offset, range[0]), true); if (position.latitude < range[0]) { position.latitude = range[0]; @@ -2867,7 +2891,7 @@ function PSVHUD(psv) { this.prop = { panelOpened: false, panelOpening: false, - markersButton: this.psv.navbar.getNavbarButton('markers') + markersButton: this.psv.navbar.getNavbarButton('markers', true) }; this.create(); @@ -3801,9 +3825,10 @@ PSVNavBar.prototype.destroy = function() { /** * @summary Returns a button by its identifier * @param {string} id + * @param {boolean} [silent=false] * @returns {module:components/buttons.PSVNavBarButton} */ -PSVNavBar.prototype.getNavbarButton = function(id) { +PSVNavBar.prototype.getNavbarButton = function(id, silent) { var button = null; this.items.some(function(item) { @@ -3813,7 +3838,7 @@ PSVNavBar.prototype.getNavbarButton = function(id) { } }); - if (!button) { + if (!button && !silent) { console.warn('PhotoSphereViewer: button "' + id + '" not found in the navbar.'); } @@ -5663,7 +5688,7 @@ PSVMarker.prototype._updatePolygon = function() { this.polygon_rad = this.polygon_rad.map(function(coord) { return [ PSVUtils.parseAngle(coord[0]), - PSVUtils.bound(PSVUtils.parseAngle(coord[1], -Math.PI), -PSVUtils.HalfPI, PSVUtils.HalfPI) + PSVUtils.parseAngle(coord[1], true) ]; }); } @@ -6122,12 +6147,12 @@ PSVUtils.parseSpeed = function(speed) { /** * @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 {float|boolean} [reference=0] - base value for normalization, false to disable + * @param {boolean} [zeroCenter=false] - normalize between -Pi/2 - Pi/2 instead of 0 - 2*Pi * @returns {float} * @throws {PSVError} when the angle cannot be parsed */ -PSVUtils.parseAngle = function(angle, reference) { - if (typeof angle == 'string') { +PSVUtils.parseAngle = function(angle, zeroCenter) { + if (typeof angle === 'string') { var match = angle.toLowerCase().trim().match(/^(-?[0-9]+(?:\.[0-9]*)?)(.*)$/); if (!match) { @@ -6151,23 +6176,18 @@ PSVUtils.parseAngle = function(angle, reference) { throw new PSVError('unknown angle unit "' + unit + '"'); } } - } - - if (reference !== false) { - if (reference === undefined) { - reference = 0; + else { + angle = value; } + } - angle = (angle - reference) % PSVUtils.TwoPI; - - if (angle < 0) { - angle = PSVUtils.TwoPI + angle; - } + angle = (zeroCenter ? angle + Math.PI : angle) % PSVUtils.TwoPI; - angle += reference; + if (angle < 0) { + angle = PSVUtils.TwoPI + angle; } - return angle; + return zeroCenter ? PSVUtils.bound(angle - Math.PI, -PSVUtils.HalfPI, PSVUtils.HalfPI) : angle; }; /** diff --git a/dist/photo-sphere-viewer.min.css b/dist/photo-sphere-viewer.min.css index 4eec64b39..6655794ab 100644 --- a/dist/photo-sphere-viewer.min.css +++ b/dist/photo-sphere-viewer.min.css @@ -1,7 +1,7 @@ /*! - * Photo Sphere Viewer 3.2.3 + * Photo Sphere Viewer 3.2.4 * Copyright (c) 2014-2015 Jérémy Heleine - * Copyright (c) 2015-2017 Damien "Mistic" Sorel + * Copyright (c) 2015-2018 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) */ -.psv-loader::before,.psv-markers-list-item::before,.psv-panel-resizer::before{content:''}.psv-hud,.psv-panel-content--no-interaction{-webkit-touch-callout:none;-khtml-user-select:none}.psv-container{width:100%;height:100%;margin:0;padding:0;position:relative;background:radial-gradient(#fff,#fdfdfd 16%,#fbfbfb 33%,#f8f8f8 49%,#efefef 66%,#dfdfdf 82%,#bfbfbf 100%);overflow:hidden}.psv-canvas-container{position:absolute;top:0;left:0;z-index:0;transition:opacity linear .1s}.psv-canvas{display:block}.psv-loader-container{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;align-items:center;justify-content:center;position:absolute;top:0;left:0;width:100%;height:100%;z-index:100}.psv-loader,.psv-loader-image,.psv-loader-text,.psv-loader::before{display:inline-block;vertical-align:middle}.psv-loader{position:relative;text-align:center;color:rgba(61,61,61,.7);width:150px;height:150px;border:10px solid transparent}.psv-button,.psv-caption{color:rgba(255,255,255,.7)}.psv-loader::before{height:100%}.psv-loader-canvas{position:absolute;top:0;left:0}.psv-loader-text{font:14px sans-serif}.psv-navbar{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;position:absolute;z-index:90;bottom:-40px;left:0;width:100%;height:40px;background:rgba(61,61,61,.5);transition:bottom ease-in-out .1s}.psv-navbar--open{bottom:0}.psv-navbar,.psv-navbar *{box-sizing:content-box}.psv-caption{-webkit-box-flex:10;-webkit-flex-grow:10;-moz-flex-grow:10;-ms-flex-positive:10;flex-grow:10;margin:10px;white-space:nowrap;overflow:hidden;text-align:center;font-family:sans-serif}@media (max-width:800px){.psv-caption{visibility:hidden}}.psv-spacer--weight-1{-webkit-box-flex:1;-webkit-flex-grow:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.psv-spacer--weight-2{-webkit-box-flex:2;-webkit-flex-grow:2;-moz-flex-grow:2;-ms-flex-positive:2;flex-grow:2}.psv-spacer--weight-3{-webkit-box-flex:3;-webkit-flex-grow:3;-moz-flex-grow:3;-ms-flex-positive:3;flex-grow:3}.psv-spacer--weight-4{-webkit-box-flex:4;-webkit-flex-grow:4;-moz-flex-grow:4;-ms-flex-positive:4;flex-grow:4}.psv-spacer--weight-5{-webkit-box-flex:5;-webkit-flex-grow:5;-moz-flex-grow:5;-ms-flex-positive:5;flex-grow:5}.psv-spacer--weight-6{-webkit-box-flex:6;-webkit-flex-grow:6;-moz-flex-grow:6;-ms-flex-positive:6;flex-grow:6}.psv-spacer--weight-7{-webkit-box-flex:7;-webkit-flex-grow:7;-moz-flex-grow:7;-ms-flex-positive:7;flex-grow:7}.psv-spacer--weight-8{-webkit-box-flex:8;-webkit-flex-grow:8;-moz-flex-grow:8;-ms-flex-positive:8;flex-grow:8}.psv-spacer--weight-9{-webkit-box-flex:9;-webkit-flex-grow:9;-moz-flex-grow:9;-ms-flex-positive:9;flex-grow:9}.psv-spacer--weight-10{-webkit-box-flex:10;-webkit-flex-grow:10;-moz-flex-grow:10;-ms-flex-positive:10;flex-grow:10}.psv-button{-webkit-box-flex:0;-webkit-flex-grow:0;-moz-flex-grow:0;-ms-flex-positive:0;flex-grow:0;-webkit-flex-shrink:0;-moz-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;padding:10px;position:relative;cursor:pointer;height:20px;width:20px;background:0 0}.psv-button--active{background:rgba(255,255,255,.1)}.psv-button--disabled{pointer-events:none;opacity:.5}.psv-button .psv-button-svg{width:100%;transform:scale(1);transition:transform .3s ease}.psv-button .psv-button-svg *{fill:rgba(255,255,255,.7)}.psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button .psv-button-svg{transform:scale(1.2)}.psv-autorotate-button{width:25px;height:25px;padding:7.5px}.psv-zoom-button{cursor:default;width:128px}.psv-zoom-button-minus,.psv-zoom-button-plus{float:left;position:relative;cursor:pointer;width:16px;height:16px}.psv-zoom-button-minus .psv-button-svg,.psv-zoom-button-plus .psv-button-svg{position:relative;top:20%}.psv-zoom-button-range{float:left;padding:9.5px 8px}.psv-zoom-button-line{position:relative;cursor:pointer;width:80px;height:1px;background:rgba(255,255,255,.7);transition:all .3s ease}.psv-zoom-button-handle{position:absolute;border-radius:50%;top:-3px;width:7px;height:7px;background:rgba(255,255,255,.7);transform:scale(1);transition:transform .3s ease}.psv-zoom-button:not(.psv-button--disabled):hover .psv-zoom-button-line{box-shadow:0 0 2px rgba(255,255,255,.7)}.psv-zoom-button:not(.psv-button--disabled):hover .psv-zoom-button-handle{transform:scale(1.3)}@media (max-width:600px){.psv-zoom-button{width:auto;padding:0}.psv-zoom-button-range{display:none}.psv-zoom-button-minus,.psv-zoom-button-plus{width:20px;height:20px;padding:10px}.psv-zoom-button-minus .psv-button-svg,.psv-zoom-button-plus .psv-button-svg{top:0}}.psv-markers-list-title{font:24px sans-serif;margin:1em 0;text-align:center;text-shadow:2px 1px #000}.psv-markers-list{list-style:none;margin:0;padding:0;overflow:hidden}.psv-markers-list-item{clear:both;min-height:20px;padding:.5em 1em;cursor:pointer;transform:translateX(0);transition:transform .3s ease-in-out}.psv-markers-list-item::before{position:absolute;top:0;left:0;height:100%;width:10px;margin-left:-10px}.psv-markers-list-item:nth-child(odd),.psv-markers-list-item:nth-child(odd)::before{background:rgba(255,255,255,.1)}.psv-markers-list-item:nth-child(even),.psv-markers-list-item:nth-child(even)::before{background:0 0}.psv-markers-list-item:hover{transform:translateX(10px);transition:transform .1s ease-in-out}.psv-markers-list-image{float:left;width:20px}.psv-hud,.psv-hud-svg-container{width:100%;height:100%;position:absolute}.psv-markers-list-name{margin:0;padding:0}.psv-markers-list-image+.psv-markers-list-name{padding-left:calc(20px + .5em)}.psv-hud{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10}.psv-hud-svg-container{top:0;left:0;z-index:20}.psv-marker{cursor:pointer;display:none}.psv-marker--normal{position:absolute;top:0;left:0;z-index:30;background-size:contain;background-repeat:no-repeat}.psv-marker--transparent{display:block;opacity:0}.psv-marker--visible{display:block}.psv-panel{position:absolute;z-index:90;right:0;height:100%;width:400px;max-width:calc(100% - 24px);background:rgba(10,10,10,.7);transform:translate3d(100%,0,0);opacity:0;transition-property:opacity,transform;transition-timing-function:ease-in-out;transition-duration:.1s;cursor:default;margin-left:9px}.psv-container--has-navbar .psv-panel{height:calc(100% - 40px)}.psv-panel-close-button{display:none;position:absolute;top:0;left:-24px;width:24px;height:24px;background:rgba(0,0,0,.9)}.psv-panel-close-button::after,.psv-panel-close-button::before{content:'';position:absolute;top:50%;left:4px;width:15px;height:1px;background-color:#fff;transition:.2s ease-in-out;transition-property:width,left,transform}.psv-panel-close-button::before{transform:rotate(45deg)}.psv-panel-close-button::after{transform:rotate(-45deg)}.psv-panel-close-button:hover::after,.psv-panel-close-button:hover::before{left:0;width:23px}.psv-panel-close-button:hover::before{transform:rotate(135deg)}.psv-panel-close-button:hover::after{transform:rotate(45deg)}.psv-panel-resizer{display:none;position:absolute;top:0;left:-9px;width:9px;height:100%;background-color:rgba(0,0,0,.9);cursor:col-resize}.psv-panel-resizer::before{position:absolute;top:50%;left:1px;margin-top:-14.5px;width:1px;height:1px;box-shadow:1px 0 #fff,3px 0 #fff,5px 0 #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;background:0 0}.psv-panel-content{width:100%;height:100%;box-sizing:border-box;color:#dcdcdc;font:16px sans-serif;overflow:auto}.psv-panel-content:not(.psv-panel-content--no-margin){padding:1em}.psv-panel-content--no-interaction{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}.psv-panel--open{transform:translate3d(0,0,0);opacity:1;transition-duration:.2s}.psv-panel--open .psv-panel-close-button,.psv-panel--open .psv-panel-resizer{display:block}.psv-tooltip{position:absolute;z-index:50;box-sizing:border-box;max-width:200px;background-color:rgba(61,61,61,.8);border-radius:4px;padding:.5em 1em;opacity:0;transition-property:opacity;transition-timing-function:ease-in-out;transition-duration:.1s}.psv-tooltip--bottom-center,.psv-tooltip--bottom-left,.psv-tooltip--center-left,.psv-tooltip--center-right,.psv-tooltip--top-center{transition-property:opacity,transform}.psv-tooltip-content{color:#fff;font:14px sans-serif;text-shadow:0 1px #000}.psv-tooltip-arrow{position:absolute;height:0;width:0;border:7px solid transparent}.psv-tooltip--bottom-center .psv-tooltip-arrow,.psv-tooltip--bottom-left .psv-tooltip-arrow,.psv-tooltip--bottom-right .psv-tooltip-arrow{border-bottom-color:rgba(61,61,61,.8)}.psv-tooltip--top-center .psv-tooltip-arrow,.psv-tooltip--top-left .psv-tooltip-arrow,.psv-tooltip--top-right .psv-tooltip-arrow{border-top-color:rgba(61,61,61,.8)}.psv-tooltip--bottom-center{box-shadow:0 3px 0 rgba(90,90,90,.7);transform:translate3d(0,-5px,0)}.psv-tooltip--center-left{box-shadow:-3px 0 0 rgba(90,90,90,.7);transform:translate3d(5px,0,0)}.psv-tooltip--center-left .psv-tooltip-arrow{border-left-color:rgba(61,61,61,.8)}.psv-tooltip--top-center{box-shadow:0 -3px 0 rgba(90,90,90,.7);transform:translate3d(0,5px,0)}.psv-tooltip--center-right{box-shadow:3px 0 0 rgba(90,90,90,.7);transform:translate3d(-5px,0,0)}.psv-tooltip--center-right .psv-tooltip-arrow{border-right-color:rgba(61,61,61,.8)}.psv-tooltip--bottom-left{box-shadow:-3px 3px 0 rgba(90,90,90,.7);transform:translate3d(0,-5px,0)}.psv-tooltip--bottom-right{box-shadow:3px 3px 0 rgba(90,90,90,.7);transform:translate3d(0,-5px,0);transition-property:opacity,transform}.psv-tooltip--top-left,.psv-tooltip--top-right{transform:translate3d(0,5px,0);transition-property:opacity,transform}.psv-tooltip--top-left{box-shadow:-3px -3px 0 rgba(90,90,90,.7)}.psv-tooltip--top-right{box-shadow:3px -3px 0 rgba(90,90,90,.7)}.psv-tooltip--visible{transform:translate3d(0,0,0);opacity:1;transition-duration:.1s} \ No newline at end of file +.psv-loader::before,.psv-markers-list-item::before,.psv-panel-resizer::before{content:''}.psv-hud,.psv-panel-content--no-interaction{-webkit-touch-callout:none;-khtml-user-select:none}.psv-container{width:100%;height:100%;margin:0;padding:0;position:relative;background:radial-gradient(#fff 0,#fdfdfd 16%,#fbfbfb 33%,#f8f8f8 49%,#efefef 66%,#dfdfdf 82%,#bfbfbf 100%);overflow:hidden}.psv-canvas-container{position:absolute;top:0;left:0;z-index:0;transition:opacity linear .1s}.psv-canvas{display:block}.psv-loader-container{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;align-items:center;justify-content:center;position:absolute;top:0;left:0;width:100%;height:100%;z-index:100}.psv-loader,.psv-loader-image,.psv-loader-text,.psv-loader::before{display:inline-block;vertical-align:middle}.psv-loader{position:relative;text-align:center;color:rgba(61,61,61,.7);width:150px;height:150px;border:10px solid transparent}.psv-button,.psv-caption{color:rgba(255,255,255,.7)}.psv-loader::before{height:100%}.psv-loader-canvas{position:absolute;top:0;left:0}.psv-loader-text{font:14px sans-serif}.psv-navbar{display:-webkit-box;display:-webkit-flex;display:-moz-flex;display:-ms-flexbox;display:flex;position:absolute;z-index:90;bottom:-40px;left:0;width:100%;height:40px;background:rgba(61,61,61,.5);transition:bottom ease-in-out .1s}.psv-navbar--open{bottom:0}.psv-navbar,.psv-navbar *{box-sizing:content-box}.psv-caption{-webkit-box-flex:10;-webkit-flex-grow:10;-moz-flex-grow:10;-ms-flex-positive:10;flex-grow:10;margin:10px;white-space:nowrap;overflow:hidden;text-align:center;font-family:sans-serif}@media (max-width:800px){.psv-caption{visibility:hidden}}.psv-spacer--weight-1{-webkit-box-flex:1;-webkit-flex-grow:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.psv-spacer--weight-2{-webkit-box-flex:2;-webkit-flex-grow:2;-moz-flex-grow:2;-ms-flex-positive:2;flex-grow:2}.psv-spacer--weight-3{-webkit-box-flex:3;-webkit-flex-grow:3;-moz-flex-grow:3;-ms-flex-positive:3;flex-grow:3}.psv-spacer--weight-4{-webkit-box-flex:4;-webkit-flex-grow:4;-moz-flex-grow:4;-ms-flex-positive:4;flex-grow:4}.psv-spacer--weight-5{-webkit-box-flex:5;-webkit-flex-grow:5;-moz-flex-grow:5;-ms-flex-positive:5;flex-grow:5}.psv-spacer--weight-6{-webkit-box-flex:6;-webkit-flex-grow:6;-moz-flex-grow:6;-ms-flex-positive:6;flex-grow:6}.psv-spacer--weight-7{-webkit-box-flex:7;-webkit-flex-grow:7;-moz-flex-grow:7;-ms-flex-positive:7;flex-grow:7}.psv-spacer--weight-8{-webkit-box-flex:8;-webkit-flex-grow:8;-moz-flex-grow:8;-ms-flex-positive:8;flex-grow:8}.psv-spacer--weight-9{-webkit-box-flex:9;-webkit-flex-grow:9;-moz-flex-grow:9;-ms-flex-positive:9;flex-grow:9}.psv-spacer--weight-10{-webkit-box-flex:10;-webkit-flex-grow:10;-moz-flex-grow:10;-ms-flex-positive:10;flex-grow:10}.psv-button{-webkit-box-flex:0;-webkit-flex-grow:0;-moz-flex-grow:0;-ms-flex-positive:0;flex-grow:0;-webkit-flex-shrink:0;-moz-flex-shrink:0;-ms-flex-negative:0;flex-shrink:0;padding:10px;position:relative;cursor:pointer;height:20px;width:20px;background:0 0}.psv-button--active{background:rgba(255,255,255,.1)}.psv-button--disabled{pointer-events:none;opacity:.5}.psv-button .psv-button-svg{width:100%;transform:scale(1);transition:transform .3s ease}.psv-button .psv-button-svg *{fill:rgba(255,255,255,.7)}.psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button .psv-button-svg{transform:scale(1.2)}.psv-autorotate-button{width:25px;height:25px;padding:7.5px}.psv-zoom-button{cursor:default;width:128px}.psv-zoom-button-minus,.psv-zoom-button-plus{float:left;position:relative;cursor:pointer;width:16px;height:16px}.psv-zoom-button-minus .psv-button-svg,.psv-zoom-button-plus .psv-button-svg{position:relative;top:20%}.psv-zoom-button-range{float:left;padding:9.5px 8px}.psv-zoom-button-line{position:relative;cursor:pointer;width:80px;height:1px;background:rgba(255,255,255,.7);transition:all .3s ease}.psv-zoom-button-handle{position:absolute;border-radius:50%;top:-3px;width:7px;height:7px;background:rgba(255,255,255,.7);transform:scale(1);transition:transform .3s ease}.psv-zoom-button:not(.psv-button--disabled):hover .psv-zoom-button-line{box-shadow:0 0 2px rgba(255,255,255,.7)}.psv-zoom-button:not(.psv-button--disabled):hover .psv-zoom-button-handle{transform:scale(1.3)}@media (max-width:600px){.psv-zoom-button{width:auto;padding:0}.psv-zoom-button-range{display:none}.psv-zoom-button-minus,.psv-zoom-button-plus{width:20px;height:20px;padding:10px}.psv-zoom-button-minus .psv-button-svg,.psv-zoom-button-plus .psv-button-svg{top:0}}.psv-markers-list-title{font:24px sans-serif;margin:1em 0;text-align:center;text-shadow:2px 1px #000}.psv-markers-list{list-style:none;margin:0;padding:0;overflow:hidden}.psv-markers-list-item{clear:both;min-height:20px;padding:.5em 1em;cursor:pointer;transform:translateX(0);transition:transform .3s ease-in-out}.psv-markers-list-item::before{position:absolute;top:0;left:0;height:100%;width:10px;margin-left:-10px}.psv-markers-list-item:nth-child(odd),.psv-markers-list-item:nth-child(odd)::before{background:rgba(255,255,255,.1)}.psv-markers-list-item:nth-child(even),.psv-markers-list-item:nth-child(even)::before{background:0 0}.psv-markers-list-item:hover{transform:translateX(10px);transition:transform .1s ease-in-out}.psv-markers-list-image{float:left;width:20px}.psv-hud,.psv-hud-svg-container{width:100%;height:100%;position:absolute}.psv-markers-list-name{margin:0;padding:0}.psv-markers-list-image+.psv-markers-list-name{padding-left:calc(20px + .5em)}.psv-hud{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;z-index:10}.psv-hud-svg-container{top:0;left:0;z-index:20}.psv-marker{cursor:pointer;display:none}.psv-marker--normal{position:absolute;top:0;left:0;z-index:30;background-size:contain;background-repeat:no-repeat}.psv-marker--transparent{display:block;opacity:0}.psv-marker--visible{display:block}.psv-panel{position:absolute;z-index:90;right:0;height:100%;width:400px;max-width:calc(100% - 24px);background:rgba(10,10,10,.7);transform:translate3d(100%,0,0);opacity:0;transition-property:opacity,transform;transition-timing-function:ease-in-out;transition-duration:.1s;cursor:default;margin-left:9px}.psv-container--has-navbar .psv-panel{height:calc(100% - 40px)}.psv-panel-close-button{display:none;position:absolute;top:0;left:-24px;width:24px;height:24px;background:rgba(0,0,0,.9)}.psv-panel-close-button::after,.psv-panel-close-button::before{content:'';position:absolute;top:50%;left:4px;width:15px;height:1px;background-color:#fff;transition:.2s ease-in-out;transition-property:width,left,transform}.psv-panel-close-button::before{transform:rotate(45deg)}.psv-panel-close-button::after{transform:rotate(-45deg)}.psv-panel-close-button:hover::after,.psv-panel-close-button:hover::before{left:0;width:23px}.psv-panel-close-button:hover::before{transform:rotate(135deg)}.psv-panel-close-button:hover::after{transform:rotate(45deg)}.psv-panel-resizer{display:none;position:absolute;top:0;left:-9px;width:9px;height:100%;background-color:rgba(0,0,0,.9);cursor:col-resize}.psv-panel-resizer::before{position:absolute;top:50%;left:1px;margin-top:-14.5px;width:1px;height:1px;box-shadow:1px 0 #fff,3px 0 #fff,5px 0 #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;background:0 0}.psv-panel-content{width:100%;height:100%;box-sizing:border-box;color:#dcdcdc;font:16px sans-serif;overflow:auto}.psv-panel-content:not(.psv-panel-content--no-margin){padding:1em}.psv-panel-content--no-interaction{-webkit-user-select:none;-moz-user-select:none;-ms-user-select:none;user-select:none;pointer-events:none}.psv-panel--open{transform:translate3d(0,0,0);opacity:1;transition-duration:.2s}.psv-panel--open .psv-panel-close-button,.psv-panel--open .psv-panel-resizer{display:block}.psv-tooltip{position:absolute;z-index:50;box-sizing:border-box;max-width:200px;background-color:rgba(61,61,61,.8);border-radius:4px;padding:.5em 1em;opacity:0;transition-property:opacity;transition-timing-function:ease-in-out;transition-duration:.1s}.psv-tooltip--bottom-center,.psv-tooltip--bottom-left,.psv-tooltip--center-left,.psv-tooltip--center-right,.psv-tooltip--top-center{transition-property:opacity,transform}.psv-tooltip-content{color:#fff;font:14px sans-serif;text-shadow:0 1px #000}.psv-tooltip-arrow{position:absolute;height:0;width:0;border:7px solid transparent}.psv-tooltip--bottom-center .psv-tooltip-arrow,.psv-tooltip--bottom-left .psv-tooltip-arrow,.psv-tooltip--bottom-right .psv-tooltip-arrow{border-bottom-color:rgba(61,61,61,.8)}.psv-tooltip--top-center .psv-tooltip-arrow,.psv-tooltip--top-left .psv-tooltip-arrow,.psv-tooltip--top-right .psv-tooltip-arrow{border-top-color:rgba(61,61,61,.8)}.psv-tooltip--bottom-center{box-shadow:0 3px 0 rgba(90,90,90,.7);transform:translate3d(0,-5px,0)}.psv-tooltip--center-left{box-shadow:-3px 0 0 rgba(90,90,90,.7);transform:translate3d(5px,0,0)}.psv-tooltip--center-left .psv-tooltip-arrow{border-left-color:rgba(61,61,61,.8)}.psv-tooltip--top-center{box-shadow:0 -3px 0 rgba(90,90,90,.7);transform:translate3d(0,5px,0)}.psv-tooltip--center-right{box-shadow:3px 0 0 rgba(90,90,90,.7);transform:translate3d(-5px,0,0)}.psv-tooltip--center-right .psv-tooltip-arrow{border-right-color:rgba(61,61,61,.8)}.psv-tooltip--bottom-left{box-shadow:-3px 3px 0 rgba(90,90,90,.7);transform:translate3d(0,-5px,0)}.psv-tooltip--bottom-right{box-shadow:3px 3px 0 rgba(90,90,90,.7);transform:translate3d(0,-5px,0);transition-property:opacity,transform}.psv-tooltip--top-left,.psv-tooltip--top-right{transform:translate3d(0,5px,0);transition-property:opacity,transform}.psv-tooltip--top-left{box-shadow:-3px -3px 0 rgba(90,90,90,.7)}.psv-tooltip--top-right{box-shadow:3px -3px 0 rgba(90,90,90,.7)}.psv-tooltip--visible{transform:translate3d(0,0,0);opacity:1;transition-duration:.1s} \ No newline at end of file diff --git a/dist/photo-sphere-viewer.min.js b/dist/photo-sphere-viewer.min.js index d478dd4e1..48ef13003 100644 --- a/dist/photo-sphere-viewer.min.js +++ b/dist/photo-sphere-viewer.min.js @@ -1,9 +1,9 @@ /*! - * Photo Sphere Viewer 3.2.3 + * Photo Sphere Viewer 3.2.4 * Copyright (c) 2014-2015 Jérémy Heleine - * Copyright (c) 2015-2017 Damien "Mistic" Sorel + * Copyright (c) 2015-2018 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) */ -!function(a,b){"function"==typeof define&&define.amd?define(["three","D.js","uevent","doT"],b):"object"==typeof module&&module.exports?module.exports=b(require("three"),require("d.js"),require("uevent"),require("dot")):a.PhotoSphereViewer=b(a.THREE,a.D,a.uEvent,a.doT)}(this,function(a,b,c,d){"use strict";function e(b){if(!(this instanceof e))return new e(b);if(e.SYSTEM.loaded||e._loadSystem(),this.config=x.clone(e.DEFAULTS),x.deepmerge(this.config,b),!b.container)throw new v("No value given for container.");if(!e.SYSTEM.isCanvasSupported)throw new v("Canvas is not supported.");if(!(e.SYSTEM.isWebGLSupported&&this.config.webgl||x.checkTHREE("CanvasRenderer","Projector")))throw new v("Missing Three.js components: CanvasRenderer, Projector. Get them from three.js-examples package.");if(this.config.longitude_range&&2!==this.config.longitude_range.length&&(this.config.longitude_range=null,console.warn("PhotoSphereViewer: longitude_range must have exactly two elements.")),this.config.latitude_range?2!==this.config.latitude_range.length?(this.config.latitude_range=null,console.warn("PhotoSphereViewer: latitude_range must have exactly two elements.")):this.config.latitude_range[0]>this.config.latitude_range[1]&&(this.config.latitude_range=[this.config.latitude_range[1],this.config.latitude_range[0]],console.warn("PhotoSphereViewer: latitude_range values must be ordered.")):void 0===this.config.tilt_up_max&&void 0===this.config.tilt_down_max||(this.config.latitude_range=[void 0!==this.config.tilt_down_max?this.config.tilt_down_max-Math.PI/4:-x.HalfPI,void 0!==this.config.tilt_up_max?this.config.tilt_up_max+Math.PI/4:x.HalfPI],console.warn("PhotoSphereViewer: tilt_up_max and tilt_down_max are deprecated, use latitude_range instead.")),this.config.max_fov"),h=a.substring(b,g);if(b===-1||g===-1||h.indexOf("GPano:")===-1)c.resolve(null);else{var i={full_width:parseInt(x.getXMPValue(h,"FullPanoWidthPixels")),full_height:parseInt(x.getXMPValue(h,"FullPanoHeightPixels")),cropped_width:parseInt(x.getXMPValue(h,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(x.getXMPValue(h,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(x.getXMPValue(h,"CroppedAreaLeftPixels")),cropped_y:parseInt(x.getXMPValue(h,"CroppedAreaTopPixels"))};i.full_width&&i.full_height&&i.cropped_width&&i.cropped_height?c.resolve(i):(console.warn("PhotoSphereViewer: invalid XMP data"),c.resolve(null))}}else 3===d.readyState&&e.loader.setProgress(f+=10)},d.onprogress=function(a){if(a.lengthComputable){var b=parseInt(a.loaded/a.total*100);b>f&&(f=b,e.loader.setProgress(f))}},d.onerror=function(){throw e.container.textContent="Cannot load image",new v("Cannot load image")},d.open("GET",a,!0),d.send(null),c.promise},e.prototype._loadTexture=function(a){var b=[];if(Array.isArray(a)){if(6!==a.length)throw new v("Must provide exactly 6 image paths when using cubemap.");for(var c=0;c<6;c++)b[c]=a[e.CUBE_MAP[c]];a=b}else if("object"==typeof a){if(!e.CUBE_HASHMAP.every(function(b){return!!a[b]}))throw new v("Must provide exactly left, front, right, back, top, bottom when using cubemap.");e.CUBE_HASHMAP.forEach(function(c,d){b[d]=a[c]}),a=b}if(Array.isArray(a)){if(this.prop.isCubemap===!1)throw new v("The viewer was initialized with an equirectangular panorama, cannot switch to cubemap.");return this.config.fisheye&&console.warn("PhotoSphereViewer: fisheye effect with cubemap texture can generate distorsions."),this.config.cache_texture===e.DEFAULTS.cache_texture&&(this.config.cache_texture*=6),this.prop.isCubemap=!0,this._loadCubemapTexture(a)}if(this.prop.isCubemap===!0)throw new v("The viewer was initialized with an cubemap, cannot switch to equirectangular panorama.");return this.prop.isCubemap=!1,this._loadEquirectangularTexture(a)},e.prototype._loadEquirectangularTexture=function(c){if(this.config.cache_texture){var d=this.getPanoramaCache(c);if(d)return this.prop.pano_data=d.pano_data,b.resolved(d.image)}return this._loadXMP(c).then(function(d){var f=b(),g=new a.ImageLoader,h=d?100:0;g.setCrossOrigin("anonymous");var i=function(b){h=100,this.loader.setProgress(h),this.trigger("panorama-load-progress",c,h),!d&&this.config.pano_data&&(d=x.clone(this.config.pano_data)),d||(d={full_width:b.width,full_height:b.height,cropped_width:b.width,cropped_height:b.height,cropped_x:0,cropped_y:0}),this.prop.pano_data=d;var g,i=Math.min(d.full_width,e.SYSTEM.maxTextureWidth)/d.full_width;if(1!==i||d.cropped_width!=d.full_width||d.cropped_height!=d.full_height){var j=x.clone(d);j.full_width*=i,j.full_height*=i,j.cropped_width*=i,j.cropped_height*=i,j.cropped_x*=i,j.cropped_y*=i,b.width=j.cropped_width,b.height=j.cropped_height;var k=document.createElement("canvas");k.width=j.full_width,k.height=j.full_height;var l=k.getContext("2d");l.drawImage(b,j.cropped_x,j.cropped_y,j.cropped_width,j.cropped_height),g=new a.Texture(k)}else g=new a.Texture(b);g.needsUpdate=!0,g.minFilter=a.LinearFilter,g.generateMipmaps=!1,this.config.cache_texture&&this._putPanoramaCache({panorama:c,image:g,pano_data:d}),f.resolve(g)},j=function(a){if(a.lengthComputable){var b=parseInt(a.loaded/a.total*100);b>h&&(h=b,this.loader.setProgress(h),this.trigger("panorama-load-progress",c,h))}},k=function(a){throw this.container.textContent="Cannot load image",f.reject(a),new v("Cannot load image")};return g.load(c,i.bind(this),j.bind(this),k.bind(this)),f.promise}.bind(this))},e.prototype._loadCubemapTexture=function(c){var d=b(),f=new a.ImageLoader,g=[0,0,0,0,0,0],h=[],i=0;f.setCrossOrigin("anonymous");for(var j=function(){h.forEach(function(b){b.needsUpdate=!0,b.minFilter=a.LinearFilter,b.generateMipmaps=!1}),d.resolve(h)},k=function(b,d){i++,g[b]=100,this.loader.setProgress(x.sum(g)/6),this.trigger("panorama-load-progress",c[b],g[b]);var f=Math.min(d.width,e.SYSTEM.maxTextureWidth/2)/d.width;if(1!==f){var k=document.createElement("canvas");k.width=d.width*f,k.height=d.height*f;var l=k.getContext("2d");l.drawImage(d,0,0,k.width,k.height),h[b]=new a.Texture(k)}else h[b]=new a.Texture(d);this.config.cache_texture&&this._putPanoramaCache({panorama:c[b],image:h[b]}),6===i&&j()},l=function(a,b){if(b.lengthComputable){var d=parseInt(b.loaded/b.total*100);d>g[a]&&(g[a]=d,this.loader.setProgress(x.sum(g)/6),this.trigger("panorama-load-progress",c[a],g[a]))}},m=function(a,b){throw this.container.textContent="Cannot load image",d.reject(b),new v("Cannot load image "+a)},n=0;n<6;n++){if(this.config.cache_texture){var o=this.getPanoramaCache(c[n]);if(o){i++,g[n]=100,h[n]=o.image;continue}}f.load(c[n],k.bind(this,n),l.bind(this,n),m.bind(this,n))}return 6===i&&d.resolve(h),d.promise},e.prototype._setTexture=function(a){if(this.scene||this._createScene(),this.prop.isCubemap)for(var b=0;b<6;b++)this.mesh.material.materials[b].map&&this.mesh.material.materials[b].map.dispose(),this.mesh.material.materials[b].map=a[b];else this.mesh.material.map&&this.mesh.material.map.dispose(),this.mesh.material.map=a;this.trigger("panorama-loaded"),this.render()},e.prototype._createScene=function(){this.raycaster=new a.Raycaster,this.renderer=e.SYSTEM.isWebGLSupported&&this.config.webgl?new a.WebGLRenderer:new a.CanvasRenderer,this.renderer.setSize(this.prop.size.width,this.prop.size.height),this.renderer.setPixelRatio(e.SYSTEM.pixelRatio);var b=e.SPHERE_RADIUS;this.prop.isCubemap&&(b*=Math.sqrt(3)),this.config.fisheye&&(b+=e.SPHERE_RADIUS),this.camera=new a.PerspectiveCamera(this.config.default_fov,this.prop.size.width/this.prop.size.height,1,b),this.camera.position.set(0,0,0),this.config.gyroscope&&x.checkTHREE("DeviceOrientationControls")&&(this.doControls=new a.DeviceOrientationControls(this.camera)),this.scene=new a.Scene,this.scene.add(this.camera),this.prop.isCubemap?this._createCubemap():this._createSphere(),this.canvas_container=document.createElement("div"),this.canvas_container.className="psv-canvas-container",this.renderer.domElement.className="psv-canvas",this.container.appendChild(this.canvas_container),this.canvas_container.appendChild(this.renderer.domElement)},e.prototype._createSphere=function(){var b=new a.SphereGeometry(e.SPHERE_RADIUS,e.SPHERE_VERTICES,e.SPHERE_VERTICES,(-x.HalfPI)),c=new a.MeshBasicMaterial({side:a.DoubleSide,overdraw:e.SYSTEM.isWebGLSupported&&this.config.webgl?0:1});this.mesh=new a.Mesh(b,c),this.mesh.scale.x=-1,this.scene.add(this.mesh)},e.prototype._createCubemap=function(){for(var b=new a.BoxGeometry(2*e.SPHERE_RADIUS,2*e.SPHERE_RADIUS,2*e.SPHERE_RADIUS,e.CUBE_VERTICES,e.CUBE_VERTICES,e.CUBE_VERTICES),c=[],d=0;d<6;d++)c.push(new a.MeshBasicMaterial({overdraw:e.SYSTEM.isWebGLSupported&&this.config.webgl?0:1}));this.mesh=new a.Mesh(b,new a.MultiMaterial(c)),this.mesh.position.x-=e.SPHERE_RADIUS,this.mesh.position.y-=e.SPHERE_RADIUS,this.mesh.position.z-=e.SPHERE_RADIUS,this.mesh.applyMatrix((new a.Matrix4).makeScale(1,1,-1)),this.scene.add(this.mesh);var f=new a.MeshBasicMaterial({side:a.BackSide,visible:!1}),g=new a.Mesh(b,f);this.scene.add(g)},e.prototype._transition=function(b,c){if(this.prop.isCubemap)throw new v("Transition is not available with cubemap.");var d=this,f=new a.SphereGeometry(.9*e.SPHERE_RADIUS,e.SPHERE_VERTICES,e.SPHERE_VERTICES,(-x.HalfPI)),g=new a.MeshBasicMaterial({side:a.DoubleSide,overdraw:e.SYSTEM.isWebGLSupported&&this.config.webgl?0:1,map:b,transparent:!0,opacity:0}),h=new a.Mesh(f,g);if(h.scale.x=-1,c){h.rotateY(c.longitude-this.prop.longitude);var i=new a.Vector3(0,1,0).cross(this.camera.getWorldDirection()).normalize(),j=(new a.Quaternion).setFromAxisAngle(i,c.latitude-this.prop.latitude);h.quaternion.multiplyQuaternions(j,h.quaternion)}return this.scene.add(h),this.render(),x.animation({properties:{opacity:{start:0,end:1}},duration:d.config.transition.duration,easing:"outCubic",onTick:function(a){g.opacity=a.opacity,d.render()}}).then(function(){d.mesh.material.map.dispose(),d.mesh.material.map=b,d.scene.remove(h),h.geometry.dispose(),h.geometry=null,h.material.dispose(),h.material=null,c?((d.config.latitude_range||d.config.longitude_range)&&(d.config.longitude_range=d.config.latitude_range=null,console.warn("PhotoSphereViewer: trying to perform transition with longitude_range and/or latitude_range, ranges cleared.")),d.rotate(c)):d.render()})},e.prototype._reverseAutorotate=function(){var a=this,b=-this.config.anim_speed,c=this.config.longitude_range;this.config.longitude_range=null,x.animation({properties:{speed:{start:this.config.anim_speed,end:0}},duration:300,easing:"inSine",onTick:function(b){a.config.anim_speed=b.speed}}).then(function(){return x.animation({properties:{speed:{start:0,end:b}},duration:300,easing:"outSine",onTick:function(b){a.config.anim_speed=b.speed}})}).then(function(){a.config.longitude_range=c,a.config.anim_speed=b})},e.prototype._putPanoramaCache=function(a){if(!this.config.cache_texture)throw new v("Cannot add panorama to cache, cache_texture is disabled");var b=this.getPanoramaCache(a.panorama);b?(b.image=a.image,b.pano_data=a.pano_data):(this.prop.cache=this.prop.cache.slice(0,this.config.cache_texture-1),this.prop.cache.unshift(a)),this.trigger("panorama-cached",a.panorama)},e.prototype._stopAll=function(){this.stopAutorotate(),this.stopAnimation(),this.stopGyroscopeControl()},e.MOVE_THRESHOLD=4,e.DBLCLICK_DELAY=300,e.INERTIA_WINDOW=300,e.SPHERE_RADIUS=100,e.SPHERE_VERTICES=64,e.CUBE_VERTICES=8,e.CUBE_MAP=[0,2,4,5,3,1],e.CUBE_HASHMAP=["left","right","top","bottom","back","front"],e.KEYMAP={33:"PageUp",34:"PageDown",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",107:"+",109:"-"},e.SYSTEM={loaded:!1,pixelRatio:1,isWebGLSupported:!1,isCanvasSupported:!1,deviceOrientationSupported:null,maxTextureWidth:0,mouseWheelEvent:null,fullscreenEvent:null},e.ICONS={},e.DEFAULTS={panorama:null,container:null,caption:null,autoload:!0,usexmpdata:!0,pano_data:null,webgl:!0,min_fov:30,max_fov:90,default_fov:null,default_long:0,default_lat:0,longitude_range:null,latitude_range:null,move_speed:1,time_anim:2e3,anim_speed:"2rpm",anim_lat:null,fisheye:!1,navbar:["autorotate","zoom","download","markers","caption","gyroscope","fullscreen"],tooltip:{offset:5,arrow_size:7,delay:100},lang:{autorotate:"Automatic rotation",zoom:"Zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",download:"Download",fullscreen:"Fullscreen",markers:"Markers",gyroscope:"Gyroscope"},mousewheel:!0,mousemove:!0,keyboard:!0,gyroscope:!1,move_inertia:!0,click_event_on_marker:!1,transition:{duration:1500,loader:!0},loading_img:null,loading_txt:"Loading...",size:null,cache_texture:5,templates:{},markers:[]},e.TEMPLATES={markersList:'

{{= it.config.lang.markers }}

'},e.prototype._bindEvents=function(){window.addEventListener("resize",this),this.config.mousemove&&(this.hud.container.style.cursor="move",this.hud.container.addEventListener("mousedown",this),this.hud.container.addEventListener("touchstart",this),window.addEventListener("mouseup",this),window.addEventListener("touchend",this),this.hud.container.addEventListener("mousemove",this),this.hud.container.addEventListener("touchmove",this)),e.SYSTEM.fullscreenEvent&&document.addEventListener(e.SYSTEM.fullscreenEvent,this),this.config.mousewheel&&this.hud.container.addEventListener(e.SYSTEM.mouseWheelEvent,this),this.on("_side-reached",function(a){this.isAutorotateEnabled()&&("left"!==a&&"right"!==a||this._reverseAutorotate())})},e.prototype.handleEvent=function(a){switch(a.type){case"resize":x.throttle(this._onResize(),50);break;case"keydown":this._onKeyDown(a);break;case"mousedown":this._onMouseDown(a);break;case"touchstart":this._onTouchStart(a);break;case"mouseup":this._onMouseUp(a);break;case"touchend":this._onTouchEnd(a);break;case"mousemove":this._onMouseMove(a);break;case"touchmove":this._onTouchMove(a);break;case e.SYSTEM.fullscreenEvent:this._fullscreenToggled();break;case e.SYSTEM.mouseWheelEvent:this._onMouseWheel(a)}},e.prototype._onResize=function(){this.container.clientWidth==this.prop.size.width&&this.container.clientHeight==this.prop.size.height||(this.prop.size.width=parseInt(this.container.clientWidth),this.prop.size.height=parseInt(this.container.clientHeight),this.prop.aspect=this.prop.size.width/this.prop.size.height,this.renderer&&(this.renderer.setSize(this.prop.size.width,this.prop.size.height),this.composer&&this.composer.reset(new a.WebGLRenderTarget(this.prop.size.width,this.prop.size.height)),this.render()),this.trigger("size-updated",this.getSize()))},e.prototype._onKeyDown=function(a){var b=0,c=0,d=0,f=a.key||e.KEYMAP[a.keyCode||a.which];switch(f){case"ArrowUp":c=.01;break;case"ArrowDown":c=-.01;break;case"ArrowRight":b=.01;break;case"ArrowLeft":b=-.01;break;case"PageUp":case"+":d=1;break;case"PageDown":case"-":d=-1}0!==d?this.zoom(this.prop.zoom_lvl+d):0===c&&0===b||this.rotate({longitude:this.prop.longitude+b*this.prop.move_speed*this.prop.hFov,latitude:this.prop.latitude+c*this.prop.move_speed*this.prop.vFov})},e.prototype._onMouseDown=function(a){this._startMove(a)},e.prototype._onMouseUp=function(a){this._stopMove(a)},e.prototype._onMouseMove=function(a){0!==a.buttons&&(a.preventDefault(),this._move(a))},e.prototype._onTouchStart=function(a){1===a.touches.length?this._startMove(a.touches[0]):2===a.touches.length&&this._startZoom(a)},e.prototype._onTouchEnd=function(a){this._stopMove(a.changedTouches[0])},e.prototype._onTouchMove=function(a){1===a.touches.length?(a.preventDefault(),this._move(a.touches[0])):2===a.touches.length&&(a.preventDefault(),this._zoom(a))},e.prototype._startMove=function(a){this.isGyroscopeEnabled()||(this._stopAll(),this.prop.mouse_x=this.prop.start_mouse_x=parseInt(a.clientX),this.prop.mouse_y=this.prop.start_mouse_y=parseInt(a.clientY),this.prop.moving=!0,this.prop.zooming=!1,this.prop.mouse_history.length=0,this._logMouseMove(a))},e.prototype._startZoom=function(a){var b=[{x:parseInt(a.touches[0].clientX),y:parseInt(a.touches[0].clientY)},{x:parseInt(a.touches[1].clientX),y:parseInt(a.touches[1].clientY)}];this.prop.pinch_dist=Math.sqrt(Math.pow(b[0].x-b[1].x,2)+Math.pow(b[0].y-b[1].y,2)),this.prop.moving=!1,this.prop.zooming=!0},e.prototype._stopMove=function(a){return this.isGyroscopeEnabled()?void this._click(a):(this.prop.moving&&(Math.abs(a.clientX-this.prop.start_mouse_x)e.INERTIA_WINDOW/10?(this.prop.mouse_history.splice(0,d),d=0,c=this.prop.mouse_history[0][d]):(d++,c=this.prop.mouse_history[0][d])},e.prototype.load=function(){if(!this.config.panorama)throw new v("No value given for panorama.");return this.setPanorama(this.config.panorama,!1)},e.prototype.getPosition=function(){return{longitude:this.prop.longitude,latitude:this.prop.latitude}},e.prototype.getZoomLevel=function(){return this.prop.zoom_lvl},e.prototype.getSize=function(){return{width:this.prop.size.width,height:this.prop.size.height}},e.prototype.isAutorotateEnabled=function(){return!!this.prop.autorotate_reqid},e.prototype.isGyroscopeEnabled=function(){return!!this.prop.orientation_reqid},e.prototype.isFullscreenEnabled=function(){return x.isFullscreenEnabled(this.container)},e.prototype.render=function(a){a!==!1&&(this.prop.direction=this.sphericalCoordsToVector3(this.prop),this.camera.position.set(0,0,0),this.camera.lookAt(this.prop.direction)),this.config.fisheye&&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.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this.trigger("render")},e.prototype.destroy=function(){this._stopAll(),this.stopKeyboardControl(),this.isFullscreenEnabled()&&x.exitFullscreen(),window.removeEventListener("resize",this),this.config.mousemove&&(this.hud.container.removeEventListener("mousedown",this),this.hud.container.removeEventListener("touchstart",this),window.removeEventListener("mouseup",this),window.removeEventListener("touchend",this),this.hud.container.removeEventListener("mousemove",this),this.hud.container.removeEventListener("touchmove",this)),e.SYSTEM.fullscreenEvent&&document.removeEventListener(e.SYSTEM.fullscreenEvent,this),this.config.mousewheel&&this.hud.container.removeEventListener(e.SYSTEM.mouseWheelEvent,this),this.tooltip&&this.tooltip.destroy(),this.hud&&this.hud.destroy(),this.loader&&this.loader.destroy(),this.navbar&&this.navbar.destroy(),this.panel&&this.panel.destroy(),this.doControls&&this.doControls.disconnect(),this.scene&&x.cleanTHREEScene(this.scene),this.canvas_container&&this.container.removeChild(this.canvas_container),this.parent.removeChild(this.container),delete this.parent.photoSphereViewer,delete this.parent,delete this.container,delete this.loader,delete this.navbar,delete this.hud,delete this.panel,delete this.tooltip,delete this.canvas_container,delete this.renderer,delete this.composer,delete this.scene,delete this.camera,delete this.mesh,delete this.doControls,delete this.raycaster,delete this.passes,delete this.config,this.prop.cache.length=0},e.prototype.setPanorama=function(a,b,c){if(null!==this.prop.loading_promise)throw new v("Loading already in progress");if("boolean"==typeof b&&(c=b,b=void 0),c&&this.prop.isCubemap)throw new v("Transition is not available with cubemap.");b&&(this.cleanPosition(b),this._stopAll()),this.config.panorama=a;var d=this;return c&&this.config.transition&&this.scene?(this.config.transition.loader&&this.loader.show(),this.prop.loading_promise=this._loadTexture(this.config.panorama).then(function(a){return d.loader.hide(),d._transition(a,b)}).ensure(function(){d.loader.hide(),d.prop.loading_promise=null}).rethrow()):(this.loader.show(),this.canvas_container&&(this.canvas_container.style.opacity=0),this.prop.loading_promise=this._loadTexture(this.config.panorama).then(function(a){d._setTexture(a),b&&d.rotate(b)}).ensure(function(){d.loader.hide(),d.canvas_container.style.opacity=1,d.prop.loading_promise=null}).rethrow()),this.prop.loading_promise},e.prototype.startAutorotate=function(){this._stopAll();var a=this,b=null,c=null;!function d(e){e&&(c=null===b?0:e-b,b=e,a.rotate({longitude:a.prop.longitude+a.config.anim_speed*c/1e3,latitude:a.prop.latitude-(a.prop.latitude-a.config.anim_lat)/200})),a.prop.autorotate_reqid=window.requestAnimationFrame(d)}(null),this.trigger("autorotate",!0)},e.prototype.stopAutorotate=function(){this.prop.start_timeout&&(window.clearTimeout(this.prop.start_timeout),this.prop.start_timeout=null),this.prop.autorotate_reqid&&(window.cancelAnimationFrame(this.prop.autorotate_reqid),this.prop.autorotate_reqid=null,this.trigger("autorotate",!1))},e.prototype.toggleAutorotate=function(){this.isAutorotateEnabled()?this.stopAutorotate():this.startAutorotate()},e.prototype.startGyroscopeControl=function(){if(!this.doControls||!this.doControls.enabled||!this.doControls.deviceOrientation)return void console.warn("PhotoSphereViewer: gyroscope disabled"); -this._stopAll();var a=this;!function b(){a.doControls.update(),a.prop.direction=a.camera.getWorldDirection();var c=a.vector3ToSphericalCoords(a.prop.direction);a.prop.longitude=c.longitude,a.prop.latitude=c.latitude,a.render(!1),a.prop.orientation_reqid=window.requestAnimationFrame(b)}(),this.trigger("gyroscope-updated",!0)},e.prototype.stopGyroscopeControl=function(){this.prop.orientation_reqid&&(window.cancelAnimationFrame(this.prop.orientation_reqid),this.prop.orientation_reqid=null,this.trigger("gyroscope-updated",!1),this.render())},e.prototype.toggleGyroscopeControl=function(){this.isGyroscopeEnabled()?this.stopGyroscopeControl():this.startGyroscopeControl()},e.prototype.rotate=function(a,b){this.cleanPosition(a),this.applyRanges(a).forEach(this.trigger.bind(this,"_side-reached")),this.prop.longitude=a.longitude,this.prop.latitude=a.latitude,b!==!1&&this.renderer&&(this.render(),this.trigger("position-updated",this.getPosition()))},e.prototype.animate=function(a,c){if(this._stopAll(),!c)return this.rotate(a),b.resolved();if(this.cleanPosition(a),this.applyRanges(a).forEach(this.trigger.bind(this,"_side-reached")),!c&&"number"!=typeof c){c=c?x.parseSpeed(c):this.config.anim_speed;var d=Math.acos(Math.cos(this.prop.latitude)*Math.cos(a.latitude)*Math.cos(this.prop.longitude-a.longitude)+Math.sin(this.prop.latitude)*Math.sin(a.latitude));c=d/c*1e3}var e=x.getShortestArc(this.prop.longitude,a.longitude);return this.prop.animation_promise=x.animation({properties:{longitude:{start:this.prop.longitude,end:this.prop.longitude+e},latitude:{start:this.prop.latitude,end:a.latitude}},duration:c,easing:"inOutSine",onTick:this.rotate.bind(this)}),this.prop.animation_promise},e.prototype.stopAnimation=function(){this.prop.animation_promise&&(this.prop.animation_promise.cancel(),this.prop.animation_promise=null)},e.prototype.zoom=function(b,c){this.prop.zoom_lvl=x.bound(Math.round(b),0,100),this.prop.vFov=this.config.max_fov+this.prop.zoom_lvl/100*(this.config.min_fov-this.config.max_fov),this.prop.hFov=a.Math.radToDeg(2*Math.atan(Math.tan(a.Math.degToRad(this.prop.vFov)/2)*this.prop.aspect)),c!==!1&&this.renderer&&(this.render(),this.trigger("zoom-updated",this.getZoomLevel()))},e.prototype.zoomIn=function(){this.prop.zoom_lvl<100&&this.zoom(this.prop.zoom_lvl+1)},e.prototype.zoomOut=function(){this.prop.zoom_lvl>0&&this.zoom(this.prop.zoom_lvl-1)},e.prototype.toggleFullscreen=function(){this.isFullscreenEnabled()?x.exitFullscreen():x.requestFullscreen(this.container)},e.prototype.startKeyboardControl=function(){window.addEventListener("keydown",this)},e.prototype.stopKeyboardControl=function(){window.removeEventListener("keydown",this)},e.prototype.preloadPanorama=function(a){if(!this.config.cache_texture)throw new v("Cannot preload panorama, cache_texture is disabled");return this._loadTexture(a)},e.prototype.clearPanoramaCache=function(a){if(!this.config.cache_texture)throw new v("Cannot clear cache, cache_texture is disabled");if(a){for(var b=0,c=this.prop.cache.length;b=Math.PI?b-Math.PI:b+Math.PI,latitude:x.HalfPI-c}},e.prototype.sphericalCoordsToTextureCoords=function(a){if(this.prop.isCubemap)throw new v("Unable to use texture coords with cubemap.");var b=a.longitude/x.TwoPI*this.prop.pano_data.full_width,c=a.latitude/Math.PI*this.prop.pano_data.full_height;return{x:parseInt(a.longitudec[1]?b.longitude>c[1]&&b.longitudec[0]/2+c[1]/2?(b.longitude=c[0],e.push("left")):(b.longitude=c[1],e.push("right"))):b.longitudec[1]&&(b.longitude=c[1],e.push("right"))),this.config.latitude_range&&(c=x.clone(this.config.latitude_range),d=a.Math.degToRad(this.prop.vFov)/2,c[0]=x.parseAngle(Math.min(c[0]+d,c[1]),-Math.PI),c[1]=x.parseAngle(Math.max(c[1]-d,c[0]),-Math.PI),b.latitudec[1]&&(b.latitude=c[1],e.push("top"))),e},f.className=null,f.publicMethods=[],f.prototype.create=function(){this.container=document.createElement("div"),this.constructor.className&&(this.container.className=this.constructor.className),this.parent.container.appendChild(this.container)},f.prototype.destroy=function(){this.parent.container.removeChild(this.container),this.constructor.publicMethods&&this.constructor.publicMethods.forEach(function(a){delete this.psv[a]},this),delete this.container,delete this.psv,delete this.parent},f.prototype.hide=function(){this.container.style.display="none"},f.prototype.show=function(){this.container.style.display=""},g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.className="psv-hud",g.publicMethods=["addMarker","removeMarker","updateMarker","clearMarkers","getMarker","getCurrentMarker","gotoMarker","hideMarker","showMarker","toggleMarker","toggleMarkersList","showMarkersList","hideMarkersList"],g.prototype.create=function(){f.prototype.create.call(this),this.svgContainer=document.createElementNS(x.svgNS,"svg"),this.svgContainer.setAttribute("class","psv-hud-svg-container"),this.container.appendChild(this.svgContainer),this.container.addEventListener("mouseenter",this,!0),this.container.addEventListener("mouseleave",this,!0),this.container.addEventListener("mousemove",this,!0),this.psv.on("click",this),this.psv.on("dblclick",this),this.psv.on("render",this),this.psv.on("open-panel",this),this.psv.on("close-panel",this)},g.prototype.destroy=function(){this.clearMarkers(!1),this.container.removeEventListener("mouseenter",this),this.container.removeEventListener("mouseleave",this),this.container.removeEventListener("mousemove",this),this.psv.off("click",this),this.psv.off("dblclick",this),this.psv.off("render",this),this.psv.off("open-panel",this),this.psv.off("close-panel",this),delete this.svgContainer,f.prototype.destroy.call(this)},g.prototype.handleEvent=function(a){switch(a.type){case"mouseenter":this._onMouseEnter(a);break;case"mouseleave":this._onMouseLeave(a);break;case"mousemove":this._onMouseMove(a);break;case"click":this._onClick(a.args[0],a,!1);break;case"dblclick":this._onClick(a.args[0],a,!0);break;case"render":this.renderMarkers();break;case"open-panel":this._onPanelOpened();break;case"close-panel":this._onPanelClosed()}},g.prototype.addMarker=function(a,b){if(!a.id)throw new v("missing marker id");if(this.markers[a.id])throw new v('marker "'+a.id+'" already exists');var c=new w(a,this.psv);return c.isNormal()?this.container.appendChild(c.$el):this.svgContainer.appendChild(c.$el),this.markers[c.id]=c,b!==!1&&this.renderMarkers(),c},g.prototype.getMarker=function(a){var b="object"==typeof a?a.id:a;if(!this.markers[b])throw new v('cannot find marker "'+b+'"');return this.markers[b]},g.prototype.getCurrentMarker=function(){return this.currentMarker},g.prototype.updateMarker=function(a,b){var c=this.getMarker(a);return c.update(a),b!==!1&&this.renderMarkers(),c},g.prototype.removeMarker=function(a,b){a=this.getMarker(a),a.isNormal()?this.container.removeChild(a.$el):this.svgContainer.removeChild(a.$el),this.hoveringMarker==a&&this.psv.tooltip.hideTooltip(),a.destroy(),delete this.markers[a.id],b!==!1&&this.renderMarkers()},g.prototype.clearMarkers=function(a){Object.keys(this.markers).forEach(function(a){this.removeMarker(a,!1)},this),a!==!1&&this.renderMarkers()},g.prototype.gotoMarker=function(a,b){return a=this.getMarker(a),this.psv.animate(a,b)},g.prototype.hideMarker=function(a){this.getMarker(a).visible=!1,this.renderMarkers()},g.prototype.showMarker=function(a){this.getMarker(a).visible=!0,this.renderMarkers()},g.prototype.toggleMarker=function(a){this.getMarker(a).visible^=!0,this.renderMarkers()},g.prototype.toggleMarkersList=function(){this.prop.panelOpened?this.hideMarkersList():this.showMarkersList()},g.prototype.showMarkersList=function(){var a=[];for(var b in this.markers)a.push(this.markers[b]);var c=this.psv.config.templates.markersList({markers:this.psv.change("render-markers-list",a),config:this.psv.config});this.prop.panelOpening=!0,this.psv.panel.showPanel(c,!0),this.psv.panel.container.querySelector(".psv-markers-list").addEventListener("click",this._onClickItem.bind(this))},g.prototype.hideMarkersList=function(){this.prop.panelOpened&&this.psv.panel.hidePanel()},g.prototype.renderMarkers=function(){var b=this.psv.isGyroscopeEnabled()?a.Math.radToDeg(this.psv.camera.rotation.z):0;for(var c in this.markers){var d=this.markers[c],e=d.visible;if(e&&d.isPolygon()){var f=this._getPolygonPositions(d);if(e=f.length>2){d.position2D=this._getPolygonDimensions(d,f);var g="";f.forEach(function(a){g+=a.x+","+a.y+" "}),d.$el.setAttributeNS(null,"points",g)}}else if(e){var h=this._getMarkerPosition(d);e=this._isMarkerVisible(d,h),e&&(d.position2D=h,d.$el instanceof SVGElement?d.$el.setAttribute("transform","translate("+h.x+" "+h.y+")"+(!d.lockRotation&&b?" rotate("+b+" "+d.anchor.left*d.width+" "+d.anchor.top*d.height+")":"")):(d.$el.style.transform="translate3D("+h.x+"px, "+h.y+"px, 0px)"+(!d.lockRotation&&b?" rotateZ("+b+"deg)":""),d.$el.style.transformOrigin=100*d.anchor.left+"% "+100*d.anchor.top+"%"))}x.toggleClass(d.$el,"psv-marker--visible",e)}},g.prototype._isMarkerVisible=function(a,b){return a.position3D.dot(this.psv.prop.direction)>0&&b.x+a.width>=0&&b.x-a.width<=this.psv.prop.size.width&&b.y+a.height>=0&&b.y-a.height<=this.psv.prop.size.height},g.prototype._getMarkerPosition=function(a){if(a._dynamicSize){x.toggleClass(a.$el,"psv-marker--transparent",!0);var b=a.$el.getBoundingClientRect();x.toggleClass(a.$el,"psv-marker--transparent",!1),a.width=b.right-b.left,a.height=b.bottom-b.top}var c=this.psv.vector3ToViewerCoords(a.position3D);return c.x-=a.width*a.anchor.left,c.y-=a.height*a.anchor.top,c},g.prototype._getPolygonPositions=function(a){var b=a.positions3D.length,c=a.positions3D.map(function(a){return{vector:a,visible:a.dot(this.psv.prop.direction)>0}},this),d=[];return c.forEach(function(a,e){if(!a.visible){var f=[0===e?c[b-1]:c[e-1],e===b-1?c[0]:c[e+1]];f.forEach(function(b){b.visible&&d.push({visible:b,invisible:a,index:e})})}}),d.reverse().forEach(function(a){c.splice(a.index,0,{vector:this._getPolygonIntermediaryPoint(a.visible.vector,a.invisible.vector),visible:!0})},this),c.filter(function(a){return a.visible}).map(function(a){return this.psv.vector3ToViewerCoords(a.vector)},this)},g.prototype._getPolygonIntermediaryPoint=function(b,c){var d=this.psv.prop.direction.clone().normalize(),f=(new a.Vector3).crossVectors(b,c).normalize(),g=(new a.Vector3).crossVectors(f,b).normalize(),h=(new a.Vector3).addVectors(b.clone().multiplyScalar(-d.dot(g)),g.clone().multiplyScalar(d.dot(b))).normalize(),i=(new a.Vector3).crossVectors(h,d);return h.applyAxisAngle(i,.01).multiplyScalar(e.SPHERE_RADIUS)},g.prototype._getPolygonDimensions=function(a,b){var c=+(1/0),d=+(1/0),e=-(1/0),f=-(1/0);return b.forEach(function(a){c=Math.min(c,a.x),d=Math.min(d,a.y),e=Math.max(e,a.x),f=Math.max(f,a.y)}),a.width=e-c,a.height=f-d,{x:c,y:d}},g.prototype._onMouseEnter=function(a){var b;a.target&&(b=a.target.psvMarker)&&!b.isPolygon()&&(this.hoveringMarker=b,this.psv.trigger("over-marker",b),b.tooltip&&this.psv.tooltip.showTooltip({content:b.tooltip.content,position:b.tooltip.position,left:b.position2D.x,top:b.position2D.y,box:{width:b.width,height:b.height}}))},g.prototype._onMouseLeave=function(a){var b;if(a.target&&(b=a.target.psvMarker)){if(b.isPolygon()&&a.relatedTarget&&x.hasParent(a.relatedTarget,this.psv.tooltip.container))return;this.psv.trigger("leave-marker",b),this.hoveringMarker=null,this.psv.tooltip.hideTooltip()}},g.prototype._onMouseMove=function(a){if(!this.psv.prop.moving){var b;if(a.target&&(b=a.target.psvMarker)&&b.isPolygon()||a.target&&x.hasParent(a.target,this.psv.tooltip.container)&&(b=this.hoveringMarker)){this.hoveringMarker||(this.psv.trigger("over-marker",b),this.hoveringMarker=b);var c=this.psv.container.getBoundingClientRect();b.tooltip&&this.psv.tooltip.showTooltip({content:b.tooltip.content,position:b.tooltip.position,top:a.clientY-c.top-this.psv.config.tooltip.arrow_size/2,left:a.clientX-c.left-this.psv.config.tooltip.arrow_size,box:{width:2*this.psv.config.tooltip.arrow_size,height:2*this.psv.config.tooltip.arrow_size}})}else this.hoveringMarker&&this.hoveringMarker.isPolygon()&&(this.psv.trigger("leave-marker",b),this.hoveringMarker=null,this.psv.tooltip.hideTooltip())}},g.prototype._onClick=function(a,b,c){var d;a.target&&(d=x.getClosest(a.target,".psv-marker"))&&d.psvMarker?(this.currentMarker=d.psvMarker,this.psv.trigger("select-marker",this.currentMarker,c),this.psv.config.click_event_on_marker?a.marker=d.psvMarker:b.stopPropagation()):this.currentMarker&&(this.psv.trigger("unselect-marker",this.currentMarker),this.currentMarker=null),d&&d.psvMarker&&d.psvMarker.content?this.psv.panel.showPanel(d.psvMarker.content):this.psv.panel.prop.opened&&(b.stopPropagation(),this.psv.panel.hidePanel())},g.prototype._onClickItem=function(a){var b;a.target&&(b=x.getClosest(a.target,"li"))&&b.dataset.psvMarker&&(this.gotoMarker(b.dataset.psvMarker,1e3),this.psv.panel.hidePanel())},g.prototype._onPanelOpened=function(){this.prop.panelOpening?(this.prop.panelOpening=!1,this.prop.panelOpened=!0):this.prop.panelOpened=!1,this.prop.markersButton&&this.prop.markersButton.toggleActive(this.prop.panelOpened)},g.prototype._onPanelClosed=function(){this.prop.panelOpened=!1,this.prop.panelOpening=!1,this.prop.markersButton&&this.prop.markersButton.toggleActive(!1)},h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.className="psv-loader-container",h.prototype.create=function(){f.prototype.create.call(this),this.loader=document.createElement("div"),this.loader.className="psv-loader",this.container.appendChild(this.loader),this.canvas=document.createElement("canvas"),this.canvas.className="psv-loader-canvas",this.canvas.width=this.loader.clientWidth,this.canvas.height=this.loader.clientWidth,this.loader.appendChild(this.canvas),this.tickness=(this.loader.offsetWidth-this.loader.clientWidth)/2;var a;if(this.psv.config.loading_img?(a=document.createElement("img"),a.className="psv-loader-image",a.src=this.psv.config.loading_img):this.psv.config.loading_txt&&(a=document.createElement("div"),a.className="psv-loader-text",a.innerHTML=this.psv.config.loading_txt),a){var b=Math.round(Math.sqrt(2*Math.pow(this.canvas.width/2-this.tickness/2,2)));a.style.maxWidth=b+"px",a.style.maxHeight=b+"px",this.loader.appendChild(a)}},h.prototype.destroy=function(){delete this.loader,delete this.canvas,f.prototype.destroy.call(this)},h.prototype.setProgress=function(a){var b=this.canvas.getContext("2d");b.clearRect(0,0,this.canvas.width,this.canvas.height),b.lineWidth=this.tickness,b.strokeStyle=x.getStyle(this.loader,"color"),b.beginPath(),b.arc(this.canvas.width/2,this.canvas.height/2,this.canvas.width/2-this.tickness/2,-Math.PI/2,a/100*2*Math.PI-Math.PI/2),b.stroke()},i.prototype=Object.create(f.prototype),i.prototype.constructor=i,i.className="psv-navbar psv-navbar--open",i.publicMethods=["showNavbar","hideNavbar","toggleNavbar","getNavbarButton"],i.prototype.create=function(){f.prototype.create.call(this),this.config.forEach(function(a){if("object"==typeof a)this.items.push(new p(this,a));else switch(a){case o.id:this.items.push(new o(this));break;case u.id:this.items.push(new u(this));break;case q.id:this.items.push(new q(this));break;case t.id:this.items.push(new t(this));break;case r.id:this.items.push(new r(this));break;case s.id:this.psv.config.gyroscope&&this.items.push(new s(this));break;case"caption":this.items.push(new j(this,this.psv.config.caption));break;case"spacer":a="spacer-5";default:var b=a.match(/^spacer\-([0-9]+)$/);if(null===b)throw new v("Unknown button "+a);this.items.push(new k(this,b[1]))}},this)},i.prototype.destroy=function(){this.items.forEach(function(a){a.destroy()}),delete this.items,delete this.config,f.prototype.destroy.call(this)},i.prototype.getNavbarButton=function(a){var b=null;return this.items.some(function(c){if(c.id===a)return b=c,!0}),b||console.warn('PhotoSphereViewer: button "'+a+'" not found in the navbar.'),b},i.prototype.showNavbar=function(){this.toggleNavbar(!0)},i.prototype.hideNavbar=function(){this.toggleNavbar(!1)},i.prototype.toggleNavbar=function(a){x.toggleClass(this.container,"psv-navbar--open",a)},j.prototype=Object.create(f.prototype),j.prototype.constructor=j,j.className="psv-caption",j.publicMethods=["setCaption"],j.prototype.setCaption=function(a){a?this.container.innerHTML=a:this.container.innerHTML=""},k.prototype=Object.create(f.prototype),k.prototype.constructor=k,k.className="psv-spacer",l.prototype=Object.create(f.prototype),l.prototype.constructor=l,l.className="psv-panel",l.publicMethods=["showPanel","hidePanel"],l.prototype.create=function(){f.prototype.create.call(this),this.container.innerHTML='
',this.content=this.container.querySelector(".psv-panel-content");var a=this.container.querySelector(".psv-panel-close-button");a.addEventListener("click",this.hidePanel.bind(this)),this.psv.config.mousewheel&&this.container.addEventListener(e.SYSTEM.mouseWheelEvent,function(a){a.stopPropagation()});var b=this.container.querySelector(".psv-panel-resizer");b.addEventListener("mousedown",this),b.addEventListener("touchstart",this),this.psv.container.addEventListener("mouseup",this),this.psv.container.addEventListener("touchend",this),this.psv.container.addEventListener("mousemove",this),this.psv.container.addEventListener("touchmove",this)},l.prototype.destroy=function(){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.prop,delete this.content,f.prototype.destroy.call(this)},l.prototype.handleEvent=function(a){switch(a.type){case"mousedown":this._onMouseDown(a);break;case"touchstart":this._onTouchStart(a);break;case"mousemove":this._onMouseMove(a);break;case"touchmove":this._onTouchMove(a);break;case"mouseup":this._onMouseUp(a);break;case"touchend":this._onMouseUp(a)}},l.prototype.showPanel=function(a,b){this.content.innerHTML=a,this.content.scrollTop=0,this.container.classList.add("psv-panel--open"),x.toggleClass(this.content,"psv-panel-content--no-margin",!!b),this.prop.opened=!0,this.psv.trigger("open-panel")},l.prototype.hidePanel=function(){this.content.innerHTML=null,this.prop.opened=!1,this.container.classList.remove("psv-panel--open"),this.psv.trigger("close-panel")},l.prototype._onMouseDown=function(a){a.stopPropagation(),this._startResize(a)},l.prototype._onTouchStart=function(a){a.stopPropagation(),this._startResize(a.changedTouches[0])},l.prototype._onMouseUp=function(a){this.prop.mousedown&&(a.stopPropagation(),this.prop.mousedown=!1,this.content.classList.remove("psv-panel-content--no-interaction"))},l.prototype._onMouseMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a))},l.prototype._onTouchMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a.touches[0]))},l.prototype._startResize=function(a){this.prop.mouse_x=parseInt(a.clientX),this.prop.mouse_y=parseInt(a.clientY),this.prop.mousedown=!0,this.content.classList.add("psv-panel-content--no-interaction")},l.prototype._resize=function(a){var b=parseInt(a.clientX),c=parseInt(a.clientY);this.container.style.width=this.container.offsetWidth-(b-this.prop.mouse_x)+"px",this.prop.mouse_x=b,this.prop.mouse_y=c},m.prototype=Object.create(f.prototype),m.prototype.constructor=m,m.className="psv-tooltip",m.publicMethods=["showTooltip","hideTooltip","isTooltipVisible"],m.leftMap={0:"left",.5:"center",1:"right"},m.topMap={0:"top",.5:"center",1:"bottom"},m.prototype.create=function(){f.prototype.create.call(this),this.container.innerHTML='
',this.container.style.top="-1000px",this.container.style.left="-1000px",this.content=this.container.querySelector(".psv-tooltip-content"),this.arrow=this.container.querySelector(".psv-tooltip-arrow"),this.psv.on("render",this)},m.prototype.destroy=function(){this.psv.off("render",this),delete this.config,delete this.prop,f.prototype.destroy.call(this)},m.prototype.handleEvent=function(a){switch(a.type){case"render":this.hideTooltip()}},m.prototype.isTooltipVisible=function(){return this.container.classList.contains("psv-tooltip--visible")},m.prototype.showTooltip=function(a){this.prop.timeout&&(window.clearTimeout(this.prop.timeout),this.prop.timeout=null);var b=this.isTooltipVisible(),c=this.container,d=this.content,e=this.arrow;if(a.position||(a.position=["top","center"]),a.box||(a.box={width:0,height:0}),"string"==typeof a.position){var f=x.parsePosition(a.position);if(!(f.left in m.leftMap&&f.top in m.topMap))throw new v('unable to parse tooltip position "'+tooltip.position+'"');a.position=[m.topMap[f.top],m.leftMap[f.left]]}if("center"==a.position[0]&&"center"==a.position[1])throw new v('unable to parse tooltip position "center center"');if(b)for(var g=c.classList.length-1;g>=0;g--){var h=c.classList.item(g);"psv-tooltip"!=h&&"psv-tooltip--visible"!=h&&c.classList.remove(h)}else c.className="psv-tooltip";a.className&&x.addClasses(c,a.className),d.innerHTML=a.content,c.style.top="0px",c.style.left="0px";var i=c.getBoundingClientRect(),j={posClass:a.position.slice(),width:i.right-i.left,height:i.bottom-i.top,top:0,left:0,arrow_top:0,arrow_left:0};this._computeTooltipPosition(j,a);var k=!1;if(j.topthis.psv.prop.size.height-this.config.offset&&(j.posClass[0]="top",k=!0),j.leftthis.psv.prop.size.width-this.config.offset&&(j.posClass[1]="left",k=!0),k&&this._computeTooltipPosition(j,a),c.style.top=j.top+"px",c.style.left=j.left+"px",e.style.top=j.arrow_top+"px",e.style.left=j.arrow_left+"px",c.classList.add("psv-tooltip--"+j.posClass.join("-")),!b){var l=this;this.prop.timeout=window.setTimeout(function(){c.classList.add("psv-tooltip--visible"),l.prop.timeout=null,l.psv.trigger("show-tooltip")},this.config.delay)}},m.prototype.hideTooltip=function(){if(this.prop.timeout&&(window.clearTimeout(this.prop.timeout),this.prop.timeout=null),this.isTooltipVisible()){this.container.classList.remove("psv-tooltip--visible");var a=this;this.prop.timeout=window.setTimeout(function(){a.content.innerHTML=null,a.container.style.top="-1000px",a.container.style.left="-1000px",a.prop.timeout=null},this.config.delay),this.psv.trigger("hide-tooltip")}},m.prototype._computeTooltipPosition=function(a,b){var c=!1;switch(a.posClass[0]){case"bottom":a.top=b.top+b.box.height+this.config.offset+this.config.arrow_size,a.arrow_top=2*-this.config.arrow_size,c=!0;break;case"center":a.top=b.top+b.box.height/2-a.height/2,a.arrow_top=a.height/2-this.config.arrow_size;break;case"top":a.top=b.top-a.height-this.config.offset-this.config.arrow_size,a.arrow_top=a.height,c=!0}switch(a.posClass[1]){case"right":c?(a.left=b.left+b.box.width/2-this.config.offset-this.config.arrow_size,a.arrow_left=this.config.offset):(a.left=b.left+b.box.width+this.config.offset+this.config.arrow_size,a.arrow_left=2*-this.config.arrow_size);break;case"center":a.left=b.left+b.box.width/2-a.width/2,a.arrow_left=a.width/2-this.config.arrow_size;break;case"left":c?(a.left=b.left-a.width+b.box.width/2+this.config.offset+this.config.arrow_size,a.arrow_left=a.width-this.config.offset-2*this.config.arrow_size):(a.left=b.left-a.width-this.config.offset-this.config.arrow_size,a.arrow_left=a.width)}},n.prototype=Object.create(f.prototype),n.prototype.constructor=n,n.id=null,n.icon=null,n.iconActive=null,n.prototype.create=function(){f.prototype.create.call(this),this.constructor.icon&&this._setIcon(this.constructor.icon),this.id&&this.psv.config.lang[this.id]&&(this.container.title=this.psv.config.lang[this.id]),this.container.addEventListener("click",function(a){this.enabled&&this._onClick(),a.stopPropagation()}.bind(this))},n.prototype.destroy=function(){f.prototype.destroy.call(this)},n.prototype.toggleActive=function(a){x.toggleClass(this.container,"psv-button--active",a),this.constructor.iconActive&&this._setIcon(a?this.constructor.iconActive:this.constructor.icon)},n.prototype.disable=function(){this.container.classList.add("psv-button--disabled"),this.enabled=!1},n.prototype.enable=function(){this.container.classList.remove("psv-button--disabled"),this.enabled=!0},n.prototype._setIcon=function(a,b){b||(b=this.container),a?(b.innerHTML=e.ICONS[a],b.querySelector("svg").setAttribute("class","psv-button-svg")):b.innerHTML=""},n.prototype._onClick=function(){},o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.id="autorotate",o.className="psv-button psv-button--hover-scale psv-autorotate-button",o.icon="play.svg",o.iconActive="play-active.svg",o.prototype.create=function(){n.prototype.create.call(this),this.psv.on("autorotate",this)},o.prototype.destroy=function(){this.psv.off("autorotate",this),n.prototype.destroy.call(this)},o.prototype.handleEvent=function(a){switch(a.type){case"autorotate":this.toggleActive(a.args[0])}},o.prototype._onClick=function(){this.psv.toggleAutorotate()},p.prototype=Object.create(n.prototype),p.prototype.constructor=p,p.className="psv-button psv-custom-button",p.prototype.create=function(){n.prototype.create.call(this),this.config.className&&x.addClasses(this.container,this.config.className),this.config.title&&(this.container.title=this.config.title),this.config.content&&(this.container.innerHTML=this.config.content),this.config.enabled!==!1&&this.config.disabled!==!0||this.disable(),this.config.visible!==!1&&this.config.hidden!==!0||this.hide()},p.prototype.destroy=function(){delete this.config,n.prototype.destroy.call(this)},p.prototype._onClick=function(){this.config.onClick&&this.config.onClick.apply(this.psv)},q.prototype=Object.create(n.prototype),q.prototype.constructor=q,q.id="download",q.className="psv-button psv-button--hover-scale psv-download-button",q.icon="download.svg",q.prototype._onClick=function(){var a=document.createElement("a");a.href=this.psv.config.panorama,a.download=this.psv.config.panorama,this.psv.container.appendChild(a),a.click()},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.id="fullscreen",r.className="psv-button psv-button--hover-scale psv-fullscreen-button",r.icon="fullscreen-in.svg",r.iconActive="fullscreen-out.svg",r.prototype.create=function(){n.prototype.create.call(this),e.SYSTEM.fullscreenEvent||(this.hide(),console.warn("PhotoSphereViewer: fullscreen not supported.")),this.psv.on("fullscreen-updated",this)},r.prototype.destroy=function(){this.psv.off("fullscreen-updated",this),n.prototype.destroy.call(this)},r.prototype.handleEvent=function(a){switch(a.type){case"fullscreen-updated":this.toggleActive(a.args[0])}},r.prototype._onClick=function(){this.psv.toggleFullscreen()},s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.id="gyroscope",s.className="psv-button psv-button--hover-scale psv-gyroscope-button",s.icon="compass.svg",s.prototype.create=function(){n.prototype.create.call(this),e.SYSTEM.deviceOrientationSupported.promise.then(this._onAvailabilityChange.bind(this,!0),this._onAvailabilityChange.bind(this,!1)),this.hide(),this.psv.on("gyroscope-updated",this)},s.prototype.destroy=function(){this.psv.off("gyroscope-updated",this),n.prototype.destroy.call(this)},s.prototype.handleEvent=function(a){switch(a.type){case"gyroscope-updated":this.toggleActive(a.args[0])}},s.prototype._onClick=function(){this.psv.toggleGyroscopeControl()},s.prototype._onAvailabilityChange=function(a){if(a){if(!x.checkTHREE("DeviceOrientationControls"))throw new v("Missing Three.js components: DeviceOrientationControls. Get them from three.js-examples package.");this.show()}},t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.id="markers",t.className="psv-button psv-button--hover-scale psv-markers-button",t.icon="pin.svg",t.prototype._onClick=function(){this.psv.hud.toggleMarkersList()},u.prototype=Object.create(n.prototype),u.prototype.constructor=u,u.id="zoom",u.className="psv-button psv-zoom-button",u.prototype.create=function(){n.prototype.create.call(this);var a=document.createElement("div");a.className="psv-zoom-button-minus",a.title=this.psv.config.lang.zoomOut,this._setIcon("zoom-out.svg",a),this.container.appendChild(a);var b=document.createElement("div");b.className="psv-zoom-button-range",this.container.appendChild(b),this.zoom_range=document.createElement("div"),this.zoom_range.className="psv-zoom-button-line",b.appendChild(this.zoom_range),this.zoom_value=document.createElement("div"),this.zoom_value.className="psv-zoom-button-handle",this.zoom_range.appendChild(this.zoom_value);var c=document.createElement("div");c.className="psv-zoom-button-plus",c.title=this.psv.config.lang.zoomIn,this._setIcon("zoom-in.svg",c), -this.container.appendChild(c),this.zoom_range.addEventListener("mousedown",this),this.zoom_range.addEventListener("touchstart",this),this.psv.container.addEventListener("mousemove",this),this.psv.container.addEventListener("touchmove",this),this.psv.container.addEventListener("mouseup",this),this.psv.container.addEventListener("touchend",this),a.addEventListener("mousedown",this._zoomOut.bind(this)),c.addEventListener("mousedown",this._zoomIn.bind(this)),this.psv.on("zoom-updated",this),this.psv.once("ready",function(){this._moveZoomValue(this.psv.prop.zoom_lvl)}.bind(this))},u.prototype.destroy=function(){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.zoom_range,delete this.zoom_value,this.psv.off("zoom-updated",this),n.prototype.destroy.call(this)},u.prototype.handleEvent=function(a){switch(a.type){case"mousedown":this._initZoomChangeWithMouse(a);break;case"touchstart":this._initZoomChangeByTouch(a);break;case"mousemove":this._changeZoomWithMouse(a);break;case"touchmove":this._changeZoomByTouch(a);break;case"mouseup":this._stopZoomChange(a);break;case"touchend":this._stopZoomChange(a);break;case"zoom-updated":this._moveZoomValue(a.args[0])}},u.prototype._moveZoomValue=function(a){this.zoom_value.style.left=a/100*this.zoom_range.offsetWidth-this.zoom_value.offsetWidth/2+"px"},u.prototype._initZoomChangeWithMouse=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.clientX))},u.prototype._initZoomChangeByTouch=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.changedTouches[0].clientX))},u.prototype._zoomIn=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomIn(),window.setTimeout(this._startLongPressInterval.bind(this,1),200))},u.prototype._zoomOut=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomOut(),window.setTimeout(this._startLongPressInterval.bind(this,-1),200))},u.prototype._startLongPressInterval=function(a){this.prop.buttondown&&(this.prop.longPressInterval=window.setInterval(function(){this.psv.zoom(this.psv.prop.zoom_lvl+a)}.bind(this),50))},u.prototype._stopZoomChange=function(){this.enabled&&(window.clearInterval(this.prop.longPressInterval),this.prop.longPressInterval=null,this.prop.mousedown=!1,this.prop.buttondown=!1)},u.prototype._changeZoomWithMouse=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.clientX))},u.prototype._changeZoomByTouch=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.changedTouches[0].clientX))},u.prototype._changeZoom=function(a){if(this.prop.mousedown){var b=parseInt(a)-this.zoom_range.getBoundingClientRect().left,c=b/this.zoom_range.offsetWidth*100;this.psv.zoom(c)}},v.prototype=Object.create(Error.prototype),v.prototype.name="PSVError",v.prototype.constructor=v,e.Error=v,w.types=["image","html","polygon_px","polygon_rad","rect","circle","ellipse","path"],w.getType=function(a,b){var c=[];if(w.types.forEach(function(b){a[b]&&c.push(b)}),0===c.length&&!b)throw new v("missing marker content, either "+w.types.join(", "));if(c.length>1)throw new v("multiple marker content, either "+w.types.join(", "));return c[0]},w.prototype.destroy=function(){delete this.$el.psvMarker},w.prototype.isNormal=function(){return"image"==this.type||"html"==this.type},w.prototype.isPolygon=function(){return"polygon_px"==this.type||"polygon_rad"==this.type},w.prototype.isSvg=function(){return"rect"==this.type||"circle"==this.type||"ellipse"==this.type||"path"==this.type},w.prototype.update=function(a){if(a&&a!==this){var b=w.getType(a,!0);if(void 0!==b&&b!==this.type)throw new v("cannot change marker type");x.deepmerge(this,a)}this.isNormal()?this.$el.setAttribute("class","psv-marker psv-marker--normal"):this.$el.setAttribute("class","psv-marker psv-marker--svg"),this.className&&x.addClasses(this.$el,this.className),this.tooltip&&(x.addClasses(this.$el,"has-tooltip"),"string"==typeof this.tooltip&&(this.tooltip={content:this.tooltip})),this.style&&x.deepmerge(this.$el.style,this.style),this.anchor=x.parsePosition(this.anchor),this.isNormal()?this._updateNormal():this.isPolygon()?this._updatePolygon():this._updateSvg()},w.prototype._updateNormal=function(){this.width&&this.height?(this.$el.style.width=this.width+"px",this.$el.style.height=this.height+"px",this._dynamicSize=!1):this._dynamicSize=!0,this.image?this.$el.style.backgroundImage="url("+this.image+")":this.$el.innerHTML=this.html,this.psv.cleanPosition(this),this.position3D=this.psv.sphericalCoordsToVector3(this)},w.prototype._updateSvg=function(){switch(this._dynamicSize=!0,this.type){case"rect":"number"==typeof this._def?this._def={x:0,y:0,width:this._def,height:this._def}:Array.isArray(this._def)?this._def={x:0,y:0,width:this._def[0],height:this._def[1]}:this._def.x=this._def.y=0;break;case"circle":"number"==typeof this._def?this._def={cx:this._def,cy:this._def,r:this._def}:Array.isArray(this._def)?this._def={cx:this._def[0],cy:this._def[0],r:this._def[0]}:this._def.cx=this._def.cy=this._def.r;break;case"ellipse":"number"==typeof this._def?this._def={cx:this._def,cy:this._def,rx:this._def,ry:this._def}:Array.isArray(this._def)?this._def={cx:this._def[0],cy:this._def[1],rx:this._def[0],ry:this._def[1]}:(this._def.cx=this._def.rx,this._def.cy=this._def.ry);break;case"path":"string"==typeof this._def&&(this._def={d:this._def})}Object.getOwnPropertyNames(this._def).forEach(function(a){this.$el.setAttributeNS(null,a,this._def[a])},this),this.svgStyle?Object.getOwnPropertyNames(this.svgStyle).forEach(function(a){this.$el.setAttributeNS(null,a,this.svgStyle[a])},this):this.$el.setAttributeNS(null,"fill","rgba(0,0,0,0.5)"),this.psv.cleanPosition(this),this.position3D=this.psv.sphericalCoordsToVector3(this)},w.prototype._updatePolygon=function(){this._dynamicSize=!0,this.svgStyle?Object.getOwnPropertyNames(this.svgStyle).forEach(function(a){this.$el.setAttributeNS(null,a,this.svgStyle[a])},this):this.$el.setAttributeNS(null,"fill","rgba(0,0,0,0.5)"),[this.polygon_rad,this.polygon_px].forEach(function(a){if(a&&"object"!=typeof a[0])for(var b=0;b0?" "+b:b,a.setAttribute("class",d)}},x.addClasses=function(a,b){b&&b.split(" ").forEach(function(b){x.toggleClass(a,b,!0)})},x.removeClasses=function(a,b){b&&b.split(" ").forEach(function(b){x.toggleClass(a,b,!1)})},x.hasParent=function(a,b){do if(a===b)return!0;while(a=a.parentNode);return!1},x.getClosest=function(a,b){var c=a.matches||a.msMatchesSelector;do if(c.bind(a)(b))return a;while(a=a.parentElement);return null},x.mouseWheelEvent=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"},x.fullscreenEvent=function(){var a={exitFullscreen:"fullscreenchange",webkitExitFullscreen:"webkitfullscreenchange",mozCancelFullScreen:"mozfullscreenchange",msExitFullscreen:"msFullscreenEnabled"};for(var b in a)if(b in document)return a[b]},x.bound=function(a,b,c){return Math.max(b,Math.min(c,a))},x.isInteger=Number.isInteger||function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a},x.sum=function(a){return a.reduce(function(a,b){return a+b},0)},x.getXMPValue=function(a,b){var c;return null!==(c=a.match("(.*)"))?c[1]:null!==(c=a.match("GPano:"+b+'="(.*?)"'))?c[1]:null},x.isFullscreenEnabled=function(a){return(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)===a},x.requestFullscreen=function(a){(a.requestFullscreen||a.mozRequestFullScreen||a.webkitRequestFullscreen||a.msRequestFullscreen).call(a)},x.exitFullscreen=function(){(document.exitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.msExitFullscreen).call(document)},x.getStyle=function(a,b){return window.getComputedStyle(a,null)[b]},x.getShortestArc=function(a,b){var c=[0,x.TwoPI,-x.TwoPI];return c.reduce(function(c,d){return d=b-a+d,Math.abs(d)b?(f&&(clearTimeout(f),f=null),g=i,e=a.apply(c,d),f||(c=d=null)):f||(f=setTimeout(h,j)),e}},x.isPlainObject=function(a){if("object"==typeof a&&null!==a){if("function"==typeof Object.getPrototypeOf){var b=Object.getPrototypeOf(a);return b===Object.prototype||null===b}return"[object Object]"==Object.prototype.toString.call(a)}return!1},x.deepmerge=function(a,b){var c=b;return function d(a,b){return Array.isArray(b)?(a&&Array.isArray(a)?a.length=0:a=[],b.forEach(function(b,c){a[c]=d(null,b)})):"object"==typeof b?(a&&!Array.isArray(a)||(a={}),Object.keys(b).forEach(function(e){"object"==typeof b[e]&&b[e]&&x.isPlainObject(b[e])?b[e]!=c&&(a[e]?d(a[e],b[e]):a[e]=d(null,b[e])):a[e]=b[e]})):a=b,a}(a,b)},x.clone=function(a){return x.deepmerge(null,a)},function(a){if(a.requestAnimationFrame=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,a.cancelAnimationFrame=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,!a.requestAnimationFrame){var b,c=[],d=[],e=0;a.requestAnimationFrame=function(a){return c.push([++e,a]),b||(b=setInterval(function(){if(c.length){var a=+new Date,e=d;for(d=c,c=e;d.length;)d.shift()[1](a)}else clearInterval(b),b=void 0},20)),e},a.cancelAnimationFrame=function(a){var b,e;for(b=0,e=c.length;bthis.config.latitude_range[1]&&(this.config.latitude_range=[this.config.latitude_range[1],this.config.latitude_range[0]],console.warn("PhotoSphereViewer: latitude_range values must be ordered.")):void 0===this.config.tilt_up_max&&void 0===this.config.tilt_down_max||(this.config.latitude_range=[void 0!==this.config.tilt_down_max?this.config.tilt_down_max-Math.PI/4:-x.HalfPI,void 0!==this.config.tilt_up_max?this.config.tilt_up_max+Math.PI/4:x.HalfPI],console.warn("PhotoSphereViewer: tilt_up_max and tilt_down_max are deprecated, use latitude_range instead.")),this.config.max_fov"),h=a.substring(b,g);if(b===-1||g===-1||h.indexOf("GPano:")===-1)c.resolve(null);else{var i={full_width:parseInt(x.getXMPValue(h,"FullPanoWidthPixels")),full_height:parseInt(x.getXMPValue(h,"FullPanoHeightPixels")),cropped_width:parseInt(x.getXMPValue(h,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(x.getXMPValue(h,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(x.getXMPValue(h,"CroppedAreaLeftPixels")),cropped_y:parseInt(x.getXMPValue(h,"CroppedAreaTopPixels"))};i.full_width&&i.full_height&&i.cropped_width&&i.cropped_height?c.resolve(i):(console.warn("PhotoSphereViewer: invalid XMP data"),c.resolve(null))}}else 3===d.readyState&&e.loader.setProgress(f+=10)},d.onprogress=function(a){if(a.lengthComputable){var b=parseInt(a.loaded/a.total*100);b>f&&(f=b,e.loader.setProgress(f))}},d.onerror=function(){throw e.container.textContent="Cannot load image",new v("Cannot load image")},d.open("GET",a,!0),d.send(null),c.promise},e.prototype._loadTexture=function(a){var b=[];if(Array.isArray(a)){if(6!==a.length)throw new v("Must provide exactly 6 image paths when using cubemap.");for(var c=0;c<6;c++)b[c]=a[e.CUBE_MAP[c]];a=b}else if("object"==typeof a){if(!e.CUBE_HASHMAP.every(function(b){return!!a[b]}))throw new v("Must provide exactly left, front, right, back, top, bottom when using cubemap.");e.CUBE_HASHMAP.forEach(function(c,d){b[d]=a[c]}),a=b}if(Array.isArray(a)){if(this.prop.isCubemap===!1)throw new v("The viewer was initialized with an equirectangular panorama, cannot switch to cubemap.");return this.config.fisheye&&console.warn("PhotoSphereViewer: fisheye effect with cubemap texture can generate distorsions."),this.config.cache_texture===e.DEFAULTS.cache_texture&&(this.config.cache_texture*=6),this.prop.isCubemap=!0,this._loadCubemapTexture(a)}if(this.prop.isCubemap===!0)throw new v("The viewer was initialized with an cubemap, cannot switch to equirectangular panorama.");return this.prop.isCubemap=!1,this._loadEquirectangularTexture(a)},e.prototype._loadEquirectangularTexture=function(c){if(this.config.cache_texture){var d=this.getPanoramaCache(c);if(d)return this.prop.pano_data=d.pano_data,b.resolved(d.image)}return this._loadXMP(c).then(function(d){var f=b(),g=new a.ImageLoader,h=d?100:0;g.setCrossOrigin("anonymous");var i=function(b){h=100,this.loader.setProgress(h),this.trigger("panorama-load-progress",c,h),!d&&this.config.pano_data&&(d=x.clone(this.config.pano_data)),d||(d={full_width:b.width,full_height:b.height,cropped_width:b.width,cropped_height:b.height,cropped_x:0,cropped_y:0}),this.prop.pano_data=d;var g,i=Math.min(d.full_width,e.SYSTEM.maxTextureWidth)/d.full_width;if(1!==i||d.cropped_width!=d.full_width||d.cropped_height!=d.full_height){var j=x.clone(d);j.full_width*=i,j.full_height*=i,j.cropped_width*=i,j.cropped_height*=i,j.cropped_x*=i,j.cropped_y*=i,b.width=j.cropped_width,b.height=j.cropped_height;var k=document.createElement("canvas");k.width=j.full_width,k.height=j.full_height;var l=k.getContext("2d");l.drawImage(b,j.cropped_x,j.cropped_y,j.cropped_width,j.cropped_height),g=new a.Texture(k)}else g=new a.Texture(b);g.needsUpdate=!0,g.minFilter=a.LinearFilter,g.generateMipmaps=!1,this.config.cache_texture&&this._putPanoramaCache({panorama:c,image:g,pano_data:d}),f.resolve(g)},j=function(a){if(a.lengthComputable){var b=parseInt(a.loaded/a.total*100);b>h&&(h=b,this.loader.setProgress(h),this.trigger("panorama-load-progress",c,h))}},k=function(a){throw this.container.textContent="Cannot load image",f.reject(a),new v("Cannot load image")};return g.load(c,i.bind(this),j.bind(this),k.bind(this)),f.promise}.bind(this))},e.prototype._loadCubemapTexture=function(c){var d=b(),f=new a.ImageLoader,g=[0,0,0,0,0,0],h=[],i=0;f.setCrossOrigin("anonymous");for(var j=function(){h.forEach(function(b){b.needsUpdate=!0,b.minFilter=a.LinearFilter,b.generateMipmaps=!1}),d.resolve(h)},k=function(b,d){i++,g[b]=100,this.loader.setProgress(x.sum(g)/6),this.trigger("panorama-load-progress",c[b],g[b]);var f=Math.min(d.width,e.SYSTEM.maxTextureWidth/2)/d.width;if(1!==f){var k=document.createElement("canvas");k.width=d.width*f,k.height=d.height*f;var l=k.getContext("2d");l.drawImage(d,0,0,k.width,k.height),h[b]=new a.Texture(k)}else h[b]=new a.Texture(d);this.config.cache_texture&&this._putPanoramaCache({panorama:c[b],image:h[b]}),6===i&&j()},l=function(a,b){if(b.lengthComputable){var d=parseInt(b.loaded/b.total*100);d>g[a]&&(g[a]=d,this.loader.setProgress(x.sum(g)/6),this.trigger("panorama-load-progress",c[a],g[a]))}},m=function(a,b){throw this.container.textContent="Cannot load image",d.reject(b),new v("Cannot load image "+a)},n=0;n<6;n++){if(this.config.cache_texture){var o=this.getPanoramaCache(c[n]);if(o){i++,g[n]=100,h[n]=o.image;continue}}f.load(c[n],k.bind(this,n),l.bind(this,n),m.bind(this,n))}return 6===i&&d.resolve(h),d.promise},e.prototype._setTexture=function(a){if(this.scene||this._createScene(),this.prop.isCubemap)for(var b=0;b<6;b++)this.mesh.material.materials[b].map&&this.mesh.material.materials[b].map.dispose(),this.mesh.material.materials[b].map=a[b];else this.mesh.material.map&&this.mesh.material.map.dispose(),this.mesh.material.map=a;this.trigger("panorama-loaded"),this.render()},e.prototype._createScene=function(){this.raycaster=new a.Raycaster,this.renderer=e.SYSTEM.isWebGLSupported&&this.config.webgl?new a.WebGLRenderer:new a.CanvasRenderer,this.renderer.setSize(this.prop.size.width,this.prop.size.height),this.renderer.setPixelRatio(e.SYSTEM.pixelRatio);var b=e.SPHERE_RADIUS;this.prop.isCubemap&&(b*=Math.sqrt(3)),this.config.fisheye&&(b+=e.SPHERE_RADIUS),this.camera=new a.PerspectiveCamera(this.config.default_fov,this.prop.size.width/this.prop.size.height,1,b),this.camera.position.set(0,0,0),this.config.gyroscope&&x.checkTHREE("DeviceOrientationControls")&&(this.doControls=new a.DeviceOrientationControls(this.camera)),this.scene=new a.Scene,this.scene.add(this.camera),this.prop.isCubemap?this._createCubemap():this._createSphere(),this.canvas_container=document.createElement("div"),this.canvas_container.className="psv-canvas-container",this.renderer.domElement.className="psv-canvas",this.container.appendChild(this.canvas_container),this.canvas_container.appendChild(this.renderer.domElement)},e.prototype._createSphere=function(){var b=new a.SphereGeometry(e.SPHERE_RADIUS,e.SPHERE_VERTICES,e.SPHERE_VERTICES,(-x.HalfPI)),c=new a.MeshBasicMaterial({side:a.DoubleSide,overdraw:e.SYSTEM.isWebGLSupported&&this.config.webgl?0:1});this.mesh=new a.Mesh(b,c),this.mesh.scale.x=-1,this.mesh.rotation.z=this.config.panorama_roll,this.scene.add(this.mesh)},e.prototype._createCubemap=function(){for(var b=new a.BoxGeometry(2*e.SPHERE_RADIUS,2*e.SPHERE_RADIUS,2*e.SPHERE_RADIUS,e.CUBE_VERTICES,e.CUBE_VERTICES,e.CUBE_VERTICES),c=[],d=0;d<6;d++)c.push(new a.MeshBasicMaterial({overdraw:e.SYSTEM.isWebGLSupported&&this.config.webgl?0:1}));this.mesh=new a.Mesh(b,new a.MultiMaterial(c)),this.mesh.position.x-=e.SPHERE_RADIUS,this.mesh.position.y-=e.SPHERE_RADIUS,this.mesh.position.z-=e.SPHERE_RADIUS,this.mesh.applyMatrix((new a.Matrix4).makeScale(1,1,-1)),this.scene.add(this.mesh);var f=new a.MeshBasicMaterial({side:a.BackSide,visible:!1}),g=new a.Mesh(b,f);this.scene.add(g)},e.prototype._transition=function(b,c){if(this.prop.isCubemap)throw new v("Transition is not available with cubemap.");var d=this,f=new a.SphereGeometry(.9*e.SPHERE_RADIUS,e.SPHERE_VERTICES,e.SPHERE_VERTICES,(-x.HalfPI)),g=new a.MeshBasicMaterial({side:a.DoubleSide,overdraw:e.SYSTEM.isWebGLSupported&&this.config.webgl?0:1,map:b,transparent:!0,opacity:0}),h=new a.Mesh(f,g);if(h.scale.x=-1,c){h.rotateY(c.longitude-this.prop.longitude);var i=new a.Vector3(0,1,0).cross(this.camera.getWorldDirection()).normalize(),j=(new a.Quaternion).setFromAxisAngle(i,c.latitude-this.prop.latitude);h.quaternion.multiplyQuaternions(j,h.quaternion)}return this.scene.add(h),this.render(),x.animation({properties:{opacity:{start:0,end:1}},duration:d.config.transition.duration,easing:"outCubic",onTick:function(a){g.opacity=a.opacity,d.render()}}).then(function(){d.mesh.material.map.dispose(),d.mesh.material.map=b,d.scene.remove(h),h.geometry.dispose(),h.geometry=null,h.material.dispose(),h.material=null,c?((d.config.latitude_range||d.config.longitude_range)&&(d.config.longitude_range=d.config.latitude_range=null,console.warn("PhotoSphereViewer: trying to perform transition with longitude_range and/or latitude_range, ranges cleared.")),d.rotate(c)):d.render()})},e.prototype._reverseAutorotate=function(){var a=this,b=-this.config.anim_speed,c=this.config.longitude_range;this.config.longitude_range=null,x.animation({properties:{speed:{start:this.config.anim_speed,end:0}},duration:300,easing:"inSine",onTick:function(b){a.config.anim_speed=b.speed}}).then(function(){return x.animation({properties:{speed:{start:0,end:b}},duration:300,easing:"outSine",onTick:function(b){a.config.anim_speed=b.speed}})}).then(function(){a.config.longitude_range=c,a.config.anim_speed=b})},e.prototype._putPanoramaCache=function(a){if(!this.config.cache_texture)throw new v("Cannot add panorama to cache, cache_texture is disabled");var b=this.getPanoramaCache(a.panorama);b?(b.image=a.image,b.pano_data=a.pano_data):(this.prop.cache=this.prop.cache.slice(0,this.config.cache_texture-1),this.prop.cache.unshift(a)),this.trigger("panorama-cached",a.panorama)},e.prototype._stopAll=function(){this.stopAutorotate(),this.stopAnimation(),this.stopGyroscopeControl()},e.MOVE_THRESHOLD=4,e.DBLCLICK_DELAY=300,e.INERTIA_WINDOW=300,e.SPHERE_RADIUS=100,e.SPHERE_VERTICES=64,e.CUBE_VERTICES=8,e.CUBE_MAP=[0,2,4,5,3,1],e.CUBE_HASHMAP=["left","right","top","bottom","back","front"],e.KEYMAP={33:"PageUp",34:"PageDown",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",107:"+",109:"-"},e.SYSTEM={loaded:!1,pixelRatio:1,isWebGLSupported:!1,isCanvasSupported:!1,deviceOrientationSupported:null,maxTextureWidth:0,mouseWheelEvent:null,fullscreenEvent:null},e.ICONS={},e.DEFAULTS={panorama:null,container:null,caption:null,autoload:!0,usexmpdata:!0,pano_data:null,webgl:!0,min_fov:30,max_fov:90,default_fov:null,default_long:0,default_lat:0,panorama_roll:0,longitude_range:null,latitude_range:null,move_speed:1,time_anim:2e3,anim_speed:"2rpm",anim_lat:null,fisheye:!1,navbar:["autorotate","zoom","download","markers","caption","gyroscope","fullscreen"],tooltip:{offset:5,arrow_size:7,delay:100},lang:{autorotate:"Automatic rotation",zoom:"Zoom",zoomOut:"Zoom out",zoomIn:"Zoom in",download:"Download",fullscreen:"Fullscreen",markers:"Markers",gyroscope:"Gyroscope"},mousewheel:!0,mousemove:!0,keyboard:!0,gyroscope:!1,move_inertia:!0,click_event_on_marker:!1,transition:{duration:1500,loader:!0},loading_img:null,loading_txt:"Loading...",size:null,cache_texture:5,templates:{},markers:[]},e.TEMPLATES={markersList:'

{{= it.config.lang.markers }}

    {{~ it.markers: marker }}
  • {{? marker.image }}{{?}}

    {{? marker.tooltip }}{{= marker.tooltip.content }}{{?? marker.html }}{{= marker.html }}{{??}}{{= marker.id }}{{?}}

  • {{~}}
'},e.prototype._bindEvents=function(){window.addEventListener("resize",this),this.config.mousemove&&(this.hud.container.style.cursor="move",this.hud.container.addEventListener("mousedown",this),this.hud.container.addEventListener("touchstart",this),window.addEventListener("mouseup",this),window.addEventListener("touchend",this),this.hud.container.addEventListener("mousemove",this),this.hud.container.addEventListener("touchmove",this)),e.SYSTEM.fullscreenEvent&&document.addEventListener(e.SYSTEM.fullscreenEvent,this),this.config.mousewheel&&this.hud.container.addEventListener(e.SYSTEM.mouseWheelEvent,this),this.on("_side-reached",function(a){this.isAutorotateEnabled()&&("left"!==a&&"right"!==a||this._reverseAutorotate())})},e.prototype.handleEvent=function(a){switch(a.type){case"resize":x.throttle(this._onResize(),50);break;case"keydown":this._onKeyDown(a);break;case"mousedown":this._onMouseDown(a);break;case"touchstart":this._onTouchStart(a);break;case"mouseup":this._onMouseUp(a);break;case"touchend":this._onTouchEnd(a);break;case"mousemove":this._onMouseMove(a);break;case"touchmove":this._onTouchMove(a);break;case e.SYSTEM.fullscreenEvent:this._fullscreenToggled();break;case e.SYSTEM.mouseWheelEvent:this._onMouseWheel(a)}},e.prototype._onResize=function(){this.container.clientWidth==this.prop.size.width&&this.container.clientHeight==this.prop.size.height||(this.prop.size.width=parseInt(this.container.clientWidth),this.prop.size.height=parseInt(this.container.clientHeight),this.prop.aspect=this.prop.size.width/this.prop.size.height,this.renderer&&(this.renderer.setSize(this.prop.size.width,this.prop.size.height),this.composer&&this.composer.reset(new a.WebGLRenderTarget(this.prop.size.width,this.prop.size.height)),this.render()),this.trigger("size-updated",this.getSize()))},e.prototype._onKeyDown=function(a){var b=0,c=0,d=0,f=a.key||e.KEYMAP[a.keyCode||a.which];switch(f){case"ArrowUp":c=.01;break;case"ArrowDown":c=-.01;break;case"ArrowRight":b=.01;break;case"ArrowLeft":b=-.01;break;case"PageUp":case"+":d=1;break;case"PageDown":case"-":d=-1}0!==d?this.zoom(this.prop.zoom_lvl+d):0===c&&0===b||this.rotate({longitude:this.prop.longitude+b*this.prop.move_speed*this.prop.hFov,latitude:this.prop.latitude+c*this.prop.move_speed*this.prop.vFov})},e.prototype._onMouseDown=function(a){this._startMove(a)},e.prototype._onMouseUp=function(a){this._stopMove(a)},e.prototype._onMouseMove=function(a){0!==a.buttons&&(a.preventDefault(),this._move(a))},e.prototype._onTouchStart=function(a){1===a.touches.length?this._startMove(a.touches[0]):2===a.touches.length&&this._startZoom(a)},e.prototype._onTouchEnd=function(a){this._stopMove(a.changedTouches[0])},e.prototype._onTouchMove=function(a){1===a.touches.length?(a.preventDefault(),this._move(a.touches[0])):2===a.touches.length&&(a.preventDefault(),this._zoom(a))},e.prototype._startMove=function(a){this.isGyroscopeEnabled()||(this._stopAll(),this.prop.mouse_x=this.prop.start_mouse_x=parseInt(a.clientX),this.prop.mouse_y=this.prop.start_mouse_y=parseInt(a.clientY),this.prop.moving=!0,this.prop.zooming=!1,this.prop.mouse_history.length=0,this._logMouseMove(a))},e.prototype._startZoom=function(a){var b=[{x:parseInt(a.touches[0].clientX),y:parseInt(a.touches[0].clientY)},{x:parseInt(a.touches[1].clientX),y:parseInt(a.touches[1].clientY)}];this.prop.pinch_dist=Math.sqrt(Math.pow(b[0].x-b[1].x,2)+Math.pow(b[0].y-b[1].y,2)),this.prop.moving=!1,this.prop.zooming=!0},e.prototype._stopMove=function(a){return this.isGyroscopeEnabled()?void this._click(a):(this.prop.moving&&(Math.abs(a.clientX-this.prop.start_mouse_x)e.INERTIA_WINDOW/10?(this.prop.mouse_history.splice(0,d),d=0,c=this.prop.mouse_history[0][d]):(d++,c=this.prop.mouse_history[0][d])},e.prototype.load=function(){if(!this.config.panorama)throw new v("No value given for panorama.");return this.setPanorama(this.config.panorama,!1)},e.prototype.getPosition=function(){return{longitude:this.prop.longitude,latitude:this.prop.latitude}},e.prototype.getZoomLevel=function(){return this.prop.zoom_lvl},e.prototype.getSize=function(){return{width:this.prop.size.width,height:this.prop.size.height}},e.prototype.isAutorotateEnabled=function(){return!!this.prop.autorotate_reqid},e.prototype.isGyroscopeEnabled=function(){return!!this.prop.orientation_reqid},e.prototype.isFullscreenEnabled=function(){return x.isFullscreenEnabled(this.container)},e.prototype.render=function(a){a!==!1&&(this.prop.direction=this.sphericalCoordsToVector3(this.prop),this.camera.position.set(0,0,0),this.camera.lookAt(this.prop.direction)),this.config.fisheye&&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.composer?this.composer.render():this.renderer.render(this.scene,this.camera),this.trigger("render")},e.prototype.destroy=function(){this._stopAll(),this.stopKeyboardControl(),this.isFullscreenEnabled()&&x.exitFullscreen(),window.removeEventListener("resize",this),this.config.mousemove&&(this.hud.container.removeEventListener("mousedown",this),this.hud.container.removeEventListener("touchstart",this),window.removeEventListener("mouseup",this),window.removeEventListener("touchend",this),this.hud.container.removeEventListener("mousemove",this),this.hud.container.removeEventListener("touchmove",this)),e.SYSTEM.fullscreenEvent&&document.removeEventListener(e.SYSTEM.fullscreenEvent,this),this.config.mousewheel&&this.hud.container.removeEventListener(e.SYSTEM.mouseWheelEvent,this),this.tooltip&&this.tooltip.destroy(),this.hud&&this.hud.destroy(),this.loader&&this.loader.destroy(),this.navbar&&this.navbar.destroy(),this.panel&&this.panel.destroy(),this.doControls&&this.doControls.disconnect(),this.scene&&x.cleanTHREEScene(this.scene),this.canvas_container&&this.container.removeChild(this.canvas_container),this.parent.removeChild(this.container),delete this.parent.photoSphereViewer,delete this.parent,delete this.container,delete this.loader,delete this.navbar,delete this.hud,delete this.panel,delete this.tooltip,delete this.canvas_container,delete this.renderer,delete this.composer,delete this.scene,delete this.camera,delete this.mesh,delete this.doControls,delete this.raycaster,delete this.passes,delete this.config,this.prop.cache.length=0},e.prototype.setPanorama=function(a,b,c){if(null!==this.prop.loading_promise)throw new v("Loading already in progress");if("boolean"==typeof b&&(c=b,b=void 0),c&&this.prop.isCubemap)throw new v("Transition is not available with cubemap.");b&&(this.cleanPosition(b),this._stopAll()),this.config.panorama=a;var d=this;return c&&this.config.transition&&this.scene?(this.config.transition.loader&&this.loader.show(),this.prop.loading_promise=this._loadTexture(this.config.panorama).then(function(a){return d.loader.hide(),d._transition(a,b)}).ensure(function(){d.loader.hide(),d.prop.loading_promise=null}).rethrow()):(this.loader.show(),this.canvas_container&&(this.canvas_container.style.opacity=0),this.prop.loading_promise=this._loadTexture(this.config.panorama).then(function(a){d._setTexture(a),b&&d.rotate(b)}).ensure(function(){d.loader.hide(),d.canvas_container.style.opacity=1,d.prop.loading_promise=null}).rethrow()),this.prop.loading_promise},e.prototype.startAutorotate=function(){this._stopAll();var a=this,b=null,c=null;!function d(e){e&&(c=null===b?0:e-b,b=e,a.rotate({longitude:a.prop.longitude+a.config.anim_speed*c/1e3,latitude:a.prop.latitude-(a.prop.latitude-a.config.anim_lat)/200})),a.prop.autorotate_reqid=window.requestAnimationFrame(d)}(null),this.trigger("autorotate",!0)},e.prototype.stopAutorotate=function(){this.prop.start_timeout&&(window.clearTimeout(this.prop.start_timeout),this.prop.start_timeout=null),this.prop.autorotate_reqid&&(window.cancelAnimationFrame(this.prop.autorotate_reqid),this.prop.autorotate_reqid=null,this.trigger("autorotate",!1))},e.prototype.toggleAutorotate=function(){this.isAutorotateEnabled()?this.stopAutorotate():this.startAutorotate()},e.prototype.startGyroscopeControl=function(){if(!this.doControls||!this.doControls.enabled||!this.doControls.deviceOrientation)return void console.warn("PhotoSphereViewer: gyroscope disabled");this._stopAll();var a=this;!function b(){a.doControls.update(), +a.prop.direction=a.camera.getWorldDirection();var c=a.vector3ToSphericalCoords(a.prop.direction);a.prop.longitude=c.longitude,a.prop.latitude=c.latitude,a.render(!1),a.prop.orientation_reqid=window.requestAnimationFrame(b)}(),this.trigger("gyroscope-updated",!0)},e.prototype.stopGyroscopeControl=function(){this.prop.orientation_reqid&&(window.cancelAnimationFrame(this.prop.orientation_reqid),this.prop.orientation_reqid=null,this.trigger("gyroscope-updated",!1),this.render())},e.prototype.toggleGyroscopeControl=function(){this.isGyroscopeEnabled()?this.stopGyroscopeControl():this.startGyroscopeControl()},e.prototype.rotate=function(a,b){this.cleanPosition(a),this.applyRanges(a).forEach(this.trigger.bind(this,"_side-reached")),this.prop.longitude=a.longitude,this.prop.latitude=a.latitude,b!==!1&&this.renderer&&(this.render(),this.trigger("position-updated",this.getPosition()))},e.prototype.animate=function(a,c){if(this._stopAll(),!c)return this.rotate(a),b.resolved();if(this.cleanPosition(a),this.applyRanges(a).forEach(this.trigger.bind(this,"_side-reached")),!c&&"number"!=typeof c){c=c?x.parseSpeed(c):this.config.anim_speed;var d=Math.acos(Math.cos(this.prop.latitude)*Math.cos(a.latitude)*Math.cos(this.prop.longitude-a.longitude)+Math.sin(this.prop.latitude)*Math.sin(a.latitude));c=d/c*1e3}var e=x.getShortestArc(this.prop.longitude,a.longitude);return this.prop.animation_promise=x.animation({properties:{longitude:{start:this.prop.longitude,end:this.prop.longitude+e},latitude:{start:this.prop.latitude,end:a.latitude}},duration:c,easing:"inOutSine",onTick:this.rotate.bind(this)}),this.prop.animation_promise},e.prototype.stopAnimation=function(){this.prop.animation_promise&&(this.prop.animation_promise.cancel(),this.prop.animation_promise=null)},e.prototype.zoom=function(b,c){this.prop.zoom_lvl=x.bound(Math.round(b),0,100),this.prop.vFov=this.config.max_fov+this.prop.zoom_lvl/100*(this.config.min_fov-this.config.max_fov),this.prop.hFov=a.Math.radToDeg(2*Math.atan(Math.tan(a.Math.degToRad(this.prop.vFov)/2)*this.prop.aspect)),c!==!1&&this.renderer&&(this.render(),this.trigger("zoom-updated",this.getZoomLevel()))},e.prototype.zoomIn=function(){this.prop.zoom_lvl<100&&this.zoom(this.prop.zoom_lvl+1)},e.prototype.zoomOut=function(){this.prop.zoom_lvl>0&&this.zoom(this.prop.zoom_lvl-1)},e.prototype.resize=function(a){a.width&&(this.container.style.width=a.width),a.height&&(this.container.style.height=a.height),this._onResize()},e.prototype.toggleFullscreen=function(){this.isFullscreenEnabled()?x.exitFullscreen():x.requestFullscreen(this.container)},e.prototype.startKeyboardControl=function(){window.addEventListener("keydown",this)},e.prototype.stopKeyboardControl=function(){window.removeEventListener("keydown",this)},e.prototype.preloadPanorama=function(a){if(!this.config.cache_texture)throw new v("Cannot preload panorama, cache_texture is disabled");return this._loadTexture(a)},e.prototype.clearPanoramaCache=function(a){if(!this.config.cache_texture)throw new v("Cannot clear cache, cache_texture is disabled");if(a){for(var b=0,c=this.prop.cache.length;b=Math.PI?b-Math.PI:b+Math.PI,latitude:x.HalfPI-c}},e.prototype.sphericalCoordsToTextureCoords=function(a){if(this.prop.isCubemap)throw new v("Unable to use texture coords with cubemap.");var b=a.longitude/x.TwoPI*this.prop.pano_data.full_width,c=a.latitude/Math.PI*this.prop.pano_data.full_height;return{x:parseInt(a.longitudec[1]?b.longitude>c[1]&&b.longitudec[0]/2+c[1]/2?(b.longitude=c[0],e.push("left")):(b.longitude=c[1],e.push("right"))):b.longitudec[1]&&(b.longitude=c[1],e.push("right"))),this.config.latitude_range&&(c=x.clone(this.config.latitude_range),d=a.Math.degToRad(this.prop.vFov)/2,c[0]=x.parseAngle(Math.min(c[0]+d,c[1]),!0),c[1]=x.parseAngle(Math.max(c[1]-d,c[0]),!0),b.latitudec[1]&&(b.latitude=c[1],e.push("top"))),e},f.className=null,f.publicMethods=[],f.prototype.create=function(){this.container=document.createElement("div"),this.constructor.className&&(this.container.className=this.constructor.className),this.parent.container.appendChild(this.container)},f.prototype.destroy=function(){this.parent.container.removeChild(this.container),this.constructor.publicMethods&&this.constructor.publicMethods.forEach(function(a){delete this.psv[a]},this),delete this.container,delete this.psv,delete this.parent},f.prototype.hide=function(){this.container.style.display="none"},f.prototype.show=function(){this.container.style.display=""},g.prototype=Object.create(f.prototype),g.prototype.constructor=g,g.className="psv-hud",g.publicMethods=["addMarker","removeMarker","updateMarker","clearMarkers","getMarker","getCurrentMarker","gotoMarker","hideMarker","showMarker","toggleMarker","toggleMarkersList","showMarkersList","hideMarkersList"],g.prototype.create=function(){f.prototype.create.call(this),this.svgContainer=document.createElementNS(x.svgNS,"svg"),this.svgContainer.setAttribute("class","psv-hud-svg-container"),this.container.appendChild(this.svgContainer),this.container.addEventListener("mouseenter",this,!0),this.container.addEventListener("mouseleave",this,!0),this.container.addEventListener("mousemove",this,!0),this.psv.on("click",this),this.psv.on("dblclick",this),this.psv.on("render",this),this.psv.on("open-panel",this),this.psv.on("close-panel",this)},g.prototype.destroy=function(){this.clearMarkers(!1),this.container.removeEventListener("mouseenter",this),this.container.removeEventListener("mouseleave",this),this.container.removeEventListener("mousemove",this),this.psv.off("click",this),this.psv.off("dblclick",this),this.psv.off("render",this),this.psv.off("open-panel",this),this.psv.off("close-panel",this),delete this.svgContainer,f.prototype.destroy.call(this)},g.prototype.handleEvent=function(a){switch(a.type){case"mouseenter":this._onMouseEnter(a);break;case"mouseleave":this._onMouseLeave(a);break;case"mousemove":this._onMouseMove(a);break;case"click":this._onClick(a.args[0],a,!1);break;case"dblclick":this._onClick(a.args[0],a,!0);break;case"render":this.renderMarkers();break;case"open-panel":this._onPanelOpened();break;case"close-panel":this._onPanelClosed()}},g.prototype.addMarker=function(a,b){if(!a.id)throw new v("missing marker id");if(this.markers[a.id])throw new v('marker "'+a.id+'" already exists');var c=new w(a,this.psv);return c.isNormal()?this.container.appendChild(c.$el):this.svgContainer.appendChild(c.$el),this.markers[c.id]=c,b!==!1&&this.renderMarkers(),c},g.prototype.getMarker=function(a){var b="object"==typeof a?a.id:a;if(!this.markers[b])throw new v('cannot find marker "'+b+'"');return this.markers[b]},g.prototype.getCurrentMarker=function(){return this.currentMarker},g.prototype.updateMarker=function(a,b){var c=this.getMarker(a);return c.update(a),b!==!1&&this.renderMarkers(),c},g.prototype.removeMarker=function(a,b){a=this.getMarker(a),a.isNormal()?this.container.removeChild(a.$el):this.svgContainer.removeChild(a.$el),this.hoveringMarker==a&&this.psv.tooltip.hideTooltip(),a.destroy(),delete this.markers[a.id],b!==!1&&this.renderMarkers()},g.prototype.clearMarkers=function(a){Object.keys(this.markers).forEach(function(a){this.removeMarker(a,!1)},this),a!==!1&&this.renderMarkers()},g.prototype.gotoMarker=function(a,b){return a=this.getMarker(a),this.psv.animate(a,b)},g.prototype.hideMarker=function(a){this.getMarker(a).visible=!1,this.renderMarkers()},g.prototype.showMarker=function(a){this.getMarker(a).visible=!0,this.renderMarkers()},g.prototype.toggleMarker=function(a){this.getMarker(a).visible^=!0,this.renderMarkers()},g.prototype.toggleMarkersList=function(){this.prop.panelOpened?this.hideMarkersList():this.showMarkersList()},g.prototype.showMarkersList=function(){var a=[];for(var b in this.markers)a.push(this.markers[b]);var c=this.psv.config.templates.markersList({markers:this.psv.change("render-markers-list",a),config:this.psv.config});this.prop.panelOpening=!0,this.psv.panel.showPanel(c,!0),this.psv.panel.container.querySelector(".psv-markers-list").addEventListener("click",this._onClickItem.bind(this))},g.prototype.hideMarkersList=function(){this.prop.panelOpened&&this.psv.panel.hidePanel()},g.prototype.renderMarkers=function(){var b=this.psv.isGyroscopeEnabled()?a.Math.radToDeg(this.psv.camera.rotation.z):0;for(var c in this.markers){var d=this.markers[c],e=d.visible;if(e&&d.isPolygon()){var f=this._getPolygonPositions(d);if(e=f.length>2){d.position2D=this._getPolygonDimensions(d,f);var g="";f.forEach(function(a){g+=a.x+","+a.y+" "}),d.$el.setAttributeNS(null,"points",g)}}else if(e){var h=this._getMarkerPosition(d);e=this._isMarkerVisible(d,h),e&&(d.position2D=h,d.$el instanceof SVGElement?d.$el.setAttribute("transform","translate("+h.x+" "+h.y+")"+(!d.lockRotation&&b?" rotate("+b+" "+d.anchor.left*d.width+" "+d.anchor.top*d.height+")":"")):(d.$el.style.transform="translate3D("+h.x+"px, "+h.y+"px, 0px)"+(!d.lockRotation&&b?" rotateZ("+b+"deg)":""),d.$el.style.transformOrigin=100*d.anchor.left+"% "+100*d.anchor.top+"%"))}x.toggleClass(d.$el,"psv-marker--visible",e)}},g.prototype._isMarkerVisible=function(a,b){return a.position3D.dot(this.psv.prop.direction)>0&&b.x+a.width>=0&&b.x-a.width<=this.psv.prop.size.width&&b.y+a.height>=0&&b.y-a.height<=this.psv.prop.size.height},g.prototype._getMarkerPosition=function(a){if(a._dynamicSize){x.toggleClass(a.$el,"psv-marker--transparent",!0);var b=a.$el.getBoundingClientRect();x.toggleClass(a.$el,"psv-marker--transparent",!1),a.width=b.right-b.left,a.height=b.bottom-b.top}var c=this.psv.vector3ToViewerCoords(a.position3D);return c.x-=a.width*a.anchor.left,c.y-=a.height*a.anchor.top,c},g.prototype._getPolygonPositions=function(a){var b=a.positions3D.length,c=a.positions3D.map(function(a){return{vector:a,visible:a.dot(this.psv.prop.direction)>0}},this),d=[];return c.forEach(function(a,e){if(!a.visible){var f=[0===e?c[b-1]:c[e-1],e===b-1?c[0]:c[e+1]];f.forEach(function(b){b.visible&&d.push({visible:b,invisible:a,index:e})})}}),d.reverse().forEach(function(a){c.splice(a.index,0,{vector:this._getPolygonIntermediaryPoint(a.visible.vector,a.invisible.vector),visible:!0})},this),c.filter(function(a){return a.visible}).map(function(a){return this.psv.vector3ToViewerCoords(a.vector)},this)},g.prototype._getPolygonIntermediaryPoint=function(b,c){var d=this.psv.prop.direction.clone().normalize(),f=(new a.Vector3).crossVectors(b,c).normalize(),g=(new a.Vector3).crossVectors(f,b).normalize(),h=(new a.Vector3).addVectors(b.clone().multiplyScalar(-d.dot(g)),g.clone().multiplyScalar(d.dot(b))).normalize(),i=(new a.Vector3).crossVectors(h,d);return h.applyAxisAngle(i,.01).multiplyScalar(e.SPHERE_RADIUS)},g.prototype._getPolygonDimensions=function(a,b){var c=+(1/0),d=+(1/0),e=-(1/0),f=-(1/0);return b.forEach(function(a){c=Math.min(c,a.x),d=Math.min(d,a.y),e=Math.max(e,a.x),f=Math.max(f,a.y)}),a.width=e-c,a.height=f-d,{x:c,y:d}},g.prototype._onMouseEnter=function(a){var b;a.target&&(b=a.target.psvMarker)&&!b.isPolygon()&&(this.hoveringMarker=b,this.psv.trigger("over-marker",b),b.tooltip&&this.psv.tooltip.showTooltip({content:b.tooltip.content,position:b.tooltip.position,left:b.position2D.x,top:b.position2D.y,box:{width:b.width,height:b.height}}))},g.prototype._onMouseLeave=function(a){var b;if(a.target&&(b=a.target.psvMarker)){if(b.isPolygon()&&a.relatedTarget&&x.hasParent(a.relatedTarget,this.psv.tooltip.container))return;this.psv.trigger("leave-marker",b),this.hoveringMarker=null,this.psv.tooltip.hideTooltip()}},g.prototype._onMouseMove=function(a){if(!this.psv.prop.moving){var b;if(a.target&&(b=a.target.psvMarker)&&b.isPolygon()||a.target&&x.hasParent(a.target,this.psv.tooltip.container)&&(b=this.hoveringMarker)){this.hoveringMarker||(this.psv.trigger("over-marker",b),this.hoveringMarker=b);var c=this.psv.container.getBoundingClientRect();b.tooltip&&this.psv.tooltip.showTooltip({content:b.tooltip.content,position:b.tooltip.position,top:a.clientY-c.top-this.psv.config.tooltip.arrow_size/2,left:a.clientX-c.left-this.psv.config.tooltip.arrow_size,box:{width:2*this.psv.config.tooltip.arrow_size,height:2*this.psv.config.tooltip.arrow_size}})}else this.hoveringMarker&&this.hoveringMarker.isPolygon()&&(this.psv.trigger("leave-marker",b),this.hoveringMarker=null,this.psv.tooltip.hideTooltip())}},g.prototype._onClick=function(a,b,c){var d;a.target&&(d=x.getClosest(a.target,".psv-marker"))&&d.psvMarker?(this.currentMarker=d.psvMarker,this.psv.trigger("select-marker",this.currentMarker,c),this.psv.config.click_event_on_marker?a.marker=d.psvMarker:b.stopPropagation()):this.currentMarker&&(this.psv.trigger("unselect-marker",this.currentMarker),this.currentMarker=null),d&&d.psvMarker&&d.psvMarker.content?this.psv.panel.showPanel(d.psvMarker.content):this.psv.panel.prop.opened&&(b.stopPropagation(),this.psv.panel.hidePanel())},g.prototype._onClickItem=function(a){var b;a.target&&(b=x.getClosest(a.target,"li"))&&b.dataset.psvMarker&&(this.gotoMarker(b.dataset.psvMarker,1e3),this.psv.panel.hidePanel())},g.prototype._onPanelOpened=function(){this.prop.panelOpening?(this.prop.panelOpening=!1,this.prop.panelOpened=!0):this.prop.panelOpened=!1,this.prop.markersButton&&this.prop.markersButton.toggleActive(this.prop.panelOpened)},g.prototype._onPanelClosed=function(){this.prop.panelOpened=!1,this.prop.panelOpening=!1,this.prop.markersButton&&this.prop.markersButton.toggleActive(!1)},h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.className="psv-loader-container",h.prototype.create=function(){f.prototype.create.call(this),this.loader=document.createElement("div"),this.loader.className="psv-loader",this.container.appendChild(this.loader),this.canvas=document.createElement("canvas"),this.canvas.className="psv-loader-canvas",this.canvas.width=this.loader.clientWidth,this.canvas.height=this.loader.clientWidth,this.loader.appendChild(this.canvas),this.tickness=(this.loader.offsetWidth-this.loader.clientWidth)/2;var a;if(this.psv.config.loading_img?(a=document.createElement("img"),a.className="psv-loader-image",a.src=this.psv.config.loading_img):this.psv.config.loading_txt&&(a=document.createElement("div"),a.className="psv-loader-text",a.innerHTML=this.psv.config.loading_txt),a){var b=Math.round(Math.sqrt(2*Math.pow(this.canvas.width/2-this.tickness/2,2)));a.style.maxWidth=b+"px",a.style.maxHeight=b+"px",this.loader.appendChild(a)}},h.prototype.destroy=function(){delete this.loader,delete this.canvas,f.prototype.destroy.call(this)},h.prototype.setProgress=function(a){var b=this.canvas.getContext("2d");b.clearRect(0,0,this.canvas.width,this.canvas.height),b.lineWidth=this.tickness,b.strokeStyle=x.getStyle(this.loader,"color"),b.beginPath(),b.arc(this.canvas.width/2,this.canvas.height/2,this.canvas.width/2-this.tickness/2,-Math.PI/2,a/100*2*Math.PI-Math.PI/2),b.stroke()},i.prototype=Object.create(f.prototype),i.prototype.constructor=i,i.className="psv-navbar psv-navbar--open",i.publicMethods=["showNavbar","hideNavbar","toggleNavbar","getNavbarButton"],i.prototype.create=function(){f.prototype.create.call(this),this.config.forEach(function(a){if("object"==typeof a)this.items.push(new p(this,a));else switch(a){case o.id:this.items.push(new o(this));break;case u.id:this.items.push(new u(this));break;case q.id:this.items.push(new q(this));break;case t.id:this.items.push(new t(this));break;case r.id:this.items.push(new r(this));break;case s.id:this.psv.config.gyroscope&&this.items.push(new s(this));break;case"caption":this.items.push(new j(this,this.psv.config.caption));break;case"spacer":a="spacer-5";default:var b=a.match(/^spacer\-([0-9]+)$/);if(null===b)throw new v("Unknown button "+a);this.items.push(new k(this,b[1]))}},this)},i.prototype.destroy=function(){this.items.forEach(function(a){a.destroy()}),delete this.items,delete this.config,f.prototype.destroy.call(this)},i.prototype.getNavbarButton=function(a,b){var c=null;return this.items.some(function(b){if(b.id===a)return c=b,!0}),c||b||console.warn('PhotoSphereViewer: button "'+a+'" not found in the navbar.'),c},i.prototype.showNavbar=function(){this.toggleNavbar(!0)},i.prototype.hideNavbar=function(){this.toggleNavbar(!1)},i.prototype.toggleNavbar=function(a){x.toggleClass(this.container,"psv-navbar--open",a)},j.prototype=Object.create(f.prototype),j.prototype.constructor=j,j.className="psv-caption",j.publicMethods=["setCaption"],j.prototype.setCaption=function(a){a?this.container.innerHTML=a:this.container.innerHTML=""},k.prototype=Object.create(f.prototype),k.prototype.constructor=k,k.className="psv-spacer",l.prototype=Object.create(f.prototype),l.prototype.constructor=l,l.className="psv-panel",l.publicMethods=["showPanel","hidePanel"],l.prototype.create=function(){f.prototype.create.call(this),this.container.innerHTML='
',this.content=this.container.querySelector(".psv-panel-content");var a=this.container.querySelector(".psv-panel-close-button");a.addEventListener("click",this.hidePanel.bind(this)),this.psv.config.mousewheel&&this.container.addEventListener(e.SYSTEM.mouseWheelEvent,function(a){a.stopPropagation()});var b=this.container.querySelector(".psv-panel-resizer");b.addEventListener("mousedown",this),b.addEventListener("touchstart",this),this.psv.container.addEventListener("mouseup",this),this.psv.container.addEventListener("touchend",this),this.psv.container.addEventListener("mousemove",this),this.psv.container.addEventListener("touchmove",this)},l.prototype.destroy=function(){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.prop,delete this.content,f.prototype.destroy.call(this)},l.prototype.handleEvent=function(a){switch(a.type){case"mousedown":this._onMouseDown(a);break;case"touchstart":this._onTouchStart(a);break;case"mousemove":this._onMouseMove(a);break;case"touchmove":this._onTouchMove(a);break;case"mouseup":this._onMouseUp(a);break;case"touchend":this._onMouseUp(a)}},l.prototype.showPanel=function(a,b){this.content.innerHTML=a,this.content.scrollTop=0,this.container.classList.add("psv-panel--open"),x.toggleClass(this.content,"psv-panel-content--no-margin",!!b),this.prop.opened=!0,this.psv.trigger("open-panel")},l.prototype.hidePanel=function(){this.content.innerHTML=null,this.prop.opened=!1,this.container.classList.remove("psv-panel--open"),this.psv.trigger("close-panel")},l.prototype._onMouseDown=function(a){a.stopPropagation(),this._startResize(a)},l.prototype._onTouchStart=function(a){a.stopPropagation(),this._startResize(a.changedTouches[0])},l.prototype._onMouseUp=function(a){this.prop.mousedown&&(a.stopPropagation(),this.prop.mousedown=!1,this.content.classList.remove("psv-panel-content--no-interaction"))},l.prototype._onMouseMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a))},l.prototype._onTouchMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a.touches[0]))},l.prototype._startResize=function(a){this.prop.mouse_x=parseInt(a.clientX),this.prop.mouse_y=parseInt(a.clientY),this.prop.mousedown=!0,this.content.classList.add("psv-panel-content--no-interaction")},l.prototype._resize=function(a){var b=parseInt(a.clientX),c=parseInt(a.clientY);this.container.style.width=this.container.offsetWidth-(b-this.prop.mouse_x)+"px",this.prop.mouse_x=b,this.prop.mouse_y=c},m.prototype=Object.create(f.prototype),m.prototype.constructor=m,m.className="psv-tooltip",m.publicMethods=["showTooltip","hideTooltip","isTooltipVisible"],m.leftMap={0:"left",.5:"center",1:"right"},m.topMap={0:"top",.5:"center",1:"bottom"},m.prototype.create=function(){f.prototype.create.call(this),this.container.innerHTML='
',this.container.style.top="-1000px",this.container.style.left="-1000px",this.content=this.container.querySelector(".psv-tooltip-content"),this.arrow=this.container.querySelector(".psv-tooltip-arrow"),this.psv.on("render",this)},m.prototype.destroy=function(){this.psv.off("render",this),delete this.config,delete this.prop,f.prototype.destroy.call(this)},m.prototype.handleEvent=function(a){switch(a.type){case"render":this.hideTooltip()}},m.prototype.isTooltipVisible=function(){return this.container.classList.contains("psv-tooltip--visible")},m.prototype.showTooltip=function(a){this.prop.timeout&&(window.clearTimeout(this.prop.timeout),this.prop.timeout=null);var b=this.isTooltipVisible(),c=this.container,d=this.content,e=this.arrow;if(a.position||(a.position=["top","center"]),a.box||(a.box={width:0,height:0}),"string"==typeof a.position){var f=x.parsePosition(a.position);if(!(f.left in m.leftMap&&f.top in m.topMap))throw new v('unable to parse tooltip position "'+tooltip.position+'"');a.position=[m.topMap[f.top],m.leftMap[f.left]]}if("center"==a.position[0]&&"center"==a.position[1])throw new v('unable to parse tooltip position "center center"');if(b)for(var g=c.classList.length-1;g>=0;g--){var h=c.classList.item(g);"psv-tooltip"!=h&&"psv-tooltip--visible"!=h&&c.classList.remove(h)}else c.className="psv-tooltip";a.className&&x.addClasses(c,a.className),d.innerHTML=a.content,c.style.top="0px",c.style.left="0px";var i=c.getBoundingClientRect(),j={posClass:a.position.slice(),width:i.right-i.left,height:i.bottom-i.top,top:0,left:0,arrow_top:0,arrow_left:0};this._computeTooltipPosition(j,a);var k=!1;if(j.topthis.psv.prop.size.height-this.config.offset&&(j.posClass[0]="top",k=!0),j.leftthis.psv.prop.size.width-this.config.offset&&(j.posClass[1]="left",k=!0),k&&this._computeTooltipPosition(j,a),c.style.top=j.top+"px",c.style.left=j.left+"px",e.style.top=j.arrow_top+"px",e.style.left=j.arrow_left+"px",c.classList.add("psv-tooltip--"+j.posClass.join("-")),!b){var l=this;this.prop.timeout=window.setTimeout(function(){c.classList.add("psv-tooltip--visible"),l.prop.timeout=null,l.psv.trigger("show-tooltip")},this.config.delay)}},m.prototype.hideTooltip=function(){if(this.prop.timeout&&(window.clearTimeout(this.prop.timeout),this.prop.timeout=null),this.isTooltipVisible()){this.container.classList.remove("psv-tooltip--visible");var a=this;this.prop.timeout=window.setTimeout(function(){a.content.innerHTML=null,a.container.style.top="-1000px",a.container.style.left="-1000px",a.prop.timeout=null},this.config.delay),this.psv.trigger("hide-tooltip")}},m.prototype._computeTooltipPosition=function(a,b){var c=!1;switch(a.posClass[0]){case"bottom":a.top=b.top+b.box.height+this.config.offset+this.config.arrow_size,a.arrow_top=2*-this.config.arrow_size,c=!0;break;case"center":a.top=b.top+b.box.height/2-a.height/2,a.arrow_top=a.height/2-this.config.arrow_size;break;case"top":a.top=b.top-a.height-this.config.offset-this.config.arrow_size,a.arrow_top=a.height,c=!0}switch(a.posClass[1]){case"right":c?(a.left=b.left+b.box.width/2-this.config.offset-this.config.arrow_size,a.arrow_left=this.config.offset):(a.left=b.left+b.box.width+this.config.offset+this.config.arrow_size,a.arrow_left=2*-this.config.arrow_size);break;case"center":a.left=b.left+b.box.width/2-a.width/2,a.arrow_left=a.width/2-this.config.arrow_size;break;case"left":c?(a.left=b.left-a.width+b.box.width/2+this.config.offset+this.config.arrow_size,a.arrow_left=a.width-this.config.offset-2*this.config.arrow_size):(a.left=b.left-a.width-this.config.offset-this.config.arrow_size,a.arrow_left=a.width)}},n.prototype=Object.create(f.prototype),n.prototype.constructor=n,n.id=null,n.icon=null,n.iconActive=null,n.prototype.create=function(){f.prototype.create.call(this),this.constructor.icon&&this._setIcon(this.constructor.icon),this.id&&this.psv.config.lang[this.id]&&(this.container.title=this.psv.config.lang[this.id]),this.container.addEventListener("click",function(a){this.enabled&&this._onClick(),a.stopPropagation()}.bind(this))},n.prototype.destroy=function(){f.prototype.destroy.call(this)},n.prototype.toggleActive=function(a){x.toggleClass(this.container,"psv-button--active",a),this.constructor.iconActive&&this._setIcon(a?this.constructor.iconActive:this.constructor.icon)},n.prototype.disable=function(){this.container.classList.add("psv-button--disabled"),this.enabled=!1},n.prototype.enable=function(){this.container.classList.remove("psv-button--disabled"),this.enabled=!0},n.prototype._setIcon=function(a,b){b||(b=this.container),a?(b.innerHTML=e.ICONS[a],b.querySelector("svg").setAttribute("class","psv-button-svg")):b.innerHTML=""},n.prototype._onClick=function(){},o.prototype=Object.create(n.prototype),o.prototype.constructor=o,o.id="autorotate",o.className="psv-button psv-button--hover-scale psv-autorotate-button",o.icon="play.svg",o.iconActive="play-active.svg",o.prototype.create=function(){n.prototype.create.call(this),this.psv.on("autorotate",this)},o.prototype.destroy=function(){this.psv.off("autorotate",this),n.prototype.destroy.call(this)},o.prototype.handleEvent=function(a){switch(a.type){case"autorotate":this.toggleActive(a.args[0])}},o.prototype._onClick=function(){this.psv.toggleAutorotate()},p.prototype=Object.create(n.prototype),p.prototype.constructor=p,p.className="psv-button psv-custom-button",p.prototype.create=function(){n.prototype.create.call(this),this.config.className&&x.addClasses(this.container,this.config.className),this.config.title&&(this.container.title=this.config.title),this.config.content&&(this.container.innerHTML=this.config.content),this.config.enabled!==!1&&this.config.disabled!==!0||this.disable(),this.config.visible!==!1&&this.config.hidden!==!0||this.hide()},p.prototype.destroy=function(){delete this.config,n.prototype.destroy.call(this)},p.prototype._onClick=function(){this.config.onClick&&this.config.onClick.apply(this.psv)},q.prototype=Object.create(n.prototype),q.prototype.constructor=q,q.id="download",q.className="psv-button psv-button--hover-scale psv-download-button",q.icon="download.svg",q.prototype._onClick=function(){var a=document.createElement("a");a.href=this.psv.config.panorama,a.download=this.psv.config.panorama,this.psv.container.appendChild(a),a.click()},r.prototype=Object.create(n.prototype),r.prototype.constructor=r,r.id="fullscreen",r.className="psv-button psv-button--hover-scale psv-fullscreen-button",r.icon="fullscreen-in.svg",r.iconActive="fullscreen-out.svg",r.prototype.create=function(){n.prototype.create.call(this),e.SYSTEM.fullscreenEvent||(this.hide(),console.warn("PhotoSphereViewer: fullscreen not supported.")),this.psv.on("fullscreen-updated",this)},r.prototype.destroy=function(){this.psv.off("fullscreen-updated",this),n.prototype.destroy.call(this)},r.prototype.handleEvent=function(a){switch(a.type){case"fullscreen-updated":this.toggleActive(a.args[0])}},r.prototype._onClick=function(){this.psv.toggleFullscreen()},s.prototype=Object.create(n.prototype),s.prototype.constructor=s,s.id="gyroscope",s.className="psv-button psv-button--hover-scale psv-gyroscope-button",s.icon="compass.svg",s.prototype.create=function(){n.prototype.create.call(this),e.SYSTEM.deviceOrientationSupported.promise.then(this._onAvailabilityChange.bind(this,!0),this._onAvailabilityChange.bind(this,!1)),this.hide(),this.psv.on("gyroscope-updated",this)},s.prototype.destroy=function(){this.psv.off("gyroscope-updated",this),n.prototype.destroy.call(this)},s.prototype.handleEvent=function(a){switch(a.type){case"gyroscope-updated":this.toggleActive(a.args[0])}},s.prototype._onClick=function(){this.psv.toggleGyroscopeControl()},s.prototype._onAvailabilityChange=function(a){if(a){if(!x.checkTHREE("DeviceOrientationControls"))throw new v("Missing Three.js components: DeviceOrientationControls. Get them from three.js-examples package.");this.show()}},t.prototype=Object.create(n.prototype),t.prototype.constructor=t,t.id="markers",t.className="psv-button psv-button--hover-scale psv-markers-button",t.icon="pin.svg",t.prototype._onClick=function(){this.psv.hud.toggleMarkersList()},u.prototype=Object.create(n.prototype),u.prototype.constructor=u,u.id="zoom",u.className="psv-button psv-zoom-button",u.prototype.create=function(){n.prototype.create.call(this);var a=document.createElement("div");a.className="psv-zoom-button-minus",a.title=this.psv.config.lang.zoomOut,this._setIcon("zoom-out.svg",a),this.container.appendChild(a);var b=document.createElement("div");b.className="psv-zoom-button-range",this.container.appendChild(b),this.zoom_range=document.createElement("div"),this.zoom_range.className="psv-zoom-button-line",b.appendChild(this.zoom_range),this.zoom_value=document.createElement("div"),this.zoom_value.className="psv-zoom-button-handle",this.zoom_range.appendChild(this.zoom_value);var c=document.createElement("div");c.className="psv-zoom-button-plus",c.title=this.psv.config.lang.zoomIn, +this._setIcon("zoom-in.svg",c),this.container.appendChild(c),this.zoom_range.addEventListener("mousedown",this),this.zoom_range.addEventListener("touchstart",this),this.psv.container.addEventListener("mousemove",this),this.psv.container.addEventListener("touchmove",this),this.psv.container.addEventListener("mouseup",this),this.psv.container.addEventListener("touchend",this),a.addEventListener("mousedown",this._zoomOut.bind(this)),c.addEventListener("mousedown",this._zoomIn.bind(this)),this.psv.on("zoom-updated",this),this.psv.once("ready",function(){this._moveZoomValue(this.psv.prop.zoom_lvl)}.bind(this))},u.prototype.destroy=function(){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.zoom_range,delete this.zoom_value,this.psv.off("zoom-updated",this),n.prototype.destroy.call(this)},u.prototype.handleEvent=function(a){switch(a.type){case"mousedown":this._initZoomChangeWithMouse(a);break;case"touchstart":this._initZoomChangeByTouch(a);break;case"mousemove":this._changeZoomWithMouse(a);break;case"touchmove":this._changeZoomByTouch(a);break;case"mouseup":this._stopZoomChange(a);break;case"touchend":this._stopZoomChange(a);break;case"zoom-updated":this._moveZoomValue(a.args[0])}},u.prototype._moveZoomValue=function(a){this.zoom_value.style.left=a/100*this.zoom_range.offsetWidth-this.zoom_value.offsetWidth/2+"px"},u.prototype._initZoomChangeWithMouse=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.clientX))},u.prototype._initZoomChangeByTouch=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.changedTouches[0].clientX))},u.prototype._zoomIn=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomIn(),window.setTimeout(this._startLongPressInterval.bind(this,1),200))},u.prototype._zoomOut=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomOut(),window.setTimeout(this._startLongPressInterval.bind(this,-1),200))},u.prototype._startLongPressInterval=function(a){this.prop.buttondown&&(this.prop.longPressInterval=window.setInterval(function(){this.psv.zoom(this.psv.prop.zoom_lvl+a)}.bind(this),50))},u.prototype._stopZoomChange=function(){this.enabled&&(window.clearInterval(this.prop.longPressInterval),this.prop.longPressInterval=null,this.prop.mousedown=!1,this.prop.buttondown=!1)},u.prototype._changeZoomWithMouse=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.clientX))},u.prototype._changeZoomByTouch=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.changedTouches[0].clientX))},u.prototype._changeZoom=function(a){if(this.prop.mousedown){var b=parseInt(a)-this.zoom_range.getBoundingClientRect().left,c=b/this.zoom_range.offsetWidth*100;this.psv.zoom(c)}},v.prototype=Object.create(Error.prototype),v.prototype.name="PSVError",v.prototype.constructor=v,e.Error=v,w.types=["image","html","polygon_px","polygon_rad","rect","circle","ellipse","path"],w.getType=function(a,b){var c=[];if(w.types.forEach(function(b){a[b]&&c.push(b)}),0===c.length&&!b)throw new v("missing marker content, either "+w.types.join(", "));if(c.length>1)throw new v("multiple marker content, either "+w.types.join(", "));return c[0]},w.prototype.destroy=function(){delete this.$el.psvMarker},w.prototype.isNormal=function(){return"image"==this.type||"html"==this.type},w.prototype.isPolygon=function(){return"polygon_px"==this.type||"polygon_rad"==this.type},w.prototype.isSvg=function(){return"rect"==this.type||"circle"==this.type||"ellipse"==this.type||"path"==this.type},w.prototype.update=function(a){if(a&&a!==this){var b=w.getType(a,!0);if(void 0!==b&&b!==this.type)throw new v("cannot change marker type");x.deepmerge(this,a)}this.isNormal()?this.$el.setAttribute("class","psv-marker psv-marker--normal"):this.$el.setAttribute("class","psv-marker psv-marker--svg"),this.className&&x.addClasses(this.$el,this.className),this.tooltip&&(x.addClasses(this.$el,"has-tooltip"),"string"==typeof this.tooltip&&(this.tooltip={content:this.tooltip})),this.style&&x.deepmerge(this.$el.style,this.style),this.anchor=x.parsePosition(this.anchor),this.isNormal()?this._updateNormal():this.isPolygon()?this._updatePolygon():this._updateSvg()},w.prototype._updateNormal=function(){this.width&&this.height?(this.$el.style.width=this.width+"px",this.$el.style.height=this.height+"px",this._dynamicSize=!1):this._dynamicSize=!0,this.image?this.$el.style.backgroundImage="url("+this.image+")":this.$el.innerHTML=this.html,this.psv.cleanPosition(this),this.position3D=this.psv.sphericalCoordsToVector3(this)},w.prototype._updateSvg=function(){switch(this._dynamicSize=!0,this.type){case"rect":"number"==typeof this._def?this._def={x:0,y:0,width:this._def,height:this._def}:Array.isArray(this._def)?this._def={x:0,y:0,width:this._def[0],height:this._def[1]}:this._def.x=this._def.y=0;break;case"circle":"number"==typeof this._def?this._def={cx:this._def,cy:this._def,r:this._def}:Array.isArray(this._def)?this._def={cx:this._def[0],cy:this._def[0],r:this._def[0]}:this._def.cx=this._def.cy=this._def.r;break;case"ellipse":"number"==typeof this._def?this._def={cx:this._def,cy:this._def,rx:this._def,ry:this._def}:Array.isArray(this._def)?this._def={cx:this._def[0],cy:this._def[1],rx:this._def[0],ry:this._def[1]}:(this._def.cx=this._def.rx,this._def.cy=this._def.ry);break;case"path":"string"==typeof this._def&&(this._def={d:this._def})}Object.getOwnPropertyNames(this._def).forEach(function(a){this.$el.setAttributeNS(null,a,this._def[a])},this),this.svgStyle?Object.getOwnPropertyNames(this.svgStyle).forEach(function(a){this.$el.setAttributeNS(null,a,this.svgStyle[a])},this):this.$el.setAttributeNS(null,"fill","rgba(0,0,0,0.5)"),this.psv.cleanPosition(this),this.position3D=this.psv.sphericalCoordsToVector3(this)},w.prototype._updatePolygon=function(){this._dynamicSize=!0,this.svgStyle?Object.getOwnPropertyNames(this.svgStyle).forEach(function(a){this.$el.setAttributeNS(null,a,this.svgStyle[a])},this):this.$el.setAttributeNS(null,"fill","rgba(0,0,0,0.5)"),[this.polygon_rad,this.polygon_px].forEach(function(a){if(a&&"object"!=typeof a[0])for(var b=0;b0?" "+b:b,a.setAttribute("class",d)}},x.addClasses=function(a,b){b&&b.split(" ").forEach(function(b){x.toggleClass(a,b,!0)})},x.removeClasses=function(a,b){b&&b.split(" ").forEach(function(b){x.toggleClass(a,b,!1)})},x.hasParent=function(a,b){do if(a===b)return!0;while(a=a.parentNode);return!1},x.getClosest=function(a,b){var c=a.matches||a.msMatchesSelector;do if(c.bind(a)(b))return a;while(a=a.parentElement);return null},x.mouseWheelEvent=function(){return"onwheel"in document.createElement("div")?"wheel":void 0!==document.onmousewheel?"mousewheel":"DOMMouseScroll"},x.fullscreenEvent=function(){var a={exitFullscreen:"fullscreenchange",webkitExitFullscreen:"webkitfullscreenchange",mozCancelFullScreen:"mozfullscreenchange",msExitFullscreen:"msFullscreenEnabled"};for(var b in a)if(b in document)return a[b]},x.bound=function(a,b,c){return Math.max(b,Math.min(c,a))},x.isInteger=Number.isInteger||function(a){return"number"==typeof a&&isFinite(a)&&Math.floor(a)===a},x.sum=function(a){return a.reduce(function(a,b){return a+b},0)},x.getXMPValue=function(a,b){var c;return null!==(c=a.match("(.*)"))?c[1]:null!==(c=a.match("GPano:"+b+'="(.*?)"'))?c[1]:null},x.isFullscreenEnabled=function(a){return(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)===a},x.requestFullscreen=function(a){(a.requestFullscreen||a.mozRequestFullScreen||a.webkitRequestFullscreen||a.msRequestFullscreen).call(a)},x.exitFullscreen=function(){(document.exitFullscreen||document.mozCancelFullScreen||document.webkitExitFullscreen||document.msExitFullscreen).call(document)},x.getStyle=function(a,b){return window.getComputedStyle(a,null)[b]},x.getShortestArc=function(a,b){var c=[0,x.TwoPI,-x.TwoPI];return c.reduce(function(c,d){return d=b-a+d,Math.abs(d)b?(f&&(clearTimeout(f),f=null),g=i,e=a.apply(c,d),f||(c=d=null)):f||(f=setTimeout(h,j)),e}},x.isPlainObject=function(a){if("object"==typeof a&&null!==a){if("function"==typeof Object.getPrototypeOf){var b=Object.getPrototypeOf(a);return b===Object.prototype||null===b}return"[object Object]"==Object.prototype.toString.call(a)}return!1},x.deepmerge=function(a,b){var c=b;return function d(a,b){return Array.isArray(b)?(a&&Array.isArray(a)?a.length=0:a=[],b.forEach(function(b,c){a[c]=d(null,b)})):"object"==typeof b?(a&&!Array.isArray(a)||(a={}),Object.keys(b).forEach(function(e){"object"==typeof b[e]&&b[e]&&x.isPlainObject(b[e])?b[e]!=c&&(a[e]?d(a[e],b[e]):a[e]=d(null,b[e])):a[e]=b[e]})):a=b,a}(a,b)},x.clone=function(a){return x.deepmerge(null,a)},function(a){if(a.requestAnimationFrame=a.requestAnimationFrame||a.mozRequestAnimationFrame||a.webkitRequestAnimationFrame||a.msRequestAnimationFrame,a.cancelAnimationFrame=a.cancelAnimationFrame||a.mozCancelAnimationFrame||a.webkitCancelAnimationFrame||a.msCancelAnimationFrame,!a.requestAnimationFrame){var b,c=[],d=[],e=0;a.requestAnimationFrame=function(a){return c.push([++e,a]),b||(b=setInterval(function(){if(c.length){var a=+new Date,e=d;for(d=c,c=e;d.length;)d.shift()[1](a)}else clearInterval(b),b=void 0},20)),e},a.cancelAnimationFrame=function(a){var b,e;for(b=0,e=c.length;b