@xtctwins/tctwins-bimx-viewer 1.1.3 → 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.
@@ -79215,15 +79215,18 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
79215
79215
  };
79216
79216
  }
79217
79217
  else if (this._modelType == "xtc") {
79218
- this._xtcLoader = new _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.XTCLoaderPlugin(this.viewer, {
79219
- dataSource: this._dataSource
79220
- });
79221
- this._xtcLoader.on("metaLoaded", (returnData) => {
79222
- this._eventTrigger.emit("metaLoaded", returnData);
79223
- });
79224
- this._xtcLoader.on("metaLoading", (callback) => {
79225
- this._eventTrigger.emit("metaLoading", callback);
79226
- });
79218
+ // 复用单个 XTCLoaderPlugin 实例,避免每个模型都重建插件与重绑事件
79219
+ if (!this._xtcLoader) {
79220
+ this._xtcLoader = new _xtctwins_tctwins_core__WEBPACK_IMPORTED_MODULE_0__.XTCLoaderPlugin(this.viewer, {
79221
+ dataSource: this._dataSource
79222
+ });
79223
+ this._xtcLoader.on("metaLoaded", (returnData) => {
79224
+ this._eventTrigger.emit("metaLoaded", returnData);
79225
+ });
79226
+ this._xtcLoader.on("metaLoading", (callback) => {
79227
+ this._eventTrigger.emit("metaLoading", callback);
79228
+ });
79229
+ }
79227
79230
  this._modelsInfo[modelId] = {
79228
79231
  id: modelId,
79229
79232
  xtc: modelBuffer,
@@ -79262,6 +79265,7 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
79262
79265
  if (cfg && cfg.brightness !== undefined && cfg.brightness !== null) {
79263
79266
  modelInfo.brightness = cfg.brightness;
79264
79267
  }
79268
+ this._numModels += 1;
79265
79269
  this._loadGeometry(modelId, done, error);
79266
79270
  }
79267
79271
  /**
@@ -79318,13 +79322,20 @@ class ModelsExplorer extends _Controller__WEBPACK_IMPORTED_MODULE_1__["default"]
79318
79322
  loadParams[key] = transform[key];
79319
79323
  }
79320
79324
  const modelLoaded = () => {
79321
- this._jumpToInitialCamera();
79325
+ this._numModelsLoaded += 1;
79326
+ if (this._numModelsLoaded >= this._numModels) {
79327
+ this._jumpToInitialCamera();
79328
+ }
79322
79329
  this.fire("modelLoaded", modelId);
79323
79330
  if (done) {
79324
79331
  done();
79325
79332
  }
79326
79333
  };
79327
79334
  const loadError = (errMsg) => {
79335
+ this._numModelsLoaded += 1;
79336
+ if (this._numModelsLoaded >= this._numModels) {
79337
+ this._jumpToInitialCamera();
79338
+ }
79328
79339
  this.error(errMsg);
79329
79340
  if (error) {
79330
79341
  error(errMsg);
package/dist/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export const VERSION = "1.1.2";
2
+ export const VERSION = "1.1.4";
package/dist/version.js CHANGED
@@ -1,2 +1,2 @@
1
1
 
2
- export const VERSION = "1.1.2";
2
+ export const VERSION = "1.1.4";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xtctwins/tctwins-bimx-viewer",
3
- "version": "1.1.3",
3
+ "version": "1.1.4",
4
4
  "private": false,
5
5
  "description": "BIM viewer built on xtctwins",
6
6
  "main": "./dist/tctwins-bimx-viewer.min.es.js",