Browse Source

Add build files

pull/675/head
Will Calderbank 6 years ago
parent
commit
a6718d14bd
3 changed files with 221 additions and 0 deletions
  1. +2
    -0
      build/pannellum.css
  2. +113
    -0
      build/pannellum.htm
  3. +106
    -0
      build/pannellum.js

+ 2
- 0
build/pannellum.css
File diff suppressed because it is too large
View File


+ 113
- 0
build/pannellum.htm
File diff suppressed because it is too large
View File


+ 106
- 0
build/pannellum.js View File

@@ -0,0 +1,106 @@
// Pannellum 3e33dcc, https://github.com/mpetroff/pannellum
window.libpannellum=function(H,f,p){function ma(S){function Oa(a,e){return 1==a.level&&1!=e.level?-1:1==e.level&&1!=a.level?1:e.timestamp-a.timestamp}function P(a,e){return a.level!=e.level?a.level-e.level:a.diff-e.diff}function Z(a,e,d,f,l,c){this.vertices=a;this.side=e;this.level=d;this.x=f;this.y=l;this.path=c.replace("%s",e).replace("%l",d).replace("%x",f).replace("%y",l)}function $(a,e,f,p,l){var c;var g=e.vertices;c=ha(a,g.slice(0,3));var s=ha(a,g.slice(3,6)),w=ha(a,g.slice(6,9)),g=ha(a,g.slice(9,
12)),t=c[0]+s[0]+w[0]+g[0];-4==t||4==t?c=!1:(t=c[1]+s[1]+w[1]+g[1],c=-4==t||4==t?!1:4!=c[2]+s[2]+w[2]+g[2]);if(c){c=e.vertices;s=c[0]+c[3]+c[6]+c[9];w=c[1]+c[4]+c[7]+c[10];g=c[2]+c[5]+c[8]+c[11];t=Math.sqrt(s*s+w*w+g*g);g=Math.asin(g/t);s=Math.atan2(w,s)-p;s+=s>Math.PI?-2*Math.PI:s<-Math.PI?2*Math.PI:0;s=Math.abs(s);e.diff=Math.acos(Math.sin(f)*Math.sin(g)+Math.cos(f)*Math.cos(g)*Math.cos(s));s=!1;for(w=0;w<d.nodeCache.length;w++)if(d.nodeCache[w].path==e.path){s=!0;d.nodeCache[w].timestamp=d.nodeCacheTimestamp++;
d.nodeCache[w].diff=e.diff;d.currentNodes.push(d.nodeCache[w]);break}s||(e.timestamp=d.nodeCacheTimestamp++,d.currentNodes.push(e),d.nodeCache.push(e));if(e.level<d.level){var g=r.cubeResolution*Math.pow(2,e.level-r.maxLevel),s=Math.ceil(g*r.invTileResolution)-1,w=g%r.tileResolution*2,x=2*g%r.tileResolution;0===x&&(x=r.tileResolution);0===w&&(w=2*r.tileResolution);t=0.5;if(e.x==s||e.y==s)t=1-r.tileResolution/(r.tileResolution+x);var k=1-t,g=[],m=t,y=t,B=t,O=k,K=k,D=k;if(x<r.tileResolution)if(e.x==
s&&e.y!=s){if(K=y=0.5,"d"==e.side||"u"==e.side)D=B=0.5}else e.x!=s&&e.y==s&&(O=m=0.5,"l"==e.side||"r"==e.side)&&(D=B=0.5);w<=r.tileResolution&&(e.x==s&&(m=0,O=1,"l"==e.side||"r"==e.side)&&(B=0,D=1),e.y==s&&(y=0,K=1,"d"==e.side||"u"==e.side)&&(B=0,D=1));x=[c[0],c[1],c[2],c[0]*m+c[3]*O,c[1]*t+c[4]*k,c[2]*B+c[5]*D,c[0]*m+c[6]*O,c[1]*y+c[7]*K,c[2]*B+c[8]*D,c[0]*t+c[9]*k,c[1]*y+c[10]*K,c[2]*B+c[11]*D];x=new Z(x,e.side,e.level+1,2*e.x,2*e.y,r.fullpath);g.push(x);e.x==s&&w<=r.tileResolution||(x=[c[0]*m+
c[3]*O,c[1]*t+c[4]*k,c[2]*B+c[5]*D,c[3],c[4],c[5],c[3]*t+c[6]*k,c[4]*y+c[7]*K,c[5]*B+c[8]*D,c[0]*m+c[6]*O,c[1]*y+c[7]*K,c[2]*B+c[8]*D],x=new Z(x,e.side,e.level+1,2*e.x+1,2*e.y,r.fullpath),g.push(x));e.x==s&&w<=r.tileResolution||e.y==s&&w<=r.tileResolution||(x=[c[0]*m+c[6]*O,c[1]*y+c[7]*K,c[2]*B+c[8]*D,c[3]*t+c[6]*k,c[4]*y+c[7]*K,c[5]*B+c[8]*D,c[6],c[7],c[8],c[9]*m+c[6]*O,c[10]*t+c[7]*k,c[11]*B+c[8]*D],x=new Z(x,e.side,e.level+1,2*e.x+1,2*e.y+1,r.fullpath),g.push(x));e.y==s&&w<=r.tileResolution||(x=
[c[0]*t+c[9]*k,c[1]*y+c[10]*K,c[2]*B+c[11]*D,c[0]*m+c[6]*O,c[1]*y+c[7]*K,c[2]*B+c[8]*D,c[9]*m+c[6]*O,c[10]*t+c[7]*k,c[11]*B+c[8]*D,c[9],c[10],c[11]],x=new Z(x,e.side,e.level+1,2*e.x,2*e.y+1,r.fullpath),g.push(x));for(e=0;e<g.length;e++)$(a,g[e],f,p,l)}}}function Ea(){return[-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,-1,-1,1,1,-1,1,-1,1,1,1,1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1,1,-1,1,-1,-1,1,-1,1,1,-1,1,-1,-1,-1,-1,-1,-1,1,1,1,-1,1,1,1,1,-1,1,1,-1,-1]}function ua(a,e,d){var f=Math.sin(e);e=Math.cos(e);
if("x"==d)return[a[0],e*a[1]+f*a[2],e*a[2]-f*a[1],a[3],e*a[4]+f*a[5],e*a[5]-f*a[4],a[6],e*a[7]+f*a[8],e*a[8]-f*a[7]];if("y"==d)return[e*a[0]-f*a[2],a[1],e*a[2]+f*a[0],e*a[3]-f*a[5],a[4],e*a[5]+f*a[3],e*a[6]-f*a[8],a[7],e*a[8]+f*a[6]];if("z"==d)return[e*a[0]+f*a[1],e*a[1]-f*a[0],a[2],e*a[3]+f*a[4],e*a[4]-f*a[3],a[5],e*a[6]+f*a[7],e*a[7]-f*a[6],a[8]]}function va(a){return[a[0],a[4],a[8],a[12],a[1],a[5],a[9],a[13],a[2],a[6],a[10],a[14],a[3],a[7],a[11],a[15]]}function Ja(a){ma(a,encodeURI(a.path+"."+
r.extension),function(e,d){a.texture=e;a.textureLoaded=d?2:1},aa.crossOrigin)}function ha(a,e){var d=[a[0]*e[0]+a[1]*e[1]+a[2]*e[2],a[4]*e[0]+a[5]*e[1]+a[6]*e[2],a[11]+a[8]*e[0]+a[9]*e[1]+a[10]*e[2],1/(a[12]*e[0]+a[13]*e[1]+a[14]*e[2])],f=d[0]*d[3],l=d[1]*d[3],d=d[2]*d[3],c=[0,0,0];-1>f&&(c[0]=-1);1<f&&(c[0]=1);-1>l&&(c[1]=-1);1<l&&(c[1]=1);if(-1>d||1<d)c[2]=1;return c}function wa(){console.log("Reducing canvas size due to error 1286!");y.width=Math.round(y.width/2);y.height=Math.round(y.height/2)}
var y=f.createElement("canvas");y.style.width=y.style.height="100%";S.appendChild(y);var d,a,W,Q,X,T,xa,ia,r,F,ya,oa,G,ea,Fa,aa;this.init=function(A,e,Pa,na,l,c,g,s){function w(a){if(x){var c=a*a*4,e=new Uint8ClampedArray(c),d=s.backgroundColor?s.backgroundColor:[0,0,0];d[0]*=255;d[1]*=255;d[2]*=255;for(var g=0;g<c;g++)e[g++]=d[0],e[g++]=d[1],e[g++]=d[2];a=new ImageData(e,a,a);for(t=0;6>t;t++)0==r[t].width&&(r[t]=a)}}e===p&&(e="equirectangular");if("equirectangular"!=e&&"cubemap"!=e&&"multires"!=
e)throw console.log("Error: invalid image type specified!"),{type:"config error"};F=e;r=A;ya=Pa;aa=s||{};if(d){W&&(a.detachShader(d,W),a.deleteShader(W));Q&&(a.detachShader(d,Q),a.deleteShader(Q));a.bindBuffer(a.ARRAY_BUFFER,null);a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,null);d.texture&&a.deleteTexture(d.texture);if(d.nodeCache)for(A=0;A<d.nodeCache.length;A++)a.deleteTexture(d.nodeCache[A].texture);a.deleteProgram(d);d=p}ia=p;var t,x=!1,I;if("cubemap"==F)for(t=0;6>t;t++)0<r[t].width?(I===p&&(I=r[t].width),
I!=r[t].width&&console.log("Cube faces have inconsistent widths: "+I+" vs. "+r[t].width)):x=!0;"cubemap"==F&&0!==(I&I-1)&&(navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 8_/)||navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 9_/)||navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 10_/)||navigator.userAgent.match(/Trident.*rv[ :]*11\./))||(a||(a=y.getContext("experimental-webgl",{alpha:!1,depth:!1})),a&&1286==a.getError()&&wa());if(!a&&("multires"==
F&&r.hasOwnProperty("fallbackPath")||"cubemap"==F)&&("WebkitAppearance"in f.documentElement.style||navigator.userAgent.match(/Trident.*rv[ :]*11\./)||-1!==navigator.appVersion.indexOf("MSIE 10"))){T&&S.removeChild(T);T=f.createElement("div");T.className="pnlm-world";na=r.basePath?r.basePath+r.fallbackPath:r.fallbackPath;var H="frblud".split(""),P=0;l=function(){var a=f.createElement("canvas");a.className="pnlm-face pnlm-"+H[this.side]+"face";T.appendChild(a);var c=a.getContext("2d");a.style.width=
this.width+4+"px";a.style.height=this.height+4+"px";a.width=this.width+4;a.height=this.height+4;c.drawImage(this,2,2);var e=c.getImageData(0,0,a.width,a.height),d=e.data,g,b;for(g=2;g<a.width-2;g++)for(b=0;4>b;b++)d[4*(g+a.width)+b]=d[4*(g+2*a.width)+b],d[4*(g+a.width*(a.height-2))+b]=d[4*(g+a.width*(a.height-3))+b];for(g=2;g<a.height-2;g++)for(b=0;4>b;b++)d[4*(g*a.width+1)+b]=d[4*(g*a.width+2)+b],d[4*((g+1)*a.width-2)+b]=d[4*((g+1)*a.width-3)+b];for(b=0;4>b;b++)d[4*(a.width+1)+b]=d[4*(2*a.width+
2)+b],d[4*(2*a.width-2)+b]=d[4*(3*a.width-3)+b],d[4*(a.width*(a.height-2)+1)+b]=d[4*(a.width*(a.height-3)+2)+b],d[4*(a.width*(a.height-1)-2)+b]=d[4*(a.width*(a.height-2)-3)+b];for(g=1;g<a.width-1;g++)for(b=0;4>b;b++)d[4*g+b]=d[4*(g+a.width)+b],d[4*(g+a.width*(a.height-1))+b]=d[4*(g+a.width*(a.height-2))+b];for(g=1;g<a.height-1;g++)for(b=0;4>b;b++)d[g*a.width*4+b]=d[4*(g*a.width+1)+b],d[4*((g+1)*a.width-1)+b]=d[4*((g+1)*a.width-2)+b];for(b=0;4>b;b++)d[b]=d[4*(a.width+1)+b],d[4*(a.width-1)+b]=d[4*(2*
a.width-2)+b],d[a.width*(a.height-1)*4+b]=d[4*(a.width*(a.height-2)+1)+b],d[4*(a.width*a.height-1)+b]=d[4*(a.width*(a.height-1)-2)+b];c.putImageData(e,0,0);B.call(this)};var B=function(){0<this.width?(X===p&&(X=this.width),X!=this.width&&console.log("Fallback faces have inconsistent widths: "+X+" vs. "+this.width)):x=!0;P++;6==P&&(X=this.width,S.appendChild(T),g())},x=!1;for(t=0;6>t;t++)c=new Image,c.crossOrigin=aa.crossOrigin?aa.crossOrigin:"anonymous",c.side=t,c.onload=l,c.onerror=B,c.src="multires"==
F?encodeURI(na.replace("%s",H[t])+"."+r.extension):encodeURI(r[t].src);w(X)}else{if(!a)throw console.log("Error: no WebGL support detected!"),{type:"no webgl"};"cubemap"==F&&w(I);r.fullpath=r.basePath?r.basePath+r.path:r.path;r.invTileResolution=1/r.tileResolution;A=Ea();xa=[];for(t=0;6>t;t++)xa[t]=A.slice(12*t,12*t+12),A=Ea();e=A=0;"equirectangular"==F?(A=Math.max(r.width,r.height),e=a.getParameter(a.MAX_TEXTURE_SIZE)):"cubemap"==F&&(A=I,e=a.getParameter(a.MAX_CUBE_MAP_TEXTURE_SIZE));if(A>e)throw console.log("Error: The image is too big; it's "+
A+"px wide, but this device's maximum supported size is "+e+"px."),{type:"webgl size error",width:A,maxWidth:e};s===p||s.horizonPitch===p&&s.horizonRoll===p||(ia=[s.horizonPitch==p?0:s.horizonPitch,s.horizonRoll==p?0:s.horizonRoll]);I=a.TEXTURE_2D;a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight);W=a.createShader(a.VERTEX_SHADER);A=m;"multires"==F&&(A=k);a.shaderSource(W,A);a.compileShader(W);Q=a.createShader(a.FRAGMENT_SHADER);A=Ka;"cubemap"==F?(I=a.TEXTURE_CUBE_MAP,A=bb):"multires"==F&&
(A=ra);a.shaderSource(Q,A);a.compileShader(Q);d=a.createProgram();a.attachShader(d,W);a.attachShader(d,Q);a.linkProgram(d);a.getShaderParameter(W,a.COMPILE_STATUS)||console.log(a.getShaderInfoLog(W));a.getShaderParameter(Q,a.COMPILE_STATUS)||console.log(a.getShaderInfoLog(Q));a.getProgramParameter(d,a.LINK_STATUS)||console.log(a.getProgramInfoLog(d));a.useProgram(d);d.drawInProgress=!1;A=s.backgroundColor?s.backgroundColor:[0,0,0];a.clearColor(A[0],A[1],A[2],1);a.clear(a.COLOR_BUFFER_BIT);d.texCoordLocation=
a.getAttribLocation(d,"a_texCoord");a.enableVertexAttribArray(d.texCoordLocation);"multires"!=F?(oa||(oa=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,oa),a.bufferData(a.ARRAY_BUFFER,new Float32Array([-1,1,1,1,1,-1,-1,1,1,-1,-1,-1]),a.STATIC_DRAW),a.vertexAttribPointer(d.texCoordLocation,2,a.FLOAT,!1,0,0),d.aspectRatio=a.getUniformLocation(d,"u_aspectRatio"),a.uniform1f(d.aspectRatio,a.drawingBufferWidth/a.drawingBufferHeight),d.psi=a.getUniformLocation(d,"u_psi"),d.theta=a.getUniformLocation(d,"u_theta"),
d.f=a.getUniformLocation(d,"u_f"),d.h=a.getUniformLocation(d,"u_h"),d.v=a.getUniformLocation(d,"u_v"),d.vo=a.getUniformLocation(d,"u_vo"),d.rot=a.getUniformLocation(d,"u_rot"),a.uniform1f(d.h,na/(2*Math.PI)),a.uniform1f(d.v,l/Math.PI),a.uniform1f(d.vo,c/Math.PI*2),"equirectangular"==F&&(d.backgroundColor=a.getUniformLocation(d,"u_backgroundColor"),a.uniform4fv(d.backgroundColor,A.concat([1]))),d.texture=a.createTexture(),a.bindTexture(I,d.texture),"cubemap"==F?(a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X,
0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r[1]),a.texImage2D(a.TEXTURE_CUBE_MAP_NEGATIVE_X,0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r[3]),a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_Y,0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r[4]),a.texImage2D(a.TEXTURE_CUBE_MAP_NEGATIVE_Y,0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r[5]),a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_Z,0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r[0]),a.texImage2D(a.TEXTURE_CUBE_MAP_NEGATIVE_Z,0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r[2])):a.texImage2D(I,0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r),a.texParameteri(I,a.TEXTURE_WRAP_S,
a.CLAMP_TO_EDGE),a.texParameteri(I,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),a.texParameteri(I,a.TEXTURE_MIN_FILTER,a.LINEAR),a.texParameteri(I,a.TEXTURE_MAG_FILTER,a.LINEAR)):(d.vertPosLocation=a.getAttribLocation(d,"a_vertCoord"),a.enableVertexAttribArray(d.vertPosLocation),G||(G=a.createBuffer()),ea||(ea=a.createBuffer()),Fa||(Fa=a.createBuffer()),a.bindBuffer(a.ARRAY_BUFFER,ea),a.bufferData(a.ARRAY_BUFFER,new Float32Array([0,0,1,0,1,1,0,1]),a.STATIC_DRAW),a.bindBuffer(a.ELEMENT_ARRAY_BUFFER,Fa),a.bufferData(a.ELEMENT_ARRAY_BUFFER,
new Uint16Array([0,1,2,0,2,3]),a.STATIC_DRAW),d.perspUniform=a.getUniformLocation(d,"u_perspMatrix"),d.cubeUniform=a.getUniformLocation(d,"u_cubeMatrix"),d.level=-1,d.currentNodes=[],d.nodeCache=[],d.nodeCacheTimestamp=0);na=a.getError();if(0!==na)throw console.log("Error: Something went wrong with WebGL!",na),{type:"webgl error"};g()}};this.destroy=function(){S!==p&&(y!==p&&S.contains(y)&&S.removeChild(y),T!==p&&S.contains(T)&&S.removeChild(T));if(a){var d=a.getExtension("WEBGL_lose_context");d&&
d.loseContext()}};this.resize=function(){var f=H.devicePixelRatio||1;y.width=y.clientWidth*f;y.height=y.clientHeight*f;a&&(1286==a.getError()&&wa(),a.viewport(0,0,a.drawingBufferWidth,a.drawingBufferHeight),"multires"!=F&&a.uniform1f(d.aspectRatio,y.clientWidth/y.clientHeight))};this.resize();this.setPose=function(a,d){ia=[a,d]};this.render=function(f,e,k,m){var l;l=0;m===p&&(m={});m.roll&&(l=m.roll);if(ia!==p){var c=ia[0],g=ia[1],s=f,w=e,t=Math.cos(g)*Math.sin(f)*Math.sin(c)+Math.cos(f)*(Math.cos(c)*
Math.cos(e)+Math.sin(g)*Math.sin(c)*Math.sin(e)),x=-Math.sin(f)*Math.sin(g)+Math.cos(f)*Math.cos(g)*Math.sin(e);f=Math.cos(g)*Math.cos(c)*Math.sin(f)+Math.cos(f)*(-Math.cos(e)*Math.sin(c)+Math.cos(c)*Math.sin(g)*Math.sin(e));f=Math.asin(Math.max(Math.min(f,1),-1));e=Math.atan2(x,t);c=[Math.cos(s)*(Math.sin(g)*Math.sin(c)*Math.cos(w)-Math.cos(c)*Math.sin(w)),Math.cos(s)*Math.cos(g)*Math.cos(w),Math.cos(s)*(Math.cos(c)*Math.sin(g)*Math.cos(w)+Math.sin(w)*Math.sin(c))];g=[-Math.cos(f)*Math.sin(e),Math.cos(f)*
Math.cos(e)];g=Math.acos(Math.max(Math.min((c[0]*g[0]+c[1]*g[1])/(Math.sqrt(c[0]*c[0]+c[1]*c[1]+c[2]*c[2])*Math.sqrt(g[0]*g[0]+g[1]*g[1])),1),-1));0>c[2]&&(g=2*Math.PI-g);l+=g}if(a||"multires"!=F&&"cubemap"!=F){if("multires"!=F)k=2*Math.atan(Math.tan(0.5*k)/(a.drawingBufferWidth/a.drawingBufferHeight)),k=1/Math.tan(0.5*k),a.uniform1f(d.psi,e),a.uniform1f(d.theta,f),a.uniform1f(d.rot,l),a.uniform1f(d.f,k),!0===ya&&"equirectangular"==F&&(a.bindTexture(a.TEXTURE_2D,d.texture),a.texImage2D(a.TEXTURE_2D,
0,a.RGB,a.RGB,a.UNSIGNED_BYTE,r)),a.drawArrays(a.TRIANGLES,0,6);else{c=a.drawingBufferWidth/a.drawingBufferHeight;g=2*Math.atan(Math.tan(k/2)*a.drawingBufferHeight/a.drawingBufferWidth);g=1/Math.tan(g/2);c=[g/c,0,0,0,0,g,0,0,0,0,100.1/-99.9,20/-99.9,0,0,-1,0];for(g=1;g<r.maxLevel&&a.drawingBufferWidth>r.tileResolution*Math.pow(2,g-1)*Math.tan(k/2)*0.707;)g++;d.level=g;g=[1,0,0,0,1,0,0,0,1];g=ua(g,-l,"z");g=ua(g,-f,"x");g=ua(g,e,"y");g=[g[0],g[1],g[2],0,g[3],g[4],g[5],0,g[6],g[7],g[8],0,0,0,0,1];a.uniformMatrix4fv(d.perspUniform,
!1,new Float32Array(va(c)));a.uniformMatrix4fv(d.cubeUniform,!1,new Float32Array(va(g)));c=[c[0]*g[0],c[0]*g[1],c[0]*g[2],0,c[5]*g[4],c[5]*g[5],c[5]*g[6],0,c[10]*g[8],c[10]*g[9],c[10]*g[10],c[11],-g[8],-g[9],-g[10],0];d.nodeCache.sort(Oa);if(200<d.nodeCache.length&&d.nodeCache.length>d.currentNodes.length+50)for(g=d.nodeCache.splice(200,d.nodeCache.length-200),l=0;l<g.length;l++)a.deleteTexture(g[l].texture);d.currentNodes=[];g="fbudlr".split("");for(l=0;6>l;l++)s=new Z(xa[l],g[l],1,0,0,r.fullpath),
$(c,s,f,e,k);d.currentNodes.sort(P);for(l=ba.length-1;0<=l;l--)-1===d.currentNodes.indexOf(ba[l].node)&&(ba[l].node.textureLoad=!1,ba.splice(l,1));if(0===ba.length)for(l=0;l<d.currentNodes.length;l++)if(f=d.currentNodes[l],!f.texture&&!f.textureLoad){f.textureLoad=!0;setTimeout(Ja,0,f);break}if(!d.drawInProgress){d.drawInProgress=!0;a.clear(a.COLOR_BUFFER_BIT);for(f=0;f<d.currentNodes.length;f++)1<d.currentNodes[f].textureLoaded&&(a.bindBuffer(a.ARRAY_BUFFER,G),a.bufferData(a.ARRAY_BUFFER,new Float32Array(d.currentNodes[f].vertices),
a.STATIC_DRAW),a.vertexAttribPointer(d.vertPosLocation,3,a.FLOAT,!1,0,0),a.bindBuffer(a.ARRAY_BUFFER,ea),a.vertexAttribPointer(d.texCoordLocation,2,a.FLOAT,!1,0,0),a.bindTexture(a.TEXTURE_2D,d.currentNodes[f].texture),a.drawElements(a.TRIANGLES,6,a.UNSIGNED_SHORT,0));d.drawInProgress=!1}}if(m.returnImage!==p)return y.toDataURL("image/png")}else for(l=X/2,m={f:"translate3d(-"+(l+2)+"px, -"+(l+2)+"px, -"+l+"px)",b:"translate3d("+(l+2)+"px, -"+(l+2)+"px, "+l+"px) rotateX(180deg) rotateZ(180deg)",u:"translate3d(-"+
(l+2)+"px, -"+l+"px, "+(l+2)+"px) rotateX(270deg)",d:"translate3d(-"+(l+2)+"px, "+l+"px, -"+(l+2)+"px) rotateX(90deg)",l:"translate3d(-"+l+"px, -"+(l+2)+"px, "+(l+2)+"px) rotateX(180deg) rotateY(90deg) rotateZ(180deg)",r:"translate3d("+l+"px, -"+(l+2)+"px, -"+(l+2)+"px) rotateY(270deg)"},k=1/Math.tan(k/2),k=k*y.clientWidth/2+"px",f="perspective("+k+") translateZ("+k+") rotateX("+f+"rad) rotateY("+e+"rad) ",e=Object.keys(m),l=0;6>l;l++)if(k=T.querySelector(".pnlm-"+e[l]+"face"))k.style.webkitTransform=
f+m[e[l]],k.style.transform=f+m[e[l]]};this.isLoading=function(){if(a&&"multires"==F)for(var f=0;f<d.currentNodes.length;f++)if(!d.currentNodes[f].textureLoaded)return!0;return!1};this.getCanvas=function(){return y};var ba=[],ma=function(){function d(){var c=this;this.texture=this.callback=null;this.image=new Image;this.image.crossOrigin=l?l:"anonymous";var e=function(){if(0<c.image.width&&0<c.image.height){var d=c.image;a.bindTexture(a.TEXTURE_2D,c.texture);a.texImage2D(a.TEXTURE_2D,0,a.RGB,a.RGB,
a.UNSIGNED_BYTE,d);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MAG_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_MIN_FILTER,a.LINEAR);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE);a.texParameteri(a.TEXTURE_2D,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE);a.bindTexture(a.TEXTURE_2D,null);c.callback(c.texture,!0)}else c.callback(c.texture,!1);ba.length?(d=ba.shift(),c.loadTexture(d.src,d.texture,d.callback)):k[f++]=c};this.image.addEventListener("load",e);this.image.addEventListener("error",
e)}function e(a,c,d,e){this.node=a;this.src=c;this.texture=d;this.callback=e}var f=4,k={},l;d.prototype.loadTexture=function(a,c,d){this.texture=c;this.callback=d;this.image.src=a};for(var c=0;c<f;c++)k[c]=new d;return function(c,d,p,m){l=m;m=a.createTexture();f?k[--f].loadTexture(d,m,p):ba.push(new e(c,d,m,p));return m}}()}var m="attribute vec2 a_texCoord;varying vec2 v_texCoord;void main() {gl_Position = vec4(a_texCoord, 0.0, 1.0);v_texCoord = a_texCoord;}",k="attribute vec3 a_vertCoord;attribute vec2 a_texCoord;uniform mat4 u_cubeMatrix;uniform mat4 u_perspMatrix;varying mediump vec2 v_texCoord;void main(void) {gl_Position = u_perspMatrix * u_cubeMatrix * vec4(a_vertCoord, 1.0);v_texCoord = a_texCoord;}",
bb="precision mediump float;\nuniform float u_aspectRatio;\nuniform float u_psi;\nuniform float u_theta;\nuniform float u_f;\nuniform float u_h;\nuniform float u_v;\nuniform float u_vo;\nuniform float u_rot;\nconst float PI = 3.14159265358979323846264;\nuniform sampler2D u_image;\nuniform samplerCube u_imageCube;\nvarying vec2 v_texCoord;\nuniform vec4 u_backgroundColor;\nvoid main() {\nfloat x = v_texCoord.x * u_aspectRatio;\nfloat y = v_texCoord.y;\nfloat sinrot = sin(u_rot);\nfloat cosrot = cos(u_rot);\nfloat rot_x = x * cosrot - y * sinrot;\nfloat rot_y = x * sinrot + y * cosrot;\nfloat sintheta = sin(u_theta);\nfloat costheta = cos(u_theta);\nfloat a = u_f * costheta - rot_y * sintheta;\nfloat root = sqrt(rot_x * rot_x + a * a);\nfloat lambda = atan(rot_x / root, a / root) + u_psi;\nfloat phi = atan((rot_y * costheta + u_f * sintheta) / root);float cosphi = cos(phi);\ngl_FragColor = textureCube(u_imageCube, vec3(cosphi*sin(lambda), sin(phi), cosphi*cos(lambda)));\n}",
Ka="precision mediump float;\nuniform float u_aspectRatio;\nuniform float u_psi;\nuniform float u_theta;\nuniform float u_f;\nuniform float u_h;\nuniform float u_v;\nuniform float u_vo;\nuniform float u_rot;\nconst float PI = 3.14159265358979323846264;\nuniform sampler2D u_image;\nuniform samplerCube u_imageCube;\nvarying vec2 v_texCoord;\nuniform vec4 u_backgroundColor;\nvoid main() {\nfloat x = v_texCoord.x * u_aspectRatio;\nfloat y = v_texCoord.y;\nfloat sinrot = sin(u_rot);\nfloat cosrot = cos(u_rot);\nfloat rot_x = x * cosrot - y * sinrot;\nfloat rot_y = x * sinrot + y * cosrot;\nfloat sintheta = sin(u_theta);\nfloat costheta = cos(u_theta);\nfloat a = u_f * costheta - rot_y * sintheta;\nfloat root = sqrt(rot_x * rot_x + a * a);\nfloat lambda = atan(rot_x / root, a / root) + u_psi;\nfloat phi = atan((rot_y * costheta + u_f * sintheta) / root);lambda = mod(lambda + PI, PI * 2.0) - PI;\nvec2 coord = vec2(lambda / PI, phi / (PI / 2.0));\nif(coord.x < -u_h || coord.x > u_h || coord.y < -u_v + u_vo || coord.y > u_v + u_vo)\ngl_FragColor = u_backgroundColor;\nelse\ngl_FragColor = texture2D(u_image, vec2((coord.x + u_h) / (u_h * 2.0), (-coord.y + u_v + u_vo) / (u_v * 2.0)));\n}",
ra="varying mediump vec2 v_texCoord;uniform sampler2D u_sampler;void main(void) {gl_FragColor = texture2D(u_sampler, v_texCoord);}";return{renderer:function(f,k,p,m){return new ma(f,k,p,m)}}}(window,document);window.requestAnimationFrame||(window.requestAnimationFrame=function(){return window.webkitRequestAnimationFrame||window.mozRequestAnimationFrame||window.oRequestAnimationFrame||window.msRequestAnimationFrame||function(H,f){window.setTimeout(H,1E3/60)}}());
window.pannellum=function(H,f,p){function ma(m,k){function ma(b){H.removeEventListener("deviceorientation",ma);b&&null!==b.alpha&&null!==b.beta&&null!==b.gamma?(u.container.appendChild(u.orientation),sa=!0,Ya&&O()):sa=!1}function Ka(){var a=f.createElement("div");a.innerHTML="\x3c!--[if lte IE 9]><i></i><![endif]--\x3e";if(1==a.getElementsByTagName("i").length)P();else{za=b.hfov;Ga=b.pitch;var h;if("cubemap"==b.type){R=[];for(a=0;6>a;a++)R.push(new Image),R[a].crossOrigin=b.crossOrigin;n.load.lbox.style.display=
"block";n.load.lbar.style.display="none"}else if("multires"==b.type)a=JSON.parse(JSON.stringify(b.multiRes)),b.basePath&&b.multiRes.basePath&&!/^(?:[a-z]+:)?\/\//i.test(b.multiRes.basePath)?a.basePath=b.basePath+b.multiRes.basePath:b.multiRes.basePath?a.basePath=b.multiRes.basePath:b.basePath&&(a.basePath=b.basePath),R=a;else if(!0===b.dynamic)R=b.panorama;else{if(b.panorama===p){P(b.strings.noPanoramaError);return}R=new Image}if("cubemap"==b.type)for(var E=6,c=function(){E--;0===E&&S()},d=function(a){var ka=
f.createElement("a");ka.href=a.target.src;ka.textContent=ka.href;P(b.strings.fileAccessError.replace("%s",ka.outerHTML))},a=0;a<R.length;a++)h=b.cubeMap[a],"null"==h?(console.log("Will use background instead of missing cubemap face "+a),c()):(b.basePath&&!ra(h)&&(h=b.basePath+h),R[a].onload=c,R[a].onerror=d,R[a].src=D(h));else if("multires"==b.type)S();else if(h="",b.basePath&&(h=b.basePath),!0!==b.dynamic){h=ra(b.panorama)?b.panorama:h+b.panorama;R.onload=function(){H.URL.revokeObjectURL(this.src);
S()};var e=new XMLHttpRequest;e.onloadend=function(){if(200!=e.status){var a=f.createElement("a");a.href=h;a.textContent=a.href;P(b.strings.fileAccessError.replace("%s",a.outerHTML))}Oa(this.response);n.load.msg.innerHTML=""};e.onprogress=function(b){if(b.lengthComputable){n.load.lbarFill.style.width=b.loaded/b.total*100+"%";var a,ka;1E6<b.total?(a="MB",ka=(b.loaded/1E6).toFixed(2),b=(b.total/1E6).toFixed(2)):1E3<b.total?(a="kB",ka=(b.loaded/1E3).toFixed(1),b=(b.total/1E3).toFixed(1)):(a="B",ka=b.loaded,
b=b.total);n.load.msg.innerHTML=ka+" / "+b+" "+a}else n.load.lbox.style.display="block",n.load.lbar.style.display="none"};try{e.open("GET",h,!0)}catch(g){P(b.strings.malformedURLError)}e.responseType="blob";e.setRequestHeader("Accept","image/*,*/*;q=0.9");e.withCredentials="use-credentials"===b.crossOrigin;e.send()}b.draggable&&C.classList.add("pnlm-grab");C.classList.remove("pnlm-grabbing")}}function ra(b){return/^(?:[a-z]+:)?\/\//i.test(b)||"/"==b[0]||"blob:"==b.slice(0,5)}function S(){z||(z=new libpannellum.renderer(N));
Ra||(Ra=!0,J.addEventListener("mousedown",Ea,!1),f.addEventListener("mousemove",Ja,!1),f.addEventListener("mouseup",ha,!1),b.mouseZoom&&(C.addEventListener("mousewheel",X,!1),C.addEventListener("DOMMouseScroll",X,!1)),b.doubleClickZoom&&J.addEventListener("dblclick",ua,!1),C.addEventListener("mozfullscreenchange",w,!1),C.addEventListener("webkitfullscreenchange",w,!1),C.addEventListener("msfullscreenchange",w,!1),C.addEventListener("fullscreenchange",w,!1),H.addEventListener("resize",oa,!1),H.addEventListener("orientationchange",
oa,!1),b.disableKeyboardCtrl||(m.addEventListener("keydown",T,!1),m.addEventListener("keyup",ia,!1),m.addEventListener("blur",xa,!1)),f.addEventListener("mouseleave",ha,!1),""===f.documentElement.style.pointerAction&&""===f.documentElement.style.touchAction?(J.addEventListener("pointerdown",a,!1),J.addEventListener("pointermove",W,!1),J.addEventListener("pointerup",Q,!1),J.addEventListener("pointerleave",Q,!1)):(J.addEventListener("touchstart",wa,!1),J.addEventListener("touchmove",y,!1),J.addEventListener("touchend",
d,!1)),H.navigator.pointerEnabled&&(m.style.touchAction="none"));ab();x(b.hfov);setTimeout(function(){},500)}function Oa(a){var h=new FileReader;h.addEventListener("loadend",function(){var E=h.result;if(navigator.userAgent.toLowerCase().match(/(iphone|ipod|ipad).* os 8_/)){var c=E.indexOf("\u00ff\u00c2");(0>c||65536<c)&&P(b.strings.iOS8WebGLError)}c=E.indexOf("<x:xmpmeta");if(-1<c&&!0!==b.ignoreGPanoXMP){var d=E.substring(c,E.indexOf("</x:xmpmeta>")+12),e=function(b){var a;0<=d.indexOf(b+'="')?(a=
d.substring(d.indexOf(b+'="')+b.length+2),a=a.substring(0,a.indexOf('"'))):0<=d.indexOf(b+">")&&(a=d.substring(d.indexOf(b+">")+b.length+1),a=a.substring(0,a.indexOf("<")));return a!==p?Number(a):null},E=e("GPano:FullPanoWidthPixels"),c=e("GPano:CroppedAreaImageWidthPixels"),f=e("GPano:FullPanoHeightPixels"),g=e("GPano:CroppedAreaImageHeightPixels"),k=e("GPano:CroppedAreaTopPixels"),l=e("GPano:PoseHeadingDegrees"),m=e("GPano:PosePitchDegrees"),e=e("GPano:PoseRollDegrees");null!==E&&null!==c&&null!==
f&&null!==g&&null!==k&&(0>fa.indexOf("haov")&&(b.haov=c/E*360),0>fa.indexOf("vaov")&&(b.vaov=g/f*180),0>fa.indexOf("vOffset")&&(b.vOffset=-180*((k+g/2)/f-0.5)),null!==l&&0>fa.indexOf("northOffset")&&(b.northOffset=l,!1!==b.compass&&(b.compass=!0)),null!==m&&null!==e&&(0>fa.indexOf("horizonPitch")&&(b.horizonPitch=m),0>fa.indexOf("horizonRoll")&&(b.horizonRoll=e)))}R.src=H.URL.createObjectURL(a)});h.readAsBinaryString!==p?h.readAsBinaryString(a):h.readAsText(a)}function P(a){a===p&&(a=b.strings.genericWebGLError);
n.errorMsg.innerHTML="<p>"+a+"</p>";u.load.style.display="none";n.load.box.style.display="none";n.errorMsg.style.display="table";La=!0;N.style.display="none";Y("error",a)}function Z(b){var a=$(b);la.style.left=a.x+"px";la.style.top=a.y+"px";clearTimeout(Z.t1);clearTimeout(Z.t2);la.style.display="block";la.style.opacity=1;Z.t1=setTimeout(function(){la.style.opacity=0},2E3);Z.t2=setTimeout(function(){la.style.display="none"},2500);b.preventDefault()}function $(b){var a=m.getBoundingClientRect(),E={};
E.x=b.clientX-a.left;E.y=b.clientY-a.top;return E}function Ea(a){a.preventDefault();m.focus();if(L&&b.draggable){var h=$(a);if(b.hotSpotDebug){var E=va(a);console.log("Pitch: "+E[0]+", Yaw: "+E[1]+", Center Pitch: "+b.pitch+", Center Yaw: "+b.yaw+", HFOV: "+b.hfov)}I();B();b.roll=0;v.hfov=0;pa=!0;U=Date.now();Aa=h.x;Ba=h.y;Ma=b.yaw;Na=b.pitch;C.classList.add("pnlm-grabbing");C.classList.remove("pnlm-grab");Y("mousedown",a);G()}}function ua(a){b.minHfov===b.hfov?ja.setHfov(za,1E3):(a=va(a),ja.lookAt(a[0],
a[1],b.minHfov,1E3))}function va(a){var h=$(a);a=z.getCanvas();var E=a.clientWidth,c=a.clientHeight;a=h.x/E*2-1;var c=(1-h.y/c*2)*c/E,d=1/Math.tan(b.hfov*Math.PI/360),e=Math.sin(b.pitch*Math.PI/180),f=Math.cos(b.pitch*Math.PI/180),h=d*f-c*e,E=Math.sqrt(a*a+h*h),c=180*Math.atan((c*f+d*e)/E)/Math.PI;a=180*Math.atan2(a/E,h/E)/Math.PI+b.yaw;-180>a&&(a+=360);180<a&&(a-=360);return[c,a]}function Ja(a){if(pa&&L){U=Date.now();var h=z.getCanvas(),c=h.clientWidth,h=h.clientHeight;a=$(a);var d=180*(Math.atan(Aa/
c*2-1)-Math.atan(a.x/c*2-1))/Math.PI*b.hfov/90+Ma;v.yaw=(d-b.yaw)%360*0.2;b.yaw=d;c=360*Math.atan(Math.tan(b.hfov/360*Math.PI)*h/c)/Math.PI;c=180*(Math.atan(a.y/h*2-1)-Math.atan(Ba/h*2-1))/Math.PI*c/90+Na;v.pitch=0.2*(c-b.pitch);b.pitch=c}}function ha(a){pa&&(pa=!1,15<Date.now()-U&&(v.pitch=v.yaw=0),C.classList.add("pnlm-grab"),C.classList.remove("pnlm-grabbing"),U=Date.now(),Y("mouseup",a))}function wa(a){if(L&&b.draggable){I();B();b.roll=0;v.hfov=0;var h=$(a.targetTouches[0]);Aa=h.x;Ba=h.y;if(2==
a.targetTouches.length){var c=$(a.targetTouches[1]);Aa+=0.5*(c.x-h.x);Ba+=0.5*(c.y-h.y);Ha=Math.sqrt((h.x-c.x)*(h.x-c.x)+(h.y-c.y)*(h.y-c.y))}pa=!0;U=Date.now();Ma=b.yaw;Na=b.pitch;Y("touchstart",a);G()}}function y(a){if(b.draggable&&(a.preventDefault(),L&&(U=Date.now()),pa&&L)){var h=$(a.targetTouches[0]),c=h.x,d=h.y;2==a.targetTouches.length&&-1!=Ha&&(a=$(a.targetTouches[1]),c+=0.5*(a.x-h.x),d+=0.5*(a.y-h.y),h=Math.sqrt((h.x-a.x)*(h.x-a.x)+(h.y-a.y)*(h.y-a.y)),x(b.hfov+0.1*(Ha-h)),Ha=h);h=b.hfov/
360*b.touchPanSpeedCoeffFactor;c=(Aa-c)*h+Ma;v.yaw=(c-b.yaw)%360*0.2;b.yaw=c;d=(d-Ba)*h+Na;v.pitch=0.2*(d-b.pitch);b.pitch=d}}function d(){pa=!1;150<Date.now()-U&&(v.pitch=v.yaw=0);Ha=-1;U=Date.now();Y("touchend",event)}function a(a){"touch"==a.pointerType&&(qa.push(a.pointerId),Ca.push({clientX:a.clientX,clientY:a.clientY}),a.targetTouches=Ca,wa(a),a.preventDefault())}function W(a){if("touch"==a.pointerType)for(var b=0;b<qa.length;b++)if(a.pointerId==qa[b]){Ca[b].clientX=a.clientX;Ca[b].clientY=
a.clientY;a.targetTouches=Ca;y(a);a.preventDefault();break}}function Q(a){if("touch"==a.pointerType){for(var b=!1,c=0;c<qa.length;c++)a.pointerId==qa[c]&&(qa[c]=p),qa[c]&&(b=!0);b||(qa=[],Ca=[],d());a.preventDefault()}}function X(a){L&&("fullscreenonly"!=b.mouseZoom||Da)&&(a.preventDefault(),I(),U=Date.now(),a.wheelDeltaY?(x(b.hfov-0.05*a.wheelDeltaY),v.hfov=0>a.wheelDelta?1:-1):a.wheelDelta?(x(b.hfov-0.05*a.wheelDelta),v.hfov=0>a.wheelDelta?1:-1):a.detail&&(x(b.hfov+1.5*a.detail),v.hfov=0<a.detail?
1:-1),G())}function T(a){I();U=Date.now();B();b.roll=0;var h=a.which||a.keycode;0>b.capturedKeyNumbers.indexOf(h)||(a.preventDefault(),27==h?Da&&s():r(h,!0))}function xa(){for(var a=0;10>a;a++)q[a]=!1}function ia(a){var h=a.which||a.keycode;0>b.capturedKeyNumbers.indexOf(h)||(a.preventDefault(),r(h,!1))}function r(a,b){var c=!1;switch(a){case 109:case 189:case 17:case 173:q[0]!=b&&(c=!0);q[0]=b;break;case 107:case 187:case 16:case 61:q[1]!=b&&(c=!0);q[1]=b;break;case 38:q[2]!=b&&(c=!0);q[2]=b;break;
case 87:q[6]!=b&&(c=!0);q[6]=b;break;case 40:q[3]!=b&&(c=!0);q[3]=b;break;case 83:q[7]!=b&&(c=!0);q[7]=b;break;case 37:q[4]!=b&&(c=!0);q[4]=b;break;case 65:q[8]!=b&&(c=!0);q[8]=b;break;case 39:q[5]!=b&&(c=!0);q[5]=b;break;case 68:q[9]!=b&&(c=!0),q[9]=b}c&&b&&(ga="undefined"!==typeof performance&&performance.now()?performance.now():Date.now(),G())}function F(){if(L){var a=!1,h=b.pitch,c=b.yaw,d=b.hfov,e;e="undefined"!==typeof performance&&performance.now()?performance.now():Date.now();ga===p&&(ga=
e);var f=(e-ga)*b.hfov/1700,f=Math.min(f,1);q[0]&&!0===b.keyboardZoom&&(x(b.hfov+(0.8*v.hfov+0.5)*f),a=!0);q[1]&&!0===b.keyboardZoom&&(x(b.hfov+(0.8*v.hfov-0.2)*f),a=!0);if(q[2]||q[6])b.pitch+=(0.8*v.pitch+0.2)*f,a=!0;if(q[3]||q[7])b.pitch+=(0.8*v.pitch-0.2)*f,a=!0;if(q[4]||q[8])b.yaw+=(0.8*v.yaw-0.2)*f,a=!0;if(q[5]||q[9])b.yaw+=(0.8*v.yaw+0.2)*f,a=!0;a&&(U=Date.now());Date.now();if(b.autoRotate){if(0.001<e-ga){var a=(e-ga)/1E3,g=(v.yaw/a*f-0.2*b.autoRotate)*a,g=(0<-b.autoRotate?1:-1)*Math.min(Math.abs(b.autoRotate*
a),Math.abs(g));b.yaw+=g}b.autoRotateStopDelay&&(b.autoRotateStopDelay-=e-ga,0>=b.autoRotateStopDelay&&(b.autoRotateStopDelay=!1,ca=b.autoRotate,b.autoRotate=0))}M.pitch&&(ya("pitch"),h=b.pitch);M.yaw&&(ya("yaw"),c=b.yaw);M.hfov&&(ya("hfov"),d=b.hfov);0<f&&!b.autoRotate&&(q[4]||q[5]||q[8]||q[9]||M.yaw||(b.yaw+=v.yaw*f*0.85),q[2]||q[3]||q[6]||q[7]||M.pitch||(b.pitch+=v.pitch*f*0.85),q[0]||q[1]||M.hfov||x(b.hfov+v.hfov*f*0.85));ga=e;0<f&&(v.yaw=0.8*v.yaw+(b.yaw-c)/f*0.2,v.pitch=0.8*v.pitch+(b.pitch-
h)/f*0.2,v.hfov=0.8*v.hfov+(b.hfov-d)/f*0.2,h=b.autoRotate?Math.abs(b.autoRotate):5,v.yaw=Math.min(h,Math.max(v.yaw,-h)),v.pitch=Math.min(h,Math.max(v.pitch,-h)),v.hfov=Math.min(h,Math.max(v.hfov,-h)));q[0]&&q[1]&&(v.hfov=0);(q[2]||q[6])&&(q[3]||q[7])&&(v.pitch=0);(q[4]||q[8])&&(q[5]||q[9])&&(v.yaw=0)}}function ya(a){var h=M[a],c=Math.min(1,Math.max((Date.now()-h.startTime)/1E3/(h.duration/1E3),0)),c=h.startPosition+b.animationTimingFunction(c)*(h.endPosition-h.startPosition);if(h.endPosition>h.startPosition&&
c>=h.endPosition||h.endPosition<h.startPosition&&c<=h.endPosition||h.endPosition===h.startPosition){c=h.endPosition;v[a]=0;var h=M[a].callback,d=M[a].callbackArgs;delete M[a];"function"==typeof h&&h(d)}b[a]=c}function oa(){w()}function G(){Sa||(Sa=!0,ea())}function ea(){Fa();Ta&&clearTimeout(Ta);if(pa||!0===da)requestAnimationFrame(ea);else if(q[0]||q[1]||q[2]||q[3]||q[4]||q[5]||q[6]||q[7]||q[8]||q[9]||b.autoRotate||M.pitch||M.yaw||M.hfov||0.01<Math.abs(v.yaw)||0.01<Math.abs(v.pitch)||0.01<Math.abs(v.hfov))F(),
0<=b.autoRotateInactivityDelay&&ca&&Date.now()-U>b.autoRotateInactivityDelay&&!b.autoRotate&&(b.autoRotate=ca,ja.lookAt(Ga,p,za,3E3)),requestAnimationFrame(ea);else if(z&&(z.isLoading()||!0===b.dynamic&&Za))requestAnimationFrame(ea);else{Y("animateFinished",{pitch:ja.getPitch(),yaw:ja.getYaw(),hfov:ja.getHfov()});Sa=!1;ga=p;var a=b.autoRotateInactivityDelay-(Date.now()-U);0<a?Ta=setTimeout(function(){b.autoRotate=ca;ja.lookAt(Ga,p,za,3E3);G()},a):0<=b.autoRotateInactivityDelay&&ca&&(b.autoRotate=
ca,ja.lookAt(Ga,p,za,3E3),G())}}function Fa(){var a;if(L){180<b.yaw?b.yaw-=360:-180>b.yaw&&(b.yaw+=360);a=b.yaw;var h=0;if(b.avoidShowingBackground){var c=z.getCanvas(),d=b.hfov/2,c=180*Math.atan2(Math.tan(d/180*Math.PI),c.width/c.height)/Math.PI;b.vaov>b.haov?Math.min(Math.cos((b.pitch-d)/180*Math.PI),Math.cos((b.pitch+d)/180*Math.PI)):h=d*(1-Math.min(Math.cos((b.pitch-c)/180*Math.PI),Math.cos((b.pitch+c)/180*Math.PI)))}var d=b.maxYaw-b.minYaw,c=-180,e=180;360>d&&(c=b.minYaw+b.hfov/2+h,e=b.maxYaw-
b.hfov/2-h,d<b.hfov&&(c=e=(c+e)/2),b.yaw=Math.max(c,Math.min(e,b.yaw)));!1!==b.autoRotate&&a!=b.yaw&&ga!==p&&(b.autoRotate*=-1);c=z.getCanvas();a=2*Math.atan(Math.tan(b.hfov/180*Math.PI*0.5)/(c.width/c.height))/Math.PI*180;h=b.minPitch+a/2;d=b.maxPitch-a/2;b.maxPitch-b.minPitch<a&&(h=d=(h+d)/2);isNaN(h)&&(h=-90);isNaN(d)&&(d=90);b.pitch=Math.max(h,Math.min(d,b.pitch));z.render(b.pitch*Math.PI/180,b.yaw*Math.PI/180,b.hfov*Math.PI/180,{roll:b.roll*Math.PI/180});b.hotSpots.forEach(l);b.compass&&(Ia.style.transform=
"rotate("+(-b.yaw-b.northOffset)+"deg)",Ia.style.webkitTransform="rotate("+(-b.yaw-b.northOffset)+"deg)")}}function aa(a,b,c,d){this.w=a;this.x=b;this.y=c;this.z=d}function ba(a){var c;c=a.alpha;var d=a.beta;a=a.gamma;d=[d?d*Math.PI/180/2:0,a?a*Math.PI/180/2:0,c?c*Math.PI/180/2:0];c=[Math.cos(d[0]),Math.cos(d[1]),Math.cos(d[2])];d=[Math.sin(d[0]),Math.sin(d[1]),Math.sin(d[2])];c=new aa(c[0]*c[1]*c[2]-d[0]*d[1]*d[2],d[0]*c[1]*c[2]-c[0]*d[1]*d[2],c[0]*d[1]*c[2]+d[0]*c[1]*d[2],c[0]*c[1]*d[2]+d[0]*d[1]*
c[2]);c=c.multiply(new aa(Math.sqrt(0.5),-Math.sqrt(0.5),0,0));d=H.orientation?-H.orientation*Math.PI/180/2:0;c=c.multiply(new aa(Math.cos(d),0,-Math.sin(d),0)).toEulerAngles();"number"==typeof da&&10>da?da+=1:10===da?($a=c[2]/Math.PI*180+b.yaw,da=!0,requestAnimationFrame(ea)):(b.pitch=c[0]/Math.PI*180,b.roll=-c[1]/Math.PI*180,b.yaw=-c[2]/Math.PI*180+$a)}function ab(){try{var a={};b.horizonPitch!==p&&(a.horizonPitch=b.horizonPitch*Math.PI/180);b.horizonRoll!==p&&(a.horizonRoll=b.horizonRoll*Math.PI/
180);b.backgroundColor!==p&&(a.backgroundColor=b.backgroundColor);z.init(R,b.type,b.dynamic,b.haov*Math.PI/180,b.vaov*Math.PI/180,b.vOffset*Math.PI/180,A,a);!0!==b.dynamic&&(R=p)}catch(c){if("webgl error"==c.type||"no webgl"==c.type)P();else if("webgl size error"==c.type)P(b.strings.textureSizeError.replace("%s",c.width).replace("%s",c.maxWidth));else throw P(b.strings.unknownError),c;}}function A(){if(b.sceneFadeDuration&&z.fadeImg!==p){z.fadeImg.style.opacity=0;var a=z.fadeImg;delete z.fadeImg;
setTimeout(function(){N.removeChild(a);Y("scenechangefadedone")},b.sceneFadeDuration)}Ia.style.display=b.compass?"inline":"none";Pa();n.load.box.style.display="none";ta!==p&&(N.removeChild(ta),ta=p);L=!0;Y("load");G()}function e(a){a.pitch=Number(a.pitch)||0;a.yaw=Number(a.yaw)||0;var c=f.createElement("div");c.className="pnlm-hotspot-base";c.className=a.cssClass?c.className+(" "+a.cssClass):c.className+(" pnlm-hotspot pnlm-sprite pnlm-"+K(a.type));var d=f.createElement("span");a.text&&(d.innerHTML=
K(a.text));var e;if(a.video){e=f.createElement("video");var g=a.video;b.basePath&&!ra(g)&&(g=b.basePath+g);e.src=D(g);e.controls=!0;e.style.width=a.width+"px";N.appendChild(c);d.appendChild(e)}else if(a.image){g=a.image;b.basePath&&!ra(g)&&(g=b.basePath+g);e=f.createElement("a");e.href=D(a.URL?a.URL:g);e.target="_blank";d.appendChild(e);var k=f.createElement("img");k.src=D(g);k.style.width=a.width+"px";k.style.paddingTop="5px";N.appendChild(c);e.appendChild(k);d.style.maxWidth="initial"}else if(a.URL){e=
f.createElement("a");e.href=D(a.URL);if(a.attributes)for(g in a.attributes)e.setAttribute(g,a.attributes[g]);else e.target="_blank";N.appendChild(e);c.className+=" pnlm-pointer";d.className+=" pnlm-pointer";e.appendChild(c)}else a.sceneId&&(c.onclick=c.ontouchend=function(){c.clicked||(c.clicked=!0,Qa(a.sceneId,a.targetPitch,a.targetYaw,a.targetHfov));return!1},c.className+=" pnlm-pointer",d.className+=" pnlm-pointer"),N.appendChild(c);if(a.createTooltipFunc)a.createTooltipFunc(c,a.createTooltipArgs);
else if(a.text||a.video||a.image)c.classList.add("pnlm-tooltip"),c.appendChild(d),d.style.width=d.scrollWidth-20+"px",d.style.marginLeft=-(d.scrollWidth-c.offsetWidth)/2+"px",d.style.marginTop=-d.scrollHeight-12+"px";a.clickHandlerFunc&&(c.addEventListener("click",function(b){a.clickHandlerFunc(b,a.clickHandlerArgs)},"false"),c.className+=" pnlm-pointer",d.className+=" pnlm-pointer");a.div=c}function Pa(){Ua||(b.hotSpots?(b.hotSpots=b.hotSpots.sort(function(a,b){return a.pitch<b.pitch}),b.hotSpots.forEach(e)):
b.hotSpots=[],Ua=!0,b.hotSpots.forEach(l))}function na(){var a=b.hotSpots;Ua=!1;delete b.hotSpots;if(a)for(var c=0;c<a.length;c++){for(var d=a[c].div;d.parentNode!=N;)d=d.parentNode;N.removeChild(d);delete a[c].div}}function l(a){var c=Math.sin(a.pitch*Math.PI/180),d=Math.cos(a.pitch*Math.PI/180),e=Math.sin(b.pitch*Math.PI/180),f=Math.cos(b.pitch*Math.PI/180),g=Math.cos((-a.yaw+b.yaw)*Math.PI/180),k=c*e+d*g*f;if(90>=a.yaw&&-90<a.yaw&&0>=k||(90<a.yaw||-90>=a.yaw)&&0>=k)a.div.style.visibility="hidden";
else{var l=Math.sin((-a.yaw+b.yaw)*Math.PI/180),m=Math.tan(b.hfov*Math.PI/360);a.div.style.visibility="visible";var p=z.getCanvas(),n=p.clientWidth,p=p.clientHeight,c=[-n/m*l*d/k/2,-n/m*(c*f-d*g*e)/k/2],d=Math.sin(b.roll*Math.PI/180),e=Math.cos(b.roll*Math.PI/180),c=[c[0]*e-c[1]*d,c[0]*d+c[1]*e];c[0]+=(n-a.div.offsetWidth)/2;c[1]+=(p-a.div.offsetHeight)/2;n="translate("+c[0]+"px, "+c[1]+"px) translateZ(9999px) rotate("+b.roll+"deg)";a.div.style.webkitTransform=n;a.div.style.MozTransform=n;a.div.style.transform=
n}}function c(a){b={};var c,d,e="haov vaov vOffset northOffset horizonPitch horizonRoll".split(" ");fa=[];for(c in Va)Va.hasOwnProperty(c)&&(b[c]=Va[c]);for(c in k.default)if(k.default.hasOwnProperty(c))if("strings"==c)for(d in k.default.strings)k.default.strings.hasOwnProperty(d)&&(b.strings[d]=K(k.default.strings[d]));else b[c]=k.default[c],0<=e.indexOf(c)&&fa.push(c);if(null!==a&&""!==a&&k.scenes&&k.scenes[a]){var f=k.scenes[a];for(c in f)if(f.hasOwnProperty(c))if("strings"==c)for(d in f.strings)f.strings.hasOwnProperty(d)&&
(b.strings[d]=K(f.strings[d]));else b[c]=f[c],0<=e.indexOf(c)&&fa.push(c);b.scene=a}for(c in k)if(k.hasOwnProperty(c))if("strings"==c)for(d in k.strings)k.strings.hasOwnProperty(d)&&(b.strings[d]=K(k.strings[d]));else b[c]=k[c],0<=e.indexOf(c)&&fa.push(c)}function g(a){if((a=a?a:!1)&&"preview"in b){var c=b.preview;b.basePath&&!ra(c)&&(c=b.basePath+c);ta=f.createElement("div");ta.className="pnlm-preview-img";ta.style.backgroundImage="url('"+D(c).replace(/"/g,"%22").replace(/'/g,"%27")+"')";N.appendChild(ta)}var c=
b.title,d=b.author;a&&("previewTitle"in b&&(b.title=b.previewTitle),"previewAuthor"in b&&(b.author=b.previewAuthor));b.hasOwnProperty("title")||(n.title.innerHTML="");b.hasOwnProperty("author")||(n.author.innerHTML="");b.hasOwnProperty("title")||b.hasOwnProperty("author")||(n.container.style.display="none");u.load.innerHTML="<p>"+b.strings.loadButtonLabel+"</p>";n.load.boxp.innerHTML=b.strings.loadingLabel;for(var e in b)if(b.hasOwnProperty(e))switch(e){case "title":n.title.innerHTML=K(b[e]);n.container.style.display=
"inline";break;case "author":n.author.innerHTML=b.strings.bylineLabel.replace("%s",K(b[e]));n.container.style.display="inline";break;case "fallback":var g=f.createElement("a");g.href=D(b[e]);g.target="_blank";g.textContent="Click here to view this panorama in an alternative viewer.";var k=f.createElement("p");k.textContent="Your browser does not support WebGL.";k.appendChild(f.createElement("br"));k.appendChild(g);n.errorMsg.innerHTML="";n.errorMsg.appendChild(k);break;case "hfov":x(Number(b[e]));
break;case "autoLoad":!0===b[e]&&z===p&&(n.load.box.style.display="inline",u.load.style.display="none",Ka());break;case "showZoomCtrl":u.zoom.style.display=b[e]&&!1!=b.showControls?"block":"none";break;case "showFullscreenCtrl":u.fullscreen.style.display=b[e]&&!1!=b.showControls&&("fullscreen"in f||"mozFullScreen"in f||"webkitIsFullScreen"in f||"msFullscreenElement"in f)?"block":"none";break;case "hotSpotDebug":Wa.style.display=b[e]?"block":"none";break;case "showControls":b[e]||(u.orientation.style.display=
"none",u.zoom.style.display="none",u.fullscreen.style.display="none");break;case "orientationOnByDefault":b[e]&&(sa===p?Ya=!0:!0===sa&&O())}a&&(c?b.title=c:delete b.title,d?b.author=d:delete b.author)}function s(){if(L&&!La)if(Da)f.exitFullscreen?f.exitFullscreen():f.mozCancelFullScreen?f.mozCancelFullScreen():f.webkitCancelFullScreen?f.webkitCancelFullScreen():f.msExitFullscreen&&f.msExitFullscreen();else try{m.requestFullscreen?m.requestFullscreen():m.mozRequestFullScreen?m.mozRequestFullScreen():
m.msRequestFullscreen?m.msRequestFullscreen():m.webkitRequestFullScreen()}catch(a){}}function w(){f.fullscreen||f.mozFullScreen||f.webkitIsFullScreen||f.msFullscreenElement?(u.fullscreen.classList.add("pnlm-fullscreen-toggle-button-active"),Da=!0):(u.fullscreen.classList.remove("pnlm-fullscreen-toggle-button-active"),Da=!1);Y("fullscreenchange",Da);z.resize();x(b.hfov);G()}function t(a){var c=b.minHfov;"multires"==b.type&&z&&b.multiResMinHfov&&(c=Math.min(c,z.getCanvas().width/(b.multiRes.cubeResolution/
90*0.9)));if(c>b.maxHfov)return console.log("HFOV bounds do not make sense (minHfov > maxHfov)."),b.hfov;var d=b.hfov,d=a<c?c:a>b.maxHfov?b.maxHfov:a;b.avoidShowingBackground&&z&&(a=z.getCanvas(),d=Math.min(d,360*Math.atan(Math.tan((b.maxPitch-b.minPitch)/360*Math.PI)/a.height*a.width)/Math.PI));return d}function x(a){b.hfov=t(a);Y("zoomchange",b.hfov)}function I(){M={};ca=b.autoRotate?b.autoRotate:ca;b.autoRotate=!1}function Xa(){La&&(n.load.box.style.display="none",n.errorMsg.style.display="none",
La=!1,Y("errorcleared"));L=!1;u.load.style.display="none";n.load.box.style.display="inline";Ka()}function Qa(a,d,e,f,l){L=!1;M={};var m,n;if(b.sceneFadeDuration&&!l&&(m=z.render(b.pitch*Math.PI/180,b.yaw*Math.PI/180,b.hfov*Math.PI/180,{returnImage:!0}),m!==p)){l=new Image;l.className="pnlm-fade-img";l.style.transition="opacity "+b.sceneFadeDuration/1E3+"s";l.style.width="100%";l.style.height="100%";l.onload=function(){Qa(a,d,e,f,!0)};l.src=m;N.appendChild(l);z.fadeImg=l;return}l="same"===d?b.pitch:
d;m="same"===e?b.yaw:"sameAzimuth"===e?b.yaw+(b.northOffset||0)-(k.scenes[a].northOffset||0):e;n="same"===f?b.hfov:f;na();c(a);v.yaw=v.pitch=v.hfov=0;g();l!==p&&(b.pitch=l);m!==p&&(b.yaw=m);n!==p&&(b.hfov=n);Y("scenechange",a);Xa()}function B(){H.removeEventListener("deviceorientation",ba);u.orientation.classList.remove("pnlm-orientation-button-active");da=!1}function O(){da=1;H.addEventListener("deviceorientation",ba);u.orientation.classList.add("pnlm-orientation-button-active")}function K(a){return k.escapeHTML?
String(a).split(/&/g).join("&amp;").split('"').join("&quot;").split("'").join("&#39;").split("<").join("&lt;").split(">").join("&gt;").split("/").join("&#x2f;").split("\n").join("<br>"):String(a).split("\n").join("<br>")}function D(a){return 0===a.trim().toLowerCase().indexOf("javascript:")?"about:blank":a}function Y(a){if(a in V)for(var b=V[a].length;0<b;b--)V[a][V[a].length-b].apply(null,[].slice.call(arguments,1))}var ja=this,b,z,ta,pa=!1,U=Date.now(),Aa=0,Ba=0,Ha=-1,Ma=0,Na=0,q=Array(10),Da=!1,
L,La=!1,Ra=!1,R,ga,v={yaw:0,pitch:0,hfov:0},Sa=!1,da=!1,$a=0,Ta,ca=0,za,Ga,M={},V={},fa=[],Za=!1,Ua=!1,Va={hfov:100,minHfov:50,multiResMinHfov:!1,maxHfov:120,pitch:0,minPitch:p,maxPitch:p,yaw:0,minYaw:-180,maxYaw:180,roll:0,haov:360,vaov:180,vOffset:0,autoRotate:!1,autoRotateInactivityDelay:-1,autoRotateStopDelay:p,type:"equirectangular",northOffset:0,showFullscreenCtrl:!0,dynamic:!1,doubleClickZoom:!0,keyboardZoom:!0,mouseZoom:!0,showZoomCtrl:!0,autoLoad:!1,showControls:!0,orientationOnByDefault:!1,
hotSpotDebug:!1,backgroundColor:[0,0,0],avoidShowingBackground:!1,animationTimingFunction:function(a){return 0.5>a?2*a*a:-1+(4-2*a)*a},draggable:!0,disableKeyboardCtrl:!1,crossOrigin:"anonymous",touchPanSpeedCoeffFactor:1,capturedKeyNumbers:[16,17,27,37,38,39,40,61,65,68,83,87,107,109,173,187,189],strings:{loadButtonLabel:"Click to<br>Load<br>Panorama",loadingLabel:"Loading...",bylineLabel:"by %s",noPanoramaError:"No panorama image was specified.",fileAccessError:"The file %s could not be accessed.",
malformedURLError:"There is something wrong with the panorama URL.",iOS8WebGLError:"Due to iOS 8's broken WebGL implementation, only progressive encoded JPEGs work for your device (this panorama uses standard encoding).",genericWebGLError:"Your browser does not have the necessary WebGL support to display this panorama.",textureSizeError:"This panorama is too big for your device! It's %spx wide, but your device only supports images up to %spx wide. Try another device. (If you're the author, try scaling down the image.)",
unknownError:"Unknown error. Check developer console."}};m="string"===typeof m?f.getElementById(m):m;m.classList.add("pnlm-container");m.tabIndex=0;var C=f.createElement("div");C.className="pnlm-ui";m.appendChild(C);var N=f.createElement("div");N.className="pnlm-render-container";m.appendChild(N);var J=f.createElement("div");J.className="pnlm-dragfix";C.appendChild(J);var la=f.createElement("span");la.className="pnlm-about-msg";la.innerHTML='<a href="https://pannellum.org/" target="_blank">Pannellum</a> 3e33dcc';
C.appendChild(la);J.addEventListener("contextmenu",Z);var n={},Wa=f.createElement("div");Wa.className="pnlm-sprite pnlm-hot-spot-debug-indicator";C.appendChild(Wa);n.container=f.createElement("div");n.container.className="pnlm-panorama-info";n.title=f.createElement("div");n.title.className="pnlm-title-box";n.container.appendChild(n.title);n.author=f.createElement("div");n.author.className="pnlm-author-box";n.container.appendChild(n.author);C.appendChild(n.container);n.load={};n.load.box=f.createElement("div");
n.load.box.className="pnlm-load-box";n.load.boxp=f.createElement("p");n.load.box.appendChild(n.load.boxp);n.load.lbox=f.createElement("div");n.load.lbox.className="pnlm-lbox";n.load.lbox.innerHTML='<div class="pnlm-loading"></div>';n.load.box.appendChild(n.load.lbox);n.load.lbar=f.createElement("div");n.load.lbar.className="pnlm-lbar";n.load.lbarFill=f.createElement("div");n.load.lbarFill.className="pnlm-lbar-fill";n.load.lbar.appendChild(n.load.lbarFill);n.load.box.appendChild(n.load.lbar);n.load.msg=
f.createElement("p");n.load.msg.className="pnlm-lmsg";n.load.box.appendChild(n.load.msg);C.appendChild(n.load.box);n.errorMsg=f.createElement("div");n.errorMsg.className="pnlm-error-msg pnlm-info-box";C.appendChild(n.errorMsg);var u={};u.container=f.createElement("div");u.container.className="pnlm-controls-container";C.appendChild(u.container);u.load=f.createElement("div");u.load.className="pnlm-load-button";u.load.addEventListener("click",function(){g();Xa()});C.appendChild(u.load);u.zoom=f.createElement("div");
u.zoom.className="pnlm-zoom-controls pnlm-controls";u.zoomIn=f.createElement("div");u.zoomIn.className="pnlm-zoom-in pnlm-sprite pnlm-control";u.zoomIn.addEventListener("click",function(){L&&(x(b.hfov-5),G())});u.zoom.appendChild(u.zoomIn);u.zoomOut=f.createElement("div");u.zoomOut.className="pnlm-zoom-out pnlm-sprite pnlm-control";u.zoomOut.addEventListener("click",function(){L&&(x(b.hfov+5),G())});u.zoom.appendChild(u.zoomOut);u.container.appendChild(u.zoom);u.fullscreen=f.createElement("div");
u.fullscreen.addEventListener("click",s);u.fullscreen.className="pnlm-fullscreen-toggle-button pnlm-sprite pnlm-fullscreen-toggle-button-inactive pnlm-controls pnlm-control";(f.fullscreenEnabled||f.mozFullScreenEnabled||f.webkitFullscreenEnabled||f.msFullscreenEnabled)&&u.container.appendChild(u.fullscreen);u.orientation=f.createElement("div");u.orientation.addEventListener("click",function(a){da?B():O()});u.orientation.addEventListener("mousedown",function(a){a.stopPropagation()});u.orientation.addEventListener("touchstart",
function(a){a.stopPropagation()});u.orientation.addEventListener("pointerdown",function(a){a.stopPropagation()});u.orientation.className="pnlm-orientation-button pnlm-orientation-button-inactive pnlm-sprite pnlm-controls pnlm-control";var sa,Ya=!1;H.DeviceOrientationEvent?H.addEventListener("deviceorientation",ma):sa=!1;var Ia=f.createElement("div");Ia.className="pnlm-compass pnlm-controls pnlm-control";C.appendChild(Ia);k.firstScene?c(k.firstScene):k.default&&k.default.firstScene?c(k.default.firstScene):
c(null);g(!0);var qa=[],Ca=[];aa.prototype.multiply=function(a){return new aa(this.w*a.w-this.x*a.x-this.y*a.y-this.z*a.z,this.x*a.w+this.w*a.x+this.y*a.z-this.z*a.y,this.y*a.w+this.w*a.y+this.z*a.x-this.x*a.z,this.z*a.w+this.w*a.z+this.x*a.y-this.y*a.x)};aa.prototype.toEulerAngles=function(){var a=Math.atan2(2*(this.w*this.x+this.y*this.z),1-2*(this.x*this.x+this.y*this.y)),b=Math.asin(2*(this.w*this.y-this.z*this.x)),c=Math.atan2(2*(this.w*this.z+this.x*this.y),1-2*(this.y*this.y+this.z*this.z));
return[a,b,c]};this.isLoaded=function(){return Boolean(L)};this.getPitch=function(){return b.pitch};this.setPitch=function(a,c,d,e){(c=c==p?1E3:Number(c))?M.pitch={startTime:Date.now(),startPosition:b.pitch,endPosition:a,duration:c,callback:d,callbackArgs:e}:b.pitch=a;G();return this};this.getPitchBounds=function(){return[b.minPitch,b.maxPitch]};this.setPitchBounds=function(a){b.minPitch=Math.max(-90,Math.min(a[0],90));b.maxPitch=Math.max(-90,Math.min(a[1],90));return this};this.getYaw=function(){return b.yaw};
this.setYaw=function(a,c,d,e){c=c==p?1E3:Number(c);a=(a+180)%360-180;c?(180<b.yaw-a?a+=360:180<a-b.yaw&&(a-=360),M.yaw={startTime:Date.now(),startPosition:b.yaw,endPosition:a,duration:c,callback:d,callbackArgs:e}):b.yaw=a;G();return this};this.getYawBounds=function(){return[b.minYaw,b.maxYaw]};this.setYawBounds=function(a){b.minYaw=Math.max(-180,Math.min(a[0],180));b.maxYaw=Math.max(-180,Math.min(a[1],180));return this};this.getHfov=function(){return b.hfov};this.setHfov=function(a,c,d,e){(c=c==p?
1E3:Number(c))?M.hfov={startTime:Date.now(),startPosition:b.hfov,endPosition:t(a),duration:c,callback:d,callbackArgs:e}:x(a);G();return this};this.getHfovBounds=function(){return[b.minHfov,b.maxHfov]};this.setHfovBounds=function(a){b.minHfov=Math.max(0,a[0]);b.maxHfov=Math.max(0,a[1]);return this};this.lookAt=function(a,b,c,d,e,f){d=d==p?1E3:Number(d);a!==p&&(this.setPitch(a,d,e,f),e=p);b!==p&&(this.setYaw(b,d,e,f),e=p);c!==p&&this.setHfov(c,d,e,f);return this};this.getNorthOffset=function(){return b.northOffset};
this.setNorthOffset=function(a){b.northOffset=Math.min(360,Math.max(0,a));G();return this};this.getHorizonRoll=function(){return b.horizonRoll};this.setHorizonRoll=function(a){b.horizonRoll=Math.min(90,Math.max(-90,a));z.setPose(b.horizonPitch*Math.PI/180,b.horizonRoll*Math.PI/180);G();return this};this.getHorizonPitch=function(){return b.horizonPitch};this.setHorizonPitch=function(a){b.horizonPitch=Math.min(90,Math.max(-90,a));z.setPose(b.horizonPitch*Math.PI/180,b.horizonRoll*Math.PI/180);G();return this};
this.startAutoRotate=function(a){a=a||ca||1;b.autoRotate=a;ja.lookAt(Ga,p,za,3E3);G();return this};this.stopAutoRotate=function(){ca=b.autoRotate?b.autoRotate:ca;b.autoRotate=!1;b.autoRotateInactivityDelay=-1;return this};this.getRenderer=function(){return z};this.setUpdate=function(a){Za=!0===a;z===p?S():G();return this};this.mouseEventToCoords=function(a){return va(a)};this.loadScene=function(a,b,c,d){!1!==L&&Qa(a,b,c,d);return this};this.getScene=function(){return b.scene};this.addScene=function(a,
b){k.scenes[a]=b;return this};this.removeScene=function(a){if(b.scene===a||!k.scenes.hasOwnProperty(a))return!1;delete k.scenes[a];return!0};this.toggleFullscreen=function(){s();return this};this.getConfig=function(){return b};this.getContainer=function(){return m};this.addHotSpot=function(a,c){if(c===p&&b.scene===p)b.hotSpots.push(a);else{var d=c!==p?c:b.scene;if(k.scenes.hasOwnProperty(d))k.scenes[d].hasOwnProperty("hotSpots")||(k.scenes[d].hotSpots=[],d==b.scene&&(b.hotSpots=k.scenes[d].hotSpots)),
k.scenes[d].hotSpots.push(a);else throw"Invalid scene ID!";}if(c===p||b.scene==c)e(a),L&&l(a);return this};this.removeHotSpot=function(a,c){if(c===p||b.scene==c){if(!b.hotSpots)return!1;for(var d=0;d<b.hotSpots.length;d++)if(b.hotSpots[d].hasOwnProperty("id")&&b.hotSpots[d].id===a){for(var e=b.hotSpots[d].div;e.parentNode!=N;)e=e.parentNode;N.removeChild(e);delete b.hotSpots[d].div;b.hotSpots.splice(d,1);return!0}}else if(k.scenes.hasOwnProperty(c)){if(!k.scenes[c].hasOwnProperty("hotSpots"))return!1;
for(d=0;d<k.scenes[c].hotSpots.length;d++)if(k.scenes[c].hotSpots[d].hasOwnProperty("id")&&k.scenes[c].hotSpots[d].id===a)return k.scenes[c].hotSpots.splice(d,1),!0}else return!1};this.resize=function(){z&&w()};this.isLoaded=function(){return L};this.isOrientationSupported=function(){return sa||!1};this.stopOrientation=function(){B()};this.startOrientation=function(){sa&&O()};this.isOrientationActive=function(){return Boolean(da)};this.on=function(a,b){V[a]=V[a]||[];V[a].push(b);return this};this.off=
function(a,b){if(!a)return V={},this;if(b){var c=V[a].indexOf(b);0<=c&&V[a].splice(c,1);0==V[a].length&&delete V[a]}else delete V[a];return this};this.destroy=function(){z&&z.destroy();Ra&&(J.removeEventListener("mousedown",Ea,!1),J.removeEventListener("dblclick",ua,!1),f.removeEventListener("mousemove",Ja,!1),f.removeEventListener("mouseup",ha,!1),m.removeEventListener("mousewheel",X,!1),m.removeEventListener("DOMMouseScroll",X,!1),m.removeEventListener("mozfullscreenchange",w,!1),m.removeEventListener("webkitfullscreenchange",
w,!1),m.removeEventListener("msfullscreenchange",w,!1),m.removeEventListener("fullscreenchange",w,!1),H.removeEventListener("resize",oa,!1),H.removeEventListener("orientationchange",oa,!1),m.removeEventListener("keydown",T,!1),m.removeEventListener("keyup",ia,!1),m.removeEventListener("blur",xa,!1),f.removeEventListener("mouseleave",ha,!1),J.removeEventListener("touchstart",wa,!1),J.removeEventListener("touchmove",y,!1),J.removeEventListener("touchend",d,!1),J.removeEventListener("pointerdown",a,
!1),J.removeEventListener("pointermove",W,!1),J.removeEventListener("pointerup",Q,!1),J.removeEventListener("pointerleave",Q,!1));m.innerHTML="";m.classList.remove("pnlm-container");C.classList.remove("pnlm-grab");C.classList.remove("pnlm-grabbing")}}return{viewer:function(f,k){return new ma(f,k)}}}(window,document);

Loading…
Cancel
Save