From 00e21ded714222ac8cd87391b172c801e9c588b7 Mon Sep 17 00:00:00 2001 From: mistic100 Date: Fri, 8 Jul 2016 19:15:39 +0200 Subject: [PATCH] Version 3.2.1 --- bower.json | 4 +- dist/photo-sphere-viewer.css | 217 ++++++++--------- dist/photo-sphere-viewer.js | 390 ++++++++++++++++++------------- dist/photo-sphere-viewer.min.css | 4 +- dist/photo-sphere-viewer.min.js | 8 +- package.json | 6 +- 6 files changed, 353 insertions(+), 276 deletions(-) diff --git a/bower.json b/bower.json index b660f442d..44ac29cfb 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "Photo-Sphere-Viewer", - "version": "3.2.0", + "version": "3.2.1", "authors": [ { "name": "Jérémy Heleine", @@ -20,7 +20,7 @@ "dist/photo-sphere-viewer.css" ], "dependencies": { - "three.js": ">= 0.0.67", + "three.js": ">= 0.70.0", "D.js": "~0.7.3", "uevent": "~1.0.0", "doT": "master" diff --git a/dist/photo-sphere-viewer.css b/dist/photo-sphere-viewer.css index 8f70bd14a..7756bb15d 100644 --- a/dist/photo-sphere-viewer.css +++ b/dist/photo-sphere-viewer.css @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 3.2.0 + * Photo Sphere Viewer 3.2.1 * Copyright (c) 2014-2015 Jérémy Heleine * Copyright (c) 2015-2016 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) @@ -14,17 +14,19 @@ background: radial-gradient(#ffffff, #fdfdfd 16%, #fbfbfb 33%, #f8f8f8 49%, #efefef 66%, #dfdfdf 82%, #bfbfbf 100%); overflow: hidden; } -.psv-container .canvas-container { + +.psv-canvas-container { position: absolute; top: 0; left: 0; z-index: 0; } -.psv-container .canvas-container canvas { + +.psv-canvas { display: block; } -.psv-container .loader-container { +.psv-loader-container { display: -webkit-box; display: -webkit-flex; display: -moz-flex; @@ -39,7 +41,8 @@ height: 100%; z-index: 100; } -.psv-container .loader-container .psv-loader { + +.psv-loader { position: relative; text-align: center; color: rgba(61, 61, 61, 0.7); @@ -47,22 +50,22 @@ height: 150px; border: 10px solid transparent; } -.psv-container .loader-container .psv-loader::before { +.psv-loader::before { content: ''; display: inline-block; height: 100%; vertical-align: middle; } -.psv-container .loader-container .psv-loader, .psv-container .loader-container .psv-loader .loader-image, .psv-container .loader-container .psv-loader .loader-text { +.psv-loader, .psv-loader-image, .psv-loader-text { display: inline-block; vertical-align: middle; } -.psv-container .loader-container .psv-loader .loader-canvas { +.psv-loader-canvas { position: absolute; top: 0; left: 0; } -.psv-container .loader-container .psv-loader .loader-text { +.psv-loader-text { font: 14px sans-serif; } @@ -81,13 +84,14 @@ background: rgba(61, 61, 61, 0.5); transition: bottom ease-in-out .1s; } -.psv-navbar.open { +.psv-navbar--open { bottom: 0; } .psv-navbar, .psv-navbar * { box-sizing: content-box; } -.psv-navbar .psv-caption { + +.psv-caption { -webkit-box-flex: 10; -webkit-flex-grow: 10; -moz-flex-grow: 10; @@ -101,81 +105,83 @@ font-family: sans-serif; } @media (max-width: 800px) { - .psv-navbar .psv-caption { + .psv-caption { visibility: hidden; } } -.psv-navbar .psv-spacer.weight-1 { + +.psv-spacer--weight-1 { -webkit-box-flex: 1; -webkit-flex-grow: 1; -moz-flex-grow: 1; -ms-flex-positive: 1; flex-grow: 1; } -.psv-navbar .psv-spacer.weight-2 { +.psv-spacer--weight-2 { -webkit-box-flex: 2; -webkit-flex-grow: 2; -moz-flex-grow: 2; -ms-flex-positive: 2; flex-grow: 2; } -.psv-navbar .psv-spacer.weight-3 { +.psv-spacer--weight-3 { -webkit-box-flex: 3; -webkit-flex-grow: 3; -moz-flex-grow: 3; -ms-flex-positive: 3; flex-grow: 3; } -.psv-navbar .psv-spacer.weight-4 { +.psv-spacer--weight-4 { -webkit-box-flex: 4; -webkit-flex-grow: 4; -moz-flex-grow: 4; -ms-flex-positive: 4; flex-grow: 4; } -.psv-navbar .psv-spacer.weight-5 { +.psv-spacer--weight-5 { -webkit-box-flex: 5; -webkit-flex-grow: 5; -moz-flex-grow: 5; -ms-flex-positive: 5; flex-grow: 5; } -.psv-navbar .psv-spacer.weight-6 { +.psv-spacer--weight-6 { -webkit-box-flex: 6; -webkit-flex-grow: 6; -moz-flex-grow: 6; -ms-flex-positive: 6; flex-grow: 6; } -.psv-navbar .psv-spacer.weight-7 { +.psv-spacer--weight-7 { -webkit-box-flex: 7; -webkit-flex-grow: 7; -moz-flex-grow: 7; -ms-flex-positive: 7; flex-grow: 7; } -.psv-navbar .psv-spacer.weight-8 { +.psv-spacer--weight-8 { -webkit-box-flex: 8; -webkit-flex-grow: 8; -moz-flex-grow: 8; -ms-flex-positive: 8; flex-grow: 8; } -.psv-navbar .psv-spacer.weight-9 { +.psv-spacer--weight-9 { -webkit-box-flex: 9; -webkit-flex-grow: 9; -moz-flex-grow: 9; -ms-flex-positive: 9; flex-grow: 9; } -.psv-navbar .psv-spacer.weight-10 { +.psv-spacer--weight-10 { -webkit-box-flex: 10; -webkit-flex-grow: 10; -moz-flex-grow: 10; -ms-flex-positive: 10; flex-grow: 10; } -.psv-navbar .psv-button { + +.psv-button { -webkit-box-flex: 0; -webkit-flex-grow: 0; -moz-flex-grow: 0; @@ -193,51 +199,51 @@ background: transparent; color: rgba(255, 255, 255, 0.7); } -.psv-navbar .psv-button.active { +.psv-button--active { background: rgba(255, 255, 255, 0.1); } -.psv-navbar .psv-button.disabled { +.psv-button--disabled { pointer-events: none; opacity: 0.5; } -.psv-navbar .psv-button svg { +.psv-button .psv-button-svg { width: 100%; transform: scale(1); transition: transform .3s ease; } -.psv-navbar .psv-button svg * { +.psv-button .psv-button-svg * { fill: rgba(255, 255, 255, 0.7); } -.psv-navbar .psv-button.hover-scale:not(.disabled):hover svg { +.psv-button--hover-scale:not(.psv-button--disabled):hover .psv-button .psv-button-svg { transform: scale(1.2); } -.psv-navbar .autorotate-button { +.psv-autorotate-button { width: 25px; height: 25px; padding: 7.5px; } -.psv-navbar .zoom-button { +.psv-zoom-button { cursor: default; width: 128px; } -.psv-navbar .zoom-button .minus, .psv-navbar .zoom-button .plus { +.psv-zoom-button-minus, .psv-zoom-button-plus { float: left; position: relative; cursor: pointer; width: 16px; height: 16px; } -.psv-navbar .zoom-button .minus svg, .psv-navbar .zoom-button .plus svg { +.psv-zoom-button-minus .psv-button-svg, .psv-zoom-button-plus .psv-button-svg { position: relative; top: 20%; } -.psv-navbar .zoom-button .range { +.psv-zoom-button-range { float: left; padding: 9.5px 8px; } -.psv-navbar .zoom-button .range .line { +.psv-zoom-button-line { position: relative; cursor: pointer; width: 80px; @@ -245,7 +251,7 @@ background: rgba(255, 255, 255, 0.7); transition: all .3s ease; } -.psv-navbar .zoom-button .range .handle { +.psv-zoom-button-handle { position: absolute; border-radius: 50%; top: -3px; @@ -255,43 +261,44 @@ transform: scale(1); transition: transform .3s ease; } -.psv-navbar .zoom-button:not(.disabled):hover .range .line { +.psv-zoom-button:not(.psv-button--disabled):hover .psv-zoom-button-line { box-shadow: 0 0 2px rgba(255, 255, 255, 0.7); } -.psv-navbar .zoom-button:not(.disabled):hover .range .handle { +.psv-zoom-button:not(.psv-button--disabled):hover .psv-zoom-button-handle { transform: scale(1.3); } - @media (max-width: 600px) { - .psv-navbar .zoom-button { + .psv-zoom-button { width: auto; padding: 0; } - .psv-navbar .zoom-button .range { + .psv-zoom-button-range { display: none; } - .psv-navbar .zoom-button .minus, .psv-navbar .zoom-button .plus { + .psv-zoom-button-minus, .psv-zoom-button-plus { width: 20px; height: 20px; padding: 10px; } - .psv-navbar .zoom-button .minus svg, .psv-navbar .zoom-button .plus svg { + .psv-zoom-button-minus .psv-button-svg, .psv-zoom-button-plus .psv-button-svg { top: 0; } } -.psv-markers-list h1 { + +.psv-markers-list-title { font: 24px sans-serif; margin: 1em 0; text-align: center; text-shadow: 2px 1px #000000; } -.psv-markers-list ul { + +.psv-markers-list { list-style: none; margin: 0; padding: 0; overflow: hidden; } -.psv-markers-list li { +.psv-markers-list-item { clear: both; min-height: 20px; padding: 0.5em 1em; @@ -299,7 +306,7 @@ transform: translateX(0); transition: transform .3s ease-in-out; } -.psv-markers-list li::before { +.psv-markers-list-item::before { content: ''; position: absolute; top: 0; @@ -308,27 +315,26 @@ width: 10px; margin-left: -10px; } -.psv-markers-list li:nth-child(odd), .psv-markers-list li:nth-child(odd)::before { +.psv-markers-list-item:nth-child(odd), .psv-markers-list-item:nth-child(odd)::before { background: rgba(255, 255, 255, 0.1); } -.psv-markers-list li:nth-child(even), .psv-markers-list li:nth-child(even)::before { +.psv-markers-list-item:nth-child(even), .psv-markers-list-item:nth-child(even)::before { background: transparent; } -.psv-markers-list li:hover { +.psv-markers-list-item:hover { transform: translateX(10px); transition: transform .1s ease-in-out; } -.psv-markers-list .marker-image { +.psv-markers-list-image { float: left; width: 20px; } -.psv-markers-list .marker-name { +.psv-markers-list-name { margin: 0; padding: 0; - padding-left: calc(20px + 0.5em); } -.psv-markers-list .marker-name.no-image { - padding-left: 0; +.psv-markers-list-image + .psv-markers-list-name { + padding-left: calc(20px + 0.5em); } .psv-hud { @@ -343,36 +349,33 @@ width: 100%; height: 100%; } -.psv-hud .psv-marker:not(.svg-marker) { + +.psv-hud-svg-container { position: absolute; top: 0; left: 0; - z-index: 30; - background-size: contain; - background-repeat: no-repeat; + width: 100%; + height: 100%; + z-index: 20; +} + +.psv-marker { cursor: pointer; display: none; } -.psv-hud .psv-marker:not(.svg-marker).transparent { - display: block; - opacity: 0; -} -.psv-hud .psv-marker:not(.svg-marker).visible { - display: block; -} -.psv-hud .psv-svg-container { +.psv-marker--normal { position: absolute; top: 0; left: 0; - width: 100%; - height: 100%; - z-index: 20; + z-index: 30; + background-size: contain; + background-repeat: no-repeat; } -.psv-hud .psv-svg-container .svg-marker { - cursor: pointer; - display: none; +.psv-marker--transparent { + display: block; + opacity: 0; } -.psv-hud .psv-svg-container .svg-marker.visible { +.psv-marker--visible { display: block; } @@ -392,10 +395,10 @@ cursor: default; margin-left: 9px; } -.psv-container.has-navbar .psv-panel { +.psv-container--has-navbar .psv-panel { height: calc(100% - 40px); } -.psv-panel .close-button { +.psv-panel-close-button { display: none; position: absolute; top: 0; @@ -404,7 +407,7 @@ height: 24px; background: rgba(0, 0, 0, 0.9); } -.psv-panel .close-button::before, .psv-panel .close-button::after { +.psv-panel-close-button::before, .psv-panel-close-button::after { content: ''; position: absolute; top: 50%; @@ -415,23 +418,23 @@ transition: .2s ease-in-out; transition-property: width, left, transform; } -.psv-panel .close-button::before { +.psv-panel-close-button::before { transform: rotate(45deg); } -.psv-panel .close-button::after { +.psv-panel-close-button::after { transform: rotate(-45deg); } -.psv-panel .close-button:hover::before, .psv-panel .close-button:hover::after { +.psv-panel-close-button:hover::before, .psv-panel-close-button:hover::after { left: 0; width: 23px; } -.psv-panel .close-button:hover::before { +.psv-panel-close-button:hover::before { transform: rotate(135deg); } -.psv-panel .close-button:hover::after { +.psv-panel-close-button:hover::after { transform: rotate(45deg); } -.psv-panel .resizer { +.psv-panel-resizer { display: none; position: absolute; top: 0; @@ -441,7 +444,7 @@ background-color: rgba(0, 0, 0, 0.9); cursor: col-resize; } -.psv-panel .resizer::before { +.psv-panel-resizer::before { content: ''; position: absolute; top: 50%; @@ -452,7 +455,7 @@ 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; background: transparent; } -.psv-panel .content { +.psv-panel-content { width: 100%; height: 100%; box-sizing: border-box; @@ -460,10 +463,10 @@ font: 16px sans-serif; overflow: auto; } -.psv-panel .content:not(.no-margin) { +.psv-panel-content:not(.psv-panel-content--no-margin) { padding: 1em; } -.psv-panel .content.no-interaction { +.psv-panel-content--no-interaction { -webkit-touch-callout: none; -webkit-user-select: none; -khtml-user-select: none; @@ -472,12 +475,12 @@ user-select: none; pointer-events: none; } -.psv-panel.open { +.psv-panel--open { transform: translate3d(0, 0, 0); opacity: 1; transition-duration: .2s; } -.psv-panel.open .close-button, .psv-panel.open .resizer { +.psv-panel--open .psv-panel-close-button, .psv-panel--open .psv-panel-close-resizer { display: block; } @@ -494,82 +497,82 @@ transition-timing-function: ease-in-out; transition-duration: 0.1s; } -.psv-tooltip .content { +.psv-tooltip-content { color: white; font: 14px sans-serif; text-shadow: 0 1px #000000; } -.psv-tooltip .arrow { +.psv-tooltip-arrow { position: absolute; height: 0; width: 0; border: 7px solid transparent; } -.psv-tooltip.bottom-center { +.psv-tooltip--bottom-center { box-shadow: 0 3px 0 rgba(90, 90, 90, 0.7); transform: translate3d(0, -5px, 0); transition-property: opacity, transform; } -.psv-tooltip.bottom-center .arrow { +.psv-tooltip--bottom-center .psv-tooltip-arrow { border-bottom-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.center-left { +.psv-tooltip--center-left { box-shadow: -3px 0 0 rgba(90, 90, 90, 0.7); transform: translate3d(5px, 0, 0); transition-property: opacity, transform; } -.psv-tooltip.center-left .arrow { +.psv-tooltip--center-left .psv-tooltip-arrow { border-left-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.top-center { +.psv-tooltip--top-center { box-shadow: 0 -3px 0 rgba(90, 90, 90, 0.7); transform: translate3d(0, 5px, 0); transition-property: opacity, transform; } -.psv-tooltip.top-center .arrow { +.psv-tooltip--top-center .psv-tooltip-arrow { border-top-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.center-right { +.psv-tooltip--center-right { box-shadow: 3px 0 0 rgba(90, 90, 90, 0.7); transform: translate3d(-5px, 0, 0); transition-property: opacity, transform; } -.psv-tooltip.center-right .arrow { +.psv-tooltip--center-right .psv-tooltip-arrow { border-right-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.bottom-left { +.psv-tooltip--bottom-left { box-shadow: -3px 3px 0 rgba(90, 90, 90, 0.7); transform: translate3d(0, -5px, 0); transition-property: opacity, transform; } -.psv-tooltip.bottom-left .arrow { +.psv-tooltip--bottom-left .psv-tooltip-arrow { border-bottom-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.bottom-right { +.psv-tooltip--bottom-right { box-shadow: 3px 3px 0 rgba(90, 90, 90, 0.7); transform: translate3d(0, -5px, 0); transition-property: opacity, transform; } -.psv-tooltip.bottom-right .arrow { +.psv-tooltip--bottom-right .psv-tooltip-arrow { border-bottom-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.top-left { +.psv-tooltip--top-left { box-shadow: -3px -3px 0 rgba(90, 90, 90, 0.7); transform: translate3d(0, 5px, 0); transition-property: opacity, transform; } -.psv-tooltip.top-left .arrow { +.psv-tooltip--top-left .psv-tooltip-arrow { border-top-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.top-right { +.psv-tooltip--top-right { box-shadow: 3px -3px 0 rgba(90, 90, 90, 0.7); transform: translate3d(0, 5px, 0); transition-property: opacity, transform; } -.psv-tooltip.top-right .arrow { +.psv-tooltip--top-right .psv-tooltip-arrow { border-top-color: rgba(61, 61, 61, 0.8); } -.psv-tooltip.visible { +.psv-tooltip--visible { transform: translate3d(0, 0, 0); opacity: 1; transition-duration: 0.1s; diff --git a/dist/photo-sphere-viewer.js b/dist/photo-sphere-viewer.js index 318ba1f9e..8a3659dd5 100644 --- a/dist/photo-sphere-viewer.js +++ b/dist/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /*! - * Photo Sphere Viewer 3.2.0 + * Photo Sphere Viewer 3.2.1 * Copyright (c) 2014-2015 Jérémy Heleine * Copyright (c) 2015-2016 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) @@ -118,6 +118,12 @@ function PhotoSphereViewer(options) { return PSVUtils.stayBetween(PSVUtils.parseAngle(angle, -Math.PI), -PSVUtils.HalfPI, PSVUtils.HalfPI); }); } + if (this.config.fisheye === true) { + this.config.fisheye = 1; + } + else if (this.config.fisheye === false) { + this.config.fisheye = 0; + } // references to components this.parent = (typeof options.container == 'string') ? document.getElementById(options.container) : options.container; @@ -208,7 +214,7 @@ function PhotoSphereViewer(options) { // load components if (this.config.navbar) { - this.container.classList.add('has-navbar'); + this.container.classList.add('psv-container--has-navbar'); this.navbar = new PSVNavBar(this); this.navbar.hide(); } @@ -308,7 +314,7 @@ PhotoSphereViewer.prototype._loadXMP = function() { } else if (xhr.readyState === 3) { if (self.loader) { - self.loader.setProgress(progress + 10); + self.loader.setProgress(progress += 10); } } }; @@ -458,8 +464,9 @@ PhotoSphereViewer.prototype._createScene = function() { // Renderer depends on whether WebGL is supported or not this.renderer = PhotoSphereViewer.SYSTEM.isWebGLSupported && this.config.webgl ? new THREE.WebGLRenderer() : new THREE.CanvasRenderer(); this.renderer.setSize(this.prop.size.width, this.prop.size.height); + this.renderer.setPixelRatio(PhotoSphereViewer.SYSTEM.pixelRatio); - this.camera = new THREE.PerspectiveCamera(this.config.default_fov, this.prop.size.width / this.prop.size.height, 1, 300); + this.camera = new THREE.PerspectiveCamera(this.config.default_fov, this.prop.size.width / this.prop.size.height, 1, PhotoSphereViewer.SPHERE_RADIUS * 2); this.camera.position.set(0, 0, 0); if (this.config.gyroscope && PSVUtils.checkTHREE('DeviceOrientationControls')) { @@ -470,7 +477,7 @@ PhotoSphereViewer.prototype._createScene = function() { this.scene.add(this.camera); // The middle of the panorama is placed at longitude=0 - var geometry = new THREE.SphereGeometry(200, this.config.sphere_segments, this.config.sphere_segments, -PSVUtils.HalfPI); + var geometry = new THREE.SphereGeometry(PhotoSphereViewer.SPHERE_RADIUS, this.config.sphere_segments, this.config.sphere_segments, -PSVUtils.HalfPI); var material = new THREE.MeshBasicMaterial(); material.side = THREE.DoubleSide; @@ -482,7 +489,8 @@ PhotoSphereViewer.prototype._createScene = function() { // create canvas container this.canvas_container = document.createElement('div'); - this.canvas_container.className = 'canvas-container'; + 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); @@ -681,6 +689,12 @@ PhotoSphereViewer.MOVE_THRESHOLD = 4; */ PhotoSphereViewer.INERTIA_WINDOW = 300; +/** + * Radius of the THREE.Sphere + * @type {int} + */ +PhotoSphereViewer.SPHERE_RADIUS = 100; + /** * Map between keyboard events "keyCode|which" and "key" * @type {Object.} @@ -741,6 +755,7 @@ PhotoSphereViewer.DEFAULTS = { time_anim: 2000, anim_speed: '2rpm', anim_lat: null, + fisheye: false, navbar: [ 'autorotate', 'zoom', @@ -789,13 +804,13 @@ PhotoSphereViewer.DEFAULTS = { */ PhotoSphereViewer.TEMPLATES = { markersList: '\ -
\ -

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

\ -
    \ +
    \ +

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

    \ +
      \ {{~ it.markers: marker }} \ -
    • \ - {{? marker.image }}{{?}} \ -

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

      \ +
    • \ + {{? marker.image }}{{?}} \ +

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

      \
    • \ {{~}} \
    \ @@ -942,7 +957,7 @@ PhotoSphereViewer.prototype._onTouchStart = function(evt) { * @private */ PhotoSphereViewer.prototype._startMove = function(evt) { - if (this.prop.orientation_reqid || this.prop.autorotate_reqid) { + if (this.isGyroscopeEnabled()) { return; } @@ -1296,6 +1311,12 @@ PhotoSphereViewer.prototype.isFullscreenEnabled = function() { PhotoSphereViewer.prototype.render = function(updateDirection) { if (updateDirection !== false) { this.prop.direction = this.sphericalCoordsToVector3(this.prop.longitude, this.prop.latitude); + + if (this.config.fisheye) { + this.prop.direction.multiplyScalar(this.config.fisheye / 2); + this.camera.position.copy(this.prop.direction).negate(); + } + this.camera.lookAt(this.prop.direction); // this.camera.rotation.z = 0; } @@ -1796,9 +1817,9 @@ PhotoSphereViewer.prototype.sphericalCoordsToTextureCoords = function(longitude, */ PhotoSphereViewer.prototype.sphericalCoordsToVector3 = function(longitude, latitude) { return new THREE.Vector3( - -Math.cos(latitude) * Math.sin(longitude), - Math.sin(latitude), - Math.cos(latitude) * Math.cos(longitude) + PhotoSphereViewer.SPHERE_RADIUS * -Math.cos(latitude) * Math.sin(longitude), + PhotoSphereViewer.SPHERE_RADIUS * Math.sin(latitude), + PhotoSphereViewer.SPHERE_RADIUS * Math.cos(latitude) * Math.cos(longitude) ); }; @@ -2052,7 +2073,7 @@ PSVHUD.prototype.create = function() { PSVComponent.prototype.create.call(this); this.$svg = document.createElementNS(PSVHUD.svgNS, 'svg'); - this.$svg.setAttribute('class', 'psv-svg-container'); + this.$svg.setAttribute('class', 'psv-hud-svg-container'); this.container.appendChild(this.$svg); // Markers events via delegation @@ -2129,6 +2150,8 @@ PSVHUD.prototype.addMarker = function(properties, render) { if (render !== false) { this.updatePositions(); } + + return marker; }; /** @@ -2257,11 +2280,13 @@ PSVHUD.prototype.updatePositions = function() { for (var id in this.markers) { var marker = this.markers[id]; + var isVisible = marker.visible; - if (marker.isPolygon()) { + if (isVisible && marker.isPolygon()) { var positions = this._getPolygonPositions(marker); + isVisible = positions.length > 2; - if (this._isPolygonVisible(marker, positions)) { + if (isVisible) { marker.position2D = this._getPolygonDimensions(marker, positions); var points = ''; @@ -2270,33 +2295,21 @@ PSVHUD.prototype.updatePositions = function() { }); marker.$el.setAttributeNS(null, 'points', points); - - if (!marker.$el.classList.contains('visible')) { - marker.$el.classList.add('visible'); - } - } - else { - marker.position2D = null; - marker.$el.classList.remove('visible'); } } - else { + else if (isVisible) { var position = this._getMarkerPosition(marker); + isVisible = this._isMarkerVisible(marker, position); - if (this._isMarkerVisible(marker, position)) { + if (isVisible) { marker.position2D = position; - marker.$el.style.transform = 'translate3D(' + position.left + 'px, ' + position.top + 'px, ' + '0px) rotateZ(' + rotation + 'deg)'; - - if (!marker.$el.classList.contains('visible')) { - marker.$el.classList.add('visible'); - } - } - else { - marker.position2D = null; - marker.$el.classList.remove('visible'); + marker.$el.style.transform = 'translate3D(' + position.left + 'px, ' + position.top + 'px, ' + '0px)' + + (!marker.lockRotation && rotation ? ' rotateZ(' + rotation + 'deg)' : ''); } } + + PSVUtils.toggleClass(marker.$el, 'psv-marker--visible', isVisible); } }; @@ -2309,33 +2322,13 @@ PSVHUD.prototype.updatePositions = function() { * @private */ PSVHUD.prototype._isMarkerVisible = function(marker, position) { - return marker.visible && - marker.position3D.dot(this.psv.prop.direction) > 0 && + return marker.position3D.dot(this.psv.prop.direction) > 0 && position.left + marker.width >= 0 && position.left - marker.width <= this.psv.prop.size.width && position.top + marker.height >= 0 && position.top - marker.height <= this.psv.prop.size.height; }; -/** - * Determine if a polygon marker is visible - * It tests if at least one point is in the viewport - * @param {PSVMarker} marker - * @param {{top: int, left: int}[]} positions - * @returns {boolean} - * @private - */ -PSVHUD.prototype._isPolygonVisible = function(marker, positions) { - return marker.visible && - positions.some(function(pos, i) { - return marker.positions3D[i].dot(this.psv.prop.direction) > 0 && - pos.left >= 0 && - pos.left <= this.psv.prop.size.width && - pos.top >= 0 && - pos.top <= this.psv.prop.size.height; - }, this); -}; - /** * Compute HUD coordinates of a marker * @param {PSVMarker} marker @@ -2345,9 +2338,9 @@ PSVHUD.prototype._isPolygonVisible = function(marker, positions) { PSVHUD.prototype._getMarkerPosition = function(marker) { if (marker.dynamicSize) { // make the marker visible to get it's size - marker.$el.classList.add('transparent'); + marker.$el.classList.add('psv-marker--transparent'); var rect = marker.$el.getBoundingClientRect(); - marker.$el.classList.remove('transparent'); + marker.$el.classList.remove('psv-marker--transparent'); marker.width = rect.right - rect.left; marker.height = rect.bottom - rect.top; @@ -2363,14 +2356,79 @@ PSVHUD.prototype._getMarkerPosition = function(marker) { /** * Compute HUD coordinates of each point of a polygon + * It handles points behind the camera by creating intermediary points suitable for the projector * @param {PSVMarker} marker * @returns {{top: int, left: int}[]} * @private */ PSVHUD.prototype._getPolygonPositions = function(marker) { - return marker.positions3D.map(function(pos) { - return this.psv.vector3ToViewerCoords(pos); + var nbVectors = marker.positions3D.length; + + // compute if each vector is visible + var positions3D = marker.positions3D.map(function(vector) { + return { + vector: vector, + visible: vector.dot(this.psv.prop.direction) > 0 + }; }, this); + + // get pairs of visible/invisible vector for each invisible vector connected to a visible vector + var toBeComputed = []; + positions3D.forEach(function(pos, i) { + if (!pos.visible) { + var neighbours = [ + i === 0 ? positions3D[nbVectors - 1] : positions3D[i - 1], + i === nbVectors - 1 ? positions3D[0] : positions3D[i + 1] + ]; + + neighbours.forEach(function(neighbour) { + if (neighbour.visible) { + toBeComputed.push({ + visible: neighbour, + invisible: pos, + index: i + }); + } + }); + } + }); + + // compute intermediary vector for each pair (the loop is reversed for splice to insert at the right place) + toBeComputed.reverse().forEach(function(pair) { + positions3D.splice(pair.index, 0, { + vector: this._getPolygonIntermediaryPoint(pair.visible.vector, pair.invisible.vector), + visible: true + }); + }, this); + + // translate vectors to screen pos + return positions3D + .filter(function(pos) { + return pos.visible; + }) + .map(function(pos) { + return this.psv.vector3ToViewerCoords(pos.vector); + }, this); +}; + +/** + * Given one point in the same direction of the camera and one point behind the camera, + * computes an intermediary point on the great circle delimiting the half sphere visible by the camera. + * The point is shifted by .01 rad because the projector cannot handle points exactly on this circle. + * @link http://math.stackexchange.com/a/1730410/327208 + * + * @param P1 {THREE.Vector3} + * @param P2 {THREE.Vector3} + * @returns {THREE.Vector3} + * @private + */ +PSVHUD.prototype._getPolygonIntermediaryPoint = function(P1, P2) { + var C = this.psv.prop.direction.clone().normalize(); + var N = new THREE.Vector3().crossVectors(P1, P2).normalize(); + var V = new THREE.Vector3().crossVectors(N, P1).normalize(); + var H = new THREE.Vector3().addVectors(P1.clone().multiplyScalar(-C.dot(V)), V.clone().multiplyScalar(C.dot(P1))).normalize(); + var a = new THREE.Vector3().crossVectors(H, C); + return H.applyAxisAngle(a, 0.01).multiplyScalar(PhotoSphereViewer.SPHERE_RADIUS); }; /** @@ -2528,7 +2586,7 @@ function PSVLoader(psv) { PSVLoader.prototype = Object.create(PSVComponent.prototype); PSVLoader.prototype.constructor = PSVLoader; -PSVLoader.className = 'loader-container'; +PSVLoader.className = 'psv-loader-container'; /** * Creates the loader content @@ -2541,7 +2599,7 @@ PSVLoader.prototype.create = function() { this.container.appendChild(this.loader); this.canvas = document.createElement('canvas'); - this.canvas.className = 'loader-canvas'; + this.canvas.className = 'psv-loader-canvas'; this.canvas.width = this.loader.clientWidth; this.canvas.height = this.loader.clientWidth; @@ -2552,12 +2610,12 @@ PSVLoader.prototype.create = function() { var inner; if (this.psv.config.loading_img) { inner = document.createElement('img'); - inner.className = 'loader-image'; + inner.className = 'psv-loader-image'; inner.src = this.psv.config.loading_img; } else if (this.psv.config.loading_txt) { inner = document.createElement('div'); - inner.className = 'loader-text'; + inner.className = 'psv-loader-text'; inner.innerHTML = this.psv.config.loading_txt; } if (inner) { @@ -2624,6 +2682,7 @@ function PSVMarker(properties, psv) { // public properties this.psv = psv; this.visible = true; + this.lockRotation = false; this.dynamicSize = false; // private properties @@ -2631,6 +2690,7 @@ function PSVMarker(properties, psv) { var _type = PSVMarker.getType(properties, false); var $el; + // readonly properties Object.defineProperties(this, { id: { configurable: false, @@ -2659,7 +2719,7 @@ function PSVMarker(properties, psv) { set: function(value) { } }, - data: { + _def: { configurable: false, enumerable: true, get: function() { @@ -2756,10 +2816,10 @@ PSVMarker.prototype.update = function(properties) { // reset CSS class if (this.isNormal()) { - this.$el.setAttribute('class', 'psv-marker'); + this.$el.setAttribute('class', 'psv-marker psv-marker--normal'); } else { - this.$el.setAttribute('class', 'psv-marker svg-marker'); + this.$el.setAttribute('class', 'psv-marker psv-marker--svg'); } // add CSS classes @@ -2831,81 +2891,81 @@ PSVMarker.prototype._updateSvg = function() { // set content switch (this.type) { case 'rect': - if (typeof this.data == 'number') { - this.data = { + if (typeof this._def == 'number') { + this._def = { x: 0, y: 0, - width: this.data, - height: this.data + width: this._def, + height: this._def }; } - else if (Array.isArray(this.data)) { - this.data = { + else if (Array.isArray(this._def)) { + this._def = { x: 0, y: 0, - width: this.data[0], - height: this.data[1] + width: this._def[0], + height: this._def[1] }; } else { - this.data.x = this.data.y = 0; + this._def.x = this._def.y = 0; } break; case 'circle': - if (typeof this.data == 'number') { - this.data = { - cx: this.data, - cy: this.data, - r: this.data + if (typeof this._def == 'number') { + this._def = { + cx: this._def, + cy: this._def, + r: this._def }; } - else if (Array.isArray(this.data)) { - this.data = { - cx: this.data[0], - cy: this.data[0], - r: this.data[0] + else if (Array.isArray(this._def)) { + this._def = { + cx: this._def[0], + cy: this._def[0], + r: this._def[0] }; } else { - this.data.cx = this.data.cy = this.data.r; + this._def.cx = this._def.cy = this._def.r; } break; case 'ellipse': - if (typeof this.data == 'number') { - this.data = { - cx: this.data, - cy: this.data, - rx: this.data, - ry: this.data + if (typeof this._def == 'number') { + this._def = { + cx: this._def, + cy: this._def, + rx: this._def, + ry: this._def }; } - else if (Array.isArray(this.data)) { - this.data = { - cx: this.data[0], - cy: this.data[1], - rx: this.data[0], - ry: this.data[1] + else if (Array.isArray(this._def)) { + this._def = { + cx: this._def[0], + cy: this._def[1], + rx: this._def[0], + ry: this._def[1] }; } else { - this.data.cx = this.data.rx; - this.data.cy = this.data.ry; + this._def.cx = this._def.rx; + this._def.cy = this._def.ry; } break; case 'path': - if (typeof this.data == 'string') { - this.data = { - d: this.data + if (typeof this._def == 'string') { + this._def = { + d: this._def }; } break; } - Object.getOwnPropertyNames(this.data).forEach(function(prop) { - this.$el.setAttributeNS(null, prop, this.data[prop]); + Object.getOwnPropertyNames(this._def).forEach(function(prop) { + this.$el.setAttributeNS(null, prop, this._def[prop]); }, this); // set style @@ -3021,7 +3081,7 @@ function PSVNavBar(psv) { PSVNavBar.prototype = Object.create(PSVComponent.prototype); PSVNavBar.prototype.constructor = PSVNavBar; -PSVNavBar.className = 'psv-navbar open'; +PSVNavBar.className = 'psv-navbar psv-navbar--open'; PSVNavBar.publicMethods = ['showNavbar', 'hideNavbar', 'toggleNavbar', 'getNavbarButton']; /** @@ -3138,7 +3198,7 @@ PSVNavBar.prototype.hideNavbar = function() { * @param active */ PSVNavBar.prototype.toggleNavbar = function(active) { - PSVUtils.toggleClass(this.container, 'open', active); + PSVUtils.toggleClass(this.container, 'psv-navbar--open', active); }; @@ -3189,7 +3249,7 @@ function PSVNavBarSpacer(navbar, weight) { this.create(); - this.container.classList.add('weight-' + (weight || 5)); + this.container.classList.add('psv-spacer--weight-' + (weight || 5)); } PSVNavBarSpacer.prototype = Object.create(PSVComponent.prototype); @@ -3231,13 +3291,13 @@ PSVPanel.prototype.create = function() { PSVComponent.prototype.create.call(this); this.container.innerHTML = - '
    ' + - '
    ' + - '
    '; + '
    ' + + '
    ' + + '
    '; - this.content = this.container.querySelector('.content'); + this.content = this.container.querySelector('.psv-panel-content'); - var closeBtn = this.container.querySelector('.close-button'); + var closeBtn = this.container.querySelector('.psv-panel-close-button'); closeBtn.addEventListener('click', this.hidePanel.bind(this)); // Stop event bubling from panel @@ -3248,7 +3308,7 @@ PSVPanel.prototype.create = function() { } // Event for panel resizing + stop bubling - var resizer = this.container.querySelector('.resizer'); + var resizer = this.container.querySelector('.psv-panel-resizer'); resizer.addEventListener('mousedown', this); resizer.addEventListener('touchstart', this); this.psv.container.addEventListener('mouseup', this); @@ -3298,16 +3358,9 @@ PSVPanel.prototype.handleEvent = function(e) { PSVPanel.prototype.showPanel = function(content, noMargin) { this.content.innerHTML = content; this.content.scrollTop = 0; - this.container.classList.add('open'); + this.container.classList.add('psv-panel--open'); - if (noMargin) { - if (!this.content.classList.contains('no-margin')) { - this.content.classList.add('no-margin'); - } - } - else { - this.content.classList.remove('no-margin'); - } + PSVUtils.toggleClass(this.content, 'psv-panel-content--no-margin', !!noMargin); this.prop.opened = true; this.psv.trigger('open-panel'); @@ -3320,7 +3373,7 @@ PSVPanel.prototype.showPanel = function(content, noMargin) { PSVPanel.prototype.hidePanel = function() { this.content.innerHTML = null; this.prop.opened = false; - this.container.classList.remove('open'); + this.container.classList.remove('psv-panel--open'); this.psv.trigger('close-panel'); }; @@ -3353,7 +3406,7 @@ PSVPanel.prototype._startResize = function(evt) { this.prop.mouse_x = parseInt(evt.clientX); this.prop.mouse_y = parseInt(evt.clientY); this.prop.mousedown = true; - this.content.classList.add('no-interaction'); + this.content.classList.add('psv-panel-content--no-interaction'); }; /** @@ -3365,7 +3418,7 @@ PSVPanel.prototype._onMouseUp = function(evt) { if (this.prop.mousedown) { evt.stopPropagation(); this.prop.mousedown = false; - this.content.classList.remove('no-interaction'); + this.content.classList.remove('psv-panel-content--no-interaction'); } }; @@ -3439,10 +3492,13 @@ PSVTooltip.topMap = { 0: 'top', 0.5: 'center', 1: 'bottom' }; PSVTooltip.prototype.create = function() { PSVComponent.prototype.create.call(this); - this.container.innerHTML = '
    '; + 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); }; @@ -3475,7 +3531,7 @@ PSVTooltip.prototype.handleEvent = function(e) { * @returns {boolean} */ PSVTooltip.prototype.isTooltipVisible = function() { - return this.container.classList.contains('visible'); + return this.container.classList.contains('psv-tooltip--visible'); }; /** @@ -3496,8 +3552,8 @@ PSVTooltip.prototype.showTooltip = function(config) { var isUpdate = this.isTooltipVisible(); var t = this.container; - var c = t.querySelector('.content'); - var a = t.querySelector('.arrow'); + var c = this.content; + var a = this.arrow; if (!config.position) { config.position = ['top', 'center']; @@ -3590,13 +3646,13 @@ PSVTooltip.prototype.showTooltip = function(config) { a.style.top = style.arrow_top + 'px'; a.style.left = style.arrow_left + 'px'; - t.classList.add(style.posClass.join('-')); + t.classList.add('psv-tooltip--' + style.posClass.join('-')); // delay for correct transition between the two classes if (!isUpdate) { var self = this; this.timeout = window.setTimeout(function() { - t.classList.add('visible'); + t.classList.add('psv-tooltip--visible'); self.psv.trigger('show-tooltip'); self.timeout = null; }, this.config.delay); @@ -3613,12 +3669,12 @@ PSVTooltip.prototype.hideTooltip = function() { } if (this.isTooltipVisible()) { - this.container.classList.remove('visible'); + this.container.classList.remove('psv-tooltip--visible'); this.psv.trigger('hide-tooltip'); var self = this; this.timeout = window.setTimeout(function() { - self.container.querySelector('.content').innerHTML = null; + self.content.innerHTML = null; self.container.style.top = '-1000px'; self.container.style.left = '-1000px'; self.timeout = null; @@ -3710,7 +3766,7 @@ PSVNavBarButton.prototype.create = function() { PSVComponent.prototype.create.call(this); if (this.constructor.icon) { - this.container.innerHTML = PhotoSphereViewer.ICONS[this.constructor.icon]; + this.setIcon(this.constructor.icon); } this.container.addEventListener('click', function() { @@ -3720,15 +3776,33 @@ PSVNavBarButton.prototype.create = function() { }.bind(this)); }; +/** + * Set the button icon (from PSV icons list) + * @param {string} icon + * @param {HTMLElement} [container] - default is the main button container + */ +PSVNavBarButton.prototype.setIcon = function(icon, container) { + if (!container) { + container = this.container; + } + if (icon) { + container.innerHTML = PhotoSphereViewer.ICONS[icon]; + container.querySelector('svg').classList.add('psv-button-svg'); + } + else { + container.innerHTML = ''; + } +}; + /** * Changes the active state of the button * @param {boolean} [active] - forced state */ PSVNavBarButton.prototype.toggleActive = function(active) { - active = PSVUtils.toggleClass(this.container, 'active', active); + active = PSVUtils.toggleClass(this.container, 'psv-button--active', active); if (this.constructor.iconActive) { - this.container.innerHTML = PhotoSphereViewer.ICONS[active ? this.constructor.iconActive : this.constructor.icon]; + this.setIcon(active ? this.constructor.iconActive : this.constructor.icon); } }; @@ -3736,7 +3810,7 @@ PSVNavBarButton.prototype.toggleActive = function(active) { * Disables the button */ PSVNavBarButton.prototype.disable = function() { - this.container.classList.add('disabled'); + this.container.classList.add('psv-button--disabled'); this.enabled = false; }; @@ -3745,7 +3819,7 @@ PSVNavBarButton.prototype.disable = function() { * Enables the button */ PSVNavBarButton.prototype.enable = function() { - this.container.classList.remove('disabled'); + this.container.classList.remove('psv-button--disabled'); this.enabled = true; }; @@ -3775,7 +3849,7 @@ PSVNavBarAutorotateButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarAutorotateButton.prototype.constructor = PSVNavBarAutorotateButton; PSVNavBarAutorotateButton.id = 'autorotate'; -PSVNavBarAutorotateButton.className = 'psv-button hover-scale autorotate-button'; +PSVNavBarAutorotateButton.className = 'psv-button psv-button--hover-scale psv-autorotate-button'; PSVNavBarAutorotateButton.icon = 'play.svg'; PSVNavBarAutorotateButton.iconActive = 'play-active.svg'; @@ -3842,7 +3916,7 @@ function PSVNavBarCustomButton(navbar, config) { PSVNavBarCustomButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarCustomButton.prototype.constructor = PSVNavBarCustomButton; -PSVNavBarCustomButton.className = 'psv-button'; +PSVNavBarCustomButton.className = 'psv-button psv-custom-button'; /** * Creates the button @@ -3906,7 +3980,7 @@ PSVNavBarDownloadButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarDownloadButton.prototype.constructor = PSVNavBarDownloadButton; PSVNavBarDownloadButton.id = 'download'; -PSVNavBarDownloadButton.className = 'psv-button hover-scale download-button'; +PSVNavBarDownloadButton.className = 'psv-button psv-button--hover-scale psv-download-button'; PSVNavBarDownloadButton.icon = 'download.svg'; /** @@ -3946,7 +4020,7 @@ PSVNavBarFullscreenButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarFullscreenButton.prototype.constructor = PSVNavBarFullscreenButton; PSVNavBarFullscreenButton.id = 'fullscreen'; -PSVNavBarFullscreenButton.className = 'psv-button hover-scale fullscreen-button'; +PSVNavBarFullscreenButton.className = 'psv-button psv-button--hover-scale psv-fullscreen-button'; PSVNavBarFullscreenButton.icon = 'fullscreen-in.svg'; PSVNavBarFullscreenButton.iconActive = 'fullscreen-out.svg'; @@ -4007,7 +4081,7 @@ PSVNavBarGyroscopeButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarGyroscopeButton.prototype.constructor = PSVNavBarGyroscopeButton; PSVNavBarGyroscopeButton.id = 'gyroscope'; -PSVNavBarGyroscopeButton.className = 'psv-button hover-scale gyroscope-button'; +PSVNavBarGyroscopeButton.className = 'psv-button psv-button--hover-scale psv-gyroscope-button'; PSVNavBarGyroscopeButton.icon = 'compass.svg'; /** @@ -4066,7 +4140,7 @@ PSVNavBarGyroscopeButton.prototype._onClick = function() { */ PSVNavBarGyroscopeButton.prototype._onAvailabilityChange = function(available) { if (available) { - if (this.psv.doControls) { + if (PSVUtils.checkTHREE('DeviceOrientationControls')) { this.show(); } else { @@ -4096,7 +4170,7 @@ PSVNavBarMarkersButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarMarkersButton.prototype.constructor = PSVNavBarMarkersButton; PSVNavBarMarkersButton.id = 'markers'; -PSVNavBarMarkersButton.className = 'psv-button hover-scale markers-button'; +PSVNavBarMarkersButton.className = 'psv-button psv-button--hover-scale psv-markers-button'; PSVNavBarMarkersButton.icon = 'pin.svg'; PSVNavBarMarkersButton.publicMethods = ['toggleMarkersList', 'showMarkersList', 'hideMarkersList']; @@ -4252,7 +4326,7 @@ PSVNavBarZoomButton.prototype = Object.create(PSVNavBarButton.prototype); PSVNavBarZoomButton.prototype.constructor = PSVNavBarZoomButton; PSVNavBarZoomButton.id = 'zoom'; -PSVNavBarZoomButton.className = 'psv-button zoom-button'; +PSVNavBarZoomButton.className = 'psv-button psv-zoom-button'; /** * Creates the button @@ -4261,29 +4335,29 @@ PSVNavBarZoomButton.prototype.create = function() { PSVNavBarButton.prototype.create.call(this); var zoom_minus = document.createElement('div'); - zoom_minus.className = 'minus'; + zoom_minus.className = 'psv-zoom-button-minus'; zoom_minus.title = this.psv.config.lang.zoomOut; - zoom_minus.innerHTML = PhotoSphereViewer.ICONS['zoom-out.svg']; + this.setIcon('zoom-out.svg', zoom_minus); this.container.appendChild(zoom_minus); var zoom_range_bg = document.createElement('div'); - zoom_range_bg.className = 'range'; + zoom_range_bg.className = 'psv-zoom-button-range'; this.container.appendChild(zoom_range_bg); this.zoom_range = document.createElement('div'); - this.zoom_range.className = 'line'; + this.zoom_range.className = 'psv-zoom-button-line'; this.zoom_range.title = this.psv.config.lang.zoom; zoom_range_bg.appendChild(this.zoom_range); this.zoom_value = document.createElement('div'); - this.zoom_value.className = 'handle'; + this.zoom_value.className = 'psv-zoom-button-handle'; this.zoom_value.title = this.psv.config.lang.zoom; this.zoom_range.appendChild(this.zoom_value); var zoom_plus = document.createElement('div'); - zoom_plus.className = 'plus'; + zoom_plus.className = 'psv-zoom-button-plus'; zoom_plus.title = this.psv.config.lang.zoomIn; - zoom_plus.innerHTML = PhotoSphereViewer.ICONS['zoom-in.svg']; + this.setIcon('zoom-in.svg', zoom_plus); this.container.appendChild(zoom_plus); this.zoom_range.addEventListener('mousedown', this); diff --git a/dist/photo-sphere-viewer.min.css b/dist/photo-sphere-viewer.min.css index b1a9e6ca7..5751fc3d7 100644 --- a/dist/photo-sphere-viewer.min.css +++ b/dist/photo-sphere-viewer.min.css @@ -1,8 +1,8 @@ /*! - * Photo Sphere Viewer 3.2.0 + * Photo Sphere Viewer 3.2.1 * Copyright (c) 2014-2015 Jérémy Heleine * Copyright (c) 2015-2016 Damien "Mistic" Sorel * Licensed under MIT (http://opensource.org/licenses/MIT) */ -.psv-hud,.psv-panel .content.no-interaction{-khtml-user-select:none;-moz-user-select:none;-webkit-touch-callout:none;-webkit-user-select:none}.psv-tooltip.bottom-center .arrow,.psv-tooltip.bottom-left .arrow,.psv-tooltip.bottom-right .arrow{border-bottom-color:rgba(61,61,61,.8)}.psv-tooltip.top-center .arrow,.psv-tooltip.top-left .arrow,.psv-tooltip.top-right .arrow{border-top-color:rgba(61,61,61,.8)}.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-container .canvas-container{position:absolute;top:0;left:0;z-index:0}.psv-container .canvas-container canvas{display:block}.psv-container .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-container .loader-container .psv-loader{position:relative;text-align:center;color:rgba(61,61,61,.7);width:150px;height:150px;border:10px solid transparent}.psv-container .loader-container .psv-loader::before{content:'';display:inline-block;height:100%;vertical-align:middle}.psv-container .loader-container .psv-loader,.psv-container .loader-container .psv-loader .loader-image,.psv-container .loader-container .psv-loader .loader-text{display:inline-block;vertical-align:middle}.psv-container .loader-container .psv-loader .loader-canvas{position:absolute;top:0;left:0}.psv-container .loader-container .psv-loader .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-navbar .psv-caption{-webkit-box-flex:10;-webkit-flex-grow:10;-moz-flex-grow:10;-ms-flex-positive:10;flex-grow:10;color:rgba(255,255,255,.7);margin:10px;white-space:nowrap;overflow:hidden;text-align:center;font-family:sans-serif}@media (max-width:800px){.psv-navbar .psv-caption{visibility:hidden}}.psv-navbar .psv-spacer.weight-1{-webkit-box-flex:1;-webkit-flex-grow:1;-moz-flex-grow:1;-ms-flex-positive:1;flex-grow:1}.psv-navbar .psv-spacer.weight-2{-webkit-box-flex:2;-webkit-flex-grow:2;-moz-flex-grow:2;-ms-flex-positive:2;flex-grow:2}.psv-navbar .psv-spacer.weight-3{-webkit-box-flex:3;-webkit-flex-grow:3;-moz-flex-grow:3;-ms-flex-positive:3;flex-grow:3}.psv-navbar .psv-spacer.weight-4{-webkit-box-flex:4;-webkit-flex-grow:4;-moz-flex-grow:4;-ms-flex-positive:4;flex-grow:4}.psv-navbar .psv-spacer.weight-5{-webkit-box-flex:5;-webkit-flex-grow:5;-moz-flex-grow:5;-ms-flex-positive:5;flex-grow:5}.psv-navbar .psv-spacer.weight-6{-webkit-box-flex:6;-webkit-flex-grow:6;-moz-flex-grow:6;-ms-flex-positive:6;flex-grow:6}.psv-navbar .psv-spacer.weight-7{-webkit-box-flex:7;-webkit-flex-grow:7;-moz-flex-grow:7;-ms-flex-positive:7;flex-grow:7}.psv-navbar .psv-spacer.weight-8{-webkit-box-flex:8;-webkit-flex-grow:8;-moz-flex-grow:8;-ms-flex-positive:8;flex-grow:8}.psv-navbar .psv-spacer.weight-9{-webkit-box-flex:9;-webkit-flex-grow:9;-moz-flex-grow:9;-ms-flex-positive:9;flex-grow:9}.psv-navbar .psv-spacer.weight-10{-webkit-box-flex:10;-webkit-flex-grow:10;-moz-flex-grow:10;-ms-flex-positive:10;flex-grow:10}.psv-navbar .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;color:rgba(255,255,255,.7)}.psv-navbar .psv-button.active{background:rgba(255,255,255,.1)}.psv-navbar .psv-button.disabled{pointer-events:none;opacity:.5}.psv-navbar .psv-button svg{width:100%;transform:scale(1);transition:transform .3s ease}.psv-navbar .psv-button svg *{fill:rgba(255,255,255,.7)}.psv-navbar .psv-button.hover-scale:not(.disabled):hover svg{transform:scale(1.2)}.psv-navbar .autorotate-button{width:25px;height:25px;padding:7.5px}.psv-navbar .zoom-button{cursor:default;width:128px}.psv-navbar .zoom-button .minus,.psv-navbar .zoom-button .plus{float:left;position:relative;cursor:pointer;width:16px;height:16px}.psv-navbar .zoom-button .minus svg,.psv-navbar .zoom-button .plus svg{position:relative;top:20%}.psv-navbar .zoom-button .range{float:left;padding:9.5px 8px}.psv-navbar .zoom-button .range .line{position:relative;cursor:pointer;width:80px;height:1px;background:rgba(255,255,255,.7);transition:all .3s ease}.psv-navbar .zoom-button .range .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-navbar .zoom-button:not(.disabled):hover .range .line{box-shadow:0 0 2px rgba(255,255,255,.7)}.psv-navbar .zoom-button:not(.disabled):hover .range .handle{transform:scale(1.3)}@media (max-width:600px){.psv-navbar .zoom-button{width:auto;padding:0}.psv-navbar .zoom-button .range{display:none}.psv-navbar .zoom-button .minus,.psv-navbar .zoom-button .plus{width:20px;height:20px;padding:10px}.psv-navbar .zoom-button .minus svg,.psv-navbar .zoom-button .plus svg{top:0}}.psv-markers-list h1{font:24px sans-serif;margin:1em 0;text-align:center;text-shadow:2px 1px #000}.psv-markers-list ul{list-style:none;margin:0;padding:0;overflow:hidden}.psv-markers-list li{clear:both;min-height:20px;padding:.5em 1em;cursor:pointer;transform:translateX(0);transition:transform .3s ease-in-out}.psv-markers-list li::before{content:'';position:absolute;top:0;left:0;height:100%;width:10px;margin-left:-10px}.psv-markers-list li:nth-child(odd),.psv-markers-list li:nth-child(odd)::before{background:rgba(255,255,255,.1)}.psv-markers-list li:nth-child(even),.psv-markers-list li:nth-child(even)::before{background:0 0}.psv-markers-list li:hover{transform:translateX(10px);transition:transform .1s ease-in-out}.psv-markers-list .marker-image{float:left;width:20px}.psv-markers-list .marker-name{margin:0;padding:0;padding-left:calc(20px + .5em)}.psv-markers-list .marker-name.no-image{padding-left:0}.psv-hud{-ms-user-select:none;user-select:none;position:absolute;z-index:10;width:100%;height:100%}.psv-hud .psv-marker:not(.svg-marker){position:absolute;top:0;left:0;z-index:30;background-size:contain;background-repeat:no-repeat;cursor:pointer;display:none}.psv-hud .psv-marker:not(.svg-marker).transparent{display:block;opacity:0}.psv-hud .psv-marker:not(.svg-marker).visible{display:block}.psv-hud .psv-svg-container{position:absolute;top:0;left:0;width:100%;height:100%;z-index:20}.psv-hud .psv-svg-container .svg-marker{cursor:pointer;display:none}.psv-hud .psv-svg-container .svg-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{content:'';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(.no-margin){padding:1em}.psv-panel .content.no-interaction{-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 .close-button,.psv-panel.open .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.bottom-right,.psv-tooltip.center-left,.psv-tooltip.center-right,.psv-tooltip.top-center,.psv-tooltip.top-left,.psv-tooltip.top-right{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{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 .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 .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)}.psv-tooltip.top-left{box-shadow:-3px -3px 0 rgba(90,90,90,.7);transform:translate3d(0,5px,0)}.psv-tooltip.top-right{box-shadow:3px -3px 0 rgba(90,90,90,.7);transform:translate3d(0,5px,0)}.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,#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}.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-close-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 bc7aff00c..0e8408822 100644 --- a/dist/photo-sphere-viewer.min.js +++ b/dist/photo-sphere-viewer.min.js @@ -1,10 +1,10 @@ /*! - * Photo Sphere Viewer 3.2.0 + * Photo Sphere Viewer 3.2.1 * Copyright (c) 2014-2015 Jérémy Heleine * Copyright (c) 2015-2016 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(a){if(!(this instanceof e))return new e(a);if(e.SYSTEM.loaded||e.loadSystem(),this.config=x.clone(e.DEFAULTS),x.deepmerge(this.config,a),!a.container)throw new w("No value given for container.");if(!e.SYSTEM.isCanvasSupported)throw new w("Canvas is not supported.");if(!(e.SYSTEM.isWebGLSupported&&this.config.webgl||x.checkTHREE("CanvasRenderer","Projector")))throw new w("Missing Three.js components: CanvasRenderer, Projector. Get them from threejs-examples package.");if(this.config.transition&&this.config.transition.blur)if(e.SYSTEM.isWebGLSupported&&this.config.webgl){if(!x.checkTHREE("EffectComposer","RenderPass","ShaderPass","MaskPass","CopyShader"))throw new w("Missing Three.js components: EffectComposer, RenderPass, ShaderPass, MaskPass, CopyShader. Get them from threejs-examples package.")}else this.config.transition.blur=!1,console.warn("PhotoSphereViewer: Using canvas rendering, blur transition disabled.");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=b.substring(f,g);if(-1===f||-1===g||-1===h.indexOf("GPano:"))a.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?a.resolve(i):(console.warn("PhotoSphereViewer: invalid XMP data"),a.resolve(null))}}else 3===c.readyState&&d.loader&&d.loader.setProgress(e+10)},c.onprogress=function(a){if(a.lengthComputable&&d.loader){var b=parseInt(a.loaded/a.total*100);b>e&&(e=b,d.loader.setProgress(e))}},c.onerror=function(){throw d.container.textContent="Cannot load image",new w("Cannot load image")},c.open("GET",this.config.panorama,!0),c.send(null),a.promise},e.prototype._loadTexture=function(){var c=this;return this._loadXMP().then(function(d){var f=b(),g=new a.ImageLoader,h=d?100:0;g.setCrossOrigin("anonymous");var i=function(b){c.loader&&c.loader.setProgress(100),!d&&c.config.pano_data&&(d=x.clone(c.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}),c.prop.pano_data=d;var g=Math.min(d.full_width,e.SYSTEM.maxTextureWidth)/d.full_width,h=x.clone(d);h.full_width*=g,h.full_height*=g,h.cropped_width*=g,h.cropped_height*=g,h.cropped_x*=g,h.cropped_y*=g,b.width=h.cropped_width,b.height=h.cropped_height;var i=document.createElement("canvas");i.width=h.full_width,i.height=h.full_height;var j=i.getContext("2d");j.drawImage(b,h.cropped_x,h.cropped_y,h.cropped_width,h.cropped_height);var k=new a.Texture(i);k.needsUpdate=!0,k.minFilter=a.LinearFilter,k.generateMipmaps=!1,f.resolve(k)},j=function(a){if(a.lengthComputable&&c.loader){var b=parseInt(a.loaded/a.total*100);b>h&&(h=b,c.loader.setProgress(h))}},k=function(){throw c.container.textContent="Cannot load image",new w("Cannot load image")};return g.load(c.config.panorama,i,j,k),f.promise})},e.prototype._setTexture=function(a){return this.scene||this._createScene(),this.mesh.material.map&&this.mesh.material.map.dispose(),this.mesh.material.map=a,this.trigger("panorama-loaded"),this.render(),b.resolved()},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.camera=new a.PerspectiveCamera(this.config.default_fov,this.prop.size.width/this.prop.size.height,1,300),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);var b=new a.SphereGeometry(200,this.config.sphere_segments,this.config.sphere_segments,-x.HalfPI),c=new a.MeshBasicMaterial;c.side=a.DoubleSide,this.mesh=new a.Mesh(b,c),this.mesh.scale.x=-1,this.scene.add(this.mesh),this.canvas_container=document.createElement("div"),this.canvas_container.className="canvas-container",this.container.appendChild(this.canvas_container),this.canvas_container.appendChild(this.renderer.domElement),this.config.time_anim!==!1&&(this.prop.start_timeout=window.setTimeout(this.startAutorotate.bind(this),this.config.time_anim)),this.config.transition&&this.config.transition.blur&&(this.composer=new a.EffectComposer(this.renderer),this.passes.render=new a.RenderPass(this.scene,this.camera),this.passes.copy=new a.ShaderPass(a.CopyShader),this.passes.copy.renderToScreen=!0,this.passes.blur=new a.ShaderPass(a.GodraysShader),this.passes.blur.enabled=!1,this.passes.blur.renderToScreen=!0,this.passes.blur.uniforms.fDensity.value=0,this.passes.blur.uniforms.fWeight.value=.5,this.passes.blur.uniforms.fDecay.value=.5,this.passes.blur.uniforms.fExposure.value=1,this.composer.addPass(this.passes.render),this.composer.addPass(this.passes.copy),this.composer.addPass(this.passes.blur))},e.prototype._transition=function(b,c){var d=this,e=new a.SphereGeometry(150,32,32,-x.HalfPI),f=new a.MeshBasicMaterial;f.side=a.DoubleSide,f.map=b,f.transparent=!0,f.opacity=0;var g=new a.Mesh(e,f);if(g.scale.x=-1,c){g.rotateY(c.longitude-this.prop.longitude);var h=new a.Vector3(0,1,0).cross(this.camera.getWorldDirection()).normalize(),i=(new a.Quaternion).setFromAxisAngle(h,c.latitude-this.prop.latitude);g.quaternion.multiplyQuaternions(i,g.quaternion)}this.scene.add(g),this.render();var j=this.prop.zoom_lvl;this.config.transition.blur&&(this.passes.copy.enabled=!1,this.passes.blur.enabled=!0);var k=function(a){f.opacity=a.opacity,d.config.transition.blur&&(d.passes.blur.uniforms.fDensity.value=a.density,d.zoom(a.zoom,!1)),d.render()};return x.animation({properties:{density:{start:0,end:1.5},opacity:{start:0,end:.5},zoom:{start:j,end:100}},duration:d.config.transition.duration/(d.config.transition.blur?4/3:2),easing:d.config.transition.blur?"outCubic":"linear",onTick:k}).then(function(){return x.animation({properties:{density:{start:1.5,end:0},opacity:{start:.5,end:1},zoom:{start:100,end:j}},duration:d.config.transition.duration/(d.config.transition.blur?4:2),easing:d.config.transition.blur?"inCubic":"linear",onTick:k})}).then(function(){d.config.transition.blur&&(d.passes.copy.enabled=!0,d.passes.blur.enabled=!1,d.zoom(j,!1)),d.mesh.material.map.dispose(),d.mesh.material.map=b,d.scene.remove(g),g.geometry.dispose(),g.geometry=null,g.material.dispose(),g.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.MOVE_THRESHOLD=4,e.INERTIA_WINDOW=300,e.KEYMAP={33:"PageUp",34:"PageDown",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",107:"+",109:"-"},e.ICONS={},e.SYSTEM={loaded:!1,pixelRatio:1,isWebGLSupported:!1,isCanvasSupported:!1,deviceOrientationSupported:null,maxTextureWidth:0,mouseWheelEvent:null,fullscreenEvent:null},e.DEFAULTS={panorama:null,container:null,caption:null,autoload:!0,usexmpdata:!0,pano_data:null,webgl:!0,sphere_segments:64,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,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,blur:!1},loading_img:null,loading_txt:"Loading...",size:null,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),document.addEventListener(e.SYSTEM.fullscreenEvent,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)),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._onTouchStart=function(a){1===a.touches.length?this._startMove(a.touches[0]):2===a.touches.length&&this._startZoom(a)},e.prototype._startMove=function(a){this.prop.orientation_reqid||this.prop.autorotate_reqid||(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._onMouseUp=function(a){this._stopMove(a)},e.prototype._onTouchEnd=function(a){this._stopMove(a.changedTouches[0])},e.prototype._stopMove=function(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 w("No value given for panorama.");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.longitude,this.prop.latitude),this.camera.lookAt(this.prop.direction)),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),document.removeEventListener(e.SYSTEM.fullscreenEvent,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)),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&&(this.scene.remove(this.camera),this.scene.remove(this.mesh)),this.mesh&&(this.mesh.geometry.dispose(),this.mesh.geometry=null,this.mesh.material.map.dispose(),this.mesh.material.map=null,this.mesh.material.dispose(),this.mesh.material=null),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},e.prototype.setPanorama=function(a,b,c){"boolean"==typeof b&&(c=b,b=void 0),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=new h(this)),this._loadTexture().then(function(a){return d.loader&&(d.loader.destroy(),d.loader=null),d._transition(a,b)}).rethrow()):(this.loader=new h(this),this._loadTexture().then(this._setTexture.bind(this)).then(function(){d.loader&&(d.loader.destroy(),d.loader=null),b?d.rotate(b):d.render()}).rethrow())},e.prototype.stopAll=function(){this.stopAutorotate(),this.stopAnimation(),this.stopGyroscopeControl()},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.config.gyroscope)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),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,b){if(this.stopAll(),!b)return void this.rotate(a);if(this.cleanPosition(a),this.applyRanges(a),!b&&"number"!=typeof b){b=b?x.parseSpeed(b):this.config.anim_speed;var c=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));b=c/b*1e3}var d=this.getShortestArc(this.prop.longitude,a.longitude);this.prop.animation_promise=x.animation({properties:{longitude:{start:this.prop.longitude,end:this.prop.longitude+d},latitude:{start:this.prop.latitude,end:a.latitude}},duration:b,easing:"inOutSine",onTick:this.rotate.bind(this)})},e.prototype.stopAnimation=function(){this.prop.animation_promise&&(this.prop.animation_promise.cancel(),this.prop.animation_promise=null)},e.prototype.zoom=function(a,b){this.prop.zoom_lvl=x.stayBetween(Math.round(a),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=2*Math.atan(Math.tan(this.prop.vFov*Math.PI/180/2)*this.prop.aspect)*180/Math.PI,b!==!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.loadSystem=function(){var a=e.SYSTEM;a.loaded=!0,a.pixelRatio=window.devicePixelRatio||1,a.isWebGLSupported=x.isWebGLSupported(),a.isCanvasSupported=x.isCanvasSupported(),a.maxTextureWidth=a.isWebGLSupported?x.getMaxTextureWidth():4096,a.mouseWheelEvent=x.mouseWheelEvent(),a.fullscreenEvent=x.fullscreenEvent(),a.deviceOrientationSupported=b(),window.addEventListener("deviceorientation",e.deviceOrientationListener,!1)},e.deviceOrientationListener=function(a){null!==a.alpha?e.SYSTEM.deviceOrientationSupported.resolve():e.SYSTEM.deviceOrientationSupported.reject(),window.removeEventListener("deviceorientation",e.deviceOrientationListener)},e.prototype._setViewerSize=function(a){["width","height"].forEach(function(b){a[b]&&(/^[0-9.]+$/.test(a[b])&&(a[b]+="px"),this.parent.style[b]=a[b])},this)},e.prototype.textureCoordsToSphericalCoords=function(a,b){var c=(a+this.prop.pano_data.cropped_x)/this.prop.pano_data.full_width*x.TwoPI,d=(b+this.prop.pano_data.cropped_y)/this.prop.pano_data.full_height*Math.PI;return{longitude:c>=Math.PI?c-Math.PI:c+Math.PI,latitude:x.HalfPI-d}},e.prototype.sphericalCoordsToTextureCoords=function(a,b){var c=a/x.TwoPI*this.prop.pano_data.full_width,d=b/Math.PI*this.prop.pano_data.full_height;return{x:parseInt(ac?-c:x.TwoPI-c,latitude:x.HalfPI-b}},e.prototype.viewerCoordsToVector3=function(b,c){var d=new a.Vector2(2*b/this.prop.size.width-1,-2*c/this.prop.size.height+1); -this.raycaster.setFromCamera(d,this.camera);var e=this.raycaster.intersectObjects(this.scene.children);return 1===e.length?e[0].point:null},e.prototype.vector3ToViewerCoords=function(a){return a=a.clone(),a.project(this.camera),{top:parseInt((1-a.y)/2*this.prop.size.height),left:parseInt((a.x+1)/2*this.prop.size.width)}},e.prototype.cleanPosition=function(a){if(a.hasOwnProperty("x")&&a.hasOwnProperty("y")){var b=this.textureCoordsToSphericalCoords(a.x,a.y);a.longitude=b.longitude,a.latitude=b.latitude}a.longitude=x.parseAngle(a.longitude),a.latitude=x.stayBetween(x.parseAngle(a.latitude,-Math.PI),-x.HalfPI,x.HalfPI)},e.prototype.applyRanges=function(a){var b,c;this.config.longitude_range&&(b=x.clone(this.config.longitude_range),c=this.prop.hFov/180*Math.PI/2,b[0]=x.parseAngle(b[0]+c),b[1]=x.parseAngle(b[1]-c),b[0]>b[1]?a.longitude>b[1]&&a.longitudeb[0]/2+b[1]/2?(a.longitude=b[0],this.trigger("_side-reached","left")):(a.longitude=b[1],this.trigger("_side-reached","right"))):a.longitudeb[1]&&(a.longitude=b[1],this.trigger("_side-reached","right"))),this.config.latitude_range&&(b=x.clone(this.config.latitude_range),c=this.prop.vFov/180*Math.PI/2,b[0]=x.parseAngle(b[0]+c,-Math.PI),b[1]=x.parseAngle(b[1]-c,-Math.PI),a.latitudeb[1]&&(a.latitude=b[1],this.trigger("_side-reached","top")))},e.prototype.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)0&&b.left+a.width>=0&&b.left-a.width<=this.psv.prop.size.width&&b.top+a.height>=0&&b.top-a.height<=this.psv.prop.size.height},g.prototype._isPolygonVisible=function(a,b){return a.visible&&b.some(function(b,c){return a.positions3D[c].dot(this.psv.prop.direction)>0&&b.left>=0&&b.left<=this.psv.prop.size.width&&b.top>=0&&b.top<=this.psv.prop.size.height},this)},g.prototype._getMarkerPosition=function(a){if(a.dynamicSize){a.$el.classList.add("transparent");var b=a.$el.getBoundingClientRect();a.$el.classList.remove("transparent"),a.width=b.right-b.left,a.height=b.bottom-b.top}var c=this.psv.vector3ToViewerCoords(a.position3D);return c.top-=a.height*a.anchor.top,c.left-=a.width*a.anchor.left,c},g.prototype._getPolygonPositions=function(a){return a.positions3D.map(function(a){return this.psv.vector3ToViewerCoords(a)},this)},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.left),d=Math.min(d,a.top),e=Math.max(e,a.left),f=Math.max(f,a.top)}),a.width=e-c,a.height=f-d,{top:d,left:c}},g.prototype._onMouseEnter=function(a){var b;a.target&&(b=a.target.psvMarker)&&b.tooltip&&!b.isPolygon()&&(this.hoveringMarker=b,this.psv.tooltip.showTooltip({content:b.tooltip.content,position:b.tooltip.position,top:b.position2D.top,left:b.position2D.left,marker:b}))},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.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.tooltip&&b.isPolygon()||a.target&&x.hasParent(a.target,this.psv.tooltip.container)&&(b=this.hoveringMarker)){this.hoveringMarker=b;var c=this.psv.container.getBoundingClientRect();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,marker:{width:2*this.psv.config.tooltip.arrow_size,height:2*this.psv.config.tooltip.arrow_size}})}else this.hoveringMarker&&this.hoveringMarker.isPolygon()&&this.psv.tooltip.hideTooltip()}},g.prototype._onClick=function(a,b){var c;a.target&&(c=x.getClosest(a.target,".psv-marker"))&&c.psvMarker?(this.currentMarker=c.psvMarker,this.psv.trigger("select-marker",c.psvMarker),this.psv.config.click_event_on_marker?a.marker=c.psvMarker:b.stopPropagation()):this.currentMarker&&(this.psv.trigger("unselect-marker",this.currentMarker),this.currentMarker=null),c&&c.psvMarker&&c.psvMarker.content?this.psv.panel.showPanel(c.psvMarker.content):this.psv.panel.prop.opened&&(b.stopPropagation(),this.psv.panel.hidePanel())},h.prototype=Object.create(f.prototype),h.prototype.constructor=h,h.className="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="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="loader-image",a.src=this.psv.config.loading_img):this.psv.config.loading_txt&&(a=document.createElement("div"),a.className="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.getType=function(a,b){var c=["image","html","polygon_px","polygon_rad","rect","circle","ellipse","path"],d=[];if(c.forEach(function(b){a[b]&&d.push(b)}),0===d.length&&!b)throw new w("missing marker content, either "+c.join(", "));if(d.length>1)throw new w("multiple marker content, either "+c.join(", "));return d[0]},i.prototype.isNormal=function(){return"image"==this.type||"html"==this.type},i.prototype.isPolygon=function(){return"polygon_px"==this.type||"polygon_rad"==this.type},i.prototype.isSvg=function(){return"rect"==this.type||"circle"==this.type||"ellipse"==this.type||"path"==this.type},i.prototype.update=function(a){if(a&&a!==this){var b=i.getType(a,!0);if(void 0!==b&&b!==this.type)throw new w("cannot change marker type");x.deepmerge(this,a)}this.isNormal()?this.$el.setAttribute("class","psv-marker"):this.$el.setAttribute("class","psv-marker svg-marker"),this.className&&x.addClasses(this.$el,this.className),this.tooltip&&(this.$el.classList.add("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.$el.style.transformOrigin=100*this.anchor.left+"% "+100*this.anchor.top+"%",this.isNormal()?this._updateNormal():this.isPolygon()?this._updatePolygon():this._updateSvg()},i.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.longitude,this.latitude)},i.prototype._updateSvg=function(){switch(this.dynamicSize=!0,this.type){case"rect":"number"==typeof this.data?this.data={x:0,y:0,width:this.data,height:this.data}:Array.isArray(this.data)?this.data={x:0,y:0,width:this.data[0],height:this.data[1]}:this.data.x=this.data.y=0;break;case"circle":"number"==typeof this.data?this.data={cx:this.data,cy:this.data,r:this.data}:Array.isArray(this.data)?this.data={cx:this.data[0],cy:this.data[0],r:this.data[0]}:this.data.cx=this.data.cy=this.data.r;break;case"ellipse":"number"==typeof this.data?this.data={cx:this.data,cy:this.data,rx:this.data,ry:this.data}:Array.isArray(this.data)?this.data={cx:this.data[0],cy:this.data[1],rx:this.data[0],ry:this.data[1]}:(this.data.cx=this.data.rx,this.data.cy=this.data.ry);break;case"path":"string"==typeof this.data&&(this.data={d:this.data})}Object.getOwnPropertyNames(this.data).forEach(function(a){this.$el.setAttributeNS(null,a,this.data[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.longitude,this.latitude)},i.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;b
    ',this.content=this.container.querySelector(".content");var a=this.container.querySelector(".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(".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)},m.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)},m.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)}},m.prototype.showPanel=function(a,b){this.content.innerHTML=a,this.content.scrollTop=0,this.container.classList.add("open"),b?this.content.classList.contains("no-margin")||this.content.classList.add("no-margin"):this.content.classList.remove("no-margin"),this.prop.opened=!0,this.psv.trigger("open-panel")},m.prototype.hidePanel=function(){this.content.innerHTML=null,this.prop.opened=!1,this.container.classList.remove("open"),this.psv.trigger("close-panel")},m.prototype._onMouseDown=function(a){a.stopPropagation(),this._startResize(a)},m.prototype._onTouchStart=function(a){a.stopPropagation(),this._startResize(a.changedTouches[0])},m.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("no-interaction")},m.prototype._onMouseUp=function(a){this.prop.mousedown&&(a.stopPropagation(),this.prop.mousedown=!1,this.content.classList.remove("no-interaction"))},m.prototype._onMouseMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a))},m.prototype._onTouchMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a.touches[0]))},m.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},n.prototype=Object.create(f.prototype),n.prototype.constructor=n,n.className="psv-tooltip",n.publicMethods=["showTooltip","hideTooltip","isTooltipVisible"],n.leftMap={0:"left",.5:"center",1:"right"},n.topMap={0:"top",.5:"center",1:"bottom"},n.prototype.create=function(){f.prototype.create.call(this),this.container.innerHTML='
    ',this.container.style.top="-1000px",this.container.style.left="-1000px",this.psv.on("render",this)},n.prototype.destroy=function(){this.psv.off("render",this),delete this.config,f.prototype.destroy.call(this)},n.prototype.handleEvent=function(a){switch(a.type){case"render":this.hideTooltip()}},n.prototype.isTooltipVisible=function(){return this.container.classList.contains("visible")},n.prototype.showTooltip=function(a){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null);var b=this.isTooltipVisible(),c=this.container,d=c.querySelector(".content"),e=c.querySelector(".arrow");if(a.position||(a.position=["top","center"]),a.marker||(a.marker={width:0,height:0}),"string"==typeof a.position){var f=x.parsePosition(a.position);if(!(f.left in n.leftMap&&f.top in n.topMap))throw new w('unable to parse tooltip position "'+tooltip.position+'"');a.position=[n.topMap[f.top],n.leftMap[f.left]]}if("center"==a.position[0]&&"center"==a.position[1])throw new w('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&&"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(j.posClass.join("-")),!b){var l=this;this.timeout=window.setTimeout(function(){c.classList.add("visible"),l.psv.trigger("show-tooltip"),l.timeout=null},this.config.delay)}},n.prototype.hideTooltip=function(){if(this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null),this.isTooltipVisible()){this.container.classList.remove("visible"),this.psv.trigger("hide-tooltip");var a=this;this.timeout=window.setTimeout(function(){a.container.querySelector(".content").innerHTML=null,a.container.style.top="-1000px",a.container.style.left="-1000px",a.timeout=null},this.config.delay)}},n.prototype._computeTooltipPosition=function(a,b){var c=!1;switch(a.posClass[0]){case"bottom":a.top=b.top+b.marker.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.marker.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.marker.width/2-this.config.offset-this.config.arrow_size,a.arrow_left=this.config.offset):(a.left=b.left+b.marker.width+this.config.offset+this.config.arrow_size,a.arrow_left=2*-this.config.arrow_size);break;case"center":a.left=b.left+b.marker.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.marker.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)}},o.prototype=Object.create(f.prototype),o.prototype.constructor=o,o.prototype.create=function(){f.prototype.create.call(this),this.constructor.icon&&(this.container.innerHTML=e.ICONS[this.constructor.icon]),this.container.addEventListener("click",function(){this.enabled&&this._onClick()}.bind(this))},o.prototype.toggleActive=function(a){a=x.toggleClass(this.container,"active",a),this.constructor.iconActive&&(this.container.innerHTML=e.ICONS[a?this.constructor.iconActive:this.constructor.icon])},o.prototype.disable=function(){this.container.classList.add("disabled"),this.enabled=!1},o.prototype.enable=function(){this.container.classList.remove("disabled"),this.enabled=!0},o.prototype._onClick=function(){},p.prototype=Object.create(o.prototype),p.prototype.constructor=p,p.id="autorotate",p.className="psv-button hover-scale autorotate-button",p.icon="play.svg",p.iconActive="play-active.svg",p.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.autorotate,this.psv.on("autorotate",this)},p.prototype.destroy=function(){this.psv.off("autorotate",this),o.prototype.destroy.call(this)},p.prototype.handleEvent=function(a){switch(a.type){case"autorotate":this.toggleActive(a.args[0])}},p.prototype._onClick=function(){this.psv.toggleAutorotate()},q.prototype=Object.create(o.prototype),q.prototype.constructor=q,q.className="psv-button",q.prototype.create=function(){o.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()},q.prototype.destroy=function(){delete this.config,o.prototype.destroy.call(this)},q.prototype._onClick=function(){this.config.onClick&&this.config.onClick.apply(this.psv)},r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.id="download",r.className="psv-button hover-scale download-button",r.icon="download.svg",r.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.download},r.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()},s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.id="fullscreen",s.className="psv-button hover-scale fullscreen-button",s.icon="fullscreen-in.svg",s.iconActive="fullscreen-out.svg",s.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.fullscreen,this.psv.on("fullscreen-updated",this)},s.prototype.destroy=function(){this.psv.off("fullscreen-updated",this),o.prototype.destroy.call(this)},s.prototype.handleEvent=function(a){switch(a.type){case"fullscreen-updated":this.toggleActive(a.args[0])}},s.prototype._onClick=function(){this.psv.toggleFullscreen()},t.prototype=Object.create(o.prototype),t.prototype.constructor=t,t.id="gyroscope",t.className="psv-button hover-scale gyroscope-button",t.icon="compass.svg",t.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.gyroscope,e.SYSTEM.deviceOrientationSupported.promise.then(this._onAvailabilityChange.bind(this,!0),this._onAvailabilityChange.bind(this,!1)),this.hide(),this.psv.on("gyroscope-updated",this)},t.prototype.destroy=function(){this.psv.off("gyroscope-updated",this),o.prototype.destroy.call(this)},t.prototype.handleEvent=function(a){switch(a.type){case"gyroscope-updated":this.toggleActive(a.args[0])}},t.prototype._onClick=function(){this.psv.toggleGyroscopeControl()},t.prototype._onAvailabilityChange=function(a){if(a){if(!this.psv.doControls)throw new w("Missing Three.js components: DeviceOrientationControls. Get them from threejs-examples package.");this.show()}},u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.id="markers",u.className="psv-button hover-scale markers-button",u.icon="pin.svg",u.publicMethods=["toggleMarkersList","showMarkersList","hideMarkersList"],u.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.markers,this.psv.on("open-panel",this),this.psv.on("close-panel",this)},u.prototype.destroy=function(){this.psv.off("open-panel",this),this.psv.off("close-panel",this),delete this.prop,o.prototype.destroy.call(this)},u.prototype.handleEvent=function(a){switch(a.type){case"open-panel":this._onPanelOpened();break;case"close-panel":this._onPanelClosed()}},u.prototype._onClick=function(){this.toggleMarkersList()},u.prototype.toggleMarkersList=function(){this.prop.panelOpened?this.hideMarkersList():this.showMarkersList()},u.prototype.showMarkersList=function(){var a=[];for(var b in this.psv.hud.markers)a.push(this.psv.hud.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))},u.prototype.hideMarkersList=function(){this.prop.panelOpened&&this.psv.panel.hidePanel()},u.prototype._onClickItem=function(a){var b;a.target&&(b=x.getClosest(a.target,"li"))&&b.dataset.psvMarker&&(this.psv.hud.gotoMarker(b.dataset.psvMarker,1e3),this.psv.panel.hidePanel())},u.prototype._onPanelOpened=function(){this.prop.panelOpening?(this.prop.panelOpening=!1,this.prop.panelOpened=!0):this.prop.panelOpened=!1,this.toggleActive(this.prop.panelOpened)},u.prototype._onPanelClosed=function(){this.prop.panelOpened=!1,this.prop.panelOpening=!1,this.toggleActive(this.prop.panelOpened)},v.prototype=Object.create(o.prototype),v.prototype.constructor=v,v.id="zoom",v.className="psv-button zoom-button",v.prototype.create=function(){o.prototype.create.call(this);var a=document.createElement("div");a.className="minus",a.title=this.psv.config.lang.zoomOut,a.innerHTML=e.ICONS["zoom-out.svg"],this.container.appendChild(a);var b=document.createElement("div");b.className="range",this.container.appendChild(b),this.zoom_range=document.createElement("div"),this.zoom_range.className="line",this.zoom_range.title=this.psv.config.lang.zoom,b.appendChild(this.zoom_range),this.zoom_value=document.createElement("div"),this.zoom_value.className="handle",this.zoom_value.title=this.psv.config.lang.zoom,this.zoom_range.appendChild(this.zoom_value);var c=document.createElement("div");c.className="plus",c.title=this.psv.config.lang.zoomIn,c.innerHTML=e.ICONS["zoom-in.svg"],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))},v.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),o.prototype.destroy.call(this)},v.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])}},v.prototype._moveZoomValue=function(a){this.zoom_value.style.left=a/100*this.zoom_range.offsetWidth-this.zoom_value.offsetWidth/2+"px"},v.prototype._initZoomChangeWithMouse=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.clientX))},v.prototype._initZoomChangeByTouch=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.changedTouches[0].clientX))},v.prototype._zoomIn=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomIn(),window.setTimeout(this._startLongPressInterval.bind(this,1),200))},v.prototype._zoomOut=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomOut(),window.setTimeout(this._startLongPressInterval.bind(this,-1),200))},v.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))},v.prototype._stopZoomChange=function(){this.enabled&&(window.clearInterval(this.prop.longPressInterval),this.prop.longPressInterval=null,this.prop.mousedown=!1,this.prop.buttondown=!1)},v.prototype._changeZoomWithMouse=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.clientX))},v.prototype._changeZoomByTouch=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.changedTouches[0].clientX))},v.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)}},w.prototype=Object.create(Error.prototype),w.prototype.name="PSVError",w.prototype.constructor=w;var x={};return x.TwoPI=2*Math.PI,x.HalfPI=Math.PI/2,x.checkTHREE=function(b){ -for(var c=0,d=arguments.length;d>c;c++)if(!(arguments[c]in a))return!1;return!0},x.isCanvasSupported=function(){var a=document.createElement("canvas");return!(!a.getContext||!a.getContext("2d"))},x.getWebGLCtx=function(){var a=document.createElement("canvas"),b=["webgl","experimental-webgl","moz-webgl","webkit-3d"],c=null;return a.getContext&&b.some(function(b){try{return c=a.getContext(b),c&&"function"==typeof c.getParameter}catch(d){return!1}})?c:null},x.isWebGLSupported=function(){return!!window.WebGLRenderingContext&&null!==x.getWebGLCtx()},x.getMaxTextureWidth=function(){var a=x.getWebGLCtx();return null!==a?a.getParameter(a.MAX_TEXTURE_SIZE):void 0},x.toggleClass=function(a,b,c){return void 0===c?a.classList.toggle(b):c&&!a.classList.contains(b)?(a.classList.add(b),!0):c?void 0:(a.classList.remove(b),!1)},x.addClasses=function(a,b){b&&b.split(" ").forEach(function(b){a.classList.add(b)})},x.removeClasses=function(a,b){b&&b.split(" ").forEach(function(b){a.classList.remove(b)})},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];return"fullscreenchange"},x.stayBetween=function(a,b,c){return Math.max(b,Math.min(c,a))},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.parsePosition=function(a){if(!a)return{top:.5,left:.5};if("object"==typeof a)return a;var b=a.toLocaleLowerCase().split(" ").slice(0,2);1===b.length&&(b=void 0!==x.parsePosition.positions[b[0]]?[b[0],"center"]:[b[0],b[0]]);var c="left"!=b[1]&&"right"!=b[1]&&"top"!=b[0]&&"bottom"!=b[0];b=b.map(function(a){return x.parsePosition.positions[a]||a}),c||b.reverse();var d=b.join(" ").match(/^([0-9.]+)% ([0-9.]+)%$/);return d?{left:d[1]/100,top:d[2]/100}:{top:.5,left:.5}},x.parsePosition.positions={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},x.parseSpeed=function(a){if("string"==typeof a){a=a.toString().trim();var b=parseFloat(a.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),c=a.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();switch(c.match(/(pm|per minute)$/)&&(b/=60),c){case"dpm":case"degrees per minute":case"dps":case"degrees per second":a=b*Math.PI/180;break;case"radians per minute":case"radians per second":a=b;break;case"rpm":case"revolutions per minute":case"rps":case"revolutions per second":a=b*x.TwoPI;break;default:throw new w('unknown speed unit "'+c+'"')}}return a},x.parseAngle=function(a,b){if("string"==typeof a){var c=a.toLowerCase().trim().match(/^(-?[0-9]+(?:\.[0-9]*)?)(.*)$/);if(!c)throw new w('unknown angle "'+a+'"');var d=parseFloat(c[1]),e=c[2];if(e)switch(e){case"deg":case"degs":a=d/180*Math.PI;break;case"rad":case"rads":a=d;break;default:throw new w('unknown angle unit "'+e+'"')}}return b!==!1&&(void 0===b&&(b=0),a=(a-b)%x.TwoPI,0>a&&(a=x.TwoPI+a),a+=b),a},x.animation=function(a){function c(b){if(-1!==d.promise.getStatus()){null===e&&(e=b);var f,g=(b-e)/a.duration,h={};if(1>g){for(f in a.properties)h[f]=a.properties[f].start+(a.properties[f].end-a.properties[f].start)*a.easing(g);a.onTick(h,g),window.requestAnimationFrame(c)}else{for(f in a.properties)h[f]=a.properties[f].end;a.onTick(h,1),a.onDone&&a.onDone(),d.resolve()}}}var d=b(),e=null;a.easing&&"string"!=typeof a.easing||(a.easing=x.animation.easings[a.easing||"linear"]),void 0!==a.delay?window.setTimeout(function(){window.requestAnimationFrame(c)},a.delay):window.requestAnimationFrame(c);var f=d.promise;return f.cancel=function(){a.onCancel&&a.onCancel(),d.reject()},f},x.animation.easings={linear:function(a){return a},inQuad:function(a){return a*a},outQuad:function(a){return a*(2-a)},inOutQuad:function(a){return.5>a?2*a*a:-1+(4-2*a)*a},inCubic:function(a){return a*a*a},outCubic:function(a){return--a*a*a+1},inOutCubic:function(a){return.5>a?4*a*a*a:(a-1)*(2*a-2)*(2*a-2)+1},inQuart:function(a){return a*a*a*a},outQuart:function(a){return 1- --a*a*a*a},inOutQuart:function(a){return.5>a?8*a*a*a*a:1-8*--a*a*a*a},inQuint:function(a){return a*a*a*a*a},outQuint:function(a){return 1+--a*a*a*a*a},inOutQuint:function(a){return.5>a?16*a*a*a*a*a:1+16*--a*a*a*a*a},inSine:function(a){return 1-Math.cos(a*(Math.PI/2))},outSine:function(a){return Math.sin(a*(Math.PI/2))},inOutSine:function(a){return.5-.5*Math.cos(Math.PI*a)},inExpo:function(a){return Math.pow(2,10*(a-1))},outExpo:function(a){return 1-Math.pow(2,-10*a)},inOutExpo:function(a){return a=2*a-1,0>a?.5*Math.pow(2,10*a):1-.5*Math.pow(2,-10*a)},inCirc:function(a){return 1-Math.sqrt(1-a*a)},outCirc:function(a){return a--,Math.sqrt(1-a*a)},inOutCirc:function(a){return a*=2,1>a?.5-.5*Math.sqrt(1-a*a):.5+.5*Math.sqrt(1-(a-=2)*a)}},x.throttle=function(a,b){var c,d,e,f=null,g=0,h=function(){g=Date.now(),f=null,e=a.apply(c,d),f||(c=d=null)};return function(){var i=Date.now();g||(g=i);var j=b-(i-g);return c=this,d=arguments,0>=j||j>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)},a.GodraysShader={uniforms:{tDiffuse:{type:"t",value:0,texture:null},fX:{type:"f",value:.5},fY:{type:"f",value:.5},fExposure:{type:"f",value:.6},fDecay:{type:"f",value:.93},fDensity:{type:"f",value:.96},fWeight:{type:"f",value:.4},fClamp:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main()","{","vUv = vec2( uv.x, uv.y );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tDiffuse;","uniform float fX;","uniform float fY;","uniform float fExposure;","uniform float fDecay;","uniform float fDensity;","uniform float fWeight;","uniform float fClamp;","const int iSamples = 20;","void main()","{","vec2 deltaTextCoord = vec2(vUv - vec2(fX,fY));","deltaTextCoord *= 1.0 / float(iSamples) * fDensity;","vec2 coord = vUv;","float illuminationDecay = 1.0;","vec4 FragColor = vec4(0.0);","for(int i=0; i < iSamples ; i++)","{","coord -= deltaTextCoord;","vec4 texel = texture2D(tDiffuse, coord);","texel *= illuminationDecay * fWeight;","FragColor += texel;","illuminationDecay *= fDecay;","}","FragColor *= fExposure;","FragColor = clamp(FragColor, 0.0, fClamp);","gl_FragColor = FragColor;","}"].join("\n")},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;e>b;b+=1)if(c[b][0]===a)return void c.splice(b,1);for(b=0,e=d.length;e>b;b+=1)if(d[b][0]===a)return void d.splice(b,1)}}}(window),e.ICONS["compass.svg"]='',e.ICONS["download.svg"]='',e.ICONS["fullscreen-in.svg"]='',e.ICONS["fullscreen-out.svg"]='',e.ICONS["pin.svg"]='',e.ICONS["play-active.svg"]='',e.ICONS["play.svg"]='',e.ICONS["zoom-in.svg"]='',e.ICONS["zoom-out.svg"]='',e.Error=w,e.Utils=x,e}); \ No newline at end of file +!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(a){if(!(this instanceof e))return new e(a);if(e.SYSTEM.loaded||e.loadSystem(),this.config=x.clone(e.DEFAULTS),x.deepmerge(this.config,a),!a.container)throw new w("No value given for container.");if(!e.SYSTEM.isCanvasSupported)throw new w("Canvas is not supported.");if(!(e.SYSTEM.isWebGLSupported&&this.config.webgl||x.checkTHREE("CanvasRenderer","Projector")))throw new w("Missing Three.js components: CanvasRenderer, Projector. Get them from threejs-examples package.");if(this.config.transition&&this.config.transition.blur)if(e.SYSTEM.isWebGLSupported&&this.config.webgl){if(!x.checkTHREE("EffectComposer","RenderPass","ShaderPass","MaskPass","CopyShader"))throw new w("Missing Three.js components: EffectComposer, RenderPass, ShaderPass, MaskPass, CopyShader. Get them from threejs-examples package.")}else this.config.transition.blur=!1,console.warn("PhotoSphereViewer: Using canvas rendering, blur transition disabled.");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=b.substring(f,g);if(f===-1||g===-1||h.indexOf("GPano:")===-1)a.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?a.resolve(i):(console.warn("PhotoSphereViewer: invalid XMP data"),a.resolve(null))}}else 3===c.readyState&&d.loader&&d.loader.setProgress(e+=10)},c.onprogress=function(a){if(a.lengthComputable&&d.loader){var b=parseInt(a.loaded/a.total*100);b>e&&(e=b,d.loader.setProgress(e))}},c.onerror=function(){throw d.container.textContent="Cannot load image",new w("Cannot load image")},c.open("GET",this.config.panorama,!0),c.send(null),a.promise},e.prototype._loadTexture=function(){var c=this;return this._loadXMP().then(function(d){var f=b(),g=new a.ImageLoader,h=d?100:0;g.setCrossOrigin("anonymous");var i=function(b){c.loader&&c.loader.setProgress(100),!d&&c.config.pano_data&&(d=x.clone(c.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}),c.prop.pano_data=d;var g=Math.min(d.full_width,e.SYSTEM.maxTextureWidth)/d.full_width,h=x.clone(d);h.full_width*=g,h.full_height*=g,h.cropped_width*=g,h.cropped_height*=g,h.cropped_x*=g,h.cropped_y*=g,b.width=h.cropped_width,b.height=h.cropped_height;var i=document.createElement("canvas");i.width=h.full_width,i.height=h.full_height;var j=i.getContext("2d");j.drawImage(b,h.cropped_x,h.cropped_y,h.cropped_width,h.cropped_height);var k=new a.Texture(i);k.needsUpdate=!0,k.minFilter=a.LinearFilter,k.generateMipmaps=!1,f.resolve(k)},j=function(a){if(a.lengthComputable&&c.loader){var b=parseInt(a.loaded/a.total*100);b>h&&(h=b,c.loader.setProgress(h))}},k=function(){throw c.container.textContent="Cannot load image",new w("Cannot load image")};return g.load(c.config.panorama,i,j,k),f.promise})},e.prototype._setTexture=function(a){return this.scene||this._createScene(),this.mesh.material.map&&this.mesh.material.map.dispose(),this.mesh.material.map=a,this.trigger("panorama-loaded"),this.render(),b.resolved()},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),this.camera=new a.PerspectiveCamera(this.config.default_fov,this.prop.size.width/this.prop.size.height,1,2*e.SPHERE_RADIUS),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);var b=new a.SphereGeometry(e.SPHERE_RADIUS,this.config.sphere_segments,this.config.sphere_segments,(-x.HalfPI)),c=new a.MeshBasicMaterial;c.side=a.DoubleSide,this.mesh=new a.Mesh(b,c),this.mesh.scale.x=-1,this.scene.add(this.mesh),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),this.config.time_anim!==!1&&(this.prop.start_timeout=window.setTimeout(this.startAutorotate.bind(this),this.config.time_anim)),this.config.transition&&this.config.transition.blur&&(this.composer=new a.EffectComposer(this.renderer),this.passes.render=new a.RenderPass(this.scene,this.camera),this.passes.copy=new a.ShaderPass(a.CopyShader),this.passes.copy.renderToScreen=!0,this.passes.blur=new a.ShaderPass(a.GodraysShader),this.passes.blur.enabled=!1,this.passes.blur.renderToScreen=!0,this.passes.blur.uniforms.fDensity.value=0,this.passes.blur.uniforms.fWeight.value=.5,this.passes.blur.uniforms.fDecay.value=.5,this.passes.blur.uniforms.fExposure.value=1,this.composer.addPass(this.passes.render),this.composer.addPass(this.passes.copy),this.composer.addPass(this.passes.blur))},e.prototype._transition=function(b,c){var d=this,e=new a.SphereGeometry(150,32,32,(-x.HalfPI)),f=new a.MeshBasicMaterial;f.side=a.DoubleSide,f.map=b,f.transparent=!0,f.opacity=0;var g=new a.Mesh(e,f);if(g.scale.x=-1,c){g.rotateY(c.longitude-this.prop.longitude);var h=new a.Vector3(0,1,0).cross(this.camera.getWorldDirection()).normalize(),i=(new a.Quaternion).setFromAxisAngle(h,c.latitude-this.prop.latitude);g.quaternion.multiplyQuaternions(i,g.quaternion)}this.scene.add(g),this.render();var j=this.prop.zoom_lvl;this.config.transition.blur&&(this.passes.copy.enabled=!1,this.passes.blur.enabled=!0);var k=function(a){f.opacity=a.opacity,d.config.transition.blur&&(d.passes.blur.uniforms.fDensity.value=a.density,d.zoom(a.zoom,!1)),d.render()};return x.animation({properties:{density:{start:0,end:1.5},opacity:{start:0,end:.5},zoom:{start:j,end:100}},duration:d.config.transition.duration/(d.config.transition.blur?4/3:2),easing:d.config.transition.blur?"outCubic":"linear",onTick:k}).then(function(){return x.animation({properties:{density:{start:1.5,end:0},opacity:{start:.5,end:1},zoom:{start:100,end:j}},duration:d.config.transition.duration/(d.config.transition.blur?4:2),easing:d.config.transition.blur?"inCubic":"linear",onTick:k})}).then(function(){d.config.transition.blur&&(d.passes.copy.enabled=!0,d.passes.blur.enabled=!1,d.zoom(j,!1)),d.mesh.material.map.dispose(),d.mesh.material.map=b,d.scene.remove(g),g.geometry.dispose(),g.geometry=null,g.material.dispose(),g.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.MOVE_THRESHOLD=4,e.INERTIA_WINDOW=300,e.SPHERE_RADIUS=100,e.KEYMAP={33:"PageUp",34:"PageDown",37:"ArrowLeft",38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",107:"+",109:"-"},e.ICONS={},e.SYSTEM={loaded:!1,pixelRatio:1,isWebGLSupported:!1,isCanvasSupported:!1,deviceOrientationSupported:null,maxTextureWidth:0,mouseWheelEvent:null,fullscreenEvent:null},e.DEFAULTS={panorama:null,container:null,caption:null,autoload:!0,usexmpdata:!0,pano_data:null,webgl:!0,sphere_segments:64,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,blur:!1},loading_img:null,loading_txt:"Loading...",size:null,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),document.addEventListener(e.SYSTEM.fullscreenEvent,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)),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._onTouchStart=function(a){1===a.touches.length?this._startMove(a.touches[0]):2===a.touches.length&&this._startZoom(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._onMouseUp=function(a){this._stopMove(a)},e.prototype._onTouchEnd=function(a){this._stopMove(a.changedTouches[0])},e.prototype._stopMove=function(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 w("No value given for panorama.");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.longitude,this.prop.latitude),this.config.fisheye&&(this.prop.direction.multiplyScalar(this.config.fisheye/2),this.camera.position.copy(this.prop.direction).negate()),this.camera.lookAt(this.prop.direction)),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),document.removeEventListener(e.SYSTEM.fullscreenEvent,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)),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&&(this.scene.remove(this.camera),this.scene.remove(this.mesh)),this.mesh&&(this.mesh.geometry.dispose(),this.mesh.geometry=null,this.mesh.material.map.dispose(),this.mesh.material.map=null,this.mesh.material.dispose(),this.mesh.material=null),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},e.prototype.setPanorama=function(a,b,c){"boolean"==typeof b&&(c=b,b=void 0),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=new h(this)),this._loadTexture().then(function(a){return d.loader&&(d.loader.destroy(),d.loader=null),d._transition(a,b)}).rethrow()):(this.loader=new h(this),this._loadTexture().then(this._setTexture.bind(this)).then(function(){d.loader&&(d.loader.destroy(),d.loader=null),b?d.rotate(b):d.render()}).rethrow())},e.prototype.stopAll=function(){this.stopAutorotate(),this.stopAnimation(),this.stopGyroscopeControl()},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.config.gyroscope)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),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,b){if(this.stopAll(),!b)return void this.rotate(a);if(this.cleanPosition(a),this.applyRanges(a),!b&&"number"!=typeof b){b=b?x.parseSpeed(b):this.config.anim_speed;var c=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));b=c/b*1e3}var d=this.getShortestArc(this.prop.longitude,a.longitude);this.prop.animation_promise=x.animation({properties:{longitude:{start:this.prop.longitude,end:this.prop.longitude+d},latitude:{start:this.prop.latitude,end:a.latitude}},duration:b,easing:"inOutSine",onTick:this.rotate.bind(this)})},e.prototype.stopAnimation=function(){this.prop.animation_promise&&(this.prop.animation_promise.cancel(),this.prop.animation_promise=null)},e.prototype.zoom=function(a,b){this.prop.zoom_lvl=x.stayBetween(Math.round(a),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=2*Math.atan(Math.tan(this.prop.vFov*Math.PI/180/2)*this.prop.aspect)*180/Math.PI,b!==!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.loadSystem=function(){var a=e.SYSTEM;a.loaded=!0,a.pixelRatio=window.devicePixelRatio||1,a.isWebGLSupported=x.isWebGLSupported(),a.isCanvasSupported=x.isCanvasSupported(),a.maxTextureWidth=a.isWebGLSupported?x.getMaxTextureWidth():4096,a.mouseWheelEvent=x.mouseWheelEvent(),a.fullscreenEvent=x.fullscreenEvent(),a.deviceOrientationSupported=b(),window.addEventListener("deviceorientation",e.deviceOrientationListener,!1)},e.deviceOrientationListener=function(a){null!==a.alpha?e.SYSTEM.deviceOrientationSupported.resolve():e.SYSTEM.deviceOrientationSupported.reject(),window.removeEventListener("deviceorientation",e.deviceOrientationListener)},e.prototype._setViewerSize=function(a){["width","height"].forEach(function(b){a[b]&&(/^[0-9.]+$/.test(a[b])&&(a[b]+="px"),this.parent.style[b]=a[b])},this)},e.prototype.textureCoordsToSphericalCoords=function(a,b){var c=(a+this.prop.pano_data.cropped_x)/this.prop.pano_data.full_width*x.TwoPI,d=(b+this.prop.pano_data.cropped_y)/this.prop.pano_data.full_height*Math.PI;return{longitude:c>=Math.PI?c-Math.PI:c+Math.PI,latitude:x.HalfPI-d}},e.prototype.sphericalCoordsToTextureCoords=function(a,b){var c=a/x.TwoPI*this.prop.pano_data.full_width,d=b/Math.PI*this.prop.pano_data.full_height;return{x:parseInt(ab[1]?a.longitude>b[1]&&a.longitudeb[0]/2+b[1]/2?(a.longitude=b[0],this.trigger("_side-reached","left")):(a.longitude=b[1],this.trigger("_side-reached","right"))):a.longitudeb[1]&&(a.longitude=b[1],this.trigger("_side-reached","right"))),this.config.latitude_range&&(b=x.clone(this.config.latitude_range),c=this.prop.vFov/180*Math.PI/2,b[0]=x.parseAngle(b[0]+c,-Math.PI),b[1]=x.parseAngle(b[1]-c,-Math.PI),a.latitudeb[1]&&(a.latitude=b[1],this.trigger("_side-reached","top")))},e.prototype.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)2){c.position2D=this._getPolygonDimensions(c,e);var f="";e.forEach(function(a){f+=a.left+","+a.top+" "}),c.$el.setAttributeNS(null,"points",f)}}else if(d){var g=this._getMarkerPosition(c);d=this._isMarkerVisible(c,g),d&&(c.position2D=g,c.$el.style.transform="translate3D("+g.left+"px, "+g.top+"px, 0px)"+(!c.lockRotation&&a?" rotateZ("+a+"deg)":""))}x.toggleClass(c.$el,"psv-marker--visible",d)}},g.prototype._isMarkerVisible=function(a,b){return a.position3D.dot(this.psv.prop.direction)>0&&b.left+a.width>=0&&b.left-a.width<=this.psv.prop.size.width&&b.top+a.height>=0&&b.top-a.height<=this.psv.prop.size.height},g.prototype._getMarkerPosition=function(a){if(a.dynamicSize){a.$el.classList.add("psv-marker--transparent");var b=a.$el.getBoundingClientRect();a.$el.classList.remove("psv-marker--transparent"),a.width=b.right-b.left,a.height=b.bottom-b.top}var c=this.psv.vector3ToViewerCoords(a.position3D);return c.top-=a.height*a.anchor.top,c.left-=a.width*a.anchor.left,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.left),d=Math.min(d,a.top),e=Math.max(e,a.left),f=Math.max(f,a.top)}),a.width=e-c,a.height=f-d,{top:d,left:c}},g.prototype._onMouseEnter=function(a){var b;a.target&&(b=a.target.psvMarker)&&b.tooltip&&!b.isPolygon()&&(this.hoveringMarker=b,this.psv.tooltip.showTooltip({content:b.tooltip.content,position:b.tooltip.position,top:b.position2D.top,left:b.position2D.left,marker:b}))},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.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.tooltip&&b.isPolygon()||a.target&&x.hasParent(a.target,this.psv.tooltip.container)&&(b=this.hoveringMarker)){this.hoveringMarker=b;var c=this.psv.container.getBoundingClientRect();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,marker:{width:2*this.psv.config.tooltip.arrow_size,height:2*this.psv.config.tooltip.arrow_size}})}else this.hoveringMarker&&this.hoveringMarker.isPolygon()&&this.psv.tooltip.hideTooltip()}},g.prototype._onClick=function(a,b){var c;a.target&&(c=x.getClosest(a.target,".psv-marker"))&&c.psvMarker?(this.currentMarker=c.psvMarker,this.psv.trigger("select-marker",c.psvMarker),this.psv.config.click_event_on_marker?a.marker=c.psvMarker:b.stopPropagation()):this.currentMarker&&(this.psv.trigger("unselect-marker",this.currentMarker),this.currentMarker=null),c&&c.psvMarker&&c.psvMarker.content?this.psv.panel.showPanel(c.psvMarker.content):this.psv.panel.prop.opened&&(b.stopPropagation(),this.psv.panel.hidePanel())},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.getType=function(a,b){var c=["image","html","polygon_px","polygon_rad","rect","circle","ellipse","path"],d=[];if(c.forEach(function(b){a[b]&&d.push(b)}),0===d.length&&!b)throw new w("missing marker content, either "+c.join(", "));if(d.length>1)throw new w("multiple marker content, either "+c.join(", "));return d[0]},i.prototype.isNormal=function(){return"image"==this.type||"html"==this.type},i.prototype.isPolygon=function(){return"polygon_px"==this.type||"polygon_rad"==this.type},i.prototype.isSvg=function(){return"rect"==this.type||"circle"==this.type||"ellipse"==this.type||"path"==this.type},i.prototype.update=function(a){if(a&&a!==this){var b=i.getType(a,!0);if(void 0!==b&&b!==this.type)throw new w("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&&(this.$el.classList.add("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.$el.style.transformOrigin=100*this.anchor.left+"% "+100*this.anchor.top+"%",this.isNormal()?this._updateNormal():this.isPolygon()?this._updatePolygon():this._updateSvg()},i.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.longitude,this.latitude)},i.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.longitude,this.latitude)},i.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;b
',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)},m.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)},m.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)}},m.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")},m.prototype.hidePanel=function(){this.content.innerHTML=null,this.prop.opened=!1,this.container.classList.remove("psv-panel--open"),this.psv.trigger("close-panel")},m.prototype._onMouseDown=function(a){a.stopPropagation(),this._startResize(a)},m.prototype._onTouchStart=function(a){a.stopPropagation(),this._startResize(a.changedTouches[0])},m.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")},m.prototype._onMouseUp=function(a){this.prop.mousedown&&(a.stopPropagation(),this.prop.mousedown=!1,this.content.classList.remove("psv-panel-content--no-interaction"))},m.prototype._onMouseMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a))},m.prototype._onTouchMove=function(a){this.prop.mousedown&&(a.stopPropagation(),this._resize(a.touches[0]))},m.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},n.prototype=Object.create(f.prototype),n.prototype.constructor=n,n.className="psv-tooltip",n.publicMethods=["showTooltip","hideTooltip","isTooltipVisible"],n.leftMap={0:"left",.5:"center",1:"right"},n.topMap={0:"top",.5:"center",1:"bottom"},n.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)},n.prototype.destroy=function(){this.psv.off("render",this),delete this.config,f.prototype.destroy.call(this)},n.prototype.handleEvent=function(a){switch(a.type){case"render":this.hideTooltip()}},n.prototype.isTooltipVisible=function(){return this.container.classList.contains("psv-tooltip--visible")},n.prototype.showTooltip=function(a){this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null);var b=this.isTooltipVisible(),c=this.container,d=this.content,e=this.arrow;if(a.position||(a.position=["top","center"]),a.marker||(a.marker={width:0,height:0}),"string"==typeof a.position){var f=x.parsePosition(a.position);if(!(f.left in n.leftMap&&f.top in n.topMap))throw new w('unable to parse tooltip position "'+tooltip.position+'"');a.position=[n.topMap[f.top],n.leftMap[f.left]]}if("center"==a.position[0]&&"center"==a.position[1])throw new w('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&&"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.timeout=window.setTimeout(function(){c.classList.add("psv-tooltip--visible"),l.psv.trigger("show-tooltip"),l.timeout=null},this.config.delay)}},n.prototype.hideTooltip=function(){if(this.timeout&&(window.clearTimeout(this.timeout),this.timeout=null),this.isTooltipVisible()){this.container.classList.remove("psv-tooltip--visible"),this.psv.trigger("hide-tooltip");var a=this;this.timeout=window.setTimeout(function(){a.content.innerHTML=null,a.container.style.top="-1000px",a.container.style.left="-1000px",a.timeout=null},this.config.delay)}},n.prototype._computeTooltipPosition=function(a,b){var c=!1;switch(a.posClass[0]){case"bottom":a.top=b.top+b.marker.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.marker.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.marker.width/2-this.config.offset-this.config.arrow_size,a.arrow_left=this.config.offset):(a.left=b.left+b.marker.width+this.config.offset+this.config.arrow_size,a.arrow_left=2*-this.config.arrow_size);break;case"center":a.left=b.left+b.marker.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.marker.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)}},o.prototype=Object.create(f.prototype),o.prototype.constructor=o,o.prototype.create=function(){f.prototype.create.call(this),this.constructor.icon&&this.setIcon(this.constructor.icon),this.container.addEventListener("click",function(){this.enabled&&this._onClick()}.bind(this))},o.prototype.setIcon=function(a,b){b||(b=this.container),a?(b.innerHTML=e.ICONS[a],b.querySelector("svg").classList.add("psv-button-svg")):b.innerHTML=""},o.prototype.toggleActive=function(a){a=x.toggleClass(this.container,"psv-button--active",a),this.constructor.iconActive&&this.setIcon(a?this.constructor.iconActive:this.constructor.icon)},o.prototype.disable=function(){this.container.classList.add("psv-button--disabled"),this.enabled=!1},o.prototype.enable=function(){this.container.classList.remove("psv-button--disabled"),this.enabled=!0},o.prototype._onClick=function(){},p.prototype=Object.create(o.prototype),p.prototype.constructor=p,p.id="autorotate",p.className="psv-button psv-button--hover-scale psv-autorotate-button",p.icon="play.svg",p.iconActive="play-active.svg",p.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.autorotate,this.psv.on("autorotate",this)},p.prototype.destroy=function(){this.psv.off("autorotate",this),o.prototype.destroy.call(this)},p.prototype.handleEvent=function(a){switch(a.type){case"autorotate":this.toggleActive(a.args[0])}},p.prototype._onClick=function(){this.psv.toggleAutorotate()},q.prototype=Object.create(o.prototype),q.prototype.constructor=q,q.className="psv-button psv-custom-button",q.prototype.create=function(){o.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()},q.prototype.destroy=function(){delete this.config,o.prototype.destroy.call(this)},q.prototype._onClick=function(){this.config.onClick&&this.config.onClick.apply(this.psv)},r.prototype=Object.create(o.prototype),r.prototype.constructor=r,r.id="download",r.className="psv-button psv-button--hover-scale psv-download-button",r.icon="download.svg",r.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.download},r.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()},s.prototype=Object.create(o.prototype),s.prototype.constructor=s,s.id="fullscreen",s.className="psv-button psv-button--hover-scale psv-fullscreen-button",s.icon="fullscreen-in.svg",s.iconActive="fullscreen-out.svg",s.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.fullscreen,this.psv.on("fullscreen-updated",this)},s.prototype.destroy=function(){this.psv.off("fullscreen-updated",this),o.prototype.destroy.call(this)},s.prototype.handleEvent=function(a){switch(a.type){case"fullscreen-updated":this.toggleActive(a.args[0])}},s.prototype._onClick=function(){this.psv.toggleFullscreen()},t.prototype=Object.create(o.prototype),t.prototype.constructor=t,t.id="gyroscope",t.className="psv-button psv-button--hover-scale psv-gyroscope-button",t.icon="compass.svg",t.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.gyroscope,e.SYSTEM.deviceOrientationSupported.promise.then(this._onAvailabilityChange.bind(this,!0),this._onAvailabilityChange.bind(this,!1)),this.hide(),this.psv.on("gyroscope-updated",this)},t.prototype.destroy=function(){this.psv.off("gyroscope-updated",this),o.prototype.destroy.call(this)},t.prototype.handleEvent=function(a){switch(a.type){case"gyroscope-updated":this.toggleActive(a.args[0])}},t.prototype._onClick=function(){this.psv.toggleGyroscopeControl()},t.prototype._onAvailabilityChange=function(a){if(a){if(!x.checkTHREE("DeviceOrientationControls"))throw new w("Missing Three.js components: DeviceOrientationControls. Get them from threejs-examples package.");this.show()}},u.prototype=Object.create(o.prototype),u.prototype.constructor=u,u.id="markers",u.className="psv-button psv-button--hover-scale psv-markers-button",u.icon="pin.svg",u.publicMethods=["toggleMarkersList","showMarkersList","hideMarkersList"],u.prototype.create=function(){o.prototype.create.call(this),this.container.title=this.psv.config.lang.markers,this.psv.on("open-panel",this),this.psv.on("close-panel",this)},u.prototype.destroy=function(){this.psv.off("open-panel",this),this.psv.off("close-panel",this),delete this.prop,o.prototype.destroy.call(this)},u.prototype.handleEvent=function(a){switch(a.type){case"open-panel":this._onPanelOpened();break;case"close-panel":this._onPanelClosed()}},u.prototype._onClick=function(){this.toggleMarkersList()},u.prototype.toggleMarkersList=function(){this.prop.panelOpened?this.hideMarkersList():this.showMarkersList()},u.prototype.showMarkersList=function(){var a=[];for(var b in this.psv.hud.markers)a.push(this.psv.hud.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))},u.prototype.hideMarkersList=function(){this.prop.panelOpened&&this.psv.panel.hidePanel()},u.prototype._onClickItem=function(a){var b;a.target&&(b=x.getClosest(a.target,"li"))&&b.dataset.psvMarker&&(this.psv.hud.gotoMarker(b.dataset.psvMarker,1e3),this.psv.panel.hidePanel())},u.prototype._onPanelOpened=function(){this.prop.panelOpening?(this.prop.panelOpening=!1,this.prop.panelOpened=!0):this.prop.panelOpened=!1,this.toggleActive(this.prop.panelOpened)},u.prototype._onPanelClosed=function(){this.prop.panelOpened=!1,this.prop.panelOpening=!1,this.toggleActive(this.prop.panelOpened)},v.prototype=Object.create(o.prototype),v.prototype.constructor=v,v.id="zoom",v.className="psv-button psv-zoom-button",v.prototype.create=function(){o.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",this.zoom_range.title=this.psv.config.lang.zoom,b.appendChild(this.zoom_range),this.zoom_value=document.createElement("div"),this.zoom_value.className="psv-zoom-button-handle",this.zoom_value.title=this.psv.config.lang.zoom,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))},v.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),o.prototype.destroy.call(this)},v.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]); +}},v.prototype._moveZoomValue=function(a){this.zoom_value.style.left=a/100*this.zoom_range.offsetWidth-this.zoom_value.offsetWidth/2+"px"},v.prototype._initZoomChangeWithMouse=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.clientX))},v.prototype._initZoomChangeByTouch=function(a){this.enabled&&(this.prop.mousedown=!0,this._changeZoom(a.changedTouches[0].clientX))},v.prototype._zoomIn=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomIn(),window.setTimeout(this._startLongPressInterval.bind(this,1),200))},v.prototype._zoomOut=function(){this.enabled&&(this.prop.buttondown=!0,this.psv.zoomOut(),window.setTimeout(this._startLongPressInterval.bind(this,-1),200))},v.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))},v.prototype._stopZoomChange=function(){this.enabled&&(window.clearInterval(this.prop.longPressInterval),this.prop.longPressInterval=null,this.prop.mousedown=!1,this.prop.buttondown=!1)},v.prototype._changeZoomWithMouse=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.clientX))},v.prototype._changeZoomByTouch=function(a){this.enabled&&(a.preventDefault(),this._changeZoom(a.changedTouches[0].clientX))},v.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)}},w.prototype=Object.create(Error.prototype),w.prototype.name="PSVError",w.prototype.constructor=w;var x={};return x.TwoPI=2*Math.PI,x.HalfPI=Math.PI/2,x.checkTHREE=function(b){for(var c=0,d=arguments.length;c(.*)"))?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.parsePosition=function(a){if(!a)return{top:.5,left:.5};if("object"==typeof a)return a;var b=a.toLocaleLowerCase().split(" ").slice(0,2);1===b.length&&(b=void 0!==x.parsePosition.positions[b[0]]?[b[0],"center"]:[b[0],b[0]]);var c="left"!=b[1]&&"right"!=b[1]&&"top"!=b[0]&&"bottom"!=b[0];b=b.map(function(a){return x.parsePosition.positions[a]||a}),c||b.reverse();var d=b.join(" ").match(/^([0-9.]+)% ([0-9.]+)%$/);return d?{left:d[1]/100,top:d[2]/100}:{top:.5,left:.5}},x.parsePosition.positions={top:"0%",bottom:"100%",left:"0%",right:"100%",center:"50%"},x.parseSpeed=function(a){if("string"==typeof a){a=a.toString().trim();var b=parseFloat(a.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),c=a.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();switch(c.match(/(pm|per minute)$/)&&(b/=60),c){case"dpm":case"degrees per minute":case"dps":case"degrees per second":a=b*Math.PI/180;break;case"radians per minute":case"radians per second":a=b;break;case"rpm":case"revolutions per minute":case"rps":case"revolutions per second":a=b*x.TwoPI;break;default:throw new w('unknown speed unit "'+c+'"')}}return a},x.parseAngle=function(a,b){if("string"==typeof a){var c=a.toLowerCase().trim().match(/^(-?[0-9]+(?:\.[0-9]*)?)(.*)$/);if(!c)throw new w('unknown angle "'+a+'"');var d=parseFloat(c[1]),e=c[2];if(e)switch(e){case"deg":case"degs":a=d/180*Math.PI;break;case"rad":case"rads":a=d;break;default:throw new w('unknown angle unit "'+e+'"')}}return b!==!1&&(void 0===b&&(b=0),a=(a-b)%x.TwoPI,a<0&&(a=x.TwoPI+a),a+=b),a},x.animation=function(a){function c(b){if(d.promise.getStatus()!==-1){null===e&&(e=b);var f,g=(b-e)/a.duration,h={};if(g<1){for(f in a.properties)h[f]=a.properties[f].start+(a.properties[f].end-a.properties[f].start)*a.easing(g);a.onTick(h,g),window.requestAnimationFrame(c)}else{for(f in a.properties)h[f]=a.properties[f].end;a.onTick(h,1),a.onDone&&a.onDone(),d.resolve()}}}var d=b(),e=null;a.easing&&"string"!=typeof a.easing||(a.easing=x.animation.easings[a.easing||"linear"]),void 0!==a.delay?window.setTimeout(function(){window.requestAnimationFrame(c)},a.delay):window.requestAnimationFrame(c);var f=d.promise;return f.cancel=function(){a.onCancel&&a.onCancel(),d.reject()},f},x.animation.easings={linear:function(a){return a},inQuad:function(a){return a*a},outQuad:function(a){return a*(2-a)},inOutQuad:function(a){return a<.5?2*a*a:-1+(4-2*a)*a},inCubic:function(a){return a*a*a},outCubic:function(a){return--a*a*a+1},inOutCubic:function(a){return a<.5?4*a*a*a:(a-1)*(2*a-2)*(2*a-2)+1},inQuart:function(a){return a*a*a*a},outQuart:function(a){return 1- --a*a*a*a},inOutQuart:function(a){return a<.5?8*a*a*a*a:1-8*--a*a*a*a},inQuint:function(a){return a*a*a*a*a},outQuint:function(a){return 1+--a*a*a*a*a},inOutQuint:function(a){return a<.5?16*a*a*a*a*a:1+16*--a*a*a*a*a},inSine:function(a){return 1-Math.cos(a*(Math.PI/2))},outSine:function(a){return Math.sin(a*(Math.PI/2))},inOutSine:function(a){return.5-.5*Math.cos(Math.PI*a)},inExpo:function(a){return Math.pow(2,10*(a-1))},outExpo:function(a){return 1-Math.pow(2,-10*a)},inOutExpo:function(a){return a=2*a-1,a<0?.5*Math.pow(2,10*a):1-.5*Math.pow(2,-10*a)},inCirc:function(a){return 1-Math.sqrt(1-a*a)},outCirc:function(a){return a--,Math.sqrt(1-a*a)},inOutCirc:function(a){return a*=2,a<1?.5-.5*Math.sqrt(1-a*a):.5+.5*Math.sqrt(1-(a-=2)*a)}},x.throttle=function(a,b){var c,d,e,f=null,g=0,h=function(){g=Date.now(),f=null,e=a.apply(c,d),f||(c=d=null)};return function(){var i=Date.now();g||(g=i);var j=b-(i-g);return c=this,d=arguments,j<=0||j>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)},a.GodraysShader={uniforms:{tDiffuse:{type:"t",value:0,texture:null},fX:{type:"f",value:.5},fY:{type:"f",value:.5},fExposure:{type:"f",value:.6},fDecay:{type:"f",value:.93},fDensity:{type:"f",value:.96},fWeight:{type:"f",value:.4},fClamp:{type:"f",value:1}},vertexShader:["varying vec2 vUv;","void main()","{","vUv = vec2( uv.x, uv.y );","gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );","}"].join("\n"),fragmentShader:["varying vec2 vUv;","uniform sampler2D tDiffuse;","uniform float fX;","uniform float fY;","uniform float fExposure;","uniform float fDecay;","uniform float fDensity;","uniform float fWeight;","uniform float fClamp;","const int iSamples = 20;","void main()","{","vec2 deltaTextCoord = vec2(vUv - vec2(fX,fY));","deltaTextCoord *= 1.0 / float(iSamples) * fDensity;","vec2 coord = vUv;","float illuminationDecay = 1.0;","vec4 FragColor = vec4(0.0);","for(int i=0; i < iSamples ; i++)","{","coord -= deltaTextCoord;","vec4 texel = texture2D(tDiffuse, coord);","texel *= illuminationDecay * fWeight;","FragColor += texel;","illuminationDecay *= fDecay;","}","FragColor *= fExposure;","FragColor = clamp(FragColor, 0.0, fClamp);","gl_FragColor = FragColor;","}"].join("\n")},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