From 2cb69e0418c426274493d2442af20c9e2fc6d9b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Heleine?= Date: Mon, 19 Dec 2016 22:20:19 +0100 Subject: [PATCH] Version 2.8 --- photo-sphere-viewer.js | 11 ++++++++--- photo-sphere-viewer.min.js | 2 +- src/PhotoSphereViewer.js | 2 +- 3 files changed, 10 insertions(+), 5 deletions(-) diff --git a/photo-sphere-viewer.js b/photo-sphere-viewer.js index 1238ef4f9..d76bbf01b 100644 --- a/photo-sphere-viewer.js +++ b/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.7.1 + * Photo Sphere Viewer v2.8 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine @@ -37,6 +37,8 @@ * @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 {integer} [args.segments=100] - Number of segments on the sphere + * @param {integer} [args.rings=100] - Number of rings on the sphere * @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 @@ -497,7 +499,7 @@ var PhotoSphereViewer = function(args) { scene.add(camera); // Sphere - var geometry = new THREE.SphereGeometry(200, 32, 32); + var geometry = new THREE.SphereGeometry(200, rings, segments); var material = new THREE.MeshBasicMaterial({map: texture, overdraw: true}); var mesh = new THREE.Mesh(geometry, material); mesh.scale.x = -1; @@ -988,7 +990,6 @@ var PhotoSphereViewer = function(args) { var keyDown = function(evt) { var dlong = 0, dlat = 0; - console.log('test'); switch (retrieveKey(evt)) { case 'ArrowUp': @@ -1662,6 +1663,10 @@ var PhotoSphereViewer = function(args) { long = stayBetween(parseAngle(args.default_position.long), PSV_MIN_LONGITUDE, PSV_MAX_LONGITUDE); } + // Sphere segments and rings + var segments = (args.segments !== undefined) ? parseInt(args.segments) : 100; + var rings = (args.rings !== undefined) ? parseInt(args.rings) : 100; + // Default zoom level var zoom_lvl = 0; diff --git a/photo-sphere-viewer.min.js b/photo-sphere-viewer.min.js index 3dc242625..a8d49984e 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"))},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(Re.innerHTML="",ot&&1===ot.nodeType)Re.appendChild(ot);else if(ot&&"string"==typeof ot)Re.innerHTML=ot;else if(tt){var e=document.createElement("img");e.setAttribute("src",tt),e.setAttribute("alt",et),Re.appendChild(e)}else Re.textContent=et;return Pe=document.createElement("div"),Pe.style.width="100%",Pe.style.height="100%",Pe.style.position="relative",Pe.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(Ee={width:0,height:0,ratio:0},void(je&&!Fe.match(/^data:image\/[a-z]+;base64/)?d():c())):void(Re.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-1==i&&(o=e.indexOf("GPano:"+t)+t.length+7,i=e.indexOf("<",o)),e.substring(o,i)},d=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(Re.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();Ke={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",Fe,!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!=Je.horizontal_fov||180!=Je.vertical_fov){if(Ke.cropped_width=t.cropped_width,Ke.cropped_height=t.cropped_height,Ke.full_width=t.full_width,Ke.full_height=t.full_height,360!=Je.horizontal_fov){var i=Je.horizontal_fov/360;Ke.full_width=Ke.cropped_width/i}if(180!=Je.vertical_fov){var n=Je.vertical_fov/180;Ke.full_height=Ke.cropped_height/n}}else{for(var r in Ke)null===Ke[r]&&void 0!==t[r]&&(Ke[r]=t[r]);if(Qe){if(Ke.cropped_width!=t.cropped_width){var a=t.cropped_width/Ke.cropped_width;Ke.cropped_width=t.cropped_width,Ke.full_width*=a,Ke.cropped_x*=a}if(Ke.cropped_height!=t.cropped_height){var s=t.cropped_height/Ke.cropped_height;Ke.cropped_height=t.cropped_height,Ke.full_height*=s,Ke.cropped_y*=s}}}null===Ke.cropped_x&&(Ke.cropped_x=(Ke.full_width-Ke.cropped_width)/2),null===Ke.cropped_y&&(Ke.cropped_y=(Ke.full_height-Ke.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(Ke.full_width,l),p=h/Ke.full_width;Ke.full_width=h,Ke.cropped_width*=p,Ke.cropped_x*=p,e.width=Ke.cropped_width,Ke.full_height*=p,Ke.cropped_height*=p,Ke.cropped_y*=p,e.height=Ke.cropped_height;var g=document.createElement("canvas");g.width=Ke.full_width,g.height=Ke.full_height;var v=g.getContext("2d");v.drawImage(e,Ke.cropped_x,Ke.cropped_y,Ke.cropped_width,Ke.cropped_height),u(g.toDataURL("image/jpeg"))},Ue&&!Fe.match(/^data:image\/[a-z]+;base64/)&&e.setAttribute("crossOrigin","anonymous"),e.src=Fe},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!==Ie.width&&(Re.style.width=Ie.width.css),void 0!==Ie.height&&(Re.style.height=Ie.height.css),w(),Be=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer,Be.setSize(Ee.width,Ee.height),Ae=new THREE.Scene,Le=new THREE.PerspectiveCamera(te,Ee.ratio,1,300),Le.position.set(0,0,0),Ae.add(Le);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,Ae.add(r),He=document.createElement("div"),He.style.position="absolute",He.style.zIndex=0,Pe.appendChild(He),ke&&(_e.setStyle(Ce),_e.create(),Pe.appendChild(_e.getBar())),null!==it){var a=document.createElement("img");a.onload=function(){a.style.display="block",a.style.position="absolute",a.style[it.position.x]="5px",a.style[it.position.y]="5px","bottom"==it.position.y&&ke&&(a.style.bottom=_e.getBar().offsetHeight+5+"px"),void 0!==it.size&&(a.style.width=it.size.width,a.style.height=it.size.height),Pe.appendChild(a)},a.src=it.image}i(window,"resize",w),ze&&(i(He,"mousedown",S),i(document,"mousemove",P),i(He,"mousemove",q),i(document,"mouseup",M),i(He,"touchstart",T),i(document,"touchend",M),i(document,"touchmove",H),Se&&(i(He,"mousewheel",O),i(He,"DOMMouseScroll",O)),nt.addAction("fullscreen-mode",C)),i(document,"fullscreenchange",W),i(document,"mozfullscreenchange",W),i(document,"webkitfullscreenchange",W),i(document,"MSFullscreenChange",W),Ve.addListener(L),Re.innerHTML="",Re.appendChild(Pe);var s=Be.domElement;s.style.display="block",He.appendChild(s),p(),he>0&&D(he),f(),j("ready")},p=function(){var e=new THREE.Vector3;e.setX(Math.cos(de)*Math.sin(ce)),e.setY(Math.sin(de)),e.setZ(Math.cos(de)*Math.cos(ce)),Le.lookAt(e),null!==Oe?Oe.render(Ae,Le):Be.render(Ae,Le)},g=function(){Oe=new THREE.StereoEffect(Be),Oe.eyeSeparation=Te,Oe.setSize(Ee.width,Ee.height),B(),N(),_e.mustBeHidden(),p(),j("stereo-effect",!0)},v=function(){Oe=null,Be.setSize(Ee.width,Ee.height),_e.mustBeHidden(!1),p(),j("stereo-effect",!1)};this.toggleStereo=function(){null!==Oe?v():g()};var f=function(){fe!==!1&&(Ge=setTimeout(y,fe))},m=function(){de-=(de-we)*be,ce+=me;var e=!0;ae||(ce=n(ce,se,le),(ce==se||ce==le)&&(ye?me*=-1:(b(),e=!1))),ce=a(ce,!0),j("position-updated",{longitude:ce,latitude:de}),p(),e&&(qe=setTimeout(m,ve))},y=function(){m(),j("autorotate",!0)},b=function(){clearTimeout(Ge),Ge=null,clearTimeout(qe),qe=null,j("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(Ge),qe?b():y()};var w=function(){(Re.clientWidth!=Ee.width||Re.clientHeight!=Ee.height)&&x({width:Re.clientWidth,height:Re.clientHeight})};this.fitToContainer=function(){w()};var x=function(e){Ee.width=void 0!==e.width?parseInt(e.width):Ee.width,Ee.height=void 0!==e.height?parseInt(e.height):Ee.height,Ee.ratio=Ee.width/Ee.height,Le&&(Le.aspect=Ee.ratio,Le.updateProjectionMatrix()),Be&&(Be.setSize(Ee.width,Ee.height),p()),Oe&&(Oe.setSize(Ee.width,Ee.height),p())};this.getPosition=function(){return{longitude:ce,latitude:de}},this.getPositionInDegrees=function(){return{longitude:180*ce/Math.PI,latitude:180*de/Math.PI}};var _=function(e,t){var o=V(e);ae||(o=n(o,se,le));var i=V(t);i>Math.PI&&(i-=2*Math.PI),i=n(i,ie,oe),ce=o,de=i,j("position-updated",{longitude:ce,latitude:de}),p()};this.moveTo=function(e,t){_(e,t)};var k=function(e,t){e=V(e),t=V(t),_(ce+e,de+t)};this.rotate=function(e,t){k(e,t)};var C=function(e){var t=e?window.addEventListener:window.removeEventListener;t("keydown",E)},z=function(e){if(e.key){var t=/^Arrow/.test(e.key)?e.key:"Arrow"+e.key;return t}if(e.keyCode||e.which){var o=e.keyCode?e.keyCode:e.which,i={38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",37:"ArrowLeft"};if(void 0!==i[o])return i[o]}return""},E=function(e){var t=0,o=0;switch(console.log("test"),z(e)){case"ArrowUp":o=Q;break;case"ArrowRight":t=-J;break;case"ArrowDown":o=-Q;break;case"ArrowLeft":t=J}k(t,o)},S=function(e){R(parseInt(e.clientX),parseInt(e.clientY))},T=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==He&&R(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(M(),e.touches[0].target.parentNode==He&&e.touches[1].target.parentNode==He&&I(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));q()},R=function(e,t){Xe=e,We=t,b(),De=!0},I=function(e){$e=e,Ne=!0},M=function(e){De=!1,Ne=!1},P=function(e){e.preventDefault(),F(parseInt(e.clientX),parseInt(e.clientY))},H=function(e){if(1==e.touches.length&&De){var t=e.touches[0];t.target.parentNode==He&&(e.preventDefault(),F(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==He&&e.touches[1].target.parentNode==He&&Ne){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),i=o-$e;if(0!==i){var n=i/Math.abs(i);D(he+n),$e=o}}},F=function(e,t){De&&(U?(ce+=(e-Xe)/Ee.height*pe*Math.PI/180,de+=(t-We)/Ee.height*pe*Math.PI/180):(ce+=(e-Xe)*K,de+=(t-We)*Z),Xe=e,We=t,ae||(ce=n(ce,se,le)),ce=a(ce,!0),de=n(de,ie,oe),j("position-updated",{longitude:ce,latitude:de}),p())},B=function(){Ve.start(),b(),j("device-orientation",!0)},A=function(){Ve.stop(),j("device-orientation",!1)};this.toggleDeviceOrientation=function(){Ve.isEventAttached()?A():B()};var L=function(e){ce=n(e.longitude,se,le),de=n(e.latitude,ie,oe),j("position-updated",{longitude:ce,latitude:de}),p()},O=function(e){e.preventDefault(),e.stopPropagation();var t=e.detail?-e.detail:e.wheelDelta;if(0!==t){var o=parseInt(t/Math.abs(t));D(he+o)}},D=function(e){he=n(parseInt(Math.round(e)),0,100),pe=te+he/100*(ee-te),Le.fov=pe,Le.updateProjectionMatrix(),p(),j("zoom-updated",he)};this.getZoomLevel=function(){return he},this.zoom=function(e){D(e)},this.zoomIn=function(){100>he&&D(he+1)},this.zoomOut=function(){he>0&&D(he-1)};var X=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},W=function(){document.webkitFullscreenElement||document.msFullscreenElement?(Me.width=Re.style.width,Me.height=Re.style.height,Re.style.width="100%",Re.style.height="100%",w()):(Re.webkitRequestFullscreen||Re.msRequestFullscreen)&&(Re.style.width=Me.width,Re.style.height=Me.height,w()),j("fullscreen-mode",X())},N=function(){Re.requestFullscreen?Re.requestFullscreen():Re.mozRequestFullScreen?Re.mozRequestFullScreen():Re.webkitRequestFullscreen?Re.webkitRequestFullscreen():Re.msRequestFullscreen&&Re.msRequestFullscreen()},$=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){X()?$():N()};var q=function(){ke&&_e.show()},G=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*ve/1e3},V=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)},Y=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"),Ie[t]={css:i+n,unit:n}}};this.addAction=function(e,t){e in Ye||(Ye[e]=[]),Ye[e].push(t)};var j=function(e,t){if(e in Ye&&Ye[e].length)for(var o=0,i=Ye[e].length;i>o;++o)void 0!==t?Ye[e][o](t):Ye[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 U=void 0!==e.smooth_user_moves?!!e.smooth_user_moves:!0,K=void 0!==e.long_offset?V(e.long_offset):Math.PI/360,Z=void 0!==e.lat_offset?V(e.lat_offset):Math.PI/180,J=void 0!==e.keyboard_long_offset?V(e.keyboard_long_offset):Math.PI/60,Q=void 0!==e.keyboard_lat_offset?V(e.keyboard_lat_offset):Math.PI/120,ee=void 0!==e.min_fov?n(parseFloat(e.min_fov),1,179):30,te=void 0!==e.max_fov?n(parseFloat(e.max_fov),1,179):90,oe=void 0!==e.tilt_up_max?n(V(e.tilt_up_max),0,Math.PI/2):Math.PI/2,ie=void 0!==e.tilt_down_max?-n(V(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,ne=void 0!==e.min_longitude?V(e.min_longitude):0,re=void 0!==e.max_longitude?V(e.max_longitude):0,ae=ne==re;ae?(ne=0,re=2*Math.PI):0===re&&(re=2*Math.PI);var se,le;re>ne?(se=ne,le=re):(se=re,le=ne);var de=0,ce=se;if(void 0!==e.default_position){if(void 0!==e.default_position.lat){var ue=V(e.default_position.lat);ue>Math.PI&&(ue-=2*Math.PI),de=n(ue,ie,oe)}void 0!==e.default_position["long"]&&(ce=n(V(e.default_position["long"]),se,le))}var he=0;void 0!==e.zoom_level&&(he=n(parseInt(Math.round(e.zoom_level)),0,100));var pe=te+he/100*(ee-te),ge=60,ve=1e3/ge,fe=2e3;void 0!==e.time_anim&&(fe="number"==typeof e.time_anim&&e.time_anim>=0?e.time_anim:!1);var me=G(void 0!==e.anim_speed?e.anim_speed:"2rpm"),ye=!0;void 0!==e.reverse_anim&&(ye=!!e.reverse_anim);var be=G(void 0!==e.vertical_anim_speed?e.vertical_anim_speed:"2rpm"),we=0;if(void 0!==e.vertical_anim_target){var xe=V(e.vertical_anim_target);xe>Math.PI&&(xe-=2*Math.PI),we=n(xe,ie,oe)}var _e=new PSVNavBar(this),ke=void 0!==e.navbar?!!e.navbar:!1,Ce=void 0!==e.navbar_style?e.navbar_style:{},ze=void 0!==e.allow_user_interactions?!!e.allow_user_interactions:!0;ze||(ke=!1);var Ee,Se=void 0!==e.allow_scroll_to_zoom?!!e.allow_scroll_to_zoom:!0,Te=void 0!==e.eyes_offset?parseFloat(e.eyes_offset):5,Re="string"==typeof e.container?document.getElementById(e.container):e.container,Ie={},Me={};void 0!==e.size&&Y(e.size);var Pe,He,Fe=e.panorama,Be=null,Ae=null,Le=null,Oe=null,De=!1,Xe=0,We=0,Ne=!1,$e=0,qe=null,Ge=null,Ve=new Sphoords,Ye={},je=void 0!==e.usexmpdata?!!e.usexmpdata:!0,Ue=void 0!==e.cors_anonymous?!!e.cors_anonymous:!0,Ke={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 Ze in Ke)void 0!==e.pano_size[Ze]&&(Ke[Ze]=parseInt(e.pano_size[Ze]));je=!1}var Je={horizontal_fov:360,vertical_fov:180};if(void 0!==e.captured_view){for(var Ze in Je)void 0!==e.captured_view[Ze]&&(Je[Ze]=parseFloat(e.captured_view[Ze]));je=!1}var Qe=!1,et=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",tt=void 0!==e.loading_img?e.loading_img.toString():null,ot=void 0!==e.loading_html?e.loading_html:null,it=null;void 0!==e.overlay&&void 0!==e.overlay.image&&(it={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||(it.position.x=e.overlay.position.x),void 0===e.overlay.position.y||"top"!=e.overlay.position.y&&"bottom"!=e.overlay.position.y||(it.position.y=e.overlay.position.y)),void 0!==e.overlay.size&&(it.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"}));var nt=this;void 0!==e.onready&&this.addAction("ready",e.onready);var rt=void 0!==e.autoload?!!e.autoload:!0;rt&&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&&f&&(g=setTimeout(n,5e3))),v&&(r.style.bottom=0,v=!1,f&&(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){f=void 0!==e?!!e:!0,f?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,f=!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 m=document.createElement("div");m.style.boxSizing="inherit",m.style.width=n+"px",m.style.height=n+"px",m.style.borderRadius="50%",m.style.border=o.autorotateThickness+"px solid "+o.buttonsColor,l.appendChild(m);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",f),i(document,"mouseup",g),i(document,"touchend",g),a.appendChild(s);var w=document.createElement("div");w.style.cssFloat="left",w.style.boxSizing="inherit",w.style.padding="10px",w.style.height=o.buttonsHeight+"px",w.style.backgroundColor=o.buttonsBackgroundColor,w.style.lineHeight=o.buttonsHeight+"px",w.style.color=o.buttonsColor,w.style.cursor="pointer",w.textContent="+",i(w,"click",function(){e.zoomIn()}),l.appendChild(w);break;case"fullscreen":var x=o.buttonsHeight*o.fullscreenRatio,_=.3*o.buttonsHeight,k=(o.buttonsHeight-_)/2,C=.3*x,z=(x-C)/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=x+"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=k+"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=C+"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=k+"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 A=document.createElement("div");A.style.boxSizing="inherit",A.style.width=H+"px",A.style.height=F+"px",A.style.borderRadius="50%",A.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,A.style.position="absolute",A.style.top="50%",A.style.left="50%",A.style.marginTop=-(F/2+o.gyroscopeThickness)+"px",A.style.marginLeft=-(H/2+o.gyroscopeThickness)+"px",l.appendChild(A);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 O=o.buttonsHeight*o.virtualRealityRatio,D=O/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=O+"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=O+"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,m(e)},g=function(e){y=!1},v=function(e){e.preventDefault(),m(parseInt(e.clientX))},f=function(e){var t=e.touches[0];(t.target==r||t.target==a||t.target==s)&&(e.preventDefault(),m(parseInt(t.clientX)))},m=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}"WebKit"===u&&window.orientation&&(0>n&&(n=-1*(n+180)),o>=180?o-=180:o+=180);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}"WebKit"===u&&window.orientation&&(0>n&&(n=-1*(n+180)),o>=180?o-=180:o+=180);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;if(screen.orientation)e=screen.orientation;else if(screen.mozOrientation)e=screen.mozOrientation;else if(screen.msOrientation)e=screen.msOrientation;else if(window.orientation||0===window.orientation)switch(window.orientation){case 0:e="portrait-primary";break;case 180:e="portrait-secondary";break;case-90:e="landscape-primary";break;case 90:e="landscape-secondary"}return 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(Me.innerHTML="",nt&&1===nt.nodeType)Me.appendChild(nt);else if(nt&&"string"==typeof nt)Me.innerHTML=nt;else if(it){var e=document.createElement("img");e.setAttribute("src",it),e.setAttribute("alt",ot),Me.appendChild(e)}else Me.textContent=ot;return Fe=document.createElement("div"),Fe.style.width="100%",Fe.style.height="100%",Fe.style.position="relative",Fe.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(Te={width:0,height:0,ratio:0},void(Ke&&!Ae.match(/^data:image\/[a-z]+;base64/)?d():c())):void(Me.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-1==i&&(o=e.indexOf("GPano:"+t)+t.length+7,i=e.indexOf("<",o)),e.substring(o,i)},d=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(Me.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();Je={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"))},tt=!0,c()}},e.open("GET",Ae,!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!=et.horizontal_fov||180!=et.vertical_fov){if(Je.cropped_width=t.cropped_width,Je.cropped_height=t.cropped_height,Je.full_width=t.full_width,Je.full_height=t.full_height,360!=et.horizontal_fov){var i=et.horizontal_fov/360;Je.full_width=Je.cropped_width/i}if(180!=et.vertical_fov){var n=et.vertical_fov/180;Je.full_height=Je.cropped_height/n}}else{for(var r in Je)null===Je[r]&&void 0!==t[r]&&(Je[r]=t[r]);if(tt){if(Je.cropped_width!=t.cropped_width){var a=t.cropped_width/Je.cropped_width;Je.cropped_width=t.cropped_width,Je.full_width*=a,Je.cropped_x*=a}if(Je.cropped_height!=t.cropped_height){var s=t.cropped_height/Je.cropped_height;Je.cropped_height=t.cropped_height,Je.full_height*=s,Je.cropped_y*=s}}}null===Je.cropped_x&&(Je.cropped_x=(Je.full_width-Je.cropped_width)/2),null===Je.cropped_y&&(Je.cropped_y=(Je.full_height-Je.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(Je.full_width,l),p=h/Je.full_width;Je.full_width=h,Je.cropped_width*=p,Je.cropped_x*=p,e.width=Je.cropped_width,Je.full_height*=p,Je.cropped_height*=p,Je.cropped_y*=p,e.height=Je.cropped_height;var g=document.createElement("canvas");g.width=Je.full_width,g.height=Je.full_height;var v=g.getContext("2d");v.drawImage(e,Je.cropped_x,Je.cropped_y,Je.cropped_width,Je.cropped_height),u(g.toDataURL("image/jpeg"))},Ze&&!Ae.match(/^data:image\/[a-z]+;base64/)&&e.setAttribute("crossOrigin","anonymous"),e.src=Ae},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!==Pe.width&&(Me.style.width=Pe.width.css),void 0!==Pe.height&&(Me.style.height=Pe.height.css),w(),Le=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer,Le.setSize(Te.width,Te.height),Oe=new THREE.Scene,De=new THREE.PerspectiveCamera(te,Te.ratio,1,300),De.position.set(0,0,0),Oe.add(De);var t=new THREE.SphereGeometry(200,pe,he),n=new THREE.MeshBasicMaterial({map:e,overdraw:!0}),r=new THREE.Mesh(t,n);if(r.scale.x=-1,Oe.add(r),Be=document.createElement("div"),Be.style.position="absolute",Be.style.zIndex=0,Fe.appendChild(Be),ze&&(Ce.setStyle(Ee),Ce.create(),Fe.appendChild(Ce.getBar())),null!==rt){var a=document.createElement("img");a.onload=function(){a.style.display="block",a.style.position="absolute",a.style[rt.position.x]="5px",a.style[rt.position.y]="5px","bottom"==rt.position.y&&ze&&(a.style.bottom=Ce.getBar().offsetHeight+5+"px"),void 0!==rt.size&&(a.style.width=rt.size.width,a.style.height=rt.size.height),Fe.appendChild(a)},a.src=rt.image}i(window,"resize",w),Se&&(i(Be,"mousedown",S),i(document,"mousemove",P),i(Be,"mousemove",q),i(document,"mouseup",M),i(Be,"touchstart",T),i(document,"touchend",M),i(document,"touchmove",H),Re&&(i(Be,"mousewheel",O),i(Be,"DOMMouseScroll",O)),at.addAction("fullscreen-mode",C)),i(document,"fullscreenchange",W),i(document,"mozfullscreenchange",W),i(document,"webkitfullscreenchange",W),i(document,"MSFullscreenChange",W),je.addListener(L),Me.innerHTML="",Me.appendChild(Fe);var s=Le.domElement;s.style.display="block",Be.appendChild(s),p(),ge>0&&D(ge),m(),j("ready")},p=function(){var e=new THREE.Vector3;e.setX(Math.cos(de)*Math.sin(ce)),e.setY(Math.sin(de)),e.setZ(Math.cos(de)*Math.cos(ce)),De.lookAt(e),null!==Xe?Xe.render(Oe,De):Le.render(Oe,De)},g=function(){Xe=new THREE.StereoEffect(Le),Xe.eyeSeparation=Ie,Xe.setSize(Te.width,Te.height),B(),N(),Ce.mustBeHidden(),p(),j("stereo-effect",!0)},v=function(){Xe=null,Le.setSize(Te.width,Te.height),Ce.mustBeHidden(!1),p(),j("stereo-effect",!1)};this.toggleStereo=function(){null!==Xe?v():g()};var m=function(){ye!==!1&&(Ye=setTimeout(y,ye))},f=function(){de-=(de-_e)*xe,ce+=be;var e=!0;ae||(ce=n(ce,se,le),(ce==se||ce==le)&&(we?be*=-1:(b(),e=!1))),ce=a(ce,!0),j("position-updated",{longitude:ce,latitude:de}),p(),e&&(Ve=setTimeout(f,fe))},y=function(){f(),j("autorotate",!0)},b=function(){clearTimeout(Ye),Ye=null,clearTimeout(Ve),Ve=null,j("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(Ye),Ve?b():y()};var w=function(){(Me.clientWidth!=Te.width||Me.clientHeight!=Te.height)&&x({width:Me.clientWidth,height:Me.clientHeight})};this.fitToContainer=function(){w()};var x=function(e){Te.width=void 0!==e.width?parseInt(e.width):Te.width,Te.height=void 0!==e.height?parseInt(e.height):Te.height,Te.ratio=Te.width/Te.height,De&&(De.aspect=Te.ratio,De.updateProjectionMatrix()),Le&&(Le.setSize(Te.width,Te.height),p()),Xe&&(Xe.setSize(Te.width,Te.height),p())};this.getPosition=function(){return{longitude:ce,latitude:de}},this.getPositionInDegrees=function(){return{longitude:180*ce/Math.PI,latitude:180*de/Math.PI}};var _=function(e,t){var o=V(e);ae||(o=n(o,se,le));var i=V(t);i>Math.PI&&(i-=2*Math.PI),i=n(i,ie,oe),ce=o,de=i,j("position-updated",{longitude:ce,latitude:de}),p()};this.moveTo=function(e,t){_(e,t)};var k=function(e,t){e=V(e),t=V(t),_(ce+e,de+t)};this.rotate=function(e,t){k(e,t)};var C=function(e){var t=e?window.addEventListener:window.removeEventListener;t("keydown",E)},z=function(e){if(e.key){var t=/^Arrow/.test(e.key)?e.key:"Arrow"+e.key;return t}if(e.keyCode||e.which){var o=e.keyCode?e.keyCode:e.which,i={38:"ArrowUp",39:"ArrowRight",40:"ArrowDown",37:"ArrowLeft"};if(void 0!==i[o])return i[o]}return""},E=function(e){var t=0,o=0;switch(z(e)){case"ArrowUp":o=Q;break;case"ArrowRight":t=-J;break;case"ArrowDown":o=-Q;break;case"ArrowLeft":t=J}k(t,o)},S=function(e){R(parseInt(e.clientX),parseInt(e.clientY))},T=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==Be&&R(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(M(),e.touches[0].target.parentNode==Be&&e.touches[1].target.parentNode==Be&&I(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));q()},R=function(e,t){Ne=e,$e=t,b(),We=!0},I=function(e){Ge=e,qe=!0},M=function(){We=!1,qe=!1},P=function(e){e.preventDefault(),F(parseInt(e.clientX),parseInt(e.clientY))},H=function(e){if(1==e.touches.length&&We){var t=e.touches[0];t.target.parentNode==Be&&(e.preventDefault(),F(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==Be&&e.touches[1].target.parentNode==Be&&qe){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),i=o-Ge;if(0!==i){var n=i/Math.abs(i);D(ge+n),Ge=o}}},F=function(e,t){We&&(U?(ce+=(e-Ne)/Te.height*ve*Math.PI/180,de+=(t-$e)/Te.height*ve*Math.PI/180):(ce+=(e-Ne)*K,de+=(t-$e)*Z),Ne=e,$e=t,ae||(ce=n(ce,se,le)),ce=a(ce,!0),de=n(de,ie,oe),j("position-updated",{longitude:ce,latitude:de}),p())},B=function(){je.start(),b(),j("device-orientation",!0)},A=function(){je.stop(),j("device-orientation",!1)};this.toggleDeviceOrientation=function(){je.isEventAttached()?A():B()};var L=function(e){ce=n(e.longitude,se,le),de=n(e.latitude,ie,oe),j("position-updated",{longitude:ce,latitude:de}),p()},O=function(e){e.preventDefault(),e.stopPropagation();var t=e.detail?-e.detail:e.wheelDelta;if(0!==t){var o=parseInt(t/Math.abs(t));D(ge+o)}},D=function(e){ge=n(parseInt(Math.round(e)),0,100),ve=te+ge/100*(ee-te),De.fov=ve,De.updateProjectionMatrix(),p(),j("zoom-updated",ge)};this.getZoomLevel=function(){return ge},this.zoom=function(e){D(e)},this.zoomIn=function(){100>ge&&D(ge+1)},this.zoomOut=function(){ge>0&&D(ge-1)};var X=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},W=function(){document.webkitFullscreenElement||document.msFullscreenElement?(He.width=Me.style.width,He.height=Me.style.height,Me.style.width="100%",Me.style.height="100%",w()):(Me.webkitRequestFullscreen||Me.msRequestFullscreen)&&(Me.style.width=He.width,Me.style.height=He.height,w()),j("fullscreen-mode",X())},N=function(){Me.requestFullscreen?Me.requestFullscreen():Me.mozRequestFullScreen?Me.mozRequestFullScreen():Me.webkitRequestFullscreen?Me.webkitRequestFullscreen():Me.msRequestFullscreen&&Me.msRequestFullscreen()},$=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){X()?$():N()};var q=function(){ze&&Ce.show()},G=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*fe/1e3},V=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)},Y=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"),Pe[t]={css:i+n,unit:n}}};this.addAction=function(e,t){e in Ue||(Ue[e]=[]),Ue[e].push(t)};var j=function(e,t){if(e in Ue&&Ue[e].length)for(var o=0,i=Ue[e].length;i>o;++o)void 0!==t?Ue[e][o](t):Ue[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 U=void 0!==e.smooth_user_moves?!!e.smooth_user_moves:!0,K=void 0!==e.long_offset?V(e.long_offset):Math.PI/360,Z=void 0!==e.lat_offset?V(e.lat_offset):Math.PI/180,J=void 0!==e.keyboard_long_offset?V(e.keyboard_long_offset):Math.PI/60,Q=void 0!==e.keyboard_lat_offset?V(e.keyboard_lat_offset):Math.PI/120,ee=void 0!==e.min_fov?n(parseFloat(e.min_fov),1,179):30,te=void 0!==e.max_fov?n(parseFloat(e.max_fov),1,179):90,oe=void 0!==e.tilt_up_max?n(V(e.tilt_up_max),0,Math.PI/2):Math.PI/2,ie=void 0!==e.tilt_down_max?-n(V(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,ne=void 0!==e.min_longitude?V(e.min_longitude):0,re=void 0!==e.max_longitude?V(e.max_longitude):0,ae=ne==re;ae?(ne=0,re=2*Math.PI):0===re&&(re=2*Math.PI);var se,le;re>ne?(se=ne,le=re):(se=re,le=ne);var de=0,ce=se;if(void 0!==e.default_position){if(void 0!==e.default_position.lat){var ue=V(e.default_position.lat);ue>Math.PI&&(ue-=2*Math.PI),de=n(ue,ie,oe)}void 0!==e.default_position["long"]&&(ce=n(V(e.default_position["long"]),se,le))}var he=void 0!==e.segments?parseInt(e.segments):100,pe=void 0!==e.rings?parseInt(e.rings):100,ge=0;void 0!==e.zoom_level&&(ge=n(parseInt(Math.round(e.zoom_level)),0,100));var ve=te+ge/100*(ee-te),me=60,fe=1e3/me,ye=2e3;void 0!==e.time_anim&&(ye="number"==typeof e.time_anim&&e.time_anim>=0?e.time_anim:!1);var be=G(void 0!==e.anim_speed?e.anim_speed:"2rpm"),we=!0;void 0!==e.reverse_anim&&(we=!!e.reverse_anim);var xe=G(void 0!==e.vertical_anim_speed?e.vertical_anim_speed:"2rpm"),_e=0;if(void 0!==e.vertical_anim_target){var ke=V(e.vertical_anim_target);ke>Math.PI&&(ke-=2*Math.PI),_e=n(ke,ie,oe)}var Ce=new PSVNavBar(this),ze=void 0!==e.navbar?!!e.navbar:!1,Ee=void 0!==e.navbar_style?e.navbar_style:{},Se=void 0!==e.allow_user_interactions?!!e.allow_user_interactions:!0;Se||(ze=!1);var Te,Re=void 0!==e.allow_scroll_to_zoom?!!e.allow_scroll_to_zoom:!0,Ie=void 0!==e.eyes_offset?parseFloat(e.eyes_offset):5,Me="string"==typeof e.container?document.getElementById(e.container):e.container,Pe={},He={};void 0!==e.size&&Y(e.size);var Fe,Be,Ae=e.panorama,Le=null,Oe=null,De=null,Xe=null,We=!1,Ne=0,$e=0,qe=!1,Ge=0,Ve=null,Ye=null,je=new Sphoords,Ue={},Ke=void 0!==e.usexmpdata?!!e.usexmpdata:!0,Ze=void 0!==e.cors_anonymous?!!e.cors_anonymous:!0,Je={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 Qe in Je)void 0!==e.pano_size[Qe]&&(Je[Qe]=parseInt(e.pano_size[Qe]));Ke=!1}var et={horizontal_fov:360,vertical_fov:180};if(void 0!==e.captured_view){for(var Qe in et)void 0!==e.captured_view[Qe]&&(et[Qe]=parseFloat(e.captured_view[Qe]));Ke=!1}var tt=!1,ot=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",it=void 0!==e.loading_img?e.loading_img.toString():null,nt=void 0!==e.loading_html?e.loading_html:null,rt=null;void 0!==e.overlay&&void 0!==e.overlay.image&&(rt={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||(rt.position.x=e.overlay.position.x),void 0===e.overlay.position.y||"top"!=e.overlay.position.y&&"bottom"!=e.overlay.position.y||(rt.position.y=e.overlay.position.y)),void 0!==e.overlay.size&&(rt.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"}));var at=this;void 0!==e.onready&&this.addAction("ready",e.onready);var st=void 0!==e.autoload?!!e.autoload:!0;st&&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 w=document.createElement("div");w.style.cssFloat="left",w.style.boxSizing="inherit",w.style.padding="10px",w.style.height=o.buttonsHeight+"px",w.style.backgroundColor=o.buttonsBackgroundColor,w.style.lineHeight=o.buttonsHeight+"px",w.style.color=o.buttonsColor,w.style.cursor="pointer",w.textContent="+",i(w,"click",function(){e.zoomIn()}),l.appendChild(w);break;case"fullscreen":var x=o.buttonsHeight*o.fullscreenRatio,_=.3*o.buttonsHeight,k=(o.buttonsHeight-_)/2,C=.3*x,z=(x-C)/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=x+"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=k+"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=C+"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=k+"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 A=document.createElement("div");A.style.boxSizing="inherit",A.style.width=H+"px",A.style.height=F+"px",A.style.borderRadius="50%",A.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,A.style.position="absolute",A.style.top="50%",A.style.left="50%",A.style.marginTop=-(F/2+o.gyroscopeThickness)+"px",A.style.marginLeft=-(H/2+o.gyroscopeThickness)+"px",l.appendChild(A);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 O=o.buttonsHeight*o.virtualRealityRatio,D=O/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=O+"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=O+"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){l.style.backgroundColor=e?o.activeButtonsBackgroundColor: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(){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}"WebKit"===u&&window.orientation&&(0>n&&(n=-1*(n+180)),o>=180?o-=180:o+=180);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}"WebKit"===u&&window.orientation&&(0>n&&(n=-1*(n+180)),o>=180?o-=180:o+=180);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;if(screen.orientation)e=screen.orientation;else if(screen.mozOrientation)e=screen.mozOrientation;else if(screen.msOrientation)e=screen.msOrientation;else if(window.orientation||0===window.orientation)switch(window.orientation){case 0:e="portrait-primary";break;case 180:e="portrait-secondary";break;case-90:e="landscape-primary";break;case 90:e="landscape-secondary"}return 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 8f2714151..1b1f532c7 100644 --- a/src/PhotoSphereViewer.js +++ b/src/PhotoSphereViewer.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.7.1 + * Photo Sphere Viewer v2.8 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine