From 756fe831c12ed4c7b3672ca86cfe77c964e89b92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Heleine?= Date: Thu, 6 Aug 2015 11:51:18 +0200 Subject: [PATCH] Version 2.3.1 --- photo-sphere-viewer.js | 3 ++- photo-sphere-viewer.min.js | 2 +- src/PSVNavBar.js | 3 ++- src/PSVNavBarButton.js | 2 +- src/PhotoSphereViewer.js | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/photo-sphere-viewer.js b/photo-sphere-viewer.js index 442c879a6..ebbc645fa 100644 --- a/photo-sphere-viewer.js +++ b/photo-sphere-viewer.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.3 + * Photo Sphere Viewer v2.3.1 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine @@ -1411,6 +1411,7 @@ var PSVNavBar = function(psv) { container.style.zIndex = 10; container.style.bottom = 0; container.style.width = '100%'; + container.style.boxSizing = 'content-box'; container.style.transition = 'bottom 0.4s ease-out'; diff --git a/photo-sphere-viewer.min.js b/photo-sphere-viewer.min.js index b3c0354d0..4cd19fd26 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){return e-2*Math.floor(e/(2*Math.PI))*Math.PI};this.load=function(){if(Se){var e=document.createElement("img");e.setAttribute("src",Se),e.setAttribute("alt",Re),se.appendChild(e)}else se.textContent=Re;return ce=document.createElement("div"),ce.style.width="100%",ce.style.height="100%",ce.style.position="relative",ce.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(ae={width:0,height:0,ratio:0},void(Te?l():d(!1))):void(se.textContent="Canvas is not supported, update your browser!")};var s=function(e,t){var o=e.indexOf("GPano:"+t)+t.length+8,n=e.indexOf('"',o);return e.substring(o,n)},l=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(se.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=e.responseText,o=t.indexOf(""),i=t.substring(o,n);if(-1==o||-1==n||-1==i.indexOf("GPano:"))return void d(!1);var r={full_width:parseInt(s(i,"FullPanoWidthPixels")),full_height:parseInt(s(i,"FullPanoHeightPixels")),cropped_width:parseInt(s(i,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(s(i,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(s(i,"CroppedAreaLeftPixels")),cropped_y:parseInt(s(i,"CroppedAreaTopPixels"))};d(r)}},e.open("GET",he,!0),e.send(null)},d=function(e){var t=new Image;t.onload=function(){e||(e={full_width:t.width,full_height:t.height,cropped_width:t.width,cropped_height:t.height,cropped_x:0,cropped_y:0});var n=2048;if(o()){var i=document.createElement("canvas"),r=i.getContext("webgl");n=r.getParameter(r.MAX_TEXTURE_SIZE)}var a=Math.min(e.full_width,n),s=a/e.full_width;e.full_width=a,e.cropped_width*=s,e.cropped_x*=s,t.width=e.cropped_width,e.full_height*=s,e.cropped_height*=s,e.cropped_y*=s,t.height=e.cropped_height;var l=document.createElement("canvas");l.width=e.full_width,l.height=e.full_height;var r=l.getContext("2d");r.drawImage(t,e.cropped_x,e.cropped_y,e.cropped_width,e.cropped_height),c(l.toDataURL("image/jpeg"))},he.match(/^data:image\/[a-z]+;base64/)||t.setAttribute("crossOrigin","anonymous"),t.src=he},c=function(e){var t=new THREE.Texture,o=new THREE.ImageLoader,n=function(e){t.needsUpdate=!0,t.image=e,u(t)};o.load(e,n)},u=function(e){void 0!==le.width&&(se.style.width=le.width.css),void 0!==le.height&&(se.style.height=le.height.css),b(),pe=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer,pe.setSize(ae.width,ae.height),ge=new THREE.Scene,me=new THREE.PerspectiveCamera(G,ae.ratio,1,300),me.position.set(0,0,0),ge.add(me);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,ge.add(r),ue=document.createElement("div"),ue.style.position="absolute",ue.style.zIndex=0,ce.appendChild(ue),ne&&(oe.setStyle(ie),oe.create(),ce.appendChild(oe.getBar())),n(window,"resize",b),re&&(n(ue,"mousedown",x),n(document,"mousemove",T),n(ue,"mousemove",L),n(document,"mouseup",_),n(ue,"touchstart",C),n(document,"touchend",_),n(document,"touchmove",R),n(ue,"mousewheel",F),n(ue,"DOMMouseScroll",F)),n(document,"fullscreenchange",P),n(document,"mozfullscreenchange",P),n(document,"webkitfullscreenchange",P),n(document,"MSFullscreenChange",P),Ee.addListener(M),se.innerHTML="",se.appendChild(ce);var a=pe.domElement;a.style.display="block",ue.appendChild(a),h(),Z>0&&z(Z),m(),N("ready")},h=function(){var e=new THREE.Vector3;e.setX(Math.cos(U)*Math.sin(K)),e.setY(Math.sin(U)),e.setZ(Math.cos(U)*Math.cos(K)),me.lookAt(e),null!==ve?ve.render(ge,me):pe.render(ge,me)},p=function(){ve=new THREE.StereoEffect(pe),ve.eyeSeparation=5,ve.setSize(ae.width,ae.height),I(),O(),oe.mustBeHidden(),h(),N("stereo-effect",!0)},g=function(){ve=null,pe.setSize(ae.width,ae.height),oe.mustBeHidden(!1),h(),N("stereo-effect",!1)};this.toggleStereo=function(){null!==ve?g():p()};var m=function(){ee!==!1&&(ke=setTimeout(f,ee))},v=function(){U-=U/200,K+=te,K-=2*Math.floor(K/(2*Math.PI))*Math.PI,h(),Ce=setTimeout(v,Q)},f=function(){v(),N("autorotate",!0)},y=function(){clearTimeout(ke),ke=null,clearTimeout(Ce),Ce=null,N("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(ke),Ce?y():f()};var b=function(){(se.clientWidth!=ae.width||se.clientHeight!=ae.height)&&w({width:se.clientWidth,height:se.clientHeight})};this.fitToContainer=function(){b()};var w=function(e){ae.width=void 0!==e.width?parseInt(e.width):ae.width,ae.height=void 0!==e.height?parseInt(e.height):ae.height,ae.ratio=ae.width/ae.height,me&&(me.aspect=ae.ratio,me.updateProjectionMatrix()),pe&&(pe.setSize(ae.width,ae.height),h()),ve&&(ve.setSize(ae.width,ae.height),h())},x=function(e){k(parseInt(e.clientX),parseInt(e.clientY))},C=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==ue&&k(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(_(),e.touches[0].target.parentNode==ue&&e.touches[1].target.parentNode==ue&&E(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));L()},k=function(e,t){ye=e,be=t,y(),fe=!0},E=function(e){xe=e,we=!0},_=function(e){fe=!1,we=!1},T=function(e){e.preventDefault(),S(parseInt(e.clientX),parseInt(e.clientY))},R=function(e){if(1==e.touches.length&&fe){var t=e.touches[0];t.target.parentNode==ue&&(e.preventDefault(),S(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==ue&&e.touches[1].target.parentNode==ue&&we){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),n=o-xe;if(0!=n){var i=n/Math.abs(n);z(Z+i),xe=o}}},S=function(e,t){fe&&(K=a(K+(e-ye)*$),U+=(t-be)*V,U=i(U,j,Y),ye=e,be=t,h())},I=function(){Ee.start(),y(),N("device-orientation",!0)},H=function(){Ee.stop(),N("device-orientation",!1)};this.toggleDeviceOrientation=function(){Ee.isEventAttached()?H():I()};var M=function(e){K=e.longitude,U=i(e.latitude,j,Y),h()},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));z(Z+o)}},z=function(e){Z=i(parseInt(Math.round(e)),0,100),me.fov=G+Z/100*(q-G),me.updateProjectionMatrix(),h(),N("zoom-updated",Z)};this.zoom=function(e){z(e)},this.zoomIn=function(){100>Z&&z(Z+1)},this.zoomOut=function(){Z>0&&z(Z-1)};var B=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},P=function(){document.webkitFullscreenElement?(de.width=se.style.width,de.height=se.style.height,se.style.width="100%",se.style.height="100%",b()):se.webkitRequestFullscreen&&(se.style.width=de.width,se.style.height=de.height,b()),N("fullscreen-mode",B())},O=function(){se.requestFullscreen?se.requestFullscreen():se.mozRequestFullScreen?se.mozRequestFullScreen():se.webkitRequestFullscreen?se.webkitRequestFullscreen():se.msRequestFullscreen&&se.msRequestFullscreen()},A=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){B()?A():O()};var L=function(){ne&&oe.show()},D=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}te=n*Q/1e3},X=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)},W=function(e){for(dim in e)if("width"==dim||"height"==dim){var t=e[dim].toString().trim(),o=parseFloat(t.replace(/^([0-9]+(?:\.[0-9]*)?).*$/,"$1")),n=t.replace(/^[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();"%"!=n&&(n="px"),le[dim]={css:o+n,unit:n}}};this.addAction=function(e,t){e in _e||(_e[e]=[]),_e[e].push(t)};var N=function(e,t){if(e in _e&&_e[e].length)for(var o=0,n=_e[e].length;n>o;++o)void 0!==t?_e[e][o](t):_e[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 $=void 0!==e.long_offset?parseFloat(e.long_offset):Math.PI/360,V=void 0!==e.lat_offset?parseFloat(e.lat_offset):Math.PI/180,q=void 0!==e.min_fov?i(parseFloat(e.min_fov),1,179):30,G=void 0!==e.max_fov?i(parseFloat(e.max_fov),1,179):90,Y=void 0!==e.tilt_up_max?i(X(e.tilt_up_max),0,Math.PI/2):Math.PI/2,j=void 0!==e.tilt_down_max?-i(X(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,U=0,K=0;void 0!==e.default_position&&(void 0!==e.default_position.lat&&(U=i(X(e.default_position.lat),j,Y)),void 0!==e.default_position["long"]&&(K=X(e.default_position["long"])));var Z=0;void 0!==e.zoom_level&&(Z=i(parseInt(Math.round(e.zoom_level)),0,100));var J=60,Q=1e3/J,ee=2e3;void 0!==e.time_anim&&(ee="number"==typeof e.time_anim&&e.time_anim>=0?e.time_anim:!1);var te=void 0!==e.theta_offset?Math.PI/parseInt(e.theta_offset):Math.PI/1440;D(void 0!==e.anim_speed?e.anim_speed:"2rpm");var oe=new PSVNavBar(this),ne=void 0!==e.navbar?!!e.navbar:!1,ie=void 0!==e.navbar_style?e.navbar_style:{},re=void 0!==e.allow_user_interactions?!!e.allow_user_interactions:!0;re||(ne=!1);var ae,se=e.container,le={},de={};void 0!==e.size&&W(e.size);var ce,ue,he=e.panorama,pe=null,ge=null,me=null,ve=null,fe=!1,ye=0,be=0,we=!1,xe=0,Ce=null,ke=null,Ee=new Sphoords,_e={},Te=void 0!==e.usexmpdata?!!e.usexmpdata:!0,Re=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",Se=void 0!==e.loading_img?e.loading_img.toString():null;void 0!==e.onready&&this.addAction("ready",e.onready);var Ie=void 0!==e.autoload?!!e.autoload:!0;Ie&&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(property in e)property in u&&o(property,e[property])&&(u[property]=e[property])},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.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.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.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.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";var b=document.createElement("div");b.style.cssFloat="left",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.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.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.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 w=document.createElement("div");w.style.cssFloat="left",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="+",n(w,"click",function(){e.zoomIn()}),l.appendChild(w);break;case"fullscreen":var x=o.buttonsHeight*o.fullscreenRatio,C=.3*o.buttonsHeight,k=(o.buttonsHeight-C)/2,E=.3*x,_=(x-E)/2-o.fullscreenThickness,T=o.buttonsHeight-2*o.fullscreenThickness;l=document.createElement("div"),l.style.cssFloat="right",l.style.padding="10px",l.style.width=x+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.cursor="pointer",n(l,"click",function(){e.toggleFullscreen()});var R=document.createElement("div");R.style.cssFloat="left",R.style.width=o.fullscreenThickness+"px",R.style.height=C+"px",R.style.borderStyle="solid",R.style.borderColor=o.buttonsColor+" transparent",R.style.borderWidth=k+"px 0",l.appendChild(R);var S=document.createElement("div");S.style.cssFloat="left",S.style.width=_+"px",S.style.height=T+"px",S.style.borderStyle="solid",S.style.borderColor=o.buttonsColor+" transparent",S.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(S);var I=document.createElement("div");I.style.cssFloat="left",I.style.marginLeft=E+"px",I.style.width=_+"px",I.style.height=T+"px",I.style.borderStyle="solid",I.style.borderColor=o.buttonsColor+" transparent",I.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(I);var H=document.createElement("div");H.style.cssFloat="left",H.style.width=o.fullscreenThickness+"px",H.style.height=C+"px",H.style.borderStyle="solid",H.style.borderColor=o.buttonsColor+" transparent",H.style.borderWidth=k+"px 0",l.appendChild(H);var M=document.createElement("div");M.style.clear="left",l.appendChild(M),e.addAction("fullscreen-mode",d);break;case"orientation":var F=o.buttonsHeight-2*o.gyroscopeThickness,z=F-4*o.gyroscopeThickness,B=F/10;l=document.createElement("div"),l.style.cssFloat="right",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 P=document.createElement("div");P.style.width=F+"px",P.style.height=F+"px",P.style.borderRadius="50%",P.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,l.appendChild(P);var O=document.createElement("div");O.style.width=z+"px",O.style.height=B+"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=-(B/2+o.gyroscopeThickness)+"px",O.style.marginLeft=-(z/2+o.gyroscopeThickness)+"px",l.appendChild(O);var A=document.createElement("div");A.style.width=B+"px",A.style.height=z+"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=-(z/2+o.gyroscopeThickness)+"px",A.style.marginLeft=-(B/2+o.gyroscopeThickness)+"px",l.appendChild(A),e.addAction("device-orientation",d);break;case"virtual-reality":var L=o.buttonsHeight*o.virtualRealityRatio,D=L/4,X=D/2;l=document.createElement("div"),l.style.cssFloat="right",l.style.position="relative",l.style.padding="10px",l.style.width=L+"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.width=L+"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.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.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 V=document.createElement("div");V.style.width=D+"px",V.style.height=o.buttonsHeight/2+"px",V.style.position="absolute",V.style.left="50%",V.style.bottom="10px",V.style.marginLeft=-(D/2)+"px",V.style.borderTopLeftRadius="50% 60%",V.style.borderTopRightRadius="50% 60%",V.style.backgroundColor=o.backgroundColor,l.appendChild(V),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"))},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){return e-2*Math.floor(e/(2*Math.PI))*Math.PI};this.load=function(){if(Se){var e=document.createElement("img");e.setAttribute("src",Se),e.setAttribute("alt",Re),se.appendChild(e)}else se.textContent=Re;return ce=document.createElement("div"),ce.style.width="100%",ce.style.height="100%",ce.style.position="relative",ce.style.overflow="hidden",t()?void 0===window.THREE?void console.log("PhotoSphereViewer: Three.js is not loaded."):(ae={width:0,height:0,ratio:0},void(Te?l():d(!1))):void(se.textContent="Canvas is not supported, update your browser!")};var s=function(e,t){var o=e.indexOf("GPano:"+t)+t.length+8,n=e.indexOf('"',o);return e.substring(o,n)},l=function(){var e=null;if(window.XMLHttpRequest)e=new XMLHttpRequest;else{if(!window.ActiveXObject)return void(se.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=e.responseText,o=t.indexOf(""),i=t.substring(o,n);if(-1==o||-1==n||-1==i.indexOf("GPano:"))return void d(!1);var r={full_width:parseInt(s(i,"FullPanoWidthPixels")),full_height:parseInt(s(i,"FullPanoHeightPixels")),cropped_width:parseInt(s(i,"CroppedAreaImageWidthPixels")),cropped_height:parseInt(s(i,"CroppedAreaImageHeightPixels")),cropped_x:parseInt(s(i,"CroppedAreaLeftPixels")),cropped_y:parseInt(s(i,"CroppedAreaTopPixels"))};d(r)}},e.open("GET",he,!0),e.send(null)},d=function(e){var t=new Image;t.onload=function(){e||(e={full_width:t.width,full_height:t.height,cropped_width:t.width,cropped_height:t.height,cropped_x:0,cropped_y:0});var n=2048;if(o()){var i=document.createElement("canvas"),r=i.getContext("webgl");n=r.getParameter(r.MAX_TEXTURE_SIZE)}var a=Math.min(e.full_width,n),s=a/e.full_width;e.full_width=a,e.cropped_width*=s,e.cropped_x*=s,t.width=e.cropped_width,e.full_height*=s,e.cropped_height*=s,e.cropped_y*=s,t.height=e.cropped_height;var l=document.createElement("canvas");l.width=e.full_width,l.height=e.full_height;var r=l.getContext("2d");r.drawImage(t,e.cropped_x,e.cropped_y,e.cropped_width,e.cropped_height),c(l.toDataURL("image/jpeg"))},he.match(/^data:image\/[a-z]+;base64/)||t.setAttribute("crossOrigin","anonymous"),t.src=he},c=function(e){var t=new THREE.Texture,o=new THREE.ImageLoader,n=function(e){t.needsUpdate=!0,t.image=e,u(t)};o.load(e,n)},u=function(e){void 0!==le.width&&(se.style.width=le.width.css),void 0!==le.height&&(se.style.height=le.height.css),b(),pe=o()?new THREE.WebGLRenderer:new THREE.CanvasRenderer,pe.setSize(ae.width,ae.height),ge=new THREE.Scene,me=new THREE.PerspectiveCamera(G,ae.ratio,1,300),me.position.set(0,0,0),ge.add(me);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,ge.add(r),ue=document.createElement("div"),ue.style.position="absolute",ue.style.zIndex=0,ce.appendChild(ue),ne&&(oe.setStyle(ie),oe.create(),ce.appendChild(oe.getBar())),n(window,"resize",b),re&&(n(ue,"mousedown",x),n(document,"mousemove",T),n(ue,"mousemove",L),n(document,"mouseup",_),n(ue,"touchstart",C),n(document,"touchend",_),n(document,"touchmove",R),n(ue,"mousewheel",z),n(ue,"DOMMouseScroll",z)),n(document,"fullscreenchange",P),n(document,"mozfullscreenchange",P),n(document,"webkitfullscreenchange",P),n(document,"MSFullscreenChange",P),Ee.addListener(M),se.innerHTML="",se.appendChild(ce);var a=pe.domElement;a.style.display="block",ue.appendChild(a),h(),Z>0&&F(Z),m(),N("ready")},h=function(){var e=new THREE.Vector3;e.setX(Math.cos(U)*Math.sin(K)),e.setY(Math.sin(U)),e.setZ(Math.cos(U)*Math.cos(K)),me.lookAt(e),null!==ve?ve.render(ge,me):pe.render(ge,me)},p=function(){ve=new THREE.StereoEffect(pe),ve.eyeSeparation=5,ve.setSize(ae.width,ae.height),I(),O(),oe.mustBeHidden(),h(),N("stereo-effect",!0)},g=function(){ve=null,pe.setSize(ae.width,ae.height),oe.mustBeHidden(!1),h(),N("stereo-effect",!1)};this.toggleStereo=function(){null!==ve?g():p()};var m=function(){ee!==!1&&(ke=setTimeout(f,ee))},v=function(){U-=U/200,K+=te,K-=2*Math.floor(K/(2*Math.PI))*Math.PI,h(),Ce=setTimeout(v,Q)},f=function(){v(),N("autorotate",!0)},y=function(){clearTimeout(ke),ke=null,clearTimeout(Ce),Ce=null,N("autorotate",!1)};this.toggleAutorotate=function(){clearTimeout(ke),Ce?y():f()};var b=function(){(se.clientWidth!=ae.width||se.clientHeight!=ae.height)&&w({width:se.clientWidth,height:se.clientHeight})};this.fitToContainer=function(){b()};var w=function(e){ae.width=void 0!==e.width?parseInt(e.width):ae.width,ae.height=void 0!==e.height?parseInt(e.height):ae.height,ae.ratio=ae.width/ae.height,me&&(me.aspect=ae.ratio,me.updateProjectionMatrix()),pe&&(pe.setSize(ae.width,ae.height),h()),ve&&(ve.setSize(ae.width,ae.height),h())},x=function(e){k(parseInt(e.clientX),parseInt(e.clientY))},C=function(e){if(1==e.touches.length){var t=e.touches[0];t.target.parentNode==ue&&k(parseInt(t.clientX),parseInt(t.clientY))}else 2==e.touches.length&&(_(),e.touches[0].target.parentNode==ue&&e.touches[1].target.parentNode==ue&&E(r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY)));L()},k=function(e,t){ye=e,be=t,y(),fe=!0},E=function(e){xe=e,we=!0},_=function(e){fe=!1,we=!1},T=function(e){e.preventDefault(),S(parseInt(e.clientX),parseInt(e.clientY))},R=function(e){if(1==e.touches.length&&fe){var t=e.touches[0];t.target.parentNode==ue&&(e.preventDefault(),S(parseInt(t.clientX),parseInt(t.clientY)))}else if(2==e.touches.length&&e.touches[0].target.parentNode==ue&&e.touches[1].target.parentNode==ue&&we){e.preventDefault();var o=r(e.touches[0].clientX,e.touches[0].clientY,e.touches[1].clientX,e.touches[1].clientY),n=o-xe;if(0!=n){var i=n/Math.abs(n);F(Z+i),xe=o}}},S=function(e,t){fe&&(K=a(K+(e-ye)*$),U+=(t-be)*V,U=i(U,j,Y),ye=e,be=t,h())},I=function(){Ee.start(),y(),N("device-orientation",!0)},H=function(){Ee.stop(),N("device-orientation",!1)};this.toggleDeviceOrientation=function(){Ee.isEventAttached()?H():I()};var M=function(e){K=e.longitude,U=i(e.latitude,j,Y),h()},z=function(e){e.preventDefault(),e.stopPropagation();var t=e.detail?-e.detail:e.wheelDelta;if(0!=t){var o=parseInt(t/Math.abs(t));F(Z+o)}},F=function(e){Z=i(parseInt(Math.round(e)),0,100),me.fov=G+Z/100*(q-G),me.updateProjectionMatrix(),h(),N("zoom-updated",Z)};this.zoom=function(e){F(e)},this.zoomIn=function(){100>Z&&F(Z+1)},this.zoomOut=function(){Z>0&&F(Z-1)};var B=function(){return!!(document.fullscreenElement||document.mozFullScreenElement||document.webkitFullscreenElement||document.msFullscreenElement)},P=function(){document.webkitFullscreenElement?(de.width=se.style.width,de.height=se.style.height,se.style.width="100%",se.style.height="100%",b()):se.webkitRequestFullscreen&&(se.style.width=de.width,se.style.height=de.height,b()),N("fullscreen-mode",B())},O=function(){se.requestFullscreen?se.requestFullscreen():se.mozRequestFullScreen?se.mozRequestFullScreen():se.webkitRequestFullscreen?se.webkitRequestFullscreen():se.msRequestFullscreen&&se.msRequestFullscreen()},A=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.msExitFullscreen&&document.msExitFullscreen()};this.toggleFullscreen=function(){B()?A():O()};var L=function(){ne&&oe.show()},D=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}te=n*Q/1e3},X=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)},W=function(e){for(dim in e)if("width"==dim||"height"==dim){var t=e[dim].toString().trim(),o=parseFloat(t.replace(/^([0-9]+(?:\.[0-9]*)?).*$/,"$1")),n=t.replace(/^[0-9]+(?:\.[0-9]*)?(.*)$/,"$1").trim();"%"!=n&&(n="px"),le[dim]={css:o+n,unit:n}}};this.addAction=function(e,t){e in _e||(_e[e]=[]),_e[e].push(t)};var N=function(e,t){if(e in _e&&_e[e].length)for(var o=0,n=_e[e].length;n>o;++o)void 0!==t?_e[e][o](t):_e[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 $=void 0!==e.long_offset?parseFloat(e.long_offset):Math.PI/360,V=void 0!==e.lat_offset?parseFloat(e.lat_offset):Math.PI/180,q=void 0!==e.min_fov?i(parseFloat(e.min_fov),1,179):30,G=void 0!==e.max_fov?i(parseFloat(e.max_fov),1,179):90,Y=void 0!==e.tilt_up_max?i(X(e.tilt_up_max),0,Math.PI/2):Math.PI/2,j=void 0!==e.tilt_down_max?-i(X(e.tilt_down_max),0,Math.PI/2):-Math.PI/2,U=0,K=0;void 0!==e.default_position&&(void 0!==e.default_position.lat&&(U=i(X(e.default_position.lat),j,Y)),void 0!==e.default_position["long"]&&(K=X(e.default_position["long"])));var Z=0;void 0!==e.zoom_level&&(Z=i(parseInt(Math.round(e.zoom_level)),0,100));var J=60,Q=1e3/J,ee=2e3;void 0!==e.time_anim&&(ee="number"==typeof e.time_anim&&e.time_anim>=0?e.time_anim:!1);var te=void 0!==e.theta_offset?Math.PI/parseInt(e.theta_offset):Math.PI/1440;D(void 0!==e.anim_speed?e.anim_speed:"2rpm");var oe=new PSVNavBar(this),ne=void 0!==e.navbar?!!e.navbar:!1,ie=void 0!==e.navbar_style?e.navbar_style:{},re=void 0!==e.allow_user_interactions?!!e.allow_user_interactions:!0;re||(ne=!1);var ae,se=e.container,le={},de={};void 0!==e.size&&W(e.size);var ce,ue,he=e.panorama,pe=null,ge=null,me=null,ve=null,fe=!1,ye=0,be=0,we=!1,xe=0,Ce=null,ke=null,Ee=new Sphoords,_e={},Te=void 0!==e.usexmpdata?!!e.usexmpdata:!0,Re=void 0!==e.loading_msg?e.loading_msg.toString():"Loading…",Se=void 0!==e.loading_img?e.loading_img.toString():null;void 0!==e.onready&&this.addAction("ready",e.onready);var Ie=void 0!==e.autoload?!!e.autoload:!0;Ie&&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(property in e)property in u&&o(property,e[property])&&(u[property]=e[property])},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.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.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.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";var b=document.createElement("div");b.style.cssFloat="left",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.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.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.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 w=document.createElement("div");w.style.cssFloat="left",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="+",n(w,"click",function(){e.zoomIn()}),l.appendChild(w);break;case"fullscreen":var x=o.buttonsHeight*o.fullscreenRatio,C=.3*o.buttonsHeight,k=(o.buttonsHeight-C)/2,E=.3*x,_=(x-E)/2-o.fullscreenThickness,T=o.buttonsHeight-2*o.fullscreenThickness;l=document.createElement("div"),l.style.cssFloat="right",l.style.padding="10px",l.style.width=x+"px",l.style.height=o.buttonsHeight+"px",l.style.backgroundColor=o.buttonsBackgroundColor,l.style.cursor="pointer",n(l,"click",function(){e.toggleFullscreen()});var R=document.createElement("div");R.style.cssFloat="left",R.style.width=o.fullscreenThickness+"px",R.style.height=C+"px",R.style.borderStyle="solid",R.style.borderColor=o.buttonsColor+" transparent",R.style.borderWidth=k+"px 0",l.appendChild(R);var S=document.createElement("div");S.style.cssFloat="left",S.style.width=_+"px",S.style.height=T+"px",S.style.borderStyle="solid",S.style.borderColor=o.buttonsColor+" transparent",S.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(S);var I=document.createElement("div");I.style.cssFloat="left",I.style.marginLeft=E+"px",I.style.width=_+"px",I.style.height=T+"px",I.style.borderStyle="solid",I.style.borderColor=o.buttonsColor+" transparent",I.style.borderWidth=o.fullscreenThickness+"px 0",l.appendChild(I);var H=document.createElement("div");H.style.cssFloat="left",H.style.width=o.fullscreenThickness+"px",H.style.height=C+"px",H.style.borderStyle="solid",H.style.borderColor=o.buttonsColor+" transparent",H.style.borderWidth=k+"px 0",l.appendChild(H);var M=document.createElement("div");M.style.clear="left",l.appendChild(M),e.addAction("fullscreen-mode",d);break;case"orientation":var z=o.buttonsHeight-2*o.gyroscopeThickness,F=z-4*o.gyroscopeThickness,B=z/10;l=document.createElement("div"),l.style.cssFloat="right",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 P=document.createElement("div");P.style.width=z+"px",P.style.height=z+"px",P.style.borderRadius="50%",P.style.border=o.gyroscopeThickness+"px solid "+o.buttonsColor,l.appendChild(P);var O=document.createElement("div");O.style.width=F+"px",O.style.height=B+"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=-(B/2+o.gyroscopeThickness)+"px",O.style.marginLeft=-(F/2+o.gyroscopeThickness)+"px",l.appendChild(O);var A=document.createElement("div");A.style.width=B+"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=-(B/2+o.gyroscopeThickness)+"px",l.appendChild(A),e.addAction("device-orientation",d);break;case"virtual-reality":var L=o.buttonsHeight*o.virtualRealityRatio,D=L/4,X=D/2;l=document.createElement("div"),l.style.cssFloat="right",l.style.position="relative",l.style.padding="10px",l.style.width=L+"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.width=L+"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.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.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 V=document.createElement("div");V.style.width=D+"px",V.style.height=o.buttonsHeight/2+"px",V.style.position="absolute",V.style.left="50%",V.style.bottom="10px",V.style.marginLeft=-(D/2)+"px",V.style.borderTopLeftRadius="50% 60%",V.style.borderTopRightRadius="50% 60%",V.style.backgroundColor=o.backgroundColor,l.appendChild(V),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 diff --git a/src/PSVNavBar.js b/src/PSVNavBar.js index 2f77ab329..9388dc0d5 100644 --- a/src/PSVNavBar.js +++ b/src/PSVNavBar.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.3 + * Photo Sphere Viewer v2.3.1 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine @@ -118,6 +118,7 @@ var PSVNavBar = function(psv) { container.style.zIndex = 10; container.style.bottom = 0; container.style.width = '100%'; + container.style.boxSizing = 'content-box'; container.style.transition = 'bottom 0.4s ease-out'; diff --git a/src/PSVNavBarButton.js b/src/PSVNavBarButton.js index 7120b3c64..f337f3ab3 100644 --- a/src/PSVNavBarButton.js +++ b/src/PSVNavBarButton.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.3 + * Photo Sphere Viewer v2.3.1 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine diff --git a/src/PhotoSphereViewer.js b/src/PhotoSphereViewer.js index ef6bebae2..c223b225e 100644 --- a/src/PhotoSphereViewer.js +++ b/src/PhotoSphereViewer.js @@ -1,5 +1,5 @@ /* - * Photo Sphere Viewer v2.3 + * Photo Sphere Viewer v2.3.1 * http://jeremyheleine.me/photo-sphere-viewer * * Copyright (c) 2014,2015 Jérémy Heleine