From 9b2582542f0233edad17fe606087dea61c0da285 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Heleine?= Date: Mon, 7 Mar 2016 22:31:40 +0100 Subject: [PATCH] Version 2.6 --- photo-sphere-viewer.js | 177 ++++++++++++++++++++++++++++++++----- photo-sphere-viewer.min.js | 2 +- src/PhotoSphereViewer.js | 2 +- 3 files changed, 157 insertions(+), 24 deletions(-) diff --git a/photo-sphere-viewer.js b/photo-sphere-viewer.js index 0b5fdbea0..e96acc0e0 100644 --- a/photo-sphere-viewer.js +++ b/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.5 + * Photo Sphere Viewer v2.6 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine @@ -29,6 +29,14 @@ * @param {object} args - Settings to apply to the viewer * @param {string} args.panorama - Panorama URL or path (absolute or relative) * @param {HTMLElement|string} args.container - Panorama container (should be a `div` or equivalent), can be a string (the ID of the element to retrieve) + * @param {object} args.overlay - Image to add over the panorama + * @param {string} args.overlay.image - Image URL or path + * @param {object} [args.overlay.position=null] - Image position (default to the bottom left corner) + * @param {string} [args.overlay.position.x=null] - Horizontal image position ('left' or 'right') + * @param {string} [args.overlay.position.y=null] - Vertical image position ('top' or 'bottom') + * @param {object} [args.overlay.size=null] - Image size (if it needs to be resized) + * @param {number|string} [args.overlay.size.width=null] - Image width (in pixels or a percentage, like '20%') + * @param {number|string} [args.overlay.size.height=null] - Image height (in pixels or a percentage, like '20%') * @param {boolean} [args.autoload=true] - `true` to automatically load the panorama, `false` to load it later (with the {@link PhotoSphereViewer#load|`.load`} method) * @param {boolean} [args.usexmpdata=true] - `true` if Photo Sphere Viewer must read XMP data, `false` if it is not necessary * @param {boolean} [args.cors_anonymous=true] - `true` to disable the exchange of user credentials via cookies, `false` otherwise @@ -39,6 +47,9 @@ * @param {number} [args.pano_size.cropped_height=null] - The cropped panorama height (the image height if `null`) * @param {number} [args.pano_size.cropped_x=null] - The cropped panorama horizontal offset relative to the full width (middle if `null`) * @param {number} [args.pano_size.cropped_y=null] - The cropped panorama vertical offset relative to the full height (middle if `null`) + * @param {object} [args.captured_view=null] - The real captured view, compared to the theoritical 360°×180° possible view + * @param {number} [args.captured_view.horizontal_fov=360] - The horizontal captured field of view in degrees (default to 360°) + * @param {number} [args.captured_view.vertical_fov=180] - The vertical captured field of view in degrees (default to 180°) * @param {object} [args.default_position] - Defines the default position (the first point seen by the user) * @param {number|string} [args.default_position.long=0] - Default longitude, in radians (or in degrees if indicated, e.g. `'45deg'`) * @param {number|string} [args.default_position.lat=0] - Default latitude, in radians (or in degrees if indicated, e.g. `'45deg'`) @@ -51,6 +62,7 @@ * @param {number|string} [args.min_longitude=0] - The minimal longitude to show * @param {number|string} [args.max_longitude=2π] - The maximal longitude to show * @param {number} [args.zoom_level=0] - The default zoom level, between 0 and 100 + * @param {boolean} [args.smooth_user_moves=true] - If set to `false` user moves have a speed fixed by `long_offset` and `lat_offset` * @param {number} [args.long_offset=π/360] - The longitude to travel per pixel moved by mouse/touch * @param {number} [args.lat_offset=π/180] - The latitude to travel per pixel moved by mouse/touch * @param {integer} [args.time_anim=2000] - Delay before automatically animating the panorama in milliseconds, `false` to not animate @@ -333,25 +345,49 @@ var PhotoSphereViewer = function(args) { cropped_y: null }; - for (var attr in pano_size) { - if (pano_size[attr] === null && default_pano_size[attr] !== undefined) - pano_size[attr] = default_pano_size[attr]; + // Captured view? + if (captured_view.horizontal_fov != 360 || captured_view.vertical_fov != 180) { + // The indicated view is the cropped panorama + pano_size.cropped_width = default_pano_size.cropped_width; + pano_size.cropped_height = default_pano_size.cropped_height; + pano_size.full_width = default_pano_size.full_width; + pano_size.full_height = default_pano_size.full_height; + + // Horizontal FOV indicated + if (captured_view.horizontal_fov != 360) { + var rh = captured_view.horizontal_fov / 360.0; + pano_size.full_width = pano_size.cropped_width / rh; + } + + // Vertical FOV indicated + if (captured_view.vertical_fov != 180) { + var rv = captured_view.vertical_fov / 180.0; + pano_size.full_height = pano_size.cropped_height / rv; + } } - // Do we have to recalculate the coordinates? - if (recalculate_coords) { - if (pano_size.cropped_width != default_pano_size.cropped_width) { - var rx = default_pano_size.cropped_width / pano_size.cropped_width; - pano_size.cropped_width = default_pano_size.cropped_width; - pano_size.full_width *= rx; - pano_size.cropped_x *= rx; + else { + // Cropped panorama: dimensions defined by the user + for (var attr in pano_size) { + if (pano_size[attr] === null && default_pano_size[attr] !== undefined) + pano_size[attr] = default_pano_size[attr]; } - if (pano_size.cropped_height != default_pano_size.cropped_height) { - var ry = default_pano_size.cropped_height / pano_size.cropped_height; - pano_size.cropped_height = default_pano_size.cropped_height; - pano_size.full_height *= ry; - pano_size.cropped_y *= ry; + // Do we have to recalculate the coordinates? + if (recalculate_coords) { + if (pano_size.cropped_width != default_pano_size.cropped_width) { + var rx = default_pano_size.cropped_width / pano_size.cropped_width; + pano_size.cropped_width = default_pano_size.cropped_width; + pano_size.full_width *= rx; + pano_size.cropped_x *= rx; + } + + if (pano_size.cropped_height != default_pano_size.cropped_height) { + var ry = default_pano_size.cropped_height / pano_size.cropped_height; + pano_size.cropped_height = default_pano_size.cropped_height; + pano_size.full_height *= ry; + pano_size.cropped_y *= ry; + } } } @@ -471,6 +507,34 @@ var PhotoSphereViewer = function(args) { root.appendChild(navbar.getBar()); } + // Overlay? + if (overlay !== null) { + // Add the image + var overlay_img = document.createElement('img'); + + overlay_img.onload = function() { + overlay_img.style.display = 'block'; + + // Image position + overlay_img.style.position = 'absolute'; + overlay_img.style[overlay.position.x] = '5px'; + overlay_img.style[overlay.position.y] = '5px'; + + if (overlay.position.y == 'bottom' && display_navbar) + overlay_img.style.bottom = (navbar.getBar().offsetHeight + 5) + 'px'; + + // Should we resize the image? + if (overlay.size !== undefined) { + overlay_img.style.width = overlay.size.width; + overlay_img.style.height = overlay.size.height; + } + + root.appendChild(overlay_img); + }; + + overlay_img.src = overlay.image; + } + // Adding events addEvent(window, 'resize', fitToContainer); @@ -879,11 +943,14 @@ var PhotoSphereViewer = function(args) { **/ var startMove = function(x, y) { + // Store the current position of the mouse mouse_x = x; mouse_y = y; + // Stop the animation stopAutorotate(); + // Start the movement mousedown = true; }; @@ -970,19 +1037,30 @@ var PhotoSphereViewer = function(args) { var move = function(x, y) { if (mousedown) { - long += (x - mouse_x) * PSV_LONG_OFFSET; + // Smooth movement + if (smooth_user_moves) { + long += (x - mouse_x) / viewer_size.height * fov * Math.PI / 180; + lat += (y - mouse_y) / viewer_size.height * fov * Math.PI / 180; + } + // No smooth movement + else { + long += (x - mouse_x) * PSV_LONG_OFFSET; + lat += (y - mouse_y) * PSV_LAT_OFFSET; + } + + // Save the current coordinates for the next movement + mouse_x = x; + mouse_y = y; + + // Coordinates treatments if (!whole_circle) long = stayBetween(long, PSV_MIN_LONGITUDE, PSV_MAX_LONGITUDE); long = getAngleMeasure(long, true); - lat += (y - mouse_y) * PSV_LAT_OFFSET; lat = stayBetween(lat, PSV_TILT_DOWN_MAX, PSV_TILT_UP_MAX); - mouse_x = x; - mouse_y = y; - triggerAction('position-updated', { longitude: long, latitude: lat @@ -1086,8 +1164,9 @@ var PhotoSphereViewer = function(args) { var zoom = function(level) { zoom_lvl = stayBetween(parseInt(Math.round(level)), 0, 100); + fov = PSV_FOV_MAX + (zoom_lvl / 100) * (PSV_FOV_MIN - PSV_FOV_MAX); - camera.fov = PSV_FOV_MAX + (zoom_lvl / 100) * (PSV_FOV_MIN - PSV_FOV_MAX); + camera.fov = fov; camera.updateProjectionMatrix(); render(); @@ -1409,6 +1488,9 @@ var PhotoSphereViewer = function(args) { return; } + // Should the movement be smooth? + var smooth_user_moves = (args.smooth_user_moves !== undefined) ? !!args.smooth_user_moves : true; + // Movement speed var PSV_LONG_OFFSET = (args.long_offset !== undefined) ? parseAngle(args.long_offset) : Math.PI / 360.0; var PSV_LAT_OFFSET = (args.lat_offset !== undefined) ? parseAngle(args.lat_offset) : Math.PI / 180.0; @@ -1468,6 +1550,8 @@ var PhotoSphereViewer = function(args) { if (args.zoom_level !== undefined) zoom_lvl = stayBetween(parseInt(Math.round(args.zoom_level)), 0, 100); + var fov = PSV_FOV_MAX + (zoom_lvl / 100) * (PSV_FOV_MIN - PSV_FOV_MAX); + // Animation constants var PSV_FRAMES_PER_SECOND = 60; var PSV_ANIM_TIMEOUT = 1000 / PSV_FRAMES_PER_SECOND; @@ -1563,6 +1647,7 @@ var PhotoSphereViewer = function(args) { cropped_y: null }; + // The user defines the real size of the panorama if (args.pano_size !== undefined) { for (var attr in pano_size) { if (args.pano_size[attr] !== undefined) @@ -1572,6 +1657,21 @@ var PhotoSphereViewer = function(args) { readxmp = false; } + // Captured FOVs + var captured_view = { + horizontal_fov: 360, + vertical_fov: 180 + }; + + if (args.captured_view !== undefined) { + for (var attr in captured_view) { + if (args.captured_view[attr] !== undefined) + captured_view[attr] = parseFloat(args.captured_view[attr]); + } + + readxmp = false; + } + // Will we have to recalculate the coordinates? var recalculate_coords = false; @@ -1584,6 +1684,39 @@ var PhotoSphereViewer = function(args) { // Loading HTML var loading_html = (args.loading_html !== undefined) ? args.loading_html : null; + // Overlay + var overlay = null; + if (args.overlay !== undefined) { + // Image + if (args.overlay.image !== undefined) { + overlay = { + image: args.overlay.image, + position: { + x: 'left', + y: 'bottom' + } + }; + + // Image position + if (args.overlay.position !== undefined) { + if (args.overlay.position.x !== undefined && (args.overlay.position.x == 'left' || args.overlay.position.x == 'right')) + overlay.position.x = args.overlay.position.x; + + if (args.overlay.position.y !== undefined && (args.overlay.position.y == 'top' || args.overlay.position.y == 'bottom')) + overlay.position.y = args.overlay.position.y; + } + + // Image size + if (args.overlay.size !== undefined) { + // Default: keep the original size, or resize following the current ratio + overlay.size = { + width: (args.overlay.size.width !== undefined) ? args.overlay.size.width : 'auto', + height: (args.overlay.size.height !== undefined) ? args.overlay.size.height : 'auto' + }; + } + } + } + // Function to call once panorama is ready? if (args.onready !== undefined) this.addAction('ready', args.onready); diff --git a/photo-sphere-viewer.min.js b/photo-sphere-viewer.min.js index f4bcd5ae6..02595dd32 100644 --- a/photo-sphere-viewer.min.js +++ b/photo-sphere-viewer.min.js @@ -1 +1 @@ -var PhotoSphereViewer=function(e){var t=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},o=function(){var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl"))},n=function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)},i=function(e,t,o){return Math.max(t,Math.min(o,e))},r=function(e,t,o,n){var i=o-e,r=n-t;return i*i+r*r},a=function(e,t){return t=void 0!==t?!!t:!1,t&&e==2*Math.PI?2*Math.PI:e-2*Math.floor(e/(2*Math.PI))*Math.PI};this.load=function(){if(we.innerHTML="",Ye&&1===Ye.nodeType)we.appendChild(Ye);else if(Ye&&"string"==typeof Ye)we.innerHTML=Ye;else if(Ge){var e=document.createElement("img");e.setAttribute("src",Ge),e.setAttribute("alt",Ve),we.appendChild(e)}else we.textContent=Ve;return ke=document.createElement("div"),ke.style.width="100%",ke.style.height="100%",ke.style.position="relative",ke.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(ye={width:0,height:0,ratio:0},void(Xe&&!Se.match(/^data:image\/[a-z]+;base64/)?d():c())):void(we.textContent="Canvas is not supported, update your browser!")};var s=function(e){for(var t=0,o=0,n="";-1!=(t=e.indexOf("",t));)if(n=e.substring(t,o),-1!=n.indexOf("GPano:"))return n;return""},l=function(e,t){var o=e.indexOf("GPano:"+t)+t.length+8,n=e.indexOf('"',o);return e.substring(o,n)},d=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(we.textContent="XHR is not supported, update your browser!");try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){e=new ActiveXObject("Microsoft.XMLHTTP")}}e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){var t=s(e.responseText);if(!t.length)return void c();Ne={full_width:parseInt(l(t,"FullPanoWidthPixels")),full_height:parseInt(l(t,"FullPanoHeightPixels")),cropped_width:parseInt(l(t,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(l(t,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(l(t,"CroppedAreaLeftPixels")),cropped_y:parseInt(l(t,"CroppedAreaTopPixels"))},qe=!0,c()}},e.open("GET",Se,!0),e.send(null)},c=function(){var e=new Image;e.onload=function(){var t={full_width:e.width,full_height:e.height,cropped_width:e.width,cropped_height:e.height,cropped_x:null,cropped_y:null};for(var n in Ne)null===Ne[n]&&void 0!==t[n]&&(Ne[n]=t[n]);if(qe){if(Ne.cropped_width!=t.cropped_width){var i=t.cropped_width/Ne.cropped_width;Ne.cropped_width=t.cropped_width,Ne.full_width*=i,Ne.cropped_x*=i}if(Ne.cropped_height!=t.cropped_height){var r=t.cropped_height/Ne.cropped_height;Ne.cropped_height=t.cropped_height,Ne.full_height*=r,Ne.cropped_y*=r}}null===Ne.cropped_x&&(Ne.cropped_x=(Ne.full_width-Ne.cropped_width)/2),null===Ne.cropped_y&&(Ne.cropped_y=(Ne.full_height-Ne.cropped_height)/2);var a=2048;if(o()){var s=document.createElement("canvas"),l=s.getContext("webgl");a=l.getParameter(l.MAX_TEXTURE_SIZE)}var d=Math.min(Ne.full_width,a),c=d/Ne.full_width;Ne.full_width=d,Ne.cropped_width*=c,Ne.cropped_x*=c,e.width=Ne.cropped_width,Ne.full_height*=c,Ne.cropped_height*=c,Ne.cropped_y*=c,e.height=Ne.cropped_height;var h=document.createElement("canvas");h.width=Ne.full_width,h.height=Ne.full_height;var p=h.getContext("2d");p.drawImage(e,Ne.cropped_x,Ne.cropped_y,Ne.cropped_width,Ne.cropped_height),u(h.toDataURL("image/jpeg"))},We&&!Se.match(/^data:image\/[a-z]+;base64/)&&e.setAttribute("crossOrigin","anonymous"),e.src=Se},u=function(e){var t=new THREE.Texture,o=new THREE.ImageLoader,n=function(e){t.needsUpdate=!0,t.image=e,h(t)};o.load(e,n)},h=function(e){void 0!==_e.width&&(we.style.width=_e.width.css),void 0!==_e.height&&(we.style.height=_e.height.css),x(),ze=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer,ze.setSize(ye.width,ye.height),Te=new THREE.Scene,Re=new THREE.PerspectiveCamera(j,ye.ratio,1,300),Re.position.set(0,0,0),Te.add(Re);var t=new THREE.SphereGeometry(200,32,32),i=new THREE.MeshBasicMaterial({map:e,overdraw:!0}),r=new THREE.Mesh(t,i);r.scale.x=-1,Te.add(r),Ee=document.createElement("div"),Ee.style.position="absolute",Ee.style.zIndex=0,ke.appendChild(Ee),me&&(ge.setStyle(ve),ge.create(),ke.appendChild(ge.getBar())),n(window,"resize",x),fe&&(n(Ee,"mousedown",C),n(document,"mousemove",T),n(Ee,"mousemove",X),n(document,"mouseup",z),n(Ee,"touchstart",k),n(document,"touchend",z),n(document,"touchmove",R),be&&(n(Ee,"mousewheel",F),n(Ee,"DOMMouseScroll",F))),n(document,"fullscreenchange",L),n(document,"mozfullscreenchange",L),n(document,"webkitfullscreenchange",L),n(document,"MSFullscreenChange",L),Ae.addListener(H),we.innerHTML="",we.appendChild(ke);var a=ze.domElement;a.style.display="block",Ee.appendChild(a),p(),re>0&&B(re),v(),q("ready")},p=function(){var e=new THREE.Vector3;e.setX(Math.cos(oe)*Math.sin(ne)),e.setY(Math.sin(oe)),e.setZ(Math.cos(oe)*Math.cos(ne)),Re.lookAt(e),null!==Ie?Ie.render(Te,Re):ze.render(Te,Re)},g=function(){Ie=new THREE.StereoEffect(ze),Ie.eyeSeparation=xe,Ie.setSize(ye.width,ye.height),M(),A(),ge.mustBeHidden(),p(),q("stereo-effect",!0)},m=function(){Ie=null,ze.setSize(ye.width,ye.height),ge.mustBeHidden(!1),p(),q("stereo-effect",!1)};this.toggleStereo=function(){null!==Ie?m():g()};var v=function(){le!==!1&&(Le=setTimeout(y,le))},f=function(){oe-=(oe-he)*ue,ne+=de;var e=!0;Q||(ne=i(ne,ee,te),(ne==ee||ne==te)&&(ce?de*=-1:(b(),e=!1))),ne=a(ne,!0),q("position-updated",{longitude:ne,latitude:oe}),p(),e&&(Oe=setTimeout(f,se))},y=function(){f(),q("autorotate",!0)},b=function(){clearTimeout(Le),Le=null,clearTimeout(Oe),Oe=null,q("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(Le),Oe?b():y()};var x=function(){(we.clientWidth!=ye.width||we.clientHeight!=ye.height)&&w({width:we.clientWidth,height:we.clientHeight})};this.fitToContainer=function(){x()};var w=function(e){ye.width=void 0!==e.width?parseInt(e.width):ye.width,ye.height=void 0!==e.height?parseInt(e.height):ye.height,ye.ratio=ye.width/ye.height,Re&&(Re.aspect=ye.ratio,Re.updateProjectionMatrix()),ze&&(ze.setSize(ye.width,ye.height),p()),Ie&&(Ie.setSize(ye.width,ye.height),p())};this.getPosition=function(){return{longitude:ne,latitude:oe}},this.getPositionInDegrees=function(){return{longitude:180*ne/Math.PI,latitude:180*oe/Math.PI}};var _=function(e,t){var o=N(e);Q||(o=i(o,ee,te));var n=N(t);n>Math.PI&&(n-=2*Math.PI),n=i(n,Z,U),ne=o,oe=n,q("position-updated",{longitude:ne,latitude:oe}),p()};this.moveTo=function(e,t){_(e,t)};var C=function(e){E(parseInt(e.clientX),parseInt(e.clientY))},k=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==Ee&&E(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(z(),e.touches[0].target.parentNode==Ee&&e.touches[1].target.parentNode==Ee&&S(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));X()},E=function(e,t){Pe=e,He=t,b(),Me=!0},S=function(e){Be=e,Fe=!0},z=function(e){Me=!1,Fe=!1},T=function(e){e.preventDefault(),I(parseInt(e.clientX),parseInt(e.clientY))},R=function(e){if(1==e.touches.length&&Me){var t=e.touches[0];t.target.parentNode==Ee&&(e.preventDefault(),I(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==Ee&&e.touches[1].target.parentNode==Ee&&Fe){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),n=o-Be;if(0!==n){var i=n/Math.abs(n);B(re+i),Be=o}}},I=function(e,t){Me&&(ne+=(e-Pe)*V,Q||(ne=i(ne,ee,te)),ne=a(ne,!0),oe+=(t-He)*G,oe=i(oe,Z,U),Pe=e,He=t,q("position-updated",{longitude:ne,latitude:oe}),p())},M=function(){Ae.start(),b(),q("device-orientation",!0)},P=function(){Ae.stop(),q("device-orientation",!1)};this.toggleDeviceOrientation=function(){Ae.isEventAttached()?P():M()};var H=function(e){ne=i(e.longitude,ee,te),oe=i(e.latitude,Z,U),q("position-updated",{longitude:ne,latitude:oe}),p()},F=function(e){e.preventDefault(),e.stopPropagation();var t=e.detail?-e.detail:e.wheelDelta;if(0!==t){var o=parseInt(t/Math.abs(t));B(re+o)}},B=function(e){re=i(parseInt(Math.round(e)),0,100),Re.fov=j+re/100*(Y-j),Re.updateProjectionMatrix(),p(),q("zoom-updated",re)};this.getZoomLevel=function(){return re},this.zoom=function(e){B(e)},this.zoomIn=function(){100>re&&B(re+1)},this.zoomOut=function(){re>0&&B(re-1)};var O=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},L=function(){document.webkitFullscreenElement||document.msFullscreenElement?(Ce.width=we.style.width,Ce.height=we.style.height,we.style.width="100%",we.style.height="100%",x()):(we.webkitRequestFullscreen||we.msRequestFullscreen)&&(we.style.width=Ce.width,we.style.height=Ce.height,x()),q("fullscreen-mode",O())},A=function(){we.requestFullscreen?we.requestFullscreen():we.mozRequestFullScreen?we.mozRequestFullScreen():we.webkitRequestFullscreen?we.webkitRequestFullscreen():we.msRequestFullscreen&&we.msRequestFullscreen()},D=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){O()?D():A()};var X=function(){me&&ge.show()},W=function(e){e=e.toString().trim();var t=parseFloat(e.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),o=e.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();o.match(/(pm|per minute)$/)&&(t/=60);var n=0;switch(o){case"rpm":case"rev per minute":case"revolutions per minute":case"rps":case"rev per second":case"revolutions per second":n=2*t*Math.PI;break;case"dpm":case"deg per minute":case"degrees per minute":case"dps":case"deg per second":case"degrees per second":n=t*Math.PI/180;break;case"rad per minute":case"radians per minute":case"rad per second":case"radians per second":n=t;break;default:m_anim=!1}return n*se/1e3},N=function(e){e=e.toString().trim();var t=parseFloat(e.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),o=e.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();return"deg"==o&&(t*=Math.PI/180),a(t)},$=function(e){for(var t in e)if("width"==t||"height"==t){var o=e[t].toString().trim(),n=parseFloat(o.replace(/^([0-9]+(?:\.[0-9]*)?).*$/,"$1")),i=o.replace(/^[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();"%"!=i&&(i="px"),_e[t]={css:n+i,unit:i}}};this.addAction=function(e,t){e in De||(De[e]=[]),De[e].push(t)};var q=function(e,t){if(e in De&&De[e].length)for(var o=0,n=De[e].length;n>o;++o)void 0!==t?De[e][o](t):De[e][o]()};if(void 0===e||void 0===e.panorama||void 0===e.container)return void console.log("PhotoSphereViewer: no value given for panorama or container");var V=void 0!==e.long_offset?N(e.long_offset):Math.PI/360,G=void 0!==e.lat_offset?N(e.lat_offset):Math.PI/180,Y=void 0!==e.min_fov?i(parseFloat(e.min_fov),1,179):30,j=void 0!==e.max_fov?i(parseFloat(e.max_fov),1,179):90,U=void 0!==e.tilt_up_max?i(N(e.tilt_up_max),0,Math.PI/2):Math.PI/2,Z=void 0!==e.tilt_down_max?-i(N(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,K=void 0!==e.min_longitude?N(e.min_longitude):0,J=void 0!==e.max_longitude?N(e.max_longitude):0,Q=K==J;Q?(K=0,J=2*Math.PI):0===J&&(J=2*Math.PI);var ee,te;J>K?(ee=K,te=J):(ee=J,te=K);var oe=0,ne=ee;if(void 0!==e.default_position){if(void 0!==e.default_position.lat){var ie=N(e.default_position.lat);ie>Math.PI&&(ie-=2*Math.PI),oe=i(ie,Z,U)}void 0!==e.default_position["long"]&&(ne=i(N(e.default_position["long"]),ee,te))}var re=0;void 0!==e.zoom_level&&(re=i(parseInt(Math.round(e.zoom_level)),0,100));var ae=60,se=1e3/ae,le=2e3;void 0!==e.time_anim&&(le="number"==typeof e.time_anim&&e.time_anim>=0?e.time_anim:!1);var de=W(void 0!==e.anim_speed?e.anim_speed:"2rpm"),ce=!0;void 0!==e.reverse_anim&&(ce=!!e.reverse_anim);var ue=W(void 0!==e.vertical_anim_speed?e.vertical_anim_speed:"2rpm"),he=0;if(void 0!==e.vertical_anim_target){var pe=N(e.vertical_anim_target);pe>Math.PI&&(pe-=2*Math.PI),he=i(pe,Z,U)}var ge=new PSVNavBar(this),me=void 0!==e.navbar?!!e.navbar:!1,ve=void 0!==e.navbar_style?e.navbar_style:{},fe=void 0!==e.allow_user_interactions?!!e.allow_user_interactions:!0;fe||(me=!1);var ye,be=void 0!==e.allow_scroll_to_zoom?!!e.allow_scroll_to_zoom:!0,xe=void 0!==e.eyes_offset?parseFloat(e.eyes_offset):5,we="string"==typeof e.container?document.getElementById(e.container):e.container,_e={},Ce={};void 0!==e.size&&$(e.size);var ke,Ee,Se=e.panorama,ze=null,Te=null,Re=null,Ie=null,Me=!1,Pe=0,He=0,Fe=!1,Be=0,Oe=null,Le=null,Ae=new Sphoords,De={},Xe=void 0!==e.usexmpdata?!!e.usexmpdata:!0,We=void 0!==e.cors_anonymous?!!e.cors_anonymous:!0,Ne={full_width:null,full_height:null,cropped_width:null,cropped_height:null,cropped_x:null,cropped_y:null};if(void 0!==e.pano_size){for(var $e in Ne)void 0!==e.pano_size[$e]&&(Ne[$e]=parseInt(e.pano_size[$e]));Xe=!1}var qe=!1,Ve=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",Ge=void 0!==e.loading_img?e.loading_img.toString():null,Ye=void 0!==e.loading_html?e.loading_html:null;void 0!==e.onready&&this.addAction("ready",e.onready);var je=void 0!==e.autoload?!!e.autoload:!0;je&&this.load()},PSVNavBar=function(e){var t=function(e,t){for(var o=0,n=t.length;n>o;++o)if(t[o]==e)return!0;return!1},o=function(e,o){return t(e,h)&&"string"==typeof o&&("transparent"==o||!!o.match(/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/)||!!o.match(/^rgb\((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])(,\s*(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}\)$/)||!!o.match(/^rgba\(((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),\s*){3}(0(\.[0-9]*)?|1)\)$/))||t(e,p)&&!isNaN(parseFloat(o))&&isFinite(o)&&o>=0};this.setStyle=function(e){for(var t in e)t in u&&o(t,e[t])&&(u[t]=e[t])},this.create=function(){r=document.createElement("div"),r.style.backgroundColor=u.backgroundColor,r.style.position="absolute",r.style.zIndex=10,r.style.bottom=0,r.style.width="100%",r.style.boxSizing="content-box",r.style.transition="bottom 0.4s ease-out",a=new PSVNavBarButton(e,"autorotate",u),r.appendChild(a.getButton()),s=new PSVNavBarButton(e,"zoom",u),r.appendChild(s.getButton()),l=new PSVNavBarButton(e,"fullscreen",u),r.appendChild(l.getButton()),Sphoords.isDeviceOrientationSupported&&(d=new PSVNavBarButton(e,"orientation",u),r.appendChild(d.getButton()),c=new PSVNavBarButton(e,"virtual-reality",u),r.appendChild(c.getButton()))},this.getBar=function(){return r};var n=function(){g&&(clearTimeout(g),!m&&v&&(g=setTimeout(i,5e3))),m&&(r.style.bottom=0,m=!1,v&&(g=setTimeout(i,5e3)))};this.show=function(){n()};var i=function(){m||(r.style.bottom=-r.offsetHeight+1+"px",m=!0)};this.hide=function(){i()},this.isHidden=function(){return m},this.mustBeHidden=function(e){v=void 0!==e?!!e:!0,v?i():n()};var r,a,s,l,d,c,u={backgroundColor:"rgba(61, 61, 61, 0.5)",buttonsColor:"rgba(255, 255, 255, 0.7)",buttonsBackgroundColor:"transparent",activeButtonsBackgroundColor:"rgba(255, 255, 255, 0.1)",buttonsHeight:20,autorotateThickness:1,zoomRangeWidth:50,zoomRangeThickness:1,zoomRangeDisk:7,fullscreenRatio:4/3,fullscreenThickness:2,gyroscopeThickness:1,virtualRealityRatio:4/3,virtualRealityBorderRadius:2},h=["backgroundColor","buttonsColor","buttonsBackgroundColor","activeButtonsBackgroundColor"],p=["buttonsHeight","autorotateThickness","zoomRangeWidth","zoomRangeThickness","zoomRangeDisk","fullscreenRatio","fullscreenThickness"],g=null,m=!1,v=!1},PSVNavBarButton=function(e,t,o){var n=function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)},i=function(){switch(t){case"autorotate":var i=o.buttonsHeight-2*o.autorotateThickness,p=i/10;l=document.createElement("div"),l.style.cssFloat="left",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=o.buttonsHeight+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.position="relative",l.style.cursor="pointer",n(l,"click",function(){e.toggleAutorotate()});var f=document.createElement("div");f.style.boxSizing="inherit",f.style.width=i+"px",f.style.height=i+"px",f.style.borderRadius="50%",f.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,l.appendChild(f);var y=document.createElement("div");y.style.boxSizing="inherit",y.style.width=i+"px",y.style.height=p+"px",y.style.borderRadius="50%",y.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,y.style.position="absolute",y.style.top="50%",y.style.marginTop=-(p/2+o.autorotateThickness)+"px",l.appendChild(y),e.addAction("autorotate",d);break;case"zoom":l=document.createElement("div"),l.style.cssFloat="left",l.style.boxSizing="inherit";var b=document.createElement("div");b.style.cssFloat="left",b.style.boxSizing="inherit",b.style.padding="10px",b.style.height=o.buttonsHeight+"px",b.style.backgroundColor=o.buttonsBackgroundColor,b.style.lineHeight=o.buttonsHeight+"px",b.style.color=o.buttonsColor,b.style.cursor="pointer",b.textContent="-",n(b,"click",function(){e.zoomOut()}),l.appendChild(b),r=document.createElement("div"),r.style.cssFloat="left",r.style.boxSizing="inherit",r.style.padding=10+(o.buttonsHeight-o.zoomRangeThickness)/2+"px 5px",r.style.backgroundColor=o.buttonsBackgroundColor,r.style.cursor="pointer",l.appendChild(r),a=document.createElement("div"),a.style.boxSizing="inherit",a.style.width=o.zoomRangeWidth+"px",a.style.height=o.zoomRangeThickness+"px",a.style.backgroundColor=o.buttonsColor,a.style.position="relative",r.appendChild(a),s=document.createElement("div"),s.style.position="absolute",s.style.top=(o.zoomRangeThickness-o.zoomRangeDisk)/2+"px",s.style.left=-(o.zoomRangeDisk/2)+"px",s.style.boxSizing="inherit",s.style.width=o.zoomRangeDisk+"px",s.style.height=o.zoomRangeDisk+"px",s.style.borderRadius="50%",s.style.backgroundColor=o.buttonsColor,e.addAction("zoom-updated",c),n(r,"mousedown",u),n(r,"touchstart",h),n(document,"mousemove",m),n(document,"touchmove",v),n(document,"mouseup",g),n(document,"touchend",g),a.appendChild(s);var x=document.createElement("div");x.style.cssFloat="left",x.style.boxSizing="inherit",x.style.padding="10px",x.style.height=o.buttonsHeight+"px",x.style.backgroundColor=o.buttonsBackgroundColor,x.style.lineHeight=o.buttonsHeight+"px",x.style.color=o.buttonsColor,x.style.cursor="pointer",x.textContent="+",n(x,"click",function(){e.zoomIn()}),l.appendChild(x);break;case"fullscreen":var w=o.buttonsHeight*o.fullscreenRatio,_=.3*o.buttonsHeight,C=(o.buttonsHeight-_)/2,k=.3*w,E=(w-k)/2-o.fullscreenThickness,S=o.buttonsHeight-2*o.fullscreenThickness;l=document.createElement("div"),l.style.cssFloat="right",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=w+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.cursor="pointer",n(l,"click",function(){e.toggleFullscreen()});var z=document.createElement("div");z.style.cssFloat="left",z.style.boxSizing="inherit",z.style.width=o.fullscreenThickness+"px",z.style.height=_+"px",z.style.borderStyle="solid",z.style.borderColor=o.buttonsColor+" transparent",z.style.borderWidth=C+"px 0",l.appendChild(z);var T=document.createElement("div");T.style.cssFloat="left",T.style.boxSizing="inherit",T.style.width=E+"px",T.style.height=S+"px",T.style.borderStyle="solid",T.style.borderColor=o.buttonsColor+" transparent",T.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(T);var R=document.createElement("div");R.style.cssFloat="left",R.style.boxSizing="inherit",R.style.marginLeft=k+"px",R.style.width=E+"px",R.style.height=S+"px",R.style.borderStyle="solid",R.style.borderColor=o.buttonsColor+" transparent",R.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(R);var I=document.createElement("div");I.style.cssFloat="left",I.style.boxSizing="inherit",I.style.width=o.fullscreenThickness+"px",I.style.height=_+"px",I.style.borderStyle="solid",I.style.borderColor=o.buttonsColor+" transparent",I.style.borderWidth=C+"px 0",l.appendChild(I);var M=document.createElement("div");M.style.clear="left",l.appendChild(M),e.addAction("fullscreen-mode",d);break;case"orientation":var P=o.buttonsHeight-2*o.gyroscopeThickness,H=P-4*o.gyroscopeThickness,F=P/10;l=document.createElement("div"),l.style.cssFloat="right",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=o.buttonsHeight+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.position="relative",l.style.cursor="pointer",n(l,"click",function(){e.toggleDeviceOrientation()});var B=document.createElement("div");B.style.boxSizing="inherit",B.style.width=P+"px",B.style.height=P+"px",B.style.borderRadius="50%",B.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,l.appendChild(B);var O=document.createElement("div");O.style.boxSizing="inherit",O.style.width=H+"px",O.style.height=F+"px",O.style.borderRadius="50%",O.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,O.style.position="absolute",O.style.top="50%",O.style.left="50%",O.style.marginTop=-(F/2+o.gyroscopeThickness)+"px",O.style.marginLeft=-(H/2+o.gyroscopeThickness)+"px",l.appendChild(O);var L=document.createElement("div");L.style.boxSizing="inherit",L.style.width=F+"px",L.style.height=H+"px",L.style.borderRadius="50%",L.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,L.style.position="absolute",L.style.top="50%",L.style.left="50%",L.style.marginTop=-(H/2+o.gyroscopeThickness)+"px",L.style.marginLeft=-(F/2+o.gyroscopeThickness)+"px",l.appendChild(L),e.addAction("device-orientation",d);break;case"virtual-reality":var A=o.buttonsHeight*o.virtualRealityRatio,D=A/4,X=D/2;l=document.createElement("div"),l.style.cssFloat="right",l.style.position="relative",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=A+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.cursor="pointer",n(l,"click",function(){e.toggleStereo()});var W=document.createElement("div");W.style.boxSizing="inherit",W.style.width=A+"px",W.style.height=o.buttonsHeight+"px",W.style.borderRadius=o.virtualRealityBorderRadius+"px",W.style.backgroundColor=o.buttonsColor,l.appendChild(W);var N=document.createElement("div");N.style.boxSizing="inherit",N.style.width=D+"px",N.style.height=D+"px",N.style.position="absolute",N.style.top=X+10+"px",N.style.left=X+10+"px",N.style.borderRadius="50%",N.style.backgroundColor=o.backgroundColor,l.appendChild(N);var $=document.createElement("div");$.style.boxSizing="inherit",$.style.width=D+"px",$.style.height=D+"px",$.style.position="absolute",$.style.top=X+10+"px",$.style.right=X+10+"px",$.style.borderRadius="50%",$.style.backgroundColor=o.backgroundColor,l.appendChild($);var q=document.createElement("div");q.style.boxSizing="inherit",q.style.width=D+"px",q.style.height=o.buttonsHeight/2+"px",q.style.position="absolute",q.style.left="50%",q.style.bottom="10px",q.style.marginLeft=-(D/2)+"px",q.style.borderTopLeftRadius="50% 60%",q.style.borderTopRightRadius="50% 60%",q.style.backgroundColor=o.backgroundColor,l.appendChild(q),e.addAction("stereo-effect",d)}};this.getButton=function(){return l};var r,a,s,l,d=function(e){e?l.style.backgroundColor=o.activeButtonsBackgroundColor:l.style.backgroundColor=o.buttonsBackgroundColor},c=function(e){s.style.left=e/100*o.zoomRangeWidth-o.zoomRangeDisk/2+"px"},u=function(e){p(parseInt(e.clientX))},h=function(e){var t=e.touches[0];(t.target==r||t.target==a||t.target==s)&&p(parseInt(t.clientX))},p=function(e){y=!0,f(e)},g=function(e){y=!1},m=function(e){e.preventDefault(),f(parseInt(e.clientX))},v=function(e){var t=e.touches[0];(t.target==r||t.target==a||t.target==s)&&(e.preventDefault(),f(parseInt(t.clientX)))},f=function(t){if(y){var n=t-a.getBoundingClientRect().left,i=n/o.zoomRangeWidth*100;e.zoom(i)}},y=!1;i()},Sphoords=function(){var e=function(){var e=navigator.userAgent;return/Gecko\/[0-9.]+/.test(e)?"Gecko":/Chrome\/[0-9.]+/.test(e)?"Blink":/AppleWebKit\/[0-9.]+/.test(e)?"WebKit":/Trident\/[0-9.]+/.test(e)?"Trident":/Opera\/[0-9.]+/.test(e)?"Presto":"Gecko"},t=function(e){return e-360*Math.floor(e/360)};this.start=function(){return Sphoords.isDeviceOrientationSupported?(window.addEventListener("deviceorientation",o,!1),i=!0,!0):(console.log("Device Orientation API not supported"),!1)},this.stop=function(){i&&(window.removeEventListener("deviceorientation",o,!1),i=!1)},this.toggle=function(){i?this.stop():this.start()},this.isEventAttached=function(){return i};var o=function(e){c=Sphoords.getScreenOrientation();var o=0,i=0;switch(c){case"portrait-primary":o=e.alpha+e.gamma,i=e.beta-90;break;case"landscape-primary":if(o=e.alpha+e.beta-90,i=-e.gamma-90,Math.abs(e.beta)>90)switch(u){case"Blink":i+=180;break;case"Gecko":default:i=-i}break;case"landscape-secondary":if(o=e.alpha-e.beta+90,i=e.gamma-90,Math.abs(e.beta)>90)switch(u){case"Blink":i+=180;break;case"Gecko":default:i=-i}break;case"portrait-secondary":o=e.alpha-e.gamma,i=180-(e.beta-90),i=270-e.beta}i=t(i),i>=180&&(i-=360),r=t(o),a=Math.max(-90,Math.min(90,i)),s=r*d,l=a*d,n()};this.getCoordinates=function(){return{longitude:s,latitude:l}},this.getCoordinatesInDegrees=function(){return{longitude:r,latitude:a}},this.getScreenOrientation=function(){return c},this.addListener=function(e){h.push(e)};var n=function(){if(h.length)for(var e=0,t=h.length;t>e;++e)h[e]({longitude:s,latitude:l})},i=!1,r=0,a=0,s=0,l=0,d=Math.PI/180,c=Sphoords.getScreenOrientation(),u=e(),h=[]};Sphoords.getScreenOrientation=function(){var e=null;return screen.orientation?e=screen.orientation:screen.mozOrientation?e=screen.mozOrientation:screen.msOrientation&&(e=screen.msOrientation),null!==e&&"object"==typeof e?e.type:e},Sphoords.isDeviceOrientationSupported=!1,function(){function e(t){null!==t&&null!==t.alpha&&(Sphoords.isDeviceOrientationSupported=!0,window.removeEventListener("deviceorientation",e))}window.DeviceOrientationEvent&&null!==Sphoords.getScreenOrientation()&&window.addEventListener("deviceorientation",e)}(); \ No newline at end of file +var PhotoSphereViewer=function(e){var t=function(){var e=document.createElement("canvas");return!(!e.getContext||!e.getContext("2d"))},o=function(){var e=document.createElement("canvas");return!(!window.WebGLRenderingContext||!e.getContext("webgl"))},i=function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)},n=function(e,t,o){return Math.max(t,Math.min(o,e))},r=function(e,t,o,i){var n=o-e,r=i-t;return n*n+r*r},a=function(e,t){return t=void 0!==t?!!t:!1,t&&e==2*Math.PI?2*Math.PI:e-2*Math.floor(e/(2*Math.PI))*Math.PI};this.load=function(){if(Ce.innerHTML="",Ze&&1===Ze.nodeType)Ce.appendChild(Ze);else if(Ze&&"string"==typeof Ze)Ce.innerHTML=Ze;else if(Ue){var e=document.createElement("img");e.setAttribute("src",Ue),e.setAttribute("alt",je),Ce.appendChild(e)}else Ce.textContent=je;return Ee=document.createElement("div"),Ee.style.width="100%",Ee.style.height="100%",Ee.style.position="relative",Ee.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(xe={width:0,height:0,ratio:0},void(Ne&&!Te.match(/^data:image\/[a-z]+;base64/)?d():c())):void(Ce.textContent="Canvas is not supported, update your browser!")};var s=function(e){for(var t=0,o=0,i="";-1!=(t=e.indexOf("",t));)if(i=e.substring(t,o),-1!=i.indexOf("GPano:"))return i;return""},l=function(e,t){var o=e.indexOf("GPano:"+t)+t.length+8,i=e.indexOf('"',o);return e.substring(o,i)},d=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(Ce.textContent="XHR is not supported, update your browser!");try{e=new ActiveXObject("Msxml2.XMLHTTP")}catch(t){e=new ActiveXObject("Microsoft.XMLHTTP")}}e.onreadystatechange=function(){if(4==e.readyState&&200==e.status){var t=s(e.responseText);if(!t.length)return void c();qe={full_width:parseInt(l(t,"FullPanoWidthPixels")),full_height:parseInt(l(t,"FullPanoHeightPixels")),cropped_width:parseInt(l(t,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(l(t,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(l(t,"CroppedAreaLeftPixels")),cropped_y:parseInt(l(t,"CroppedAreaTopPixels"))},Ye=!0,c()}},e.open("GET",Te,!0),e.send(null)},c=function(){var e=new Image;e.onload=function(){var t={full_width:e.width,full_height:e.height,cropped_width:e.width,cropped_height:e.height,cropped_x:null,cropped_y:null};if(360!=Ge.horizontal_fov||180!=Ge.vertical_fov){if(qe.cropped_width=t.cropped_width,qe.cropped_height=t.cropped_height,qe.full_width=t.full_width,qe.full_height=t.full_height,360!=Ge.horizontal_fov){var i=Ge.horizontal_fov/360;qe.full_width=qe.cropped_width/i}if(180!=Ge.vertical_fov){var n=Ge.vertical_fov/180;qe.full_height=qe.cropped_height/n}}else{for(var r in qe)null===qe[r]&&void 0!==t[r]&&(qe[r]=t[r]);if(Ye){if(qe.cropped_width!=t.cropped_width){var a=t.cropped_width/qe.cropped_width;qe.cropped_width=t.cropped_width,qe.full_width*=a,qe.cropped_x*=a}if(qe.cropped_height!=t.cropped_height){var s=t.cropped_height/qe.cropped_height;qe.cropped_height=t.cropped_height,qe.full_height*=s,qe.cropped_y*=s}}}null===qe.cropped_x&&(qe.cropped_x=(qe.full_width-qe.cropped_width)/2),null===qe.cropped_y&&(qe.cropped_y=(qe.full_height-qe.cropped_height)/2);var l=2048;if(o()){var d=document.createElement("canvas"),c=d.getContext("webgl");l=c.getParameter(c.MAX_TEXTURE_SIZE)}var h=Math.min(qe.full_width,l),p=h/qe.full_width;qe.full_width=h,qe.cropped_width*=p,qe.cropped_x*=p,e.width=qe.cropped_width,qe.full_height*=p,qe.cropped_height*=p,qe.cropped_y*=p,e.height=qe.cropped_height;var g=document.createElement("canvas");g.width=qe.full_width,g.height=qe.full_height;var v=g.getContext("2d");v.drawImage(e,qe.cropped_x,qe.cropped_y,qe.cropped_width,qe.cropped_height),u(g.toDataURL("image/jpeg"))},$e&&!Te.match(/^data:image\/[a-z]+;base64/)&&e.setAttribute("crossOrigin","anonymous"),e.src=Te},u=function(e){var t=new THREE.Texture,o=new THREE.ImageLoader,i=function(e){t.needsUpdate=!0,t.image=e,h(t)};o.load(e,i)},h=function(e){void 0!==ke.width&&(Ce.style.width=ke.width.css),void 0!==ke.height&&(Ce.style.height=ke.height.css),x(),Re=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer,Re.setSize(xe.width,xe.height),Ie=new THREE.Scene,Me=new THREE.PerspectiveCamera(U,xe.ratio,1,300),Me.position.set(0,0,0),Ie.add(Me);var t=new THREE.SphereGeometry(200,32,32),n=new THREE.MeshBasicMaterial({map:e,overdraw:!0}),r=new THREE.Mesh(t,n);if(r.scale.x=-1,Ie.add(r),Se=document.createElement("div"),Se.style.position="absolute",Se.style.zIndex=0,Ee.appendChild(Se),fe&&(me.setStyle(ye),me.create(),Ee.appendChild(me.getBar())),null!==Ke){var a=document.createElement("img");a.onload=function(){a.style.display="block",a.style.position="absolute",a.style[Ke.position.x]="5px",a.style[Ke.position.y]="5px","bottom"==Ke.position.y&&fe&&(a.style.bottom=me.getBar().offsetHeight+5+"px"),void 0!==Ke.size&&(a.style.width=Ke.size.width,a.style.height=Ke.size.height),Ee.appendChild(a)},a.src=Ke.image}i(window,"resize",x),be&&(i(Se,"mousedown",C),i(document,"mousemove",T),i(Se,"mousemove",X),i(document,"mouseup",S),i(Se,"touchstart",k),i(document,"touchend",S),i(document,"touchmove",R),we&&(i(Se,"mousewheel",F),i(Se,"DOMMouseScroll",F))),i(document,"fullscreenchange",L),i(document,"mozfullscreenchange",L),i(document,"webkitfullscreenchange",L),i(document,"MSFullscreenChange",L),Xe.addListener(H),Ce.innerHTML="",Ce.appendChild(Ee);var s=Re.domElement;s.style.display="block",Se.appendChild(s),p(),ae>0&&B(ae),m(),q("ready")},p=function(){var e=new THREE.Vector3;e.setX(Math.cos(ie)*Math.sin(ne)),e.setY(Math.sin(ie)),e.setZ(Math.cos(ie)*Math.cos(ne)),Me.lookAt(e),null!==Pe?Pe.render(Ie,Me):Re.render(Ie,Me)},g=function(){Pe=new THREE.StereoEffect(Re),Pe.eyeSeparation=_e,Pe.setSize(xe.width,xe.height),M(),A(),me.mustBeHidden(),p(),q("stereo-effect",!0)},v=function(){Pe=null,Re.setSize(xe.width,xe.height),me.mustBeHidden(!1),p(),q("stereo-effect",!1)};this.toggleStereo=function(){null!==Pe?v():g()};var m=function(){ce!==!1&&(De=setTimeout(y,ce))},f=function(){ie-=(ie-ge)*pe,ne+=ue;var e=!0;ee||(ne=n(ne,te,oe),(ne==te||ne==oe)&&(he?ue*=-1:(b(),e=!1))),ne=a(ne,!0),q("position-updated",{longitude:ne,latitude:ie}),p(),e&&(Ae=setTimeout(f,de))},y=function(){f(),q("autorotate",!0)},b=function(){clearTimeout(De),De=null,clearTimeout(Ae),Ae=null,q("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(De),Ae?b():y()};var x=function(){(Ce.clientWidth!=xe.width||Ce.clientHeight!=xe.height)&&w({width:Ce.clientWidth,height:Ce.clientHeight})};this.fitToContainer=function(){x()};var w=function(e){xe.width=void 0!==e.width?parseInt(e.width):xe.width,xe.height=void 0!==e.height?parseInt(e.height):xe.height,xe.ratio=xe.width/xe.height,Me&&(Me.aspect=xe.ratio,Me.updateProjectionMatrix()),Re&&(Re.setSize(xe.width,xe.height),p()),Pe&&(Pe.setSize(xe.width,xe.height),p())};this.getPosition=function(){return{longitude:ne,latitude:ie}},this.getPositionInDegrees=function(){return{longitude:180*ne/Math.PI,latitude:180*ie/Math.PI}};var _=function(e,t){var o=N(e);ee||(o=n(o,te,oe));var i=N(t);i>Math.PI&&(i-=2*Math.PI),i=n(i,K,Z),ne=o,ie=i,q("position-updated",{longitude:ne,latitude:ie}),p()};this.moveTo=function(e,t){_(e,t)};var C=function(e){z(parseInt(e.clientX),parseInt(e.clientY))},k=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==Se&&z(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(S(),e.touches[0].target.parentNode==Se&&e.touches[1].target.parentNode==Se&&E(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));X()},z=function(e,t){Fe=e,Be=t,b(),He=!0},E=function(e){Le=e,Oe=!0},S=function(e){He=!1,Oe=!1},T=function(e){e.preventDefault(),I(parseInt(e.clientX),parseInt(e.clientY))},R=function(e){if(1==e.touches.length&&He){var t=e.touches[0];t.target.parentNode==Se&&(e.preventDefault(),I(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==Se&&e.touches[1].target.parentNode==Se&&Oe){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),i=o-Le;if(0!==i){var n=i/Math.abs(i);B(ae+n),Le=o}}},I=function(e,t){He&&(V?(ne+=(e-Fe)/xe.height*se*Math.PI/180,ie+=(t-Be)/xe.height*se*Math.PI/180):(ne+=(e-Fe)*G,ie+=(t-Be)*Y),Fe=e,Be=t,ee||(ne=n(ne,te,oe)),ne=a(ne,!0),ie=n(ie,K,Z),q("position-updated",{longitude:ne,latitude:ie}),p())},M=function(){Xe.start(),b(),q("device-orientation",!0)},P=function(){Xe.stop(),q("device-orientation",!1)};this.toggleDeviceOrientation=function(){Xe.isEventAttached()?P():M()};var H=function(e){ne=n(e.longitude,te,oe),ie=n(e.latitude,K,Z),q("position-updated",{longitude:ne,latitude:ie}),p()},F=function(e){e.preventDefault(),e.stopPropagation();var t=e.detail?-e.detail:e.wheelDelta;if(0!==t){var o=parseInt(t/Math.abs(t));B(ae+o)}},B=function(e){ae=n(parseInt(Math.round(e)),0,100),se=U+ae/100*(j-U),Me.fov=se,Me.updateProjectionMatrix(),p(),q("zoom-updated",ae)};this.getZoomLevel=function(){return ae},this.zoom=function(e){B(e)},this.zoomIn=function(){100>ae&&B(ae+1)},this.zoomOut=function(){ae>0&&B(ae-1)};var O=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},L=function(){document.webkitFullscreenElement||document.msFullscreenElement?(ze.width=Ce.style.width,ze.height=Ce.style.height,Ce.style.width="100%",Ce.style.height="100%",x()):(Ce.webkitRequestFullscreen||Ce.msRequestFullscreen)&&(Ce.style.width=ze.width,Ce.style.height=ze.height,x()),q("fullscreen-mode",O())},A=function(){Ce.requestFullscreen?Ce.requestFullscreen():Ce.mozRequestFullScreen?Ce.mozRequestFullScreen():Ce.webkitRequestFullscreen?Ce.webkitRequestFullscreen():Ce.msRequestFullscreen&&Ce.msRequestFullscreen()},D=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){O()?D():A()};var X=function(){fe&&me.show()},W=function(e){e=e.toString().trim();var t=parseFloat(e.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),o=e.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();o.match(/(pm|per minute)$/)&&(t/=60);var i=0;switch(o){case"rpm":case"rev per minute":case"revolutions per minute":case"rps":case"rev per second":case"revolutions per second":i=2*t*Math.PI;break;case"dpm":case"deg per minute":case"degrees per minute":case"dps":case"deg per second":case"degrees per second":i=t*Math.PI/180;break;case"rad per minute":case"radians per minute":case"rad per second":case"radians per second":i=t;break;default:m_anim=!1}return i*de/1e3},N=function(e){e=e.toString().trim();var t=parseFloat(e.replace(/^(-?[0-9]+(?:\.[0-9]*)?).*$/,"$1")),o=e.replace(/^-?[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();return"deg"==o&&(t*=Math.PI/180),a(t)},$=function(e){for(var t in e)if("width"==t||"height"==t){var o=e[t].toString().trim(),i=parseFloat(o.replace(/^([0-9]+(?:\.[0-9]*)?).*$/,"$1")),n=o.replace(/^[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();"%"!=n&&(n="px"),ke[t]={css:i+n,unit:n}}};this.addAction=function(e,t){e in We||(We[e]=[]),We[e].push(t)};var q=function(e,t){if(e in We&&We[e].length)for(var o=0,i=We[e].length;i>o;++o)void 0!==t?We[e][o](t):We[e][o]()};if(void 0===e||void 0===e.panorama||void 0===e.container)return void console.log("PhotoSphereViewer: no value given for panorama or container");var V=void 0!==e.smooth_user_moves?!!e.smooth_user_moves:!0,G=void 0!==e.long_offset?N(e.long_offset):Math.PI/360,Y=void 0!==e.lat_offset?N(e.lat_offset):Math.PI/180,j=void 0!==e.min_fov?n(parseFloat(e.min_fov),1,179):30,U=void 0!==e.max_fov?n(parseFloat(e.max_fov),1,179):90,Z=void 0!==e.tilt_up_max?n(N(e.tilt_up_max),0,Math.PI/2):Math.PI/2,K=void 0!==e.tilt_down_max?-n(N(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,J=void 0!==e.min_longitude?N(e.min_longitude):0,Q=void 0!==e.max_longitude?N(e.max_longitude):0,ee=J==Q;ee?(J=0,Q=2*Math.PI):0===Q&&(Q=2*Math.PI);var te,oe;Q>J?(te=J,oe=Q):(te=Q,oe=J);var ie=0,ne=te;if(void 0!==e.default_position){if(void 0!==e.default_position.lat){var re=N(e.default_position.lat);re>Math.PI&&(re-=2*Math.PI),ie=n(re,K,Z)}void 0!==e.default_position["long"]&&(ne=n(N(e.default_position["long"]),te,oe))}var ae=0;void 0!==e.zoom_level&&(ae=n(parseInt(Math.round(e.zoom_level)),0,100));var se=U+ae/100*(j-U),le=60,de=1e3/le,ce=2e3;void 0!==e.time_anim&&(ce="number"==typeof e.time_anim&&e.time_anim>=0?e.time_anim:!1);var ue=W(void 0!==e.anim_speed?e.anim_speed:"2rpm"),he=!0;void 0!==e.reverse_anim&&(he=!!e.reverse_anim);var pe=W(void 0!==e.vertical_anim_speed?e.vertical_anim_speed:"2rpm"),ge=0;if(void 0!==e.vertical_anim_target){var ve=N(e.vertical_anim_target);ve>Math.PI&&(ve-=2*Math.PI),ge=n(ve,K,Z)}var me=new PSVNavBar(this),fe=void 0!==e.navbar?!!e.navbar:!1,ye=void 0!==e.navbar_style?e.navbar_style:{},be=void 0!==e.allow_user_interactions?!!e.allow_user_interactions:!0;be||(fe=!1);var xe,we=void 0!==e.allow_scroll_to_zoom?!!e.allow_scroll_to_zoom:!0,_e=void 0!==e.eyes_offset?parseFloat(e.eyes_offset):5,Ce="string"==typeof e.container?document.getElementById(e.container):e.container,ke={},ze={};void 0!==e.size&&$(e.size);var Ee,Se,Te=e.panorama,Re=null,Ie=null,Me=null,Pe=null,He=!1,Fe=0,Be=0,Oe=!1,Le=0,Ae=null,De=null,Xe=new Sphoords,We={},Ne=void 0!==e.usexmpdata?!!e.usexmpdata:!0,$e=void 0!==e.cors_anonymous?!!e.cors_anonymous:!0,qe={full_width:null,full_height:null,cropped_width:null,cropped_height:null,cropped_x:null,cropped_y:null};if(void 0!==e.pano_size){for(var Ve in qe)void 0!==e.pano_size[Ve]&&(qe[Ve]=parseInt(e.pano_size[Ve]));Ne=!1}var Ge={horizontal_fov:360,vertical_fov:180};if(void 0!==e.captured_view){for(var Ve in Ge)void 0!==e.captured_view[Ve]&&(Ge[Ve]=parseFloat(e.captured_view[Ve]));Ne=!1}var Ye=!1,je=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",Ue=void 0!==e.loading_img?e.loading_img.toString():null,Ze=void 0!==e.loading_html?e.loading_html:null,Ke=null;void 0!==e.overlay&&void 0!==e.overlay.image&&(Ke={image:e.overlay.image,position:{x:"left",y:"bottom"}},void 0!==e.overlay.position&&(void 0===e.overlay.position.x||"left"!=e.overlay.position.x&&"right"!=e.overlay.position.x||(Ke.position.x=e.overlay.position.x),void 0===e.overlay.position.y||"top"!=e.overlay.position.y&&"bottom"!=e.overlay.position.y||(Ke.position.y=e.overlay.position.y)),void 0!==e.overlay.size&&(Ke.size={width:void 0!==e.overlay.size.width?e.overlay.size.width:"auto",height:void 0!==e.overlay.size.height?e.overlay.size.height:"auto"})),void 0!==e.onready&&this.addAction("ready",e.onready);var Je=void 0!==e.autoload?!!e.autoload:!0;Je&&this.load()},PSVNavBar=function(e){var t=function(e,t){for(var o=0,i=t.length;i>o;++o)if(t[o]==e)return!0;return!1},o=function(e,o){return t(e,h)&&"string"==typeof o&&("transparent"==o||!!o.match(/^#([0-9A-Fa-f]{3}|[0-9A-Fa-f]{6})$/)||!!o.match(/^rgb\((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])(,\s*(1?[0-9]{1,2}|2[0-4][0-9]|25[0-5])){2}\)$/)||!!o.match(/^rgba\(((1?[0-9]{1,2}|2[0-4][0-9]|25[0-5]),\s*){3}(0(\.[0-9]*)?|1)\)$/))||t(e,p)&&!isNaN(parseFloat(o))&&isFinite(o)&&o>=0};this.setStyle=function(e){for(var t in e)t in u&&o(t,e[t])&&(u[t]=e[t])},this.create=function(){r=document.createElement("div"),r.style.backgroundColor=u.backgroundColor,r.style.position="absolute",r.style.zIndex=10,r.style.bottom=0,r.style.width="100%",r.style.boxSizing="content-box",r.style.transition="bottom 0.4s ease-out",a=new PSVNavBarButton(e,"autorotate",u),r.appendChild(a.getButton()),s=new PSVNavBarButton(e,"zoom",u),r.appendChild(s.getButton()),l=new PSVNavBarButton(e,"fullscreen",u),r.appendChild(l.getButton()),Sphoords.isDeviceOrientationSupported&&(d=new PSVNavBarButton(e,"orientation",u),r.appendChild(d.getButton()),c=new PSVNavBarButton(e,"virtual-reality",u),r.appendChild(c.getButton()))},this.getBar=function(){return r};var i=function(){g&&(clearTimeout(g),!v&&m&&(g=setTimeout(n,5e3))),v&&(r.style.bottom=0,v=!1,m&&(g=setTimeout(n,5e3)))};this.show=function(){i()};var n=function(){v||(r.style.bottom=-r.offsetHeight+1+"px",v=!0)};this.hide=function(){n()},this.isHidden=function(){return v},this.mustBeHidden=function(e){m=void 0!==e?!!e:!0,m?n():i()};var r,a,s,l,d,c,u={backgroundColor:"rgba(61, 61, 61, 0.5)",buttonsColor:"rgba(255, 255, 255, 0.7)",buttonsBackgroundColor:"transparent",activeButtonsBackgroundColor:"rgba(255, 255, 255, 0.1)",buttonsHeight:20,autorotateThickness:1,zoomRangeWidth:50,zoomRangeThickness:1,zoomRangeDisk:7,fullscreenRatio:4/3,fullscreenThickness:2,gyroscopeThickness:1,virtualRealityRatio:4/3,virtualRealityBorderRadius:2},h=["backgroundColor","buttonsColor","buttonsBackgroundColor","activeButtonsBackgroundColor"],p=["buttonsHeight","autorotateThickness","zoomRangeWidth","zoomRangeThickness","zoomRangeDisk","fullscreenRatio","fullscreenThickness"],g=null,v=!1,m=!1},PSVNavBarButton=function(e,t,o){var i=function(e,t,o){e.addEventListener?e.addEventListener(t,o,!1):e.attachEvent("on"+t,o)},n=function(){switch(t){case"autorotate":var n=o.buttonsHeight-2*o.autorotateThickness,p=n/10;l=document.createElement("div"),l.style.cssFloat="left",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=o.buttonsHeight+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.position="relative",l.style.cursor="pointer",i(l,"click",function(){e.toggleAutorotate()});var f=document.createElement("div");f.style.boxSizing="inherit",f.style.width=n+"px",f.style.height=n+"px",f.style.borderRadius="50%",f.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,l.appendChild(f);var y=document.createElement("div");y.style.boxSizing="inherit",y.style.width=n+"px",y.style.height=p+"px",y.style.borderRadius="50%",y.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,y.style.position="absolute",y.style.top="50%",y.style.marginTop=-(p/2+o.autorotateThickness)+"px",l.appendChild(y),e.addAction("autorotate",d);break;case"zoom":l=document.createElement("div"),l.style.cssFloat="left",l.style.boxSizing="inherit";var b=document.createElement("div");b.style.cssFloat="left",b.style.boxSizing="inherit",b.style.padding="10px",b.style.height=o.buttonsHeight+"px",b.style.backgroundColor=o.buttonsBackgroundColor,b.style.lineHeight=o.buttonsHeight+"px",b.style.color=o.buttonsColor,b.style.cursor="pointer",b.textContent="-",i(b,"click",function(){e.zoomOut()}),l.appendChild(b),r=document.createElement("div"),r.style.cssFloat="left",r.style.boxSizing="inherit",r.style.padding=10+(o.buttonsHeight-o.zoomRangeThickness)/2+"px 5px",r.style.backgroundColor=o.buttonsBackgroundColor,r.style.cursor="pointer",l.appendChild(r),a=document.createElement("div"),a.style.boxSizing="inherit",a.style.width=o.zoomRangeWidth+"px",a.style.height=o.zoomRangeThickness+"px",a.style.backgroundColor=o.buttonsColor,a.style.position="relative",r.appendChild(a),s=document.createElement("div"),s.style.position="absolute",s.style.top=(o.zoomRangeThickness-o.zoomRangeDisk)/2+"px",s.style.left=-(o.zoomRangeDisk/2)+"px",s.style.boxSizing="inherit",s.style.width=o.zoomRangeDisk+"px",s.style.height=o.zoomRangeDisk+"px",s.style.borderRadius="50%",s.style.backgroundColor=o.buttonsColor,e.addAction("zoom-updated",c),i(r,"mousedown",u),i(r,"touchstart",h),i(document,"mousemove",v),i(document,"touchmove",m),i(document,"mouseup",g),i(document,"touchend",g),a.appendChild(s);var x=document.createElement("div");x.style.cssFloat="left",x.style.boxSizing="inherit",x.style.padding="10px",x.style.height=o.buttonsHeight+"px",x.style.backgroundColor=o.buttonsBackgroundColor,x.style.lineHeight=o.buttonsHeight+"px",x.style.color=o.buttonsColor,x.style.cursor="pointer",x.textContent="+",i(x,"click",function(){e.zoomIn()}),l.appendChild(x);break;case"fullscreen":var w=o.buttonsHeight*o.fullscreenRatio,_=.3*o.buttonsHeight,C=(o.buttonsHeight-_)/2,k=.3*w,z=(w-k)/2-o.fullscreenThickness,E=o.buttonsHeight-2*o.fullscreenThickness;l=document.createElement("div"),l.style.cssFloat="right",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=w+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.cursor="pointer",i(l,"click",function(){e.toggleFullscreen()});var S=document.createElement("div");S.style.cssFloat="left",S.style.boxSizing="inherit",S.style.width=o.fullscreenThickness+"px",S.style.height=_+"px",S.style.borderStyle="solid",S.style.borderColor=o.buttonsColor+" transparent",S.style.borderWidth=C+"px 0",l.appendChild(S);var T=document.createElement("div");T.style.cssFloat="left",T.style.boxSizing="inherit",T.style.width=z+"px",T.style.height=E+"px",T.style.borderStyle="solid",T.style.borderColor=o.buttonsColor+" transparent",T.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(T);var R=document.createElement("div");R.style.cssFloat="left",R.style.boxSizing="inherit",R.style.marginLeft=k+"px",R.style.width=z+"px",R.style.height=E+"px",R.style.borderStyle="solid",R.style.borderColor=o.buttonsColor+" transparent",R.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(R);var I=document.createElement("div");I.style.cssFloat="left",I.style.boxSizing="inherit",I.style.width=o.fullscreenThickness+"px",I.style.height=_+"px",I.style.borderStyle="solid",I.style.borderColor=o.buttonsColor+" transparent",I.style.borderWidth=C+"px 0",l.appendChild(I);var M=document.createElement("div");M.style.clear="left",l.appendChild(M),e.addAction("fullscreen-mode",d);break;case"orientation":var P=o.buttonsHeight-2*o.gyroscopeThickness,H=P-4*o.gyroscopeThickness,F=P/10;l=document.createElement("div"),l.style.cssFloat="right",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=o.buttonsHeight+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.position="relative",l.style.cursor="pointer",i(l,"click",function(){e.toggleDeviceOrientation()});var B=document.createElement("div");B.style.boxSizing="inherit",B.style.width=P+"px",B.style.height=P+"px",B.style.borderRadius="50%",B.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,l.appendChild(B);var O=document.createElement("div");O.style.boxSizing="inherit",O.style.width=H+"px",O.style.height=F+"px",O.style.borderRadius="50%",O.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,O.style.position="absolute",O.style.top="50%",O.style.left="50%",O.style.marginTop=-(F/2+o.gyroscopeThickness)+"px",O.style.marginLeft=-(H/2+o.gyroscopeThickness)+"px",l.appendChild(O);var L=document.createElement("div");L.style.boxSizing="inherit",L.style.width=F+"px",L.style.height=H+"px",L.style.borderRadius="50%",L.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,L.style.position="absolute",L.style.top="50%",L.style.left="50%",L.style.marginTop=-(H/2+o.gyroscopeThickness)+"px",L.style.marginLeft=-(F/2+o.gyroscopeThickness)+"px",l.appendChild(L),e.addAction("device-orientation",d);break;case"virtual-reality":var A=o.buttonsHeight*o.virtualRealityRatio,D=A/4,X=D/2;l=document.createElement("div"),l.style.cssFloat="right",l.style.position="relative",l.style.boxSizing="inherit",l.style.padding="10px",l.style.width=A+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.cursor="pointer",i(l,"click",function(){e.toggleStereo()});var W=document.createElement("div");W.style.boxSizing="inherit",W.style.width=A+"px",W.style.height=o.buttonsHeight+"px",W.style.borderRadius=o.virtualRealityBorderRadius+"px",W.style.backgroundColor=o.buttonsColor,l.appendChild(W);var N=document.createElement("div");N.style.boxSizing="inherit",N.style.width=D+"px",N.style.height=D+"px",N.style.position="absolute",N.style.top=X+10+"px",N.style.left=X+10+"px",N.style.borderRadius="50%",N.style.backgroundColor=o.backgroundColor,l.appendChild(N);var $=document.createElement("div");$.style.boxSizing="inherit",$.style.width=D+"px",$.style.height=D+"px",$.style.position="absolute",$.style.top=X+10+"px",$.style.right=X+10+"px",$.style.borderRadius="50%",$.style.backgroundColor=o.backgroundColor,l.appendChild($);var q=document.createElement("div");q.style.boxSizing="inherit",q.style.width=D+"px",q.style.height=o.buttonsHeight/2+"px",q.style.position="absolute",q.style.left="50%",q.style.bottom="10px",q.style.marginLeft=-(D/2)+"px",q.style.borderTopLeftRadius="50% 60%",q.style.borderTopRightRadius="50% 60%",q.style.backgroundColor=o.backgroundColor,l.appendChild(q),e.addAction("stereo-effect",d)}};this.getButton=function(){return l};var r,a,s,l,d=function(e){e?l.style.backgroundColor=o.activeButtonsBackgroundColor:l.style.backgroundColor=o.buttonsBackgroundColor},c=function(e){s.style.left=e/100*o.zoomRangeWidth-o.zoomRangeDisk/2+"px"},u=function(e){p(parseInt(e.clientX))},h=function(e){var t=e.touches[0];(t.target==r||t.target==a||t.target==s)&&p(parseInt(t.clientX))},p=function(e){y=!0,f(e)},g=function(e){y=!1},v=function(e){e.preventDefault(),f(parseInt(e.clientX))},m=function(e){var t=e.touches[0];(t.target==r||t.target==a||t.target==s)&&(e.preventDefault(),f(parseInt(t.clientX)))},f=function(t){if(y){var i=t-a.getBoundingClientRect().left,n=i/o.zoomRangeWidth*100;e.zoom(n)}},y=!1;n()},Sphoords=function(){var e=function(){var e=navigator.userAgent;return/Gecko\/[0-9.]+/.test(e)?"Gecko":/Chrome\/[0-9.]+/.test(e)?"Blink":/AppleWebKit\/[0-9.]+/.test(e)?"WebKit":/Trident\/[0-9.]+/.test(e)?"Trident":/Opera\/[0-9.]+/.test(e)?"Presto":"Gecko"},t=function(e){return e-360*Math.floor(e/360)};this.start=function(){return Sphoords.isDeviceOrientationSupported?(window.addEventListener("deviceorientation",o,!1),n=!0,!0):(console.log("Device Orientation API not supported"),!1)},this.stop=function(){n&&(window.removeEventListener("deviceorientation",o,!1),n=!1)},this.toggle=function(){n?this.stop():this.start()},this.isEventAttached=function(){return n};var o=function(e){c=Sphoords.getScreenOrientation();var o=0,n=0;switch(c){case"portrait-primary":o=e.alpha+e.gamma,n=e.beta-90;break;case"landscape-primary":if(o=e.alpha+e.beta-90,n=-e.gamma-90,Math.abs(e.beta)>90)switch(u){case"Blink":n+=180;break;case"Gecko":default:n=-n}break;case"landscape-secondary":if(o=e.alpha-e.beta+90,n=e.gamma-90,Math.abs(e.beta)>90)switch(u){case"Blink":n+=180;break;case"Gecko":default:n=-n}break;case"portrait-secondary":o=e.alpha-e.gamma,n=180-(e.beta-90),n=270-e.beta}n=t(n),n>=180&&(n-=360),r=t(o),a=Math.max(-90,Math.min(90,n)),s=r*d,l=a*d,i()};this.getCoordinates=function(){return{longitude:s,latitude:l}},this.getCoordinatesInDegrees=function(){return{longitude:r,latitude:a}},this.getScreenOrientation=function(){return c},this.addListener=function(e){h.push(e)};var i=function(){if(h.length)for(var e=0,t=h.length;t>e;++e)h[e]({longitude:s,latitude:l})},n=!1,r=0,a=0,s=0,l=0,d=Math.PI/180,c=Sphoords.getScreenOrientation(),u=e(),h=[]};Sphoords.getScreenOrientation=function(){var e=null;return screen.orientation?e=screen.orientation:screen.mozOrientation?e=screen.mozOrientation:screen.msOrientation&&(e=screen.msOrientation),null!==e&&"object"==typeof e?e.type:e},Sphoords.isDeviceOrientationSupported=!1,function(){function e(t){null!==t&&null!==t.alpha&&(Sphoords.isDeviceOrientationSupported=!0,window.removeEventListener("deviceorientation",e))}window.DeviceOrientationEvent&&null!==Sphoords.getScreenOrientation()&&window.addEventListener("deviceorientation",e)}(); \ No newline at end of file diff --git a/src/PhotoSphereViewer.js b/src/PhotoSphereViewer.js index 290ae4177..a4eeac606 100644 --- a/src/PhotoSphereViewer.js +++ b/src/PhotoSphereViewer.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.5 + * Photo Sphere Viewer v2.6 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine