/** * @preserve Mockup 1.01 | Copyright 2016, Deepak Ghimire. All rights reserved. */ "use strict";var MOCKUP={VERSION:"1",REVISION:"01"};!function(e){e.__extends=function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n]);function Ctor(){this.constructor=e}return Ctor.prototype=t.prototype,e.prototype=new Ctor,e.__super=t.prototype,e},e.MODE={PLUGIN:0,BUILDER:1},e.GEOMETRY_TYPE={PLANE:0,BOX:1,MODEL:2},e.MATERIAL_FACE={FRONT:4,BACK:5},e.MOUSE={LEFT:0,MIDDLE:1,RIGHT:2},e.Vector3=THREE.Vector3,e.Vector2=THREE.Vector2,e.defaults={anisotropy:8,maxTextureSize:2048,groundTexture:"images/textures/ground-grid.png",textureLoadFallback:"blank"},e.overrideAsTemplate=!1,e.enableLog=!1,e.log=function(){console.log.apply(console,arguments)},e.error=function(){console.error.apply(console,arguments)},e.autoSave=function(){},e.libType="THREE",e.textureLoader=new THREE.TextureLoader,e.paperDefaults={geometryType:e.GEOMETRY_TYPE.PLANE,width:210,height:297,depth:.2,segments:150,widthScale:1,heightScale:1,folds:1,angles:[],backImage:null,frontImage:null,frontBump:null,backBump:null,mipmap:!1,shininess:15,bumpScale:.4,stiffness:.02,color:16777215,skipMaterials:!1,repeat:100,defaultImage:[,,,,"blank","blank"]},e.Paper=function(t){function Paper(t,n){t=jQuery.extend({},e.paperDefaults,t),this.geometryType=t.geometryType,this.width=t.width,this.widthScale=t.widthScale,this.height=t.height,this.depth=t.depth,this.segments=t.segments,this.folds=t.folds,this.angles=t.angles,this._shininess=t.shininess,this._bumpScale=t.bumpScale,this.stiffness=t.stiffness,this.color=t.color,this.heightScale=t.heightScale,this.defaultImage=t.defaultImage,this.baseType="Paper",this.type="Paper",this.subType=t.subType,null!=t.cloneParent&&(this.cloneParent=t.cloneParent),this.createGeometry(),this.updateGeometry(),t.skipMaterials||1==t.skipLoad&&null!=t.cloneParent||(null!=this.frontImage&&null!=t.defaultImage&&this.frontImage(null!=t.frontImage?t.frontImage:t.defaultImage[e.MATERIAL_FACE.FRONT]),null!=this.backImage&&null!=t.defaultImage&&this.backImage(null!=t.backImage?t.backImage:t.defaultImage[e.MATERIAL_FACE.BACK]),null!=this.frontBump&&this.frontBump(t.frontBump),null!=this.backBump&&this.backBump(t.backBump)),null!=this.bumpScale&&this.bumpScale(t.bumpScale),null!=n&&null!=n.add&&n.add(this)}e.__extends(Paper,t);var loadTexture=function(t,n,a,s){if(t){var o=t.image;t.naturalWidth=o.naturalWidth,t.naturalHeight=o.naturalHeight,t.needsUpdate=!0}null!==t&&"map"==a&&(t.anisotropy=0,e.defaults.anisotropy>0&&(t.anisotropy=e.defaults.anisotropy),1==THREE.skipPowerOfTwo&&(t.minFilter=THREE.LinearFilter,t.magFilter=THREE.LinearFilter),t.name=(new Date).toTimeString(),null!=n.textureRepeat&&(t.wrapS=THREE.RepeatWrapping,t.wrapT=THREE.RepeatWrapping,e.defaults.anisotropy>0&&(t.anisotropy=e.defaults.anisotropy),t.repeat.set(n._textureRepeat,n._textureRepeat),n instanceof e.Ground&&(n.material.bumpMap=t,n.material.bumpScale=n.bumpScale(),n.material.needsUpdate=!0))),n.geometryType==e.GEOMETRY_TYPE.PLANE?(clearTexture(n.material[a]),n.material[a]=t,"bumpMap"==a&&(n.material.bumpScale=n.bumpScale())):(clearTexture(n.material.materials[s][a]),n.material.materials[s][a]=t,"bumpMap"==a&&(n.material.materials[s].bumpScale=n.bumpScale()),n.material.materials[s].needsUpdate=!0),e.autoSave()},clearTexture=function(e){e&&(e.image&&"CANVAS"==e.image.nodeName&&(e.image.remove&&e.image.remove(),delete e.image),e.dispose&&e.dispose(),e=null)},traverseStage=function(e){return e instanceof THREE.Object3D&&e.parent instanceof THREE.Object3D?e.parent instanceof THREE.Scene?e.parent:traverseStage(e.parent):null};return e.loadImage=function(t,n,a,s,o){if(null==n){var r=t.geometryType==e.GEOMETRY_TYPE.PLANE?null!==t.material[s]?t.material[s].sourceFile:null:null==t.material.materials[a]?null:t.material.materials[a][s]?t.material.materials[a][s].sourceFile:null;return null==r||r.indexOf("data:image")>-1?null:r}1==e.enableLog&&console.log(n);var i=null;if("CANVAS"==n.nodeName||"IMG"==n.nodeName){(i=new THREE.Texture(n)).needsUpdate=!0,loadTexture(i,t,s,a),null!=o&&o(t,i);var p=traverseStage(t);null!=p&&(p.renderRequestPending=!0)}else"blank"!=n?(i=null==n?null:e.textureLoader.load(n,(function(e){e.sourceFile=n,loadTexture(e,t,s,a),null!=o&&o(t,e);var r=traverseStage(t);null!=r&&(r.renderRequestPending=!0)}),void 0,(function(o){if(null==i.image)if(null!=t.defaultImage){var r=t.geometryType==e.GEOMETRY_TYPE.PLANE?t.defaultImage[e.MATERIAL_FACE.FRONT]:t.defaultImage[a];n!==r&&null!=r?e.loadImage(t,r,a,s):n===e.defaults.textureLoadFallback&&null!=r||e.loadImage(t,e.defaults.textureLoadFallback,a,s)}else n!==e.defaults.textureLoadFallback&&e.loadImage(t,e.defaults.textureLoadFallback,a,s)})))&&(i.mapping=THREE.UVMapping):loadTexture(null,t,s,a);return 0},Paper.prototype.loadImage=function(t,n,a,s){return e.loadImage(this,t,n,a,s)},Paper.prototype.frontImage=function(t,n){return this.loadImage(t,e.MATERIAL_FACE.FRONT,"map",n)},Paper.prototype.backImage=function(t,n){return this.loadImage(t,e.MATERIAL_FACE.BACK,"map",n)},Paper.prototype.frontBump=function(t,n){return this.loadImage(t,e.MATERIAL_FACE.FRONT,"bumpMap",n)},Paper.prototype.backBump=function(t,n){return this.loadImage(t,e.MATERIAL_FACE.BACK,"bumpMap",n)},Paper.prototype.bumpScale=function(t){if(null==t)return this._bumpScale;this._bumpScale=t,this.geometryType==e.GEOMETRY_TYPE.PLANE?this.material.bumpScale=t:this.geometryType==e.GEOMETRY_TYPE.BOX&&(this.material.materials[e.MATERIAL_FACE.FRONT].bumpScale=t,this.material.materials[e.MATERIAL_FACE.BACK].bumpScale=t)},Paper.prototype.shininess=function(t){if(null==t)return this._shininess;this._shininess=t,this.geometryType==e.GEOMETRY_TYPE.PLANE?this.material.shininess=t:this.geometryType==e.GEOMETRY_TYPE.BOX&&(this.material.materials[e.MATERIAL_FACE.FRONT].shininess=t,this.material.materials[e.MATERIAL_FACE.BACK].shininess=t)},Paper.prototype.bumpImage=function(t){return this.loadImage(t,e.MATERIAL_FACE.FRONT,"bumpMap")},Paper.prototype.createCopy=function(t){null==t&&(t={},e.getParameter(this,t)),t.type=this.type;var n=e.createObject(t);return n.cloneParent=null,n.copy(this,null),n},Paper.prototype.createClone=function(t){null==t&&(t={},e.getParameter(this,t)),t.type=this.type;var n=e.createObject(t);return n.material=this.material,n.cloneParent=null!=n.cloneParent?n.cloneParent:this.uuid,n.copy(this,null),n},Paper.prototype.createGeometry=function(){var n={color:this.color,shading:THREE.SmoothShading,shininess:this._shininess},a=new THREE.MeshPhongMaterial(n);if(this.geometryType==e.GEOMETRY_TYPE.BOX){var s=[a,a,a,a,new THREE.MeshPhongMaterial(n),new THREE.MeshPhongMaterial(n)];t.call(this,new THREE.BoxGeometry(this.width,this.height,this.depth,this.segments*this.folds,1,1),new THREE.MeshFaceMaterial(s))}else this.geometryType==e.GEOMETRY_TYPE.PLANE&&t.call(this,new THREE.PlaneBufferGeometry(this.width,this.height),a)},Paper.prototype.updateGeometry=function(){},Paper}(THREE.Mesh)}(MOCKUP||(MOCKUP={})),function(e){e.selected=null,e.Stage=function(t){function Stage(n){n=n||{};var a=this;if(a.postRender=null,t.call(a),!0!==n.skipLoad){a.canvas=n.canvas||document.createElement("canvas"),a.canvas=jQuery(this.canvas),a.camera=new THREE.PerspectiveCamera(30,a.width/a.height,4,5e4),a.renderer=new THREE.WebGLRenderer({canvas:a.canvas[0],antialias:!0,alpha:!0}),a.renderer.setPixelRatio(n.pixelRatio),a.renderer.setSize(a.width,a.height),a.renderer.setClearColor(16777215,0),(a.orbitControl=new THREE.OrbitControls(a.camera,a.renderer.domElement)).maxPolarAngle=Math.PI,e.mode!==e.MODE.PLUGIN&&(a.renderer.shadowMap.enabled=!0,a.ground=new e.Ground({color:15658734,height:a.camera.far,width:a.camera.far},a)),a.ambientLight=new THREE.AmbientLight(4473924),a.add(a.ambientLight);var s=a.spotLight=new THREE.DirectionalLight(16777215,.5);if(s.position.set(0,1,0),0!=n.webglShadow&&(s.castShadow=!0,s.shadow=new THREE.LightShadow(new THREE.PerspectiveCamera(70,1,200,2e3)),s.shadow.bias=-222e-6,s.shadow.mapSize.width=1024,s.shadow.mapSize.height=1024),s.intensity=.6,s.shadow){var o=a.spotLightHelper=new THREE.CameraHelper(s.shadow.camera);o.visible=!1,a.add(s),a.add(o)}if(1==n.stats){var r=a.stats=new Stats;r.domElement.style.position="absolute",r.domElement.style.top="60px",a.canvas.parent().append(jQuery(r.domElement))}a.enableSoftShadow(!1),a.animateCount=0,a.renderCount=0,a.camera.position.set(-300,300,300),a.camera.lookAt(new THREE.Vector3(0,0,0)),a.orbitControl.center.set(0,0,0),a.orbitControl.update(),a.selectiveRendering=!1,a.renderRequestPending=!1,animate()}function animate(){animate&&requestAnimationFrame(animate),(1!=a.selectiveRendering||1==a.selectiveRendering&&1==a.renderRequestPending)&&a.render()}this.type="Stage",a.cancelRAF=function(){cancelAnimationFrame(animate),animate=null}}return e.__extends(Stage,t),Stage.prototype.enableSoftShadow=function(e){if(null!=this.spotLight.shadow){e=null!=e&&e;var t=this.renderer.shadowMap.type;this.renderer.shadowMap.type=THREE.PCFShadowMap;var n=this.spotLight;if(n.shadow.map){if(t==this.renderer.shadowMap.type)return;n.shadow.map.dispose(),n.shadow.map=null}var a=e?4096:1024;n.shadow.mapSize.width=a,n.shadow.mapSize.height=a,n.shadow.bias=e?-875e-8:-5e-5,this.clearMaterials(),this.renderRequestPending=!0}},Stage.prototype.clearMaterials=function(){for(var e=this.children.length-1;e>=0;e--){var t=this.children[e];if(t.baseType&&"Paper"==t.baseType&&t.material)if(null!=t.material.materials)for(var n=0;n=0;t--){var n=this.children[t];if(n instanceof e.Bundle)for(var a=n.children.length-1;a>=0;a--)e.clearChild(n.children[a]);e.clearChild(n),n=null}this.render()},Stage.prototype.resizeAuto=function(){this.resizeCanvas(this.canvas.parent().width(),this.canvas.parent().height())},Stage.prototype.resizeCanvas=function(e,t){this.renderer.setSize(e,t),this.camera.aspect=e/t,this.camera.updateProjectionMatrix(),this.renderRequestPending=!0,null!=this.resizeCallback&&this.resizeCallback()},Stage.prototype.render=function(){this.animateCount++,this.renderer.render(this,this.camera),null!=this.stats&&this.stats.update(),this.renderRequestPending=!1,null!=this.renderCallback&&this.renderCallback()},Stage.prototype.toJSON=function(){var t={metadata:{version:4.3,type:"Object",generator:"ObjectExporter"}},n={},a={},parseMaterial=function(e){if(null==t.materials&&(t.materials=[]),null==a[e.uuid]){var n=e.toJSON();delete n.metadata,a[e.uuid]=n,t.materials.push(n)}return e.uuid},parseObject=function(a){var s={};if(s.uuid=a.uuid,s.type=a.type,""!==a.name&&(s.name=a.name),"{}"!==JSON.stringify(a.userData)&&(s.userData=a.userData),!0!==a.visible&&(s.visible=a.visible),e.getParameter(a,s),a instanceof THREE.PerspectiveCamera?(s.fov=a.fov,s.aspect=a.aspect,s.near=a.near,s.far=a.far):a instanceof THREE.OrthographicCamera?(s.left=a.left,s.right=a.right,s.top=a.top,s.bottom=a.bottom,s.near=a.near,s.far=a.far):a instanceof THREE.AmbientLight?s.color=a.color.getHex():a instanceof THREE.DirectionalLight?(s.color=a.color.getHex(),s.intensity=a.intensity):a instanceof THREE.PointLight?(s.color=a.color.getHex(),s.intensity=a.intensity,s.distance=a.distance,s.decay=a.decay):a instanceof THREE.SpotLight?(s.radius=a.radius,s.color=a.color.getHex(),s.intensity=a.intensity,s.distance=a.distance,s.angle=a.angle,s.exponent=a.exponent,s.decay=a.decay):a instanceof THREE.Mesh||a instanceof THREE.Line||a instanceof THREE.PointCloud?a instanceof e.Iphone||(s.geometry=function(e){if(null==t.geometries&&(t.geometries=[]),null==n[e.uuid]){var a=e.toJSON();delete a.metadata,n[e.uuid]=a,t.geometries.push(a)}return e.uuid}(a.geometry),s.material=parseMaterial(a.material),a instanceof THREE.Line&&(s.mode=a.mode)):a instanceof THREE.Sprite&&(s.material=parseMaterial(a.material)),s.matrix=a.matrix.toArray(),a.children.length>0){s.children=[];for(var o=0;o=1){M[0]=[],x[o-1]=[],T=n.angles[1]*Math.PI/180,b=n.angles[4]*Math.PI/180;Math.sin(b);M[0][0]=M[0][1]=1==n.folds?new THREE.Vector3(-d*Math.cos(T),0,Math.sin(T)*d):new THREE.Vector3(d-i-d*Math.cos(T),0,Math.sin(T)*d),P=(n.angles[1]-90)*Math.PI/180,T=P,x[o-1][2]=x[o-1][3]=new THREE.Vector3(M[0][0].x-Math.cos(T)*y,0,M[0][0].z+Math.sin(T)*y),1==n.folds&&(M[0][1]=new THREE.Vector3(-d/2*Math.cos(b),0,d/2*Math.sin(b)),x[o-1][2]=new THREE.Vector3(M[0][1].x-Math.cos(P)*y,0,M[0][1].z+Math.sin(P)*y)),T=(45+n.angles[1]/2)*Math.PI/180,n.folds>1&&(T=2==n.folds?(45+n.angles[1]/4-n.angles[4]/2)*Math.PI/180:(45+n.angles[1]/4)*Math.PI/180),M[0][2]=1==n.folds?new THREE.Vector3(-Math.cos(T)*m/2,0,Math.sin(T)*m):new THREE.Vector3(d-i-R-Math.cos(T)*m/2,0,Math.sin(T)*m),x[o-1][1]=1==n.folds?new THREE.Vector3(M[0][2].x-Math.cos(P)*y,0,M[0][2].z+Math.sin(P)*y):M[0][2],M[0][3]=1==n.folds?new THREE.Vector3(0,0,0):new THREE.Vector3(d-i-R,0,0),T=2==n.folds?(n.angles[1]/2-n.angles[4]/2-90)*Math.PI/180:1==n.folds?(n.angles[1]-90)*Math.PI/180:(n.angles[1]/2-90)*Math.PI/180,x[o-1][0]=new THREE.Vector3(M[0][3].x-Math.cos(T)*y,0,M[0][3].z+Math.sin(T)*y)}n.folds>=2&&(M[1]=[],x[o-2]=[],M[1][0]=M[0][3],x[o-2][3]=x[o-1][0],T=(135+3*n.angles[1]/4)*Math.PI/180,M[1][1]=new THREE.Vector3(d-i-Math.cos(T)*m,0,Math.sin(T)*m),x[o-2][2]=M[1][1],T=0,n.folds>2?(T=(45-3*n.angles[4]/4)*Math.PI/180,M[1][2]=new THREE.Vector3(2*d-i+R-Math.cos(T)*m,0,Math.sin(T)*m),x[o-2][1]=M[1][2],M[1][3]=new THREE.Vector3(2*d-i+R,0,0),T=(n.angles[4]/2-90)*Math.PI/180,x[o-2][0]=new THREE.Vector3(M[1][3].x+Math.cos(T)*y*1.25,0,M[1][3].z+Math.sin(T)*y*1.25)):(T=(135-n.angles[4]/4+n.angles[1]/2)*Math.PI/180,M[1][1]=new THREE.Vector3(d-i-Math.cos(T)*m/2,0,Math.sin(T)*m),x[0][2]=M[1][1],T=(180-n.angles[4])*Math.PI/180,M[1][2]=M[1][3]=new THREE.Vector3(d-i-Math.cos(T)*d,0,Math.sin(T)*d),T=(n.angles[4]-90)*Math.PI/180,x[0][0]=x[0][1]=new THREE.Vector3(M[1][3].x+Math.cos(T)*y,0,M[1][3].z+Math.sin(T)*y))),n.folds>2&&(M[2]=[],x[0]=[],M[2][0]=M[1][3],x[0][3]=x[1][0],T=(135-1*n.angles[4]/4)*Math.PI/180,M[2][1]=new THREE.Vector3(2*d-i-0*Math.cos(T),0,Math.sin(T)*m),x[0][2]=M[2][1],T=(180-n.angles[4])*Math.PI/180,M[2][2]=M[2][3]=new THREE.Vector3(2*d-i-Math.cos(T)*d,0,Math.sin(T)*d),T=(n.angles[4]-90)*Math.PI/180,x[0][0]=x[0][1]=new THREE.Vector3(M[2][3].x+Math.cos(T)*y,0,M[2][3].z+Math.sin(T)*y));for(var e=0;e=1){M[0]=[],x[o-1]=[],T=n.angles[1]*Math.PI/180,b=n.angles[4]*Math.PI/180;Math.sin(b);M[0][0]=M[0][1]=1==n.folds?new THREE.Vector3(-d*Math.cos(T),0,Math.sin(T)*d):new THREE.Vector3(d-i-d*Math.cos(T),0,Math.sin(T)*d),P=(n.angles[1]-90)*Math.PI/180,T=P,x[o-1][2]=x[o-1][3]=new THREE.Vector3(M[0][0].x-Math.cos(T)*y,0,M[0][0].z+Math.sin(T)*y),1==n.folds&&(M[0][1]=new THREE.Vector3(-d/2*Math.cos(b),0,d/2*Math.sin(b)),x[o-1][2]=new THREE.Vector3(M[0][1].x-Math.cos(P)*y,0,M[0][1].z+Math.sin(P)*y)),T=(45+n.angles[1]/2)*Math.PI/180,n.folds>1&&(T=2==n.folds?(45+n.angles[1]/4-n.angles[4]/2)*Math.PI/180:(45+n.angles[1]/4)*Math.PI/180),M[0][2]=1==n.folds?new THREE.Vector3(-Math.cos(T)*m/2,0,Math.sin(T)*m):new THREE.Vector3(d-i-R-Math.cos(T)*m/2,0,Math.sin(T)*m),x[o-1][1]=1==n.folds?new THREE.Vector3(M[0][2].x-Math.cos(P)*y,0,M[0][2].z+Math.sin(P)*y):M[0][2],M[0][3]=1==n.folds?new THREE.Vector3(0,0,0):new THREE.Vector3(d-i-R,0,0),T=2==n.folds?(n.angles[1]/2-n.angles[4]/2-90)*Math.PI/180:1==n.folds?(n.angles[1]-90)*Math.PI/180:(n.angles[1]/2-90)*Math.PI/180,x[o-1][0]=new THREE.Vector3(M[0][3].x-Math.cos(T)*y,0,M[0][3].z+Math.sin(T)*y)}n.folds>=2&&(M[1]=[],x[o-2]=[],M[1][0]=M[0][3],x[o-2][3]=x[o-1][0],T=(135+3*n.angles[1]/4)*Math.PI/180,M[1][1]=new THREE.Vector3(d-i-Math.cos(T)*m,0,Math.sin(T)*m),x[o-2][2]=M[1][1],T=0,n.folds>2?(T=(45-3*n.angles[4]/4)*Math.PI/180,M[1][2]=new THREE.Vector3(2*d-i+R-Math.cos(T)*m,0,Math.sin(T)*m),x[o-2][1]=M[1][2],M[1][3]=new THREE.Vector3(2*d-i+R,0,0),T=(n.angles[4]/2-90)*Math.PI/180,x[o-2][0]=new THREE.Vector3(M[1][3].x+Math.cos(T)*y*1.25,0,M[1][3].z+Math.sin(T)*y*1.25)):(T=(135-n.angles[4]/4+n.angles[1]/2)*Math.PI/180,M[1][1]=new THREE.Vector3(d-i-Math.cos(T)*m/2,0,Math.sin(T)*m),x[0][2]=M[1][1],T=(180-n.angles[4])*Math.PI/180,M[1][2]=M[1][3]=new THREE.Vector3(d-i-Math.cos(T)*d,0,Math.sin(T)*d),T=(n.angles[4]-90)*Math.PI/180,x[0][0]=x[0][1]=new THREE.Vector3(M[1][3].x+Math.cos(T)*y,0,M[1][3].z+Math.sin(T)*y))),n.folds>2&&(M[2]=[],x[0]=[],M[2][0]=M[1][3],x[0][3]=x[1][0],T=(135-1*n.angles[4]/4)*Math.PI/180,M[2][1]=new THREE.Vector3(2*d-i-0*Math.cos(T),0,Math.sin(T)*m),x[0][2]=M[2][1],T=(180-n.angles[4])*Math.PI/180,M[2][2]=M[2][3]=new THREE.Vector3(2*d-i-Math.cos(T)*d,0,Math.sin(T)*d),T=(n.angles[4]-90)*Math.PI/180,x[0][0]=x[0][1]=new THREE.Vector3(M[2][3].x+Math.cos(T)*y,0,M[2][3].z+Math.sin(T)*y));for(var e=0;e0?s.dollyIn():x.y<0&&s.dollyOut(),v.copy(M)}else if(L===z){if(!0===s.noPan)return;d.set(e.clientX,e.clientY),E.subVectors(d,m),s.pan(E.x,E.y),m.copy(d)}L!==I&&s.update()}}function onMouseUp(){!1!==s.enabled&&(document.removeEventListener("mousemove",onMouseMove,!1),document.removeEventListener("mouseup",onMouseUp,!1),document.removeEventListener("mouseout",onMouseUp,!1),s.dispatchEvent(_),L=I)}function onMouseWheel(e){if(!1!==s.enabled&&!0!==s.noZoom&&L===I){e.preventDefault(),e.stopPropagation();var t=0;null!=e.wheelDelta?t=e.wheelDelta:null!=e.detail&&(t=-e.detail),t>0?s.dollyOut():t<0&&s.dollyIn(),s.update(),s.dispatchEvent(F),s.dispatchEvent(_),s.zoomCallback&&s.zoomCallback()}}function onKeyDown(e){if(!1!==s.enabled&&!0!==s.noKeys&&!0!==s.noPan)switch(e.keyCode){case s.keys.UP:s.pan(0,s.keyPanSpeed),s.update();break;case s.keys.BOTTOM:s.pan(0,-s.keyPanSpeed),s.update();break;case s.keys.LEFT:s.pan(s.keyPanSpeed,0),s.update();break;case s.keys.RIGHT:s.pan(-s.keyPanSpeed,0),s.update()}}function touchstart(e){if(!1!==s.enabled){var t=e.touches.length;switch(s.mouseButtons.PAN==THREE.MOUSE.LEFT&&(t=3),t){case 4:if(!0===s.noRotate)return;L=A,r.set(e.touches[0].pageX,e.touches[0].pageY);break;case 2:if(!0===s.noZoom)return;L=C;var n=e.touches[0].pageX-e.touches[1].pageX,a=e.touches[0].pageY-e.touches[1].pageY,o=Math.sqrt(n*n+a*a);v.set(0,o);break;case 3:if(!0===s.noPan)return;L=O,m.set(e.touches[0].pageX,e.touches[0].pageY);break;default:L=I}L!==I&&s.dispatchEvent(F)}}function touchmove(e){if(!1!==s.enabled){var t=s.domElement===document?s.domElement.body:s.domElement,n=e.touches.length;switch(s.mouseButtons.PAN==THREE.MOUSE.LEFT&&(n=3),n){case 4:if(!0===s.noRotate)return;if(L!==A)return;e.preventDefault(),e.stopPropagation(),i.set(e.touches[0].pageX,e.touches[0].pageY),p.subVectors(i,r),s.rotateLeft(2*Math.PI*p.x/t.clientWidth*s.rotateSpeed),s.rotateUp(2*Math.PI*p.y/t.clientHeight*s.rotateSpeed),r.copy(i),s.update();break;case 2:if(!0===s.noZoom)return;if(L!==C)return;e.preventDefault(),e.stopPropagation();var a=e.touches[0].pageX-e.touches[1].pageX,o=e.touches[0].pageY-e.touches[1].pageY,f=Math.sqrt(a*a+o*o);M.set(0,f),x.subVectors(M,v),x.y>0?s.dollyOut():x.y<0&&s.dollyIn(),v.copy(M),s.update();break;case 3:if(!0===s.noPan)return;if(L!==O)return;e.preventDefault(),e.stopPropagation(),d.set(e.touches[0].pageX,e.touches[0].pageY),E.subVectors(d,m),s.pan(E.x,E.y),m.copy(d),s.update();break;default:L=I}}}function touchend(){!1!==s.enabled&&(s.dispatchEvent(_),L=I)}function suppressEvent(e){e.preventDefault()}this.rotateLeft=function(e){null==e&&(e=getAutoRotationAngle()),y-=e},this.rotateUp=function(e){null==e&&(e=getAutoRotationAngle()),T-=e},this.panLeft=function(e){var t=this.object.matrix.elements;f.set(t[0],t[1],t[2]),f.multiplyScalar(-e),R.add(f)},this.panUp=function(e){var t=this.object.matrix.elements;f.set(t[4],t[5],t[6]),f.multiplyScalar(e),R.add(f)},this.pan=function(e,t){var n=s.domElement===document?s.domElement.body:s.domElement;if(s.object instanceof THREE.PerspectiveCamera){var a=s.object.position.clone().sub(s.target).length();a*=Math.tan(s.object.fov/2*Math.PI/180),s.panLeft(2*e*a/n.clientHeight),s.panUp(2*t*a/n.clientHeight)}else s.object instanceof THREE.OrthographicCamera?(s.panLeft(e*(s.object.right-s.object.left)/n.clientWidth),s.panUp(t*(s.object.top-s.object.bottom)/n.clientHeight)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - pan disabled.")},this.dollyIn=function(e){null==e&&(e=getZoomScale()),s.object instanceof THREE.PerspectiveCamera?b/=e:s.object instanceof THREE.OrthographicCamera?(s.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom*e)),s.object.updateProjectionMatrix(),s.dispatchEvent(k)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.dollyOut=function(e){null==e&&(e=getZoomScale()),s.object instanceof THREE.PerspectiveCamera?b*=e:s.object instanceof THREE.OrthographicCamera?(s.object.zoom=Math.max(this.minZoom,Math.min(this.maxZoom,this.object.zoom/e)),s.object.updateProjectionMatrix(),s.dispatchEvent(k)):console.warn("WARNING: OrbitControls.js encountered an unknown camera type - dolly/zoom disabled.")},this.update=function(){var e=this.object.position;g.copy(e).sub(this.target),g.applyQuaternion(B),n=Math.atan2(g.x,g.z),a=Math.atan2(Math.sqrt(g.x*g.x+g.z*g.z),g.y),this.autoRotate&&L===I&&this.rotateLeft(getAutoRotationAngle()),n+=y,a+=T,n=Math.max(this.minAzimuthAngle,Math.min(this.maxAzimuthAngle,n)),a=Math.max(this.minPolarAngle,Math.min(this.maxPolarAngle,a)),a=Math.max(o,Math.min(Math.PI-o,a));var t=g.length()*b;t=Math.max(this.minDistance,Math.min(this.maxDistance,t)),this.target.add(R),g.x=t*Math.sin(a)*Math.sin(n),g.y=t*Math.cos(a),g.z=t*Math.sin(a)*Math.cos(n),g.applyQuaternion(V),e.copy(this.target).add(g),this.object.lookAt(this.target),y=0,T=0,b=1,R.set(0,0,0),(P.distanceToSquared(this.object.position)>o||8*(1-w.dot(this.object.quaternion))>o)&&(this.dispatchEvent(k),P.copy(this.object.position),w.copy(this.object.quaternion))},this.reset=function(){L=I,this.target.copy(this.target0),this.object.position.copy(this.position0),this.object.zoom=this.zoom0,this.object.updateProjectionMatrix(),this.dispatchEvent(k),this.update()},this.getPolarAngle=function(){return a},this.getAzimuthalAngle=function(){return n},this.dispose=function(){this.domElement.removeEventListener("contextmenu",suppressEvent,!1),this.domElement.removeEventListener("mousedown",onMouseDown,!1),this.domElement.removeEventListener("mousewheel",onMouseWheel,!1),this.domElement.removeEventListener("DOMMouseScroll",onMouseWheel,!1),this.domElement.removeEventListener("touchstart",touchstart,!1),this.domElement.removeEventListener("touchend",touchend,!1),this.domElement.removeEventListener("touchmove",touchmove,!1),window.removeEventListener("keydown",onKeyDown,!1)},this.domElement.addEventListener("contextmenu",suppressEvent,!1),this.domElement.addEventListener("mousedown",onMouseDown,!1),this.domElement.addEventListener("mousewheel",onMouseWheel,!1),this.domElement.addEventListener("DOMMouseScroll",onMouseWheel,!1),this.domElement.addEventListener("touchstart",touchstart,!1),this.domElement.addEventListener("touchend",touchend,!1),this.domElement.addEventListener("touchmove",touchmove,!1),window.addEventListener("keydown",onKeyDown,!1),this.update()},THREE.OrbitControls.prototype=Object.create(THREE.EventDispatcher.prototype),THREE.OrbitControls.prototype.constructor=THREE.OrbitControls,THREE.CSS3DObject=function(e){THREE.Object3D.call(this),this.element=e,this.element.style.position="absolute",this.addEventListener("removed",(function(e){null!==this.element.parentNode&&this.element.parentNode.removeChild(this.element)}))},THREE.CSS3DObject.prototype=Object.create(THREE.Object3D.prototype),THREE.CSS3DObject.prototype.constructor=THREE.CSS3DObject,THREE.CSS3DSprite=function(e){THREE.CSS3DObject.call(this,e)},THREE.CSS3DSprite.prototype=Object.create(THREE.CSS3DObject.prototype),THREE.CSS3DSprite.prototype.constructor=THREE.CSS3DSprite,THREE.CSS3DRenderer=function(){var e,t,n,a;console.log("THREE.CSS3DRenderer",THREE.REVISION);var s=new THREE.Matrix4,o={camera:{fov:0,style:""},objects:{}},r=document.createElement("div");r.style.overflow="hidden",r.style.WebkitTransformStyle="preserve-3d",r.style.MozTransformStyle="preserve-3d",r.style.oTransformStyle="preserve-3d",r.style.transformStyle="preserve-3d",this.domElement=r;var i=document.createElement("div");i.style.WebkitTransformStyle="preserve-3d",i.style.MozTransformStyle="preserve-3d",i.style.oTransformStyle="preserve-3d",i.style.transformStyle="preserve-3d",r.appendChild(i),this.setClearColor=function(){},this.getSize=function(){return{width:e,height:t}},this.setSize=function(s,o){n=(e=s)/2,a=(t=o)/2,r.style.width=s+"px",r.style.height=o+"px",i.style.width=s+"px",i.style.height=o+"px"};var h=function(e){return Math.abs(e)