@xeokit/xeokit-sdk 2.4.0-alpha-18 → 2.4.0-alpha-19
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -113445,6 +113445,16 @@ class NavCubePlugin extends Plugin {
|
|
|
113445
113445
|
this.setIsProjectNorth(cfg.isProjectNorth);
|
|
113446
113446
|
this.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);
|
|
113447
113447
|
|
|
113448
|
+
const rotateTrueNorth = (function () {
|
|
113449
|
+
const trueNorthMatrix = math.mat4();
|
|
113450
|
+
const resultVec = math.vec3();
|
|
113451
|
+
return function (dir, vec) {
|
|
113452
|
+
math.identityMat4(trueNorthMatrix);
|
|
113453
|
+
math.rotationMat4v(dir * self._projectNorthOffsetAngle * math.DEGTORAD, [0, 1, 0], trueNorthMatrix);
|
|
113454
|
+
return math.transformVec3(trueNorthMatrix, vec, resultVec)
|
|
113455
|
+
}
|
|
113456
|
+
}());
|
|
113457
|
+
|
|
113448
113458
|
this._synchCamera = (function () {
|
|
113449
113459
|
var matrix = math.rotationMat4c(-90 * math.DEGTORAD, 1, 0, 0);
|
|
113450
113460
|
var eyeLookVec = math.vec3();
|
|
@@ -113455,6 +113465,11 @@ class NavCubePlugin extends Plugin {
|
|
|
113455
113465
|
var look = viewer.camera.look;
|
|
113456
113466
|
var up = viewer.camera.up;
|
|
113457
113467
|
eyeLookVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye, look, eyeLookVec)), 5);
|
|
113468
|
+
|
|
113469
|
+
if (self._isProjectNorth && self._projectNorthOffsetAngle) {
|
|
113470
|
+
eyeLookVec = rotateTrueNorth(-1, eyeLookVec);
|
|
113471
|
+
}
|
|
113472
|
+
|
|
113458
113473
|
if (self._zUp) { // +Z up
|
|
113459
113474
|
math.transformVec3(matrix, eyeLookVec, eyeLookVecCube);
|
|
113460
113475
|
math.transformVec3(matrix, up, upCube);
|
|
@@ -113466,9 +113481,6 @@ class NavCubePlugin extends Plugin {
|
|
|
113466
113481
|
self._navCubeCamera.eye = eyeLookVec;
|
|
113467
113482
|
self._navCubeCamera.up = up;
|
|
113468
113483
|
}
|
|
113469
|
-
if (self._isProjectNorth && self._projectNorthOffsetAngle) {
|
|
113470
|
-
self._navCubeCamera.orbitYaw(self._projectNorthOffsetAngle);
|
|
113471
|
-
}
|
|
113472
113484
|
};
|
|
113473
113485
|
}());
|
|
113474
113486
|
|
|
@@ -113663,6 +113675,9 @@ class NavCubePlugin extends Plugin {
|
|
|
113663
113675
|
}
|
|
113664
113676
|
var dir = self._cubeTextureCanvas.getAreaDir(areaId);
|
|
113665
113677
|
if (dir) {
|
|
113678
|
+
if (self._isProjectNorth && self._projectNorthOffsetAngle) {
|
|
113679
|
+
dir = rotateTrueNorth(+1, dir);
|
|
113680
|
+
}
|
|
113666
113681
|
var up = self._cubeTextureCanvas.getAreaUp(areaId);
|
|
113667
113682
|
flyTo(dir, up, function () {
|
|
113668
113683
|
if (lastAreaId >= 0) {
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -113441,6 +113441,16 @@ class NavCubePlugin extends Plugin {
|
|
|
113441
113441
|
this.setIsProjectNorth(cfg.isProjectNorth);
|
|
113442
113442
|
this.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);
|
|
113443
113443
|
|
|
113444
|
+
const rotateTrueNorth = (function () {
|
|
113445
|
+
const trueNorthMatrix = math.mat4();
|
|
113446
|
+
const resultVec = math.vec3();
|
|
113447
|
+
return function (dir, vec) {
|
|
113448
|
+
math.identityMat4(trueNorthMatrix);
|
|
113449
|
+
math.rotationMat4v(dir * self._projectNorthOffsetAngle * math.DEGTORAD, [0, 1, 0], trueNorthMatrix);
|
|
113450
|
+
return math.transformVec3(trueNorthMatrix, vec, resultVec)
|
|
113451
|
+
}
|
|
113452
|
+
}());
|
|
113453
|
+
|
|
113444
113454
|
this._synchCamera = (function () {
|
|
113445
113455
|
var matrix = math.rotationMat4c(-90 * math.DEGTORAD, 1, 0, 0);
|
|
113446
113456
|
var eyeLookVec = math.vec3();
|
|
@@ -113451,6 +113461,11 @@ class NavCubePlugin extends Plugin {
|
|
|
113451
113461
|
var look = viewer.camera.look;
|
|
113452
113462
|
var up = viewer.camera.up;
|
|
113453
113463
|
eyeLookVec = math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye, look, eyeLookVec)), 5);
|
|
113464
|
+
|
|
113465
|
+
if (self._isProjectNorth && self._projectNorthOffsetAngle) {
|
|
113466
|
+
eyeLookVec = rotateTrueNorth(-1, eyeLookVec);
|
|
113467
|
+
}
|
|
113468
|
+
|
|
113454
113469
|
if (self._zUp) { // +Z up
|
|
113455
113470
|
math.transformVec3(matrix, eyeLookVec, eyeLookVecCube);
|
|
113456
113471
|
math.transformVec3(matrix, up, upCube);
|
|
@@ -113462,9 +113477,6 @@ class NavCubePlugin extends Plugin {
|
|
|
113462
113477
|
self._navCubeCamera.eye = eyeLookVec;
|
|
113463
113478
|
self._navCubeCamera.up = up;
|
|
113464
113479
|
}
|
|
113465
|
-
if (self._isProjectNorth && self._projectNorthOffsetAngle) {
|
|
113466
|
-
self._navCubeCamera.orbitYaw(self._projectNorthOffsetAngle);
|
|
113467
|
-
}
|
|
113468
113480
|
};
|
|
113469
113481
|
}());
|
|
113470
113482
|
|
|
@@ -113659,6 +113671,9 @@ class NavCubePlugin extends Plugin {
|
|
|
113659
113671
|
}
|
|
113660
113672
|
var dir = self._cubeTextureCanvas.getAreaDir(areaId);
|
|
113661
113673
|
if (dir) {
|
|
113674
|
+
if (self._isProjectNorth && self._projectNorthOffsetAngle) {
|
|
113675
|
+
dir = rotateTrueNorth(+1, dir);
|
|
113676
|
+
}
|
|
113662
113677
|
var up = self._cubeTextureCanvas.getAreaUp(areaId);
|
|
113663
113678
|
flyTo(dir, up, function () {
|
|
113664
113679
|
if (lastAreaId >= 0) {
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -24576,10 +24576,10 @@ for(var i=0,len=areas.length;i<len;i++){var _area3=areas[i];var boundaries=_area
|
|
|
24576
24576
|
* @param {Boolean} [cfg.isProjectNorth] sets whether the NavCube switches between true north and project north - using the project north offset angle.
|
|
24577
24577
|
* @param {number} [cfg.projectNorthOffsetAngle] sets the NavCube project north offset angle - when the {@link isProjectNorth} is true.
|
|
24578
24578
|
*/function NavCubePlugin(viewer){var _this119;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,NavCubePlugin);_this119=_super79.call(this,"NavCube",viewer,cfg);viewer.navCube=_assertThisInitialized(_this119);var visible=true;try{_this119._navCubeScene=new Scene(viewer,{canvasId:cfg.canvasId,canvasElement:cfg.canvasElement,transparent:true});_this119._navCubeCanvas=_this119._navCubeScene.canvas.canvas;_this119._navCubeScene.input.keyboardEnabled=false;// Don't want keyboard input in the NavCube
|
|
24579
|
-
}catch(error){_this119.error(error);return _possibleConstructorReturn(_this119);}var navCubeScene=_this119._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:1.0,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:1.0,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:1.0,space:"view"});_this119._navCubeCamera=navCubeScene.camera;_this119._navCubeCamera.ortho.scale=7.0;_this119._navCubeCamera.ortho.near=0.1;_this119._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.2,0.2,0.2];navCubeScene.edgeMaterial.edgeAlpha=0.6;_this119._zUp=Boolean(viewer.camera.zUp);var self=_assertThisInitialized(_this119);_this119.setIsProjectNorth(cfg.isProjectNorth);_this119.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);_this119._synchCamera=function(){var matrix=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var eyeLookVec=math.vec3();var eyeLookVecCube=math.vec3();var upCube=math.vec3();return function(){var eye=viewer.camera.eye;var look=viewer.camera.look;var up=viewer.camera.up;eyeLookVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,eyeLookVec)),5);if(self._zUp){// +Z up
|
|
24579
|
+
}catch(error){_this119.error(error);return _possibleConstructorReturn(_this119);}var navCubeScene=_this119._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:1.0,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:1.0,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:1.0,space:"view"});_this119._navCubeCamera=navCubeScene.camera;_this119._navCubeCamera.ortho.scale=7.0;_this119._navCubeCamera.ortho.near=0.1;_this119._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.2,0.2,0.2];navCubeScene.edgeMaterial.edgeAlpha=0.6;_this119._zUp=Boolean(viewer.camera.zUp);var self=_assertThisInitialized(_this119);_this119.setIsProjectNorth(cfg.isProjectNorth);_this119.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=function(){var trueNorthMatrix=math.mat4();var resultVec=math.vec3();return function(dir,vec){math.identityMat4(trueNorthMatrix);math.rotationMat4v(dir*self._projectNorthOffsetAngle*math.DEGTORAD,[0,1,0],trueNorthMatrix);return math.transformVec3(trueNorthMatrix,vec,resultVec);};}();_this119._synchCamera=function(){var matrix=math.rotationMat4c(-90*math.DEGTORAD,1,0,0);var eyeLookVec=math.vec3();var eyeLookVecCube=math.vec3();var upCube=math.vec3();return function(){var eye=viewer.camera.eye;var look=viewer.camera.look;var up=viewer.camera.up;eyeLookVec=math.mulVec3Scalar(math.normalizeVec3(math.subVec3(eye,look,eyeLookVec)),5);if(self._isProjectNorth&&self._projectNorthOffsetAngle){eyeLookVec=rotateTrueNorth(-1,eyeLookVec);}if(self._zUp){// +Z up
|
|
24580
24580
|
math.transformVec3(matrix,eyeLookVec,eyeLookVecCube);math.transformVec3(matrix,up,upCube);self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=math.transformVec3(matrix,eyeLookVec,eyeLookVecCube);self._navCubeCamera.up=math.transformPoint3(matrix,up,upCube);}else{// +Y up
|
|
24581
|
-
self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=eyeLookVec;self._navCubeCamera.up=up;}
|
|
24582
|
-
return;}down=false;if(downX===null){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId>=0){document.body.style.cursor="pointer";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);lastAreaId=areaId;self._repaint();if(e.x<downX-3||e.x>downX+3||e.y<downY-3||e.y>downY+3){return;}var dir=self._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=self._cubeTextureCanvas.getAreaUp(areaId);flyTo(dir,up,function(){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}document.body.style.cursor="pointer";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,false);lastAreaId=-1;self._repaint();}});}}}}}});document.addEventListener("mousemove",self._onMouseMove=function(e){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(e.buttons===1&&!down){return;}if(down){var posX=e.clientX;var posY=e.clientY;document.body.style.cursor="move";actionMove(posX,posY);return;}if(!over){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){document.body.style.cursor="pointer";var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId===lastAreaId){return;}if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);self._repaint();lastAreaId=areaId;}}}else{document.body.style.cursor="default";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}}});var flyTo=function(){var center=math.vec3();return function(dir,up,ok){var aabb=self._fitVisible?viewer.scene.getAABB(viewer.scene.visibleObjectIds):viewer.scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var dist=Math.abs(diag/Math.tan(self._cameraFitFOV*math.DEGTORAD));viewer.cameraControl.pivotPos=center;if(self._cameraFly){viewer.cameraFlight.flyTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV,duration:self._cameraFlyDuration},ok);}else{viewer.cameraFlight.jumpTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV},ok);}};}();}_this119._onUpdated=viewer.localeService.on("updated",function(){_this119._cubeTextureCanvas.clear();_this119._repaint();});_this119.setVisible(cfg.visible);_this119.setCameraFitFOV(cfg.cameraFitFOV);_this119.setCameraFly(cfg.cameraFly);_this119.setCameraFlyDuration(cfg.cameraFlyDuration);_this119.setFitVisible(cfg.fitVisible);_this119.setSynchProjection(cfg.synchProjection);return _this119;}_createClass(NavCubePlugin,[{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
|
|
24581
|
+
self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=eyeLookVec;self._navCubeCamera.up=up;}};}();_this119._cubeTextureCanvas=new CubeTextureCanvas(viewer,cfg);_this119._cubeSampler=new Texture(navCubeScene,{image:_this119._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this119._cubeMesh=new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,{primitive:"triangles",normals:[0,0,1,0,0,1,0,0,1,0,0,1,1,0,0,1,0,0,1,0,0,1,0,0,0,1,0,0,1,0,0,1,0,0,1,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1,0,0,0,-1,0,0,-1,0,0,-1,0,0,-1],positions:[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],uv:[0.5,0.6666,0.25,0.6666,0.25,0.3333,0.5,0.3333,0.5,0.6666,0.5,0.3333,0.75,0.3333,0.75,0.6666,0.5,0.6666,0.5,1,0.25,1,0.25,0.6666,0.25,0.6666,0.0,0.6666,0.0,0.3333,0.25,0.3333,0.25,0,0.50,0,0.50,0.3333,0.25,0.3333,0.75,0.3333,1.0,0.3333,1.0,0.6666,0.75,0.6666],indices:[0,1,2,0,2,3,4,5,6,4,6,7,8,9,10,8,10,11,12,13,14,12,14,15,16,17,18,16,18,19,20,21,22,20,22,23]}),material:new PhongMaterial(navCubeScene,{diffuse:[0.4,0.4,0.4],specular:[0.4,0.4,0.4],emissive:[.6,.6,.6],diffuseMap:_this119._cubeSampler,emissiveMap:_this119._cubeSampler}),visible:!!visible,edges:true});_this119._shadow=cfg.shadowVisible===false?null:new Mesh(navCubeScene,{geometry:new ReadableGeometry(navCubeScene,buildCylinderGeometry({center:[0,0,0],radiusTop:0.001,radiusBottom:1.4,height:0.01,radialSegments:20,heightSegments:1,openEnded:true})),material:new PhongMaterial(navCubeScene,{diffuse:[0.0,0.0,0.0],specular:[0,0,0],emissive:[0.0,0.0,0.0],alpha:0.5}),position:[0,-1.5,0],visible:!!visible,pickable:false,backfaces:false});_this119._onCameraMatrix=viewer.camera.on("matrix",_this119._synchCamera);_this119._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this119._zUp=true;_this119._cubeTextureCanvas.setZUp();_this119._repaint();_this119._synchCamera();}else if(viewer.camera.yUp){_this119._zUp=false;_this119._cubeTextureCanvas.setYUp();_this119._repaint();_this119._synchCamera();}});_this119._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this119._synchProjection){_this119._navCubeCamera.perspective.fov=fov;}});_this119._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this119._synchProjection){_this119._navCubeCamera.projection=projection==="ortho"||projection==="perspective"?projection:"perspective";}});var lastAreaId=-1;function actionMove(posX,posY){var yawInc=(posX-lastX)*-sensitivity;var pitchInc=(posY-lastY)*-sensitivity;viewer.camera.orbitYaw(yawInc);viewer.camera.orbitPitch(-pitchInc);lastX=posX;lastY=posY;}function getCoordsWithinElement(event){var coords=[0,0];if(!event){event=window.event;coords[0]=event.x;coords[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}coords[0]=event.pageX-totalOffsetLeft;coords[1]=event.pageY-totalOffsetTop;}return coords;}{var downX=null;var downY=null;var down=false;var over=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;});self._navCubeCanvas.addEventListener("mousedown",self._onMouseDown=function(e){if(e.which!==1){return;}downX=e.x;downY=e.y;lastX=e.clientX;lastY=e.clientY;var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos});if(hit){down=true;}else{down=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
|
|
24582
|
+
return;}down=false;if(downX===null){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId>=0){document.body.style.cursor="pointer";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);lastAreaId=areaId;self._repaint();if(e.x<downX-3||e.x>downX+3||e.y<downY-3||e.y>downY+3){return;}var dir=self._cubeTextureCanvas.getAreaDir(areaId);if(dir){if(self._isProjectNorth&&self._projectNorthOffsetAngle){dir=rotateTrueNorth(+1,dir);}var up=self._cubeTextureCanvas.getAreaUp(areaId);flyTo(dir,up,function(){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}document.body.style.cursor="pointer";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,false);lastAreaId=-1;self._repaint();}});}}}}}});document.addEventListener("mousemove",self._onMouseMove=function(e){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}if(e.buttons===1&&!down){return;}if(down){var posX=e.clientX;var posY=e.clientY;document.body.style.cursor="move";actionMove(posX,posY);return;}if(!over){return;}var canvasPos=getCoordsWithinElement(e);var hit=navCubeScene.pick({canvasPos:canvasPos,pickSurface:true});if(hit){if(hit.uv){document.body.style.cursor="pointer";var areaId=self._cubeTextureCanvas.getArea(hit.uv);if(areaId===lastAreaId){return;}if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);}if(areaId>=0){self._cubeTextureCanvas.setAreaHighlighted(areaId,true);self._repaint();lastAreaId=areaId;}}}else{document.body.style.cursor="default";if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}}});var flyTo=function(){var center=math.vec3();return function(dir,up,ok){var aabb=self._fitVisible?viewer.scene.getAABB(viewer.scene.visibleObjectIds):viewer.scene.aabb;var diag=math.getAABB3Diag(aabb);math.getAABB3Center(aabb,center);var dist=Math.abs(diag/Math.tan(self._cameraFitFOV*math.DEGTORAD));viewer.cameraControl.pivotPos=center;if(self._cameraFly){viewer.cameraFlight.flyTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV,duration:self._cameraFlyDuration},ok);}else{viewer.cameraFlight.jumpTo({look:center,eye:[center[0]-dist*dir[0],center[1]-dist*dir[1],center[2]-dist*dir[2]],up:up||[0,1,0],orthoScale:diag*1.1,fitFOV:self._cameraFitFOV},ok);}};}();}_this119._onUpdated=viewer.localeService.on("updated",function(){_this119._cubeTextureCanvas.clear();_this119._repaint();});_this119.setVisible(cfg.visible);_this119.setCameraFitFOV(cfg.cameraFitFOV);_this119.setCameraFly(cfg.cameraFly);_this119.setCameraFlyDuration(cfg.cameraFlyDuration);_this119.setFitVisible(cfg.fitVisible);_this119.setSynchProjection(cfg.synchProjection);return _this119;}_createClass(NavCubePlugin,[{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
|
|
24583
24583
|
break;}}},{key:"_repaint",value:function _repaint(){var image=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=image;this._cubeMesh.material.emissiveMap.image=image;}/**
|
|
24584
24584
|
* Sets if the NavCube is visible.
|
|
24585
24585
|
*
|