@xtctwins/tctwins-core 1.1.2 → 1.1.4

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.
@@ -9055,7 +9055,7 @@ if(this.components[component.id]){if(component.id=="sectionControl"){return;}thi
9055
9055
  if(window.nextID===undefined){window.nextID=0;}//component.id = math.createUUID();
9056
9056
  component.id="__"+window.nextID++;while(this.components[component.id]){component.id=math.createUUID();}}this.components[component.id]=component;// Register for class type
9057
9057
  var type=component.type;var types=this.types[component.type];if(!types){types=this.types[type]={};}types[component.id]=component;if(component.compile){this._compilables[component.id]=component;}if(component.isDrawable){this._renderer.addDrawable(component.id,component);this._collidables[component.id]=component;}}},{key:"_removeComponent",value:function _removeComponent(component){var id=component.id;var type=component.type;delete this.components[id];// Unregister for types
9058
- var types=this.types[type];if(types){delete types[id];if(utils.isEmptyObject(types)){delete this.types[type];}}if(component.compile){delete this._compilables[component.id];}if(component.isDrawable){this._renderer.removeDrawable(component.id);delete this._collidables[component.id];}}// Methods below are called by various component types to register themselves on their
9058
+ var types=this.types[type];if(types){delete types[id];if(utils.isEmptyObject(types)){delete this.types[type];}}if(component.compile){delete this._compilables[component.id];}if(component.isDrawable){this._renderer.removeDrawable(component.id);delete this._collidables[component.id];this._setAABBDirty();}}// Methods below are called by various component types to register themselves on their
9059
9059
  // Scene. Violates Hollywood Principle, where we could just filter on type in _addComponent,
9060
9060
  // but this is faster than checking the type of each component in such a filter.
9061
9061
  },{key:"_sectionPlaneCreated",value:function _sectionPlaneCreated(sectionPlane){this.sectionPlanes[sectionPlane.id]=sectionPlane;this.scene._sectionPlanesState.addSectionPlane(sectionPlane._state);this.scene.fire("sectionPlaneCreated",sectionPlane,true/* Don't retain event */);this._needRecompile=true;}},{key:"_sectionBoxCreated",value:function _sectionBoxCreated(sectionBox){this.sectionBox=sectionBox;this.scene.fire("sectionBoxCreated",sectionBox,true/* Don't retain event */);this._needRecompile=true;}},{key:"_bitmapCreated",value:function _bitmapCreated(bitmap){this.bitmaps[bitmap.id]=bitmap;this.scene.fire("bitmapCreated",bitmap,true/* Don't retain event */);}},{key:"_lineSetCreated",value:function _lineSetCreated(lineSet){this.lineSets[lineSet.id]=lineSet;this.scene.fire("lineSetCreated",lineSet,true/* Don't retain event */);}},{key:"_lightCreated",value:function _lightCreated(light){this.lights[light.id]=light;this.scene._lightsState.addLight(light._state);this._needRecompile=true;}},{key:"_lightMapCreated",value:function _lightMapCreated(lightMap){this.lightMaps[lightMap.id]=lightMap;this.scene._lightsState.addLightMap(lightMap._state);this._needRecompile=true;}},{key:"_reflectionMapCreated",value:function _reflectionMapCreated(reflectionMap){this.reflectionMaps[reflectionMap.id]=reflectionMap;this.scene._lightsState.addReflectionMap(reflectionMap._state);this._needRecompile=true;}},{key:"_sectionPlaneDestroyed",value:function _sectionPlaneDestroyed(sectionPlane){delete this.sectionPlanes[sectionPlane.id];this.scene._sectionPlanesState.removeSectionPlane(sectionPlane._state);this.scene.fire("sectionPlaneDestroyed",sectionPlane,true/* Don't retain event */);this._needRecompile=true;}},{key:"_sectionBoxDestroyed",value:function _sectionBoxDestroyed(sectionBox){this.sectionBox=null;this.scene.fire("sectionBoxDestroyed",sectionBox,true/* Don't retain event */);this._needRecompile=true;}},{key:"_bitmapDestroyed",value:function _bitmapDestroyed(bitmap){delete this.bitmaps[bitmap.id];this.scene.fire("bitmapDestroyed",bitmap,true/* Don't retain event */);}},{key:"_lineSetDestroyed",value:function _lineSetDestroyed(lineSet){delete this.lineSets[lineSet.id];this.scene.fire("lineSetDestroyed",lineSet,true/* Don't retain event */);}},{key:"_lightDestroyed",value:function _lightDestroyed(light){delete this.lights[light.id];this.scene._lightsState.removeLight(light._state);this._needRecompile=true;}},{key:"_lightMapDestroyed",value:function _lightMapDestroyed(lightMap){delete this.lightMaps[lightMap.id];this.scene._lightsState.removeLightMap(lightMap._state);this._needRecompile=true;}},{key:"_reflectionMapDestroyed",value:function _reflectionMapDestroyed(reflectionMap){delete this.reflectionMaps[reflectionMap.id];this.scene._lightsState.removeReflectionMap(reflectionMap._state);this._needRecompile=true;}},{key:"_registerModel",value:function _registerModel(model){this.models[model.id]=model;this._modelIds=null;// Lazy regenerate
@@ -9679,7 +9679,7 @@ return entity.aabb;}ids=[ids];// Must be an entity type
9679
9679
  *
9680
9680
  * @param {String[]} ids Array of {@link Entity#id} values.
9681
9681
  * @param {Number[]} [colorize=(1,1,1)] RGB colorize factors, multiplied by the rendered pixel colors.
9682
- * @returns {Boolean} True if any {@link Entity}s changed opacity, else false if all updates were redundant and not applied.
9682
+ * @returns {Boolean} True if any {@link Entity}s were colorized, else false if all updates were redundant and not applied.
9683
9683
  */},{key:"setObjectsColorized",value:function setObjectsColorized(ids,colorize){return this.withObjects(ids,function(entity){entity.colorize=colorize;});}/**
9684
9684
  * Batch-updates {@link Entity#opacity} on {@link Entity}s that represent objects.
9685
9685
  *
@@ -22371,7 +22371,7 @@ if(this.canvas!=null){this.canvas.removeEventListener("mouseenter",this._mouseEn
22371
22371
  * @private
22372
22372
  */var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates,cameraControl){var _this114=this;_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;this._cameraControl=cameraControl;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();this._dollyspeed=1;this._panspeed=1;var lastCanvasTouchPosList=[];this.canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});this.canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}if(!event.isTrusted)return;event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){states.touchStartTime;getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();pivotController.setPivotPos(scene.camera.look);if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){// pivotController.setPivotPos(pickController.pickResult.worldPos);
22373
22373
  pivotController.setPivotPos(scene.camera.look);if(!configs.firstPerson&&pivotController.startPivot());}else{if(configs.smartPivot){pivotController.setPivotPos(scene.camera.look);// pivotController.setCanvasPivotPos(states.pointerCanvasPos);
22374
- }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i466=0,len=touches.length;_i466<len;++_i466){getCanvasPosFromEvent$1(touches[_i466],lastCanvasTouchPosList[_i466]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
22374
+ }else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot());}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i466=0,len=touches.length;_i466<len;++_i466){getCanvasPosFromEvent$1(touches[_i466],lastCanvasTouchPosList[_i466]);}numTouches=touches.length;});this.canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();pivotController.hidePivot();}});this.canvas.addEventListener("touchcancel",this._canvasTouchEndHandler);this.canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}_this114._cameraControl.fire("touchmoveCanvas");event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
22375
22375
  return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
22376
22376
  var canvasBoundary=scene.canvas.boundary;var canvasWidth=canvasBoundary[2];var canvasHeight=canvasBoundary[3];var touches=event.touches;if(event.touches.length!==numTouches){// Two fingers were pressed, then one of them is removed
22377
22377
  // We don't want to rotate in this case (weird behavior)
@@ -23760,10 +23760,7 @@ this.propertySets.push(propertySet);}}if(metaModelData.metaObjects){// for (let
23760
23760
  // const objectData = metaModelData.metaObjects[i];
23761
23761
  // const metaId = objectData.id;
23762
23762
  for(var _metaId in metaModelData.metaObjects){var objectData=metaModelData.metaObjects[_metaId];var metaObject=new MetaObject({id:_metaId,originalSystemId:_metaId,parentId:objectData.parent,type:objectData.type,name:objectData.name,propertySetIds:objectData.propertySetIds,external:objectData.external});metaObject.children=[];metaObject.metaModels=[];metaObject.metaModels.push(this);metaScene.metaObjects[_metaId]=metaObject;this.metaObjects.push(metaObject);if(!objectData.parent){this.rootMetaObjects.push(metaObject);metaScene.rootMetaObjects[_metaId]=metaObject;}}}if(typeof done==="function")done();}catch(error){if(typeof err==="function")err(error);else this.log(err);}}},{key:"_decompressProperties",value:function _decompressProperties(propertyLookup,properties){for(var _i474=0,len=properties.length;_i474<len;_i474++){var property=properties[_i474];if(Number.isInteger(property)){var lookupProperty=propertyLookup[property];if(lookupProperty){properties[_i474]=lookupProperty;}}}}},{key:"finalize",value:function finalize(){if(this._finalized){throw"MetaScene already finalized - can't re-finalize";}// Re-link MetaScene's entire MetaObject parent/child hierarchy
23763
- var metaScene=this.metaScene;metaScene.metaObjectsByType={};for(var objectId in metaScene.metaObjects){var metaObject=metaScene.metaObjects[objectId];// if (metaObject.children) {
23764
- // metaObject.children = [];
23765
- // }
23766
- if(metaObject.parentId){var parentMetaObject=metaScene.metaObjects[metaObject.parentId];if(parentMetaObject){metaObject.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(metaObject);}}// Re-link each MetaObject's property sets
23763
+ var metaScene=this.metaScene;metaScene.metaObjectsByType={};for(var objectId in metaScene.metaObjects){var metaObject=metaScene.metaObjects[objectId];if(metaObject.children){metaObject.children=[];}if(metaObject.parentId){var parentMetaObject=metaScene.metaObjects[metaObject.parentId];if(parentMetaObject){metaObject.parent=parentMetaObject;(parentMetaObject.children||(parentMetaObject.children=[])).push(metaObject);}}// Re-link each MetaObject's property sets
23767
23764
  if(metaObject.propertySets){metaObject.propertySets=[];}if(metaObject.propertySetIds){for(var _i475=0,len=metaObject.propertySetIds.length;_i475<len;_i475++){var propertySetId=metaObject.propertySetIds[_i475];var propertySet=metaScene.propertySets[propertySetId];metaObject.propertySets.push(propertySet);}}var type=metaObject.type;(metaScene.metaObjectsByType[type]||(metaScene.metaObjectsByType[type]={}))[objectId]=metaObject;}// for (let objectId in metaScene.metaObjects) {
23768
23765
  // const metaObject = metaScene.metaObjects[objectId];
23769
23766
  // if (metaObject.parentId) {
@@ -24659,7 +24656,7 @@ sceneModel.fire("loaded",true,false);});if(ok){ok();}},function(msg){plugin.erro
24659
24656
  sceneModel.fire("loaded",true,false);if(ok){ok();}});}}]);}();function loadGLTF(plugin,src,metaModelJSON,options,sceneModel,ok,error){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;var isGLB=src.split(".").pop()==="glb";if(isGLB){plugin.dataSource.getGLB(src,function(arrayBuffer){// OK
24660
24657
  options.basePath=getBasePath(src);parseGLTF(plugin,src,arrayBuffer,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}else{plugin.dataSource.getGLTF(src,function(gltf){// OK
24661
24658
  options.basePath=getBasePath(src);parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok);spinner.processes--;},function(err){spinner.processes--;error(err);});}}function getBasePath(src){var i=src.lastIndexOf("/");return i!==0?src.substring(0,i+1):"";}function parseGLTF(plugin,src,gltf,metaModelJSON,options,sceneModel,ok){var spinner=plugin.viewer.scene.canvas.spinner;spinner.processes++;parse$2(gltf,GLTFLoader,{baseUri:options.basePath}).then(function(gltfData){var ctx={src:src,entityId:options.entityId,metaModelJSON:metaModelJSON,autoMetaModel:options.autoMetaModel,globalizeObjectIds:options.globalizeObjectIds,metaObjects:[],loadBuffer:options.loadBuffer,basePath:options.basePath,handlenode:options.handlenode,backfaces:!!options.backfaces,gltfData:gltfData,scene:sceneModel.scene,plugin:plugin,sceneModel:sceneModel,//geometryCreated: {},
24662
- numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);if(options.autoMetaModel){ctx.metaObjects.push({id:sceneModel.id,type:"Default",name:sceneModel.id});}loadDefaultScene(ctx);sceneModel.finalize();if(options.autoMetaModel){plugin.viewer.metaScene.createMetaModel(sceneModel.id,{metaObjects:ctx.metaObjects});}spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i544=0,len=textures.length;_i544<len;_i544++){loadTexture(ctx,textures[_i544]);}}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i545=0,len=materials.length;_i545<len;_i545++){var material=materials[_i545];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}switch(material.alphaMode){case"OPAQUE":break;case"MASK":var alphaCutoff=material.alphaCutoff;// Default from the spec https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material
24659
+ numObjects:0,nodes:[],nextId:0,log:function log(msg){plugin.log(msg);}};loadTextures(ctx);loadMaterials(ctx);if(options.autoMetaModel){ctx.metaObjects.push({id:sceneModel.id,type:"Default",name:sceneModel.id});}loadDefaultScene(ctx);sceneModel.finalize();if(options.autoMetaModel){plugin.viewer.metaScene.createMetaModel(sceneModel.id,{metaObjects:ctx.metaObjects});}spinner.processes--;ok();});}function loadTextures(ctx){var gltfData=ctx.gltfData;var textures=gltfData.textures;if(textures){for(var _i544=0,len=textures.length;_i544<len;_i544++){loadTexture(ctx,textures[_i544]);}}else{console.log("no texture");}}function loadTexture(ctx,texture){if(!texture.source||!texture.source.image){return;}var textureId="texture-".concat(ctx.nextId++);var minFilter=NearestMipMapLinearFilter;switch(texture.sampler.minFilter){case 9728:minFilter=NearestFilter;break;case 9729:minFilter=LinearFilter;break;case 9984:minFilter=NearestMipMapNearestFilter;break;case 9985:minFilter=LinearMipMapNearestFilter;break;case 9986:minFilter=NearestMipMapLinearFilter;break;case 9987:minFilter=LinearMipMapLinearFilter;break;}var magFilter=LinearFilter;switch(texture.sampler.magFilter){case 9728:magFilter=NearestFilter;break;case 9729:magFilter=LinearFilter;break;}var wrapS=RepeatWrapping;switch(texture.sampler.wrapS){case 33071:wrapS=ClampToEdgeWrapping;break;case 33648:wrapS=MirroredRepeatWrapping;break;case 10497:wrapS=RepeatWrapping;break;}var wrapT=RepeatWrapping;switch(texture.sampler.wrapT){case 33071:wrapT=ClampToEdgeWrapping;break;case 33648:wrapT=MirroredRepeatWrapping;break;case 10497:wrapT=RepeatWrapping;break;}var wrapR=RepeatWrapping;switch(texture.sampler.wrapR){case 33071:wrapR=ClampToEdgeWrapping;break;case 33648:wrapR=MirroredRepeatWrapping;break;case 10497:wrapR=RepeatWrapping;break;}ctx.sceneModel.createTexture({id:textureId,image:texture.source.image,flipY:!!texture.flipY,minFilter:minFilter,magFilter:magFilter,wrapS:wrapS,wrapT:wrapT,wrapR:wrapR,encoding:sRGBEncoding});texture._textureId=textureId;}function loadMaterials(ctx){var gltfData=ctx.gltfData;var materials=gltfData.materials;if(materials){for(var _i545=0,len=materials.length;_i545<len;_i545++){var material=materials[_i545];material._textureSetId=loadTextureSet(ctx,material);material._attributes=loadMaterialAttributes(ctx,material);}}}function loadTextureSet(ctx,material){var textureSetCfg={};if(material.normalTexture){textureSetCfg.normalTextureId=material.normalTexture.texture._textureId;}if(material.occlusionTexture){textureSetCfg.occlusionTextureId=material.occlusionTexture.texture._textureId;}if(material.emissiveTexture){textureSetCfg.emissiveTextureId=material.emissiveTexture.texture._textureId;}switch(material.alphaMode){case"OPAQUE":break;case"MASK":var alphaCutoff=material.alphaCutoff;// Default from the spec https://registry.khronos.org/glTF/specs/2.0/glTF-2.0.html#reference-material
24663
24660
  textureSetCfg.alphaCutoff=alphaCutoff!==undefined?alphaCutoff:0.5;break;}var metallicPBR=material.pbrMetallicRoughness;if(material.pbrMetallicRoughness){var pbrMetallicRoughness=material.pbrMetallicRoughness;var baseColorTexture=pbrMetallicRoughness.baseColorTexture||pbrMetallicRoughness.colorTexture;if(baseColorTexture){if(baseColorTexture.texture){textureSetCfg.colorTextureId=baseColorTexture.texture._textureId;}else{textureSetCfg.colorTextureId=ctx.gltfData.textures[baseColorTexture.index]._textureId;}}if(metallicPBR.metallicRoughnessTexture){textureSetCfg.metallicRoughnessTextureId=metallicPBR.metallicRoughnessTexture.texture._textureId;}}var extensions=material.extensions;if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){specularPBR.specularTexture;var specularColorTexture=specularPBR.specularColorTexture;if(specularColorTexture!==null&&specularColorTexture!==undefined){textureSetCfg.colorTextureId=ctx.gltfData.textures[specularColorTexture.index]._textureId;}}}if(textureSetCfg.normalTextureId!==undefined||textureSetCfg.occlusionTextureId!==undefined||textureSetCfg.emissiveTextureId!==undefined||textureSetCfg.colorTextureId!==undefined||textureSetCfg.metallicRoughnessTextureId!==undefined){textureSetCfg.id="textureSet-".concat(ctx.nextId++,";");ctx.sceneModel.createTextureSet(textureSetCfg);return textureSetCfg.id;}return null;}function loadMaterialAttributes(ctx,material){// Substitute RGBA for material, to use fast flat shading instead
24664
24661
  var extensions=material.extensions;var materialAttributes={color:new Float32Array([1,1,1,1]),opacity:1,metallic:0,roughness:1,doubleSided:true};if(extensions){var specularPBR=extensions["KHR_materials_pbrSpecularGlossiness"];if(specularPBR){var diffuseFactor=specularPBR.diffuseFactor;if(diffuseFactor!==null&&diffuseFactor!==undefined){materialAttributes.color.set(diffuseFactor);}}var common=extensions["KHR_materials_common"];if(common){var technique=common.technique;var values=common.values||{};var blinn=technique==="BLINN";var phong=technique==="PHONG";var lambert=technique==="LAMBERT";var diffuse=values.diffuse;if(diffuse&&(blinn||phong||lambert)){if(!utils.isString(diffuse)){materialAttributes.color.set(diffuse);}}var transparency=values.transparency;if(transparency!==null&&transparency!==undefined){materialAttributes.opacity=transparency;}var transparent=values.transparent;if(transparent!==null&&transparent!==undefined){materialAttributes.opacity=transparent;}}}var metallicPBR=material.pbrMetallicRoughness;if(metallicPBR){var baseColorFactor=metallicPBR.baseColorFactor;if(baseColorFactor){materialAttributes.color[0]=baseColorFactor[0];materialAttributes.color[1]=baseColorFactor[1];materialAttributes.color[2]=baseColorFactor[2];materialAttributes.opacity=baseColorFactor[3];}var metallicFactor=metallicPBR.metallicFactor;if(metallicFactor!==null&&metallicFactor!==undefined){materialAttributes.metallic=metallicFactor;}var roughnessFactor=metallicPBR.roughnessFactor;if(roughnessFactor!==null&&roughnessFactor!==undefined){materialAttributes.roughness=roughnessFactor;}}materialAttributes.doubleSided=material.doubleSided!==false;return materialAttributes;}function loadDefaultScene(ctx){var gltfData=ctx.gltfData;var scene=gltfData.scene||gltfData.scenes[0];if(!scene){error(ctx,"glTF has no default scene");return;}var nodes=scene.nodes;if(!nodes){return;}(function accumulateMeshInstantes(nodes){nodes.forEach(function(node){var mesh=node.mesh;if(mesh){mesh.instances||(mesh.instances=0);mesh.instances+=1;}if(node.children){accumulateMeshInstantes(node.children);}});})(nodes);// Create a SceneMesh for each mesh primitive, and a SceneModelEntity for the root node and each named node.
24665
24662
  var meshIdsStack=[];var meshIds=null;(function createSceneMeshesAndEntities(nodes,depth,parentMatrix){nodes.forEach(function(node){var nodeName=node.name;var entityId=nodeName!==undefined&&nodeName!==null&&nodeName||depth===0&&"entity-"+ctx.nextId++;if(entityId){while(ctx.sceneModel.objects[entityId]){entityId="entity-"+ctx.nextId++;}meshIdsStack.push(meshIds);meshIds=[];}var matrix=parseNodeMatrix(node,parentMatrix);if(node.mesh){parseNodeMesh(node,ctx,matrix,meshIds);}if(node.children){createSceneMeshesAndEntities(node.children,depth+1,matrix);}if(entityId){if(meshIds.length>0){var globalId=ctx.globalizeObjectIds?math.globalizeObjectId(ctx.sceneModel.id,entityId):entityId;ctx.sceneModel.createEntity({id:globalId,meshIds:meshIds,isObject:true});if(ctx.autoMetaModel){ctx.metaObjects.push({id:globalId,type:"Default",name:globalId,parent:ctx.sceneModel.id});}}meshIds=meshIdsStack.pop();}});})(nodes,0,null);}/**
@@ -25043,11 +25040,10 @@ for(var i=0,len=areas.length;i<len;i++){var area=areas[i];var boundaries=area.bo
25043
25040
  }catch(error){_this137.error(error);return _possibleConstructorReturn(_this137);}var navCubeScene=_this137._navCubeScene;navCubeScene.clearLights();new DirLight(navCubeScene,{dir:[0.4,-0.4,0.8],color:[0.8,1.0,1.0],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[-0.8,-0.3,-0.4],color:[0.8,0.8,0.8],intensity:0.8,space:"view"});new DirLight(navCubeScene,{dir:[0.8,-0.6,-0.8],color:[1.0,1.0,1.0],intensity:0.8,space:"view"});_this137._navCubeCamera=navCubeScene.camera;_this137._navCubeCamera.ortho.scale=7.0;_this137._navCubeCamera.ortho.near=0.1;_this137._navCubeCamera.ortho.far=2000;navCubeScene.edgeMaterial.edgeColor=[0.47,0.62,0.67];//120,160,170,0.8
25044
25041
  navCubeScene.edgeMaterial.edgeAlpha=0.2;navCubeScene.edgeMaterial.edgeWidth=1;_this137._zUp=Boolean(viewer.camera.zUp);var self=_this137;_this137.mousedown=false;_this137.mouseover=false;_this137.setIsProjectNorth(cfg.isProjectNorth);_this137.setProjectNorthOffsetAngle(cfg.projectNorthOffsetAngle);var rotateTrueNorth=_this137.rotateTrueNorth=function(){var trueNorthMatrix=math.mat4();return function(dir,vec,dest){math.identityMat4(trueNorthMatrix);math.rotationMat4v(dir*self._projectNorthOffsetAngle*math.DEGTORAD,[0,1,0],trueNorthMatrix);return math.transformVec3(trueNorthMatrix,vec,dest);};}();var viewerNormalUp=false;viewer.scene.on("aabb",function(){viewerNormalUp=viewer.scene.camera.normalUp;});_this137._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,tempVec3a$1);up=rotateTrueNorth(-1,up,tempVec3b);}if(self._zUp){// +Z up
25045
25042
  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
25046
- self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);self._navCubeCamera.up=up*(viewerNormalUp?1:-1);}};}();_this137._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this137._cubeSampler=new Texture(navCubeScene,{image:_this137._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this137._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.5,0,0.5,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:[0.6,0.6,0.6],diffuseMap:_this137._cubeSampler,emissiveMap:_this137._cubeSampler}),visible:!!visible,edges:true});_this137._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});_this137._onCameraMatrix=viewer.camera.on("matrix",_this137._synchCamera);_this137._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this137._zUp=true;_this137._cubeTextureCanvas.setZUp();_this137._repaint();_this137._synchCamera();}else if(viewer.camera.yUp){_this137._zUp=false;_this137._cubeTextureCanvas.setYUp();_this137._repaint();_this137._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this137._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this137._synchProjection){_this137._navCubeCamera.perspective.fov=fov;}});_this137._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this137._synchProjection){_this137._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;self.MOUSEDOWN=false;var over=false;self.MOUSEOVER=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;self.MOUSEOVER=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;self.MOUSEOVER=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;self.MOUSEDOWN=true;}else{down=false;self.MOUSEDOWN=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
25043
+ self._navCubeCamera.look=[0,0,0];self._navCubeCamera.eye=viewerNormalUp?eyeLookVec:math.mulVec3(eyeLookVec,[-1,-1,1]);if(viewerNormalUp){self._navCubeCamera.up=up;}else{self._navCubeCamera.up=math.mulVec3Scalar(up,-1);}}};}();_this137._cubeTextureCanvas=new CubeTextureCanvas(viewer,navCubeScene,cfg);_this137._cubeSampler=new Texture(navCubeScene,{image:_this137._cubeTextureCanvas.getImage(),flipY:true,wrapS:ClampToEdgeWrapping,wrapT:ClampToEdgeWrapping});_this137._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.5,0,0.5,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:[0.6,0.6,0.6],diffuseMap:_this137._cubeSampler,emissiveMap:_this137._cubeSampler}),visible:!!visible,edges:true});_this137._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});_this137._onCameraMatrix=viewer.camera.on("matrix",_this137._synchCamera);_this137._onCameraWorldAxis=viewer.camera.on("worldAxis",function(){if(viewer.camera.zUp){_this137._zUp=true;_this137._cubeTextureCanvas.setZUp();_this137._repaint();_this137._synchCamera();}else if(viewer.camera.yUp){_this137._zUp=false;_this137._cubeTextureCanvas.setYUp();_this137._repaint();_this137._synchCamera();}viewerNormalUp=viewer.scene.camera.normalUp;});_this137._onCameraFOV=viewer.camera.perspective.on("fov",function(fov){if(_this137._synchProjection){_this137._navCubeCamera.perspective.fov=fov;}});_this137._onCameraProjection=viewer.camera.on("projection",function(projection){if(_this137._synchProjection){_this137._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;self.MOUSEDOWN=false;var over=false;self.MOUSEOVER=false;var sensitivity=0.5;var lastX;var lastY;self._navCubeCanvas.addEventListener("mouseenter",self._onMouseEnter=function(e){over=true;self.MOUSEOVER=true;});self._navCubeCanvas.addEventListener("mouseleave",self._onMouseLeave=function(e){over=false;self.MOUSEOVER=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;self.MOUSEDOWN=true;}else{down=false;self.MOUSEDOWN=false;}});document.addEventListener("mouseup",self._onMouseUp=function(e){if(e.which!==1){// Left button
25047
25044
  return;}down=false;self.MOUSEDOWN=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";
25048
25045
  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);if(self._isProjectNorth&&self._projectNorthOffsetAngle){dir=rotateTrueNorth(+1,dir,tempVec3a$1);up=rotateTrueNorth(+1,up,tempVec3b);}flyTo(dir,up,function(){if(lastAreaId>=0){self._cubeTextureCanvas.setAreaHighlighted(lastAreaId,false);self._repaint();lastAreaId=-1;}// document.body.style.cursor = "pointer";
25049
- 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=_this137.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);}};}();}_this137._onUpdated=viewer.localeService.on("updated",function(){_this137._cubeTextureCanvas.clear();_this137._repaint();});_this137.setVisible(cfg.visible);_this137.setCameraFitFOV(cfg.cameraFitFOV);_this137.setCameraFly(cfg.cameraFly);_this137.setCameraFlyDuration(cfg.cameraFlyDuration);_this137.setFitVisible(cfg.fitVisible);_this137.setSynchProjection(cfg.synchProjection);return _this137;}_inherits(NavCubePlugin,_Plugin7);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId){if(areaId>=0){this._cubeTextureCanvas.setAreaHighlighted(areaId,true);this._repaint();var dir=this._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=this._cubeTextureCanvas.getAreaUp(areaId);if(this._isProjectNorth&&this._projectNorthOffsetAngle){dir=this.rotateTrueNorth(+1,dir,tempVec3a$1);up=this.rotateTrueNorth(+1,up,tempVec3b);}this.flyTo(dir,up,function(){// document.body.style.cursor = "pointer";
25050
- });}}}},{key:"jumpByClick",value:function jumpByClick(areaId){this.setCameraFly(false);this.flyByClick(areaId);this.setCameraFly(true);}},{key:"navCubeScene",get:function get(){return this._navCubeScene;}},{key:"MOUSEDOWN",get:function get(){return this.mousedown;},set:function set(down){this.mousedown=down;}},{key:"MOUSEOVER",get:function get(){return this.mouseover;},set:function set(over){this.mouseover=over;}},{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
25046
+ 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=_this137.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);}};}();}_this137._onUpdated=viewer.localeService.on("updated",function(){_this137._cubeTextureCanvas.clear();_this137._repaint();});_this137.setVisible(cfg.visible);_this137.setCameraFitFOV(cfg.cameraFitFOV);_this137.setCameraFly(cfg.cameraFly);_this137.setCameraFlyDuration(cfg.cameraFlyDuration);_this137.setFitVisible(cfg.fitVisible);_this137.setSynchProjection(cfg.synchProjection);return _this137;}_inherits(NavCubePlugin,_Plugin7);return _createClass(NavCubePlugin,[{key:"flyByClick",value:function flyByClick(areaId,ok){if(areaId>=0){this._cubeTextureCanvas.setAreaHighlighted(areaId,true);this._repaint();var dir=this._cubeTextureCanvas.getAreaDir(areaId);if(dir){var up=this._cubeTextureCanvas.getAreaUp(areaId);if(this._isProjectNorth&&this._projectNorthOffsetAngle){dir=this.rotateTrueNorth(+1,dir,tempVec3a$1);up=this.rotateTrueNorth(+1,up,tempVec3b);}this.flyTo(dir,up,ok);}}}},{key:"jumpByClick",value:function jumpByClick(areaId){this.setCameraFly(false);this.flyByClick(areaId);this.setCameraFly(true);}},{key:"navCubeScene",get:function get(){return this._navCubeScene;}},{key:"MOUSEDOWN",get:function get(){return this.mousedown;},set:function set(down){this.mousedown=down;}},{key:"MOUSEOVER",get:function get(){return this.mouseover;},set:function set(over){this.mouseover=over;}},{key:"send",value:function send(name,value){switch(name){case"language":this._cubeTextureCanvas.clear();this._repaint();// CubeTextureCanvas gets language from Viewer
25051
25047
  break;}}},{key:"_repaint",value:function _repaint(){var image=this._cubeTextureCanvas.getImage();this._cubeMesh.material.diffuseMap.image=image;this._cubeMesh.material.emissiveMap.image=image;}/**
25052
25048
  * Sets if the NavCube is visible.
25053
25049
  *
@@ -27088,7 +27084,7 @@ _this154._muteTreeEvents=false;});// this._switchExpandHandler = (event) => {
27088
27084
  // this._checkboxChangeHandler = (event) => {
27089
27085
  // this.checkboxChangeHandler(event)
27090
27086
  // };
27091
- _this154._hierarchy=cfg.hierarchy||"containment";_this154._autoExpandDepth=cfg.autoExpandDepth||0;if(_this154._autoAddModels){var modelIds=Object.keys(_this154.viewer.metaScene.metaModels);for(var _i554=0,len=modelIds.length;_i554<len;_i554++){var modelId=modelIds[_i554];var metaModel=_this154.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this154.addModel(modelId);}}_this154.viewer.scene.on("modelLoaded",function(modelId){if(_this154.viewer.metaScene.metaModels[modelId]){_this154.addModel(modelId);}});}_this154.hierarchy=cfg.hierarchy;return _this154;}//展开点击事件
27087
+ _this154._hierarchy=cfg.hierarchy||"containment";_this154._autoExpandDepth=cfg.autoExpandDepth||0;if(_this154._autoAddModels){var modelIds=Object.keys(_this154.viewer.metaScene.metaModels);for(var _i554=0,len=modelIds.length;_i554<len;_i554++){var modelId=modelIds[_i554];var metaModel=_this154.viewer.metaScene.metaModels[modelId];if(metaModel.finalized){_this154.addModel(modelId);}}_this154.viewer.scene.on("modelLoaded",function(modelId){if(_this154.viewer.metaScene.metaModels[modelId]){_this154.addModel(modelId);}});}return _this154;}//展开点击事件
27092
27088
  _inherits(TreeViewPlugin,_Plugin11);return _createClass(TreeViewPlugin,[{key:"switchExpandHandler",value:function switchExpandHandler(event){event.preventDefault();event.stopPropagation();event.target;// this._expandSwitchElement(switchElement);
27093
27089
  this.fire("ExpandHandler",event);}//收起点击事件
27094
27090
  },{key:"switchCollapseHandler",value:function switchCollapseHandler(event){event.preventDefault();event.stopPropagation();// const switchElement = event.target;
@@ -27126,7 +27122,8 @@ setCheckbox(parent.nodeId,parent.numVisibleEntities>0);parent=parent.parent;}thi
27126
27122
  * 获取nodeNodes
27127
27123
  */},{key:"nodeNodes",get:function get(){return this._nodeNodes;}//创建根节点tree---------11111111111111111
27128
27124
  },{key:"_createNodes",value:function _createNodes(){if(this._rootElement){this._rootElement.parentNode.removeChild(this._rootElement);this._rootElement=null;}this._rootNodes=[];this._objectNodes={};this._nodeNodes={};this._validate();if(this.valid||this._hierarchy!=="storeys"){this._createEnabledNodes();}}//创建节点tree----------222222222222222222
27129
- },{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){this.error("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();//同步scene和metaScene中的内容
27125
+ },{key:"_createEnabledNodes",value:function _createEnabledNodes(){if(this._pruneEmptyNodes){this._findEmptyNodes();}switch(this._hierarchy){case"storeys":this._createStoreysNodes();if(this._rootNodes.length===0){// return;
27126
+ this.warn("Failed to build storeys hierarchy");}break;case"types":this._createTypesNodes();break;case"containment":default:this._createContainmentNodes();}if(this._sortNodes){this._doSortNodes();}this._synchNodesToEntities();//同步scene和metaScene中的内容
27130
27127
  this.fire("nodeNodes_Created",this._nodeNodes);this.fire("rootNodes_Created",this._rootNodes);this.fire("objectNodes_Created",this._objectNodes);// this._createTrees(); //创建html tree
27131
27128
  // this.expandToDepth(this._autoExpandDepth); //展开几层与否
27132
27129
  }// //创建
@@ -27203,8 +27200,7 @@ return true;}/**
27203
27200
  // return;
27204
27201
  // }
27205
27202
  var model=this.viewer.scene.models[modelId];if(!model){throw"Model not found: "+modelId;}var metaModel=this.viewer.metaScene.metaModels[modelId];if(!metaModel){this.error("MetaModel not found: "+modelId);return;}if(this._metaModels[modelId]){this._metaModels[modelId]=null;// this.warn("Model already added: " + modelId);
27206
- // return;
27207
- }this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this155.removeModel(model.id);});this._createNodes();}/**
27203
+ return;}this._metaModels[modelId]=metaModel;if(options&&options.rootName){this._rootNames[modelId]=options.rootName;}model.on("destroyed",function(){_this155.removeModel(model.id);});this._createNodes();}/**
27208
27204
  * Removes a model from this tree view.
27209
27205
  *
27210
27206
  * Does nothing if model not currently in tree view.