@xtctwins/tctwins-bimx-viewer 0.1.11 → 0.1.13

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.
@@ -13274,7 +13274,7 @@ this._ignoreNextSectionPlaneDirUpdate=false;this._createNodes();this._bindEvents
13274
13274
  */},{key:"sectionPlane",get:function get(){return this._sectionPlane;}/**
13275
13275
  * 设置剖切面位置
13276
13276
  * @param {any} value
13277
- */},{key:"pos",get:function get(){return this.posRate;},set:function set(posRate){if(posRate<0||posRate>100)return;var aabb=this._scene.aabb;var center=this._scene.center;var xRange=aabb[3]-aabb[0];//前后
13277
+ */},{key:"pos",get:function get(){return this._pos;},set:function set(posRate){if(posRate<0||posRate>100)return;var aabb=this._scene.aabb;var center=this._scene.center;var xRange=aabb[3]-aabb[0];//前后
13278
13278
  var yRange=aabb[4]-aabb[1];//上下
13279
13279
  var zRange=aabb[5]-aabb[2];//左右
13280
13280
  var newSectionPos=math.vec3();newSectionPos[0]=this.pos[0];newSectionPos[1]=this.pos[1];newSectionPos[2]=this.pos[2];var dir=this._sectionPlane.dir;var rateDis;if(dir[0]!=0){rateDis=posRate/100*xRange;newSectionPos[0]=center[0]-xRange/2+rateDis;}else if(dir[1]!=0){rateDis=posRate/100*yRange;newSectionPos[1]=center[1]-yRange/2+rateDis;}else if(dir[2]!=0){rateDis=posRate/100*zRange;newSectionPos[2]=center[2]-zRange/2+rateDis;}this._sectionPlane.pos=newSectionPos;}},{key:"posRate",get:function get(){var aabb=this._scene.aabb;var center=this._scene.center;var xRange=aabb[3]-aabb[0];// 前后
@@ -13583,7 +13583,7 @@ var sectionPlane=new SectionPlane(this.viewer.scene,{id:params.id,pos:params.pos
13583
13583
  */},{key:"setControlPos",value:function setControlPos(posRate){if(this._currentControl==null)return;this._currentControl.pos=posRate;}/**
13584
13584
  * 获取剖切面位置
13585
13585
  * @returns
13586
- */},{key:"getControlPos",value:function getControlPos(){if(this._currentControl==null)return-1;return this._currentControl.pos;}/**
13586
+ */},{key:"getControlPos",value:function getControlPos(){if(this._currentControl==null)return-1;return this._currentControl.posRate;}/**
13587
13587
  * Inverts the direction of {@link SectionPlane#dir} on every existing SectionPlane.
13588
13588
  *
13589
13589
  * Inverts all SectionPlanes, including those that were not created with SectionPlanesPlugin.
@@ -69856,9 +69856,10 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69856
69856
  this._eventTrigger = new _EventTrigger__WEBPACK_IMPORTED_MODULE_2__["default"]();
69857
69857
  this.navCubeCanvasElement = cfg.navCubeCanvasElement;
69858
69858
  this.viewerElement = cfg.viewerElement;
69859
- this._modelId = cfg.modelId;
69859
+ this._multiModel = cfg.multiModel ? cfg.multiModel : false;
69860
69860
  this._hasOutlier = false;
69861
69861
  this._outlierObjectIds = [];
69862
+ this._projectId = cfg.projectId ? cfg.projectId : "";
69862
69863
  this.viewer = viewer;
69863
69864
  // this._objectsKdTree3 = new ObjectsKdTree3({
69864
69865
  // viewer
@@ -69868,12 +69869,11 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69868
69869
  enableEditModels: false,
69869
69870
  modelFromOutSide: true,
69870
69871
  modelType: cfg.modelType,
69871
- modelContent: cfg.modelContent,
69872
69872
  modelSrc: cfg.modelSrc ? cfg.modelSrc : "/",
69873
- modelMetaData: cfg.modelMetaData,
69874
69873
  modelConfig: cfg.modelConfig,
69875
69874
  IfcAPI: cfg.IfcAPI,
69876
- WebIFC: cfg.WebIFC
69875
+ WebIFC: cfg.WebIFC,
69876
+ multiModel: this._multiModel
69877
69877
  });
69878
69878
  this._objectsExplorer = new _explorer_ObjectsExplorer__WEBPACK_IMPORTED_MODULE_12__["default"](this, {
69879
69879
  modelType: cfg.modelType
@@ -69921,7 +69921,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69921
69921
  });
69922
69922
  this._hideTool = new _toolbar_HideTool__WEBPACK_IMPORTED_MODULE_7__["default"](this, {});
69923
69923
  this._annotationTool = new _toolbar_AnnotationTool__WEBPACK_IMPORTED_MODULE_17__["default"](this, {
69924
- modelId: this._modelId
69924
+ modelId: this._projectId
69925
69925
  });
69926
69926
  this._measureTool = new _toolbar_MeasureTool__WEBPACK_IMPORTED_MODULE_18__["default"](this, {});
69927
69927
  this._sectionTool = new _toolbar_SectionTool__WEBPACK_IMPORTED_MODULE_9__["default"](this, {});
@@ -69942,9 +69942,6 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69942
69942
  this._modelsExplorer.on("modelUnloaded", (modelId) => {
69943
69943
  this.fire("modelUnloaded", modelId);
69944
69944
  });
69945
- this._resetAction.on("reset", () => {
69946
- this.fire("reset", true);
69947
- });
69948
69945
  this._mutexActivation([this._hideTool, this._sectionTool, this._annotationTool]);
69949
69946
  // this._initConfigs();
69950
69947
  this._initSingleClickEvent();
@@ -69968,6 +69965,9 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
69968
69965
  get eventTrigger() {
69969
69966
  return this._eventTrigger;
69970
69967
  }
69968
+ get multiModel() {
69969
+ return this._multiModel;
69970
+ }
69971
69971
  /**
69972
69972
  * Returns the LocaleService that was configured on this Viewer.
69973
69973
  *
@@ -70322,8 +70322,8 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70322
70322
  *
70323
70323
  * @returns {String[]} The IDs of the models in the currently loaded project.
70324
70324
  */
70325
- modelId() {
70326
- return this._modelId;
70325
+ projectId() {
70326
+ return this._projectId;
70327
70327
  }
70328
70328
  /**
70329
70329
  * Loads a model into the viewer.
@@ -70334,15 +70334,15 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70334
70334
  * @param {Function} done Callback invoked on success.
70335
70335
  * @param {Function} error Callback invoked on failure, into which the error message string is passed.
70336
70336
  */
70337
- loadModel(done = () => { }, error = () => { }) {
70338
- this._modelsExplorer.loadModel(this._modelId, done, error);
70337
+ loadModel(modelId, modelBuffer, done = () => { }, error = () => { }) {
70338
+ this._modelsExplorer.loadModel(modelId, modelBuffer, done, error);
70339
70339
  }
70340
70340
  /**
70341
70341
  * 单独加载元数据
70342
70342
  * @param deflatedMetadata
70343
70343
  */
70344
- loadMetadata(deflatedMetadata, force = true, done = () => { }) {
70345
- this._modelsExplorer.loadMetadata(this.viewer.metaScene.metaModels[this._modelId], deflatedMetadata, force, () => {
70344
+ loadMetadata(modelId, deflatedMetadata, force = true, done = () => { }) {
70345
+ this._modelsExplorer.loadMetadata(modelId, deflatedMetadata, force, () => {
70346
70346
  this._metaLoaded = true;
70347
70347
  if (this._focusPartial) {
70348
70348
  this.viewFitPartial(0, done);
@@ -70418,8 +70418,8 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70418
70418
  * 获取模型信息
70419
70419
  * @returns
70420
70420
  */
70421
- getModelInfo() {
70422
- const metaModel = this.viewer.metaScene.metaModels[this._modelId];
70421
+ getModelInfo(modelId) {
70422
+ const metaModel = this.viewer.metaScene.metaModels[modelId];
70423
70423
  const modelInfo = {
70424
70424
  id: metaModel.id,
70425
70425
  createDate: metaModel.createdAt ? metaModel.createdAt : "",
@@ -70429,6 +70429,9 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70429
70429
  };
70430
70430
  return modelInfo;
70431
70431
  }
70432
+ getMetaModel(modelId) {
70433
+ return this.viewer.metaScene.metaModels[modelId];
70434
+ }
70432
70435
  //------------------------------------------------------------------------------------------------------------------
70433
70436
  // 视图设置
70434
70437
  //------------------------------------------------------------------------------------------------------------------
@@ -70771,7 +70774,7 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70771
70774
  this._hasOutlier = true;
70772
70775
  this._outlierObjectIds = exceptionIDs;
70773
70776
  }
70774
- const model = this.viewer.scene.models[this._modelId];
70777
+ const model = this.viewer.scene.models[this._projectId];
70775
70778
  const newExceptionsIds = exceptionIDs.concat(model.exceptionIds);
70776
70779
  model.exceptionIds = newExceptionsIds;
70777
70780
  this.viewer.scene.setObjectsVisible(newExceptionsIds, false);
@@ -70780,6 +70783,10 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
70780
70783
  callback();
70781
70784
  });
70782
70785
  }
70786
+ closeAll() {
70787
+ this.fire("closeAll", true);
70788
+ this.disableClickEvent = false;
70789
+ }
70783
70790
  /**
70784
70791
  * 销毁
70785
70792
  */
@@ -71284,16 +71291,6 @@ class BIMXViewer extends _Controller__WEBPACK_IMPORTED_MODULE_3__["default"] {
71284
71291
  if (callback)
71285
71292
  callback();
71286
71293
  }
71287
- /**
71288
- * 框选开关
71289
- * @param active
71290
- * @param callback
71291
- */
71292
- SetMarqueeSelectionActive(active, callback = () => { }) {
71293
- // this._marqueeSelectionTool.setActive(active);
71294
- if (callback)
71295
- callback();
71296
- }
71297
71294
  /**
71298
71295
  * 相机视角开关
71299
71296
  * @param active
@@ -72059,9 +72056,6 @@ class ClassesExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
72059
72056
  this._treeView.removeModel(modelId);
72060
72057
  }
72061
72058
  });
72062
- this.bimViewer.on("reset", () => {
72063
- // this._treeView.collapse();
72064
- });
72065
72059
  }
72066
72060
  get rootNode() {
72067
72061
  return this._rootNode;
@@ -72292,9 +72286,8 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
72292
72286
  constructor(parent, cfg) {
72293
72287
  super(parent, cfg);
72294
72288
  this._modelFromOutSide = cfg.modelFromOutSide;
72289
+ this._projectId = cfg.projectId;
72295
72290
  this._modelType = cfg.modelType;
72296
- this._modelArrayBuffer = cfg.modelContent;
72297
- this._modelMetaData = cfg.modelMetaData;
72298
72291
  this._modelSrc = cfg.modelSrc;
72299
72292
  this._eventTrigger = parent.eventTrigger;
72300
72293
  this._dataSource = new BIMViewerDataSource(this.server, {
@@ -72329,7 +72322,6 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
72329
72322
  this._modelsInfo = {};
72330
72323
  this._numModels = 0;
72331
72324
  this._numModelsLoaded = 0;
72332
- this._projectId = null;
72333
72325
  }
72334
72326
  /**
72335
72327
  *
@@ -72337,57 +72329,81 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
72337
72329
  getModelIds() {
72338
72330
  return Object.keys(this._modelsInfo);
72339
72331
  }
72332
+ getModelInfo(modelId) {
72333
+ return this._modelsInfo[modelId];
72334
+ }
72340
72335
  /**
72341
72336
  * @param {string} modelId
72342
72337
  * @param {Function} done
72343
72338
  * @param {Function} error
72344
72339
  */
72345
- loadModel(modelId, done = () => { }, error = () => { }) {
72346
- let modelInfo = this._modelsInfo[modelId];
72347
- if (!modelInfo) {
72348
- modelInfo = {
72349
- id: "testModel",
72350
- name: "testModel",
72351
- objectColorSource: "model",
72340
+ loadModel(modelId, modelBuffer, done = () => { }, error = () => { }) {
72341
+ if (this._modelType == "ifc") {
72342
+ this._modelsInfo[modelId] = {
72343
+ id: modelId,
72344
+ ifc: modelBuffer,
72345
+ metaBuffer: null,
72352
72346
  edges: true,
72347
+ loadMetadata: false,
72353
72348
  saoEnabled: true,
72354
- pbrEnabled: true
72349
+ pbrEnabled: true,
72350
+ dtxEnabled: true
72355
72351
  };
72356
72352
  }
72357
- this._loadGeometry(modelId, modelInfo, this._modelMetaData, done, error);
72353
+ else {
72354
+ this._modelsInfo[modelId] = {
72355
+ id: modelId,
72356
+ xtc: modelBuffer,
72357
+ metaBuffer: null,
72358
+ edges: true,
72359
+ loadMetadata: false,
72360
+ saoEnabled: true,
72361
+ pbrEnabled: true,
72362
+ dtxEnabled: true
72363
+ };
72364
+ }
72365
+ this._loadGeometry(modelId, done, error);
72366
+ }
72367
+ /**
72368
+ * 销毁已载入模型
72369
+ * @param {string} modelId
72370
+ * @returns
72371
+ */
72372
+ unloadModel(modelId) {
72373
+ const model = this.viewer.scene.models[modelId];
72374
+ if (!model) {
72375
+ this.error("Model not loaded: " + modelId);
72376
+ return;
72377
+ }
72378
+ model.destroy();
72379
+ this.fire("modelUnloaded", modelId);
72358
72380
  }
72359
72381
  /**
72360
72382
  * 单独加载元数据
72361
72383
  * @param metaModel
72362
72384
  * @param deflatedMetadata
72363
72385
  */
72364
- loadMetadata(metaModel, deflatedMetadata, force, done) {
72365
- if (this._xtcLoader)
72366
- this._xtcLoader.loadMetadata(metaModel, deflatedMetadata, force, done);
72386
+ loadMetadata(modelId, deflatedMetadata, force, done) {
72387
+ if (this._xtcLoader) {
72388
+ if (this._modelsInfo[modelId]) {
72389
+ this._modelsInfo[modelId].metaBuffer = deflatedMetadata;
72390
+ }
72391
+ this._xtcLoader.loadMetadata(this.viewer.metaScene.metaModels[modelId], deflatedMetadata, force, done);
72392
+ }
72367
72393
  }
72368
72394
  /**
72369
72395
  * @param {string} modelId
72370
- * @param {*} modelInfo
72371
72396
  * @param {*} json
72372
72397
  * @param {Function} done
72373
72398
  * @param {Function} error
72374
72399
  */
72375
- _loadGeometry(modelId, modelInfo, json, done, error) {
72400
+ _loadGeometry(modelId, done, error) {
72401
+ const modelInfo = this._modelsInfo[modelId];
72376
72402
  const modelLoaded = () => {
72377
- this._numModelsLoaded += 1;
72378
- if (this._numModelsLoaded === 1) {
72379
- // Jump camera to view-fit first model loaded
72380
- this._jumpToInitialCamera();
72381
- this.fire("modelLoaded", modelId);
72382
- if (done) {
72383
- done();
72384
- }
72385
- }
72386
- else {
72387
- this.fire("modelLoaded", modelId);
72388
- if (done) {
72389
- done();
72390
- }
72403
+ this._jumpToInitialCamera();
72404
+ this.fire("modelLoaded", modelId);
72405
+ if (done) {
72406
+ done();
72391
72407
  }
72392
72408
  };
72393
72409
  const loadError = (errMsg) => {
@@ -72396,44 +72412,11 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
72396
72412
  error(errMsg);
72397
72413
  }
72398
72414
  };
72399
- if (modelInfo.manifest) {
72400
- // Load multi-part split model;
72401
- // Uses the BIMViewerDataSource, which then uses the BIMViewer's Server strategy
72402
- this._dataSource.setProjectId(this._projectId);
72403
- this._dataSource.setModelId(modelId);
72404
- if (this._xtcLoader) {
72405
- const model = this._xtcLoader.load({
72406
- id: modelId,
72407
- manifestSrc: modelInfo.manifest,
72408
- // objectDefaults,
72409
- excludeUnclassifiedObjects: true,
72410
- origin: modelInfo.origin || modelInfo.position,
72411
- scale: modelInfo.scale,
72412
- rotation: modelInfo.rotation,
72413
- matrix: modelInfo.matrix,
72414
- edges: modelInfo.edges !== false,
72415
- saoEnabled: modelInfo.saoEnabled,
72416
- pbrEnabled: modelInfo.pbrEnabled,
72417
- backfaces: modelInfo.backfaces,
72418
- globalizeObjectIds: modelInfo.globalizeObjectIds,
72419
- reuseGeometries: modelInfo.reuseGeometries !== false
72420
- });
72421
- model.on("loaded", modelLoaded);
72422
- model.on("error", loadError);
72423
- }
72424
- }
72425
- else if (this._modelType == "ifc") {
72415
+ if (this._modelType == "ifc") {
72426
72416
  if (this._ifcLoader) {
72427
72417
  if (this._modelFromOutSide) {
72428
72418
  this.log("加载从外部传入的ifc模型...");
72429
- const model = this._ifcLoader.load({
72430
- id: modelId,
72431
- ifc: this._modelArrayBuffer,
72432
- edges: this._modelConfig.edges ? this._modelConfig.edges : false,
72433
- loadMetadata: false,
72434
- dtxEnabled: true,
72435
- metadata: json
72436
- });
72419
+ const model = this._ifcLoader.load(modelInfo);
72437
72420
  model.on("loaded", modelLoaded);
72438
72421
  model.on("error", loadError);
72439
72422
  }
@@ -72442,12 +72425,10 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
72442
72425
  const model = this._ifcLoader.load({
72443
72426
  id: modelId,
72444
72427
  src: this._modelSrc,
72445
- edges: this._modelConfig.edges !== undefined ? this._modelConfig.edges : false,
72428
+ edges: modelInfo.edges,
72446
72429
  loadMetadata: false,
72447
- metadata: json,
72448
- // pbrEnabled: true,
72449
- dtxEnabled: true
72450
- // excludeUnclassifiedObjects: true
72430
+ pbrEnabled: modelInfo.pbrEnabled,
72431
+ dtxEnabled: modelInfo.dtxEnabled
72451
72432
  });
72452
72433
  model.on("loaded", modelLoaded);
72453
72434
  model.on("error", loadError);
@@ -72457,22 +72438,7 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
72457
72438
  else if (this._xtcLoader) {
72458
72439
  if (this._modelFromOutSide) {
72459
72440
  this.log("加载从外部传入的xtc模型...");
72460
- const model = this._xtcLoader.load({
72461
- id: modelId,
72462
- metaModelData: json,
72463
- xtc: this._modelArrayBuffer,
72464
- // objectDefaults,
72465
- origin: modelInfo.origin || modelInfo.position,
72466
- scale: modelInfo.scale,
72467
- rotation: modelInfo.rotation,
72468
- matrix: modelInfo.matrix,
72469
- edges: this._modelConfig.edges ? this._modelConfig.edges : false,
72470
- saoEnabled: modelInfo.saoEnabled,
72471
- pbrEnabled: modelInfo.pbrEnabled,
72472
- backfaces: modelInfo.backfaces,
72473
- globalizeObjectIds: modelInfo.globalizeObjectIds,
72474
- reuseGeometries: modelInfo.reuseGeometries !== false
72475
- });
72441
+ const model = this._xtcLoader.load(modelInfo);
72476
72442
  model.on("loaded", modelLoaded);
72477
72443
  model.on("error", loadError);
72478
72444
  }
@@ -72586,7 +72552,6 @@ class ObjectsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
72586
72552
  this._treeView.removeModel(modelId);
72587
72553
  }
72588
72554
  });
72589
- this.bimViewer.on("reset", () => { });
72590
72555
  }
72591
72556
  get rootNode() {
72592
72557
  return this._rootNode;
@@ -72713,7 +72678,6 @@ class StoreysExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
72713
72678
  this._treeView.removeModel(modelId);
72714
72679
  }
72715
72680
  });
72716
- this.bimViewer.on("reset", () => { });
72717
72681
  }
72718
72682
  get rootNode() {
72719
72683
  return this._rootNode;
@@ -73667,7 +73631,7 @@ class AnnotationTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
73667
73631
  iconType: ""
73668
73632
  }
73669
73633
  });
73670
- this.bimViewer.on("reset", () => {
73634
+ this.bimViewer.on("closeAll", () => {
73671
73635
  this.setActive(false);
73672
73636
  });
73673
73637
  this.on("active", (active) => {
@@ -73987,15 +73951,13 @@ class CommentsTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
73987
73951
  this._revocationMechanism = null;
73988
73952
  this.on("active", (active) => {
73989
73953
  if (active) {
73990
- // this.saveSVG();
73991
- // this.endCommentsTool();
73954
+ this.saveSVG();
73992
73955
  }
73993
73956
  else {
73994
- // this.endCommentsTool();
73995
73957
  this.endCommentsTool();
73996
73958
  }
73997
73959
  });
73998
- this.bimViewer.on("reset", () => {
73960
+ this.bimViewer.on("closeAll", () => {
73999
73961
  this.setActive(false);
74000
73962
  });
74001
73963
  this.initEventListeners();
@@ -75975,7 +75937,7 @@ class FirstPersonMode extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"
75975
75937
  // cameraControl.pivoting = true;
75976
75938
  }
75977
75939
  });
75978
- this.bimViewer.on("reset", () => {
75940
+ this.bimViewer.on("closeAll", () => {
75979
75941
  this.setActive(false);
75980
75942
  });
75981
75943
  // this.smallCanvas();
@@ -76091,8 +76053,14 @@ class FitAction extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
76091
76053
  fit(callback) {
76092
76054
  const { viewer } = this;
76093
76055
  const { scene } = viewer;
76094
- const { aabb } = scene;
76095
76056
  const { center } = scene;
76057
+ let aabb;
76058
+ if (this.bimViewer.multiModel) {
76059
+ aabb = scene.getAABB(scene.visibleObjectIds);
76060
+ }
76061
+ else {
76062
+ aabb = scene.aabb;
76063
+ }
76096
76064
  const diag = _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.math.getAABB3Diag(aabb);
76097
76065
  viewer.cameraControl.pivotPos = center;
76098
76066
  if (viewer.cameraControl.planView)
@@ -76138,9 +76106,9 @@ __webpack_require__.r(__webpack_exports__);
76138
76106
  */
76139
76107
  class HideTool extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"] {
76140
76108
  /**
76141
- * @param {*} parent
76142
- * @param {*} cfg
76143
- */
76109
+ * @param {*} parent
76110
+ * @param {*} cfg
76111
+ */
76144
76112
  constructor(parent, cfg) {
76145
76113
  super(parent, cfg);
76146
76114
  this.on("active", (active) => {
@@ -76161,7 +76129,7 @@ class HideTool extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"] {
76161
76129
  }
76162
76130
  }
76163
76131
  });
76164
- this.bimViewer.on("reset", () => {
76132
+ this.bimViewer.on("closeAll", () => {
76165
76133
  this.setActive(false);
76166
76134
  });
76167
76135
  }
@@ -76202,7 +76170,7 @@ class MeasureTool extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"] {
76202
76170
  this._measure_distance_tool.setEnabled(false);
76203
76171
  }
76204
76172
  });
76205
- this.bimViewer.on("reset", () => {
76173
+ this.bimViewer.on("closeAll", () => {
76206
76174
  this.setActive(false);
76207
76175
  });
76208
76176
  }
@@ -76302,7 +76270,7 @@ class MeasureAngleTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default
76302
76270
  offsetY: cfg.offsetY
76303
76271
  });
76304
76272
  this._angleMeasurementsMouseControl.snapping = true;
76305
- this.bimViewer.on("reset", () => {
76273
+ this.bimViewer.on("closeAll", () => {
76306
76274
  this.setActive(false);
76307
76275
  });
76308
76276
  this.on("active", (active) => {
@@ -76654,7 +76622,7 @@ class MeasureDistanceTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["defa
76654
76622
  offsetY: cfg.offsetY
76655
76623
  });
76656
76624
  this._distanceMeasurementsMouseControl.snapping = true;
76657
- this.bimViewer.on("reset", () => {
76625
+ this.bimViewer.on("closeAll", () => {
76658
76626
  this.setActive(false);
76659
76627
  });
76660
76628
  this.on("active", (active) => {
@@ -77088,13 +77056,13 @@ __webpack_require__.r(__webpack_exports__);
77088
77056
  */
77089
77057
  class OrthoMode extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"] {
77090
77058
  /**
77091
- * 创建一个正交模式对象
77092
- * @param {*} parent
77093
- * @param {*} cfg
77094
- */
77059
+ * 创建一个正交模式对象
77060
+ * @param {*} parent
77061
+ * @param {*} cfg
77062
+ */
77095
77063
  constructor(parent, cfg) {
77096
77064
  super(parent, cfg);
77097
- this.bimViewer.on("reset", () => {
77065
+ this.bimViewer.on("closeAll", () => {
77098
77066
  this.setActive(false);
77099
77067
  });
77100
77068
  this.viewer.camera.on("projection", () => {
@@ -77104,9 +77072,9 @@ class OrthoMode extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"] {
77104
77072
  this._active = false;
77105
77073
  }
77106
77074
  /**
77107
- * @param {boolean} active
77108
- * @param {Function} done
77109
- */
77075
+ * @param {boolean} active
77076
+ * @param {Function} done
77077
+ */
77110
77078
  setActive(active, done = () => { }) {
77111
77079
  if (this._active === active) {
77112
77080
  if (done) {
@@ -77234,14 +77202,18 @@ class ResetAction extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77234
77202
  // this._restoreModelMemento(modelId);
77235
77203
  // });
77236
77204
  // this.bimViewer.unShowObjectInExplorers();
77237
- this.fire("reset", true);
77238
77205
  this._resetCamera(callback);
77239
77206
  }
77240
77207
  _resetCamera(callback) {
77241
77208
  const { viewer } = this;
77242
77209
  const { scene } = viewer;
77243
- const { aabb } = scene;
77244
- // const aabb = scene.getAABB(scene.visibleObjectIds);
77210
+ let aabb;
77211
+ if (this.bimViewer.multiModel) {
77212
+ aabb = scene.getAABB(scene.visibleObjectIds);
77213
+ }
77214
+ else {
77215
+ aabb = scene.aabb;
77216
+ }
77245
77217
  const diag = _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.math.getAABB3Diag(aabb);
77246
77218
  const center = _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.math.getAABB3Center(aabb, tempVec3a);
77247
77219
  const { camera } = scene;
@@ -77324,7 +77296,7 @@ class SectionTool extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77324
77296
  this.clear();
77325
77297
  }
77326
77298
  });
77327
- this.bimViewer.on("reset", () => {
77299
+ this.bimViewer.on("closeAll", () => {
77328
77300
  this.clear();
77329
77301
  this.setActive(false);
77330
77302
  });
@@ -77588,10 +77560,6 @@ class ShowSpacesMode extends _Controller__WEBPACK_IMPORTED_MODULE_0__["default"]
77588
77560
  */
77589
77561
  constructor(parent, cfg) {
77590
77562
  super(parent, cfg);
77591
- // this.bimViewer.on("reset", () => {
77592
- // // IfcSpaces hidden by default
77593
- // this.setActive(false);
77594
- // });
77595
77563
  this._active = true;
77596
77564
  parent.eventTrigger.on("metaLoaded", (returnData) => {
77597
77565
  // 将空间对象设为半透明
@@ -77688,7 +77656,7 @@ class ThreeDMode extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"] {
77688
77656
  this._saveOrthoActive = null;
77689
77657
  this._cameraControlNavModeMediator = cfg.cameraControlNavModeMediator;
77690
77658
  this._active = false;
77691
- this.bimViewer.on("reset", () => {
77659
+ this.bimViewer.on("closeAll", () => {
77692
77660
  // Animated
77693
77661
  this.setActive(true, () => { });
77694
77662
  });
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export const VERSION = "0.1.11";
2
+ export const VERSION = "0.1.12";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export const VERSION = "0.1.11";
2
+ export const VERSION = "0.1.12";
package/package.json CHANGED
@@ -1,14 +1,14 @@
1
1
  {
2
2
  "name": "@xtctwins/tctwins-bimx-viewer",
3
- "version": "0.1.11",
3
+ "version": "0.1.13",
4
4
  "private": false,
5
5
  "description": "BIM viewer built on xtctwins",
6
6
  "main": "./dist/tctwins-bimx-viewer.min.es.js",
7
7
  "types": "./types/index.d.ts",
8
8
  "scripts": {
9
9
  "build": "webpack --config webpack.config.js",
10
- "build-dev": "webpack serve --config webpack.dev.config.js --open",
11
- "build-dev-only": "webpack --config webpack.dev.config.js",
10
+ "dev": "webpack serve --config webpack.dev.config.js --open",
11
+ "build-dev": "webpack --config webpack.dev.config.js",
12
12
  "docs": "esdoc",
13
13
  "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
14
14
  "publish": "npm publish --access public",
@@ -28,7 +28,7 @@
28
28
  "@types/ali-oss": "^6.16.11",
29
29
  "@typescript-eslint/eslint-plugin": "^6.14.0",
30
30
  "@typescript-eslint/parser": "^6.14.0",
31
- "@xtctwins/tctwins-core": "^1.0.45",
31
+ "@xtctwins/tctwins-core": "^1.0.46",
32
32
  "ali-oss": "^6.18.1",
33
33
  "autoprefixer": "^9.8.6",
34
34
  "axios": "^1.6.5",