@xeokit/xeokit-sdk 2.6.49 → 2.6.51

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.
@@ -12936,9 +12936,6 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
12936
12936
  const mouseHoverCanvasPos = math.vec2();
12937
12937
  this._currentAngleMeasurement = null;
12938
12938
 
12939
- const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));
12940
- const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
12941
-
12942
12939
  const pagePos = math.vec2();
12943
12940
 
12944
12941
  const hoverOn = event => {
@@ -12973,8 +12970,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
12973
12970
  this.markerDiv.style.left = `${pagePos[0] - 5}px`;
12974
12971
  this.markerDiv.style.top = `${pagePos[1] - 5}px`;
12975
12972
  } else {
12976
- this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
12977
- this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
12973
+ const markerPos = math.vec2(canvasPos);
12974
+ transformToNode(canvas, this.markerDiv.parentNode, markerPos);
12975
+ this.markerDiv.style.left = `${markerPos[0] - 5}px`;
12976
+ this.markerDiv.style.top = `${markerPos[1] - 5}px`;
12978
12977
  }
12979
12978
  break;
12980
12979
  case MOUSE_FINDING_CORNER:
@@ -84280,13 +84279,7 @@ class SceneModel extends Component {
84280
84279
  */
84281
84280
  set matrix(value) {
84282
84281
  this._matrix.set(value || DEFAULT_MATRIX);
84283
-
84284
- math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84285
- math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84286
- math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);
84287
- this._matrix.set(this._worldRotationMatrix);
84288
- math.translateMat4v(this._position, this._matrix);
84289
-
84282
+ math.decomposeMat4(this._matrix, this._position, this._quaternion, this._scale);
84290
84283
  this._matrixDirty = false;
84291
84284
  this._setWorldMatrixDirty();
84292
84285
  this._sceneModelDirty();
@@ -84320,6 +84313,8 @@ class SceneModel extends Component {
84320
84313
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84321
84314
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84322
84315
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84316
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
84317
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
84323
84318
  this._matrix.set(this._worldRotationMatrix);
84324
84319
  math.translateMat4v(this._position, this._matrix);
84325
84320
  this._matrixDirty = false;
@@ -89382,9 +89377,6 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
89382
89377
 
89383
89378
  this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
89384
89379
 
89385
- const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));
89386
- const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
89387
-
89388
89380
  const pagePos = math.vec2();
89389
89381
 
89390
89382
  const hoverOn = event => {
@@ -89399,8 +89391,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
89399
89391
  this._markerDiv.style.left = `${pagePos[0] - 5}px`;
89400
89392
  this._markerDiv.style.top = `${pagePos[1] - 5}px`;
89401
89393
  } else {
89402
- this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
89403
- this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
89394
+ const markerPos = math.vec2(canvasPos);
89395
+ transformToNode(canvas, this._markerDiv.parentNode, markerPos);
89396
+ this._markerDiv.style.left = `${markerPos[0] - 5}px`;
89397
+ this._markerDiv.style.top = `${markerPos[1] - 5}px`;
89404
89398
  }
89405
89399
 
89406
89400
  this._markerDiv.style.background = "pink";
@@ -101687,8 +101681,8 @@ class MetaModel {
101687
101681
 
101688
101682
  for (let modelId in metaScene.metaModels) {
101689
101683
  const metaModel = metaScene.metaModels[modelId];
101690
- for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
101691
- const metaObject = metaModel.metaObjects[i];
101684
+ for (let objectId in metaModel.metaObjects) {
101685
+ const metaObject = metaModel.metaObjects[objectId];
101692
101686
  metaObject.metaModels.push(metaModel);
101693
101687
  }
101694
101688
  }
@@ -122965,7 +122959,7 @@ class Storey {
122965
122959
  /**
122966
122960
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122967
122961
  *
122968
- * The boundary is a six-element Float32Array containing the min/max extents of the
122962
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122969
122963
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122970
122964
  *
122971
122965
  * @property storeyAABB
@@ -122976,7 +122970,7 @@ class Storey {
122976
122970
  /**
122977
122971
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122978
122972
  *
122979
- * The boundary is a six-element Float32Array containing the min/max extents of the
122973
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122980
122974
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122981
122975
  *
122982
122976
  * @deprecated
@@ -122988,7 +122982,7 @@ class Storey {
122988
122982
  /**
122989
122983
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
122990
122984
  *
122991
- * The boundary is a six-element Float32Array containing the min/max extents of the
122985
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122992
122986
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122993
122987
  *
122994
122988
  * @property modelAABB
@@ -123313,6 +123307,8 @@ class StoreyViewsPlugin extends Plugin {
123313
123307
  */
123314
123308
  this.storeys = {};
123315
123309
 
123310
+ this._storeysList = null;
123311
+
123316
123312
  /**
123317
123313
  * A set of {@link Storey}s for each {@link MetaModel}.
123318
123314
  *
@@ -123354,6 +123350,7 @@ class StoreyViewsPlugin extends Plugin {
123354
123350
  this.fire("storeys", this.storeys);
123355
123351
  });
123356
123352
  this.storeys[storeyId] = storey;
123353
+ this._storeysList= null;
123357
123354
  if (!this.modelStoreys[modelId]) {
123358
123355
  this.modelStoreys[modelId] = {};
123359
123356
  }
@@ -123374,6 +123371,7 @@ class StoreyViewsPlugin extends Plugin {
123374
123371
  model.off(storey._onModelDestroyed);
123375
123372
  }
123376
123373
  delete this.storeys[storyObjectId];
123374
+ this._storeysList= null;
123377
123375
  }
123378
123376
  }
123379
123377
  delete this.modelStoreys[modelId];
@@ -123478,7 +123476,7 @@ class StoreyViewsPlugin extends Plugin {
123478
123476
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
123479
123477
  * @param {*} [options] Options for showing the Entitys within the storey.
123480
123478
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
123481
- */
123479
+ */
123482
123480
  showStoreyObjects(storeyId, options = {}) {
123483
123481
 
123484
123482
  const storey = this.storeys[storeyId];
@@ -123503,7 +123501,7 @@ class StoreyViewsPlugin extends Plugin {
123503
123501
 
123504
123502
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
123505
123503
  if (entity) {
123506
- entity.visible = true;
123504
+ entity.visible = true;
123507
123505
  }
123508
123506
  });
123509
123507
  }
@@ -123739,7 +123737,7 @@ class StoreyViewsPlugin extends Plugin {
123739
123737
 
123740
123738
  /**
123741
123739
  * Gets the ID of the storey which's bounding box contains the y point of the world position
123742
- *
123740
+ *
123743
123741
  * @param {Number[]} worldPos 3D World-space position.
123744
123742
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
123745
123743
  */
@@ -123859,6 +123857,42 @@ class StoreyViewsPlugin extends Plugin {
123859
123857
  this.viewer.scene.off(this._onModelLoaded);
123860
123858
  super.destroy();
123861
123859
  }
123860
+
123861
+ /**
123862
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
123863
+ *
123864
+ * @returns {null}
123865
+ */
123866
+ get storeysList() {
123867
+ if (!this._storeysList) {
123868
+ this._storeysList = Object.values(this.storeys);
123869
+ this._storeysList.sort(this._getSpatialSortFunc());
123870
+ }
123871
+ return this._storeysList;
123872
+ }
123873
+
123874
+ _getSpatialSortFunc() {
123875
+ const viewer = this.viewer;
123876
+ const scene = viewer.scene;
123877
+ const camera = scene.camera;
123878
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
123879
+ let idx = 0;
123880
+ if (camera.xUp) {
123881
+ idx = 0;
123882
+ } else if (camera.yUp) {
123883
+ idx = 1;
123884
+ } else {
123885
+ idx = 2;
123886
+ }
123887
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
123888
+ return -1;
123889
+ }
123890
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
123891
+ return 1;
123892
+ }
123893
+ return 0;
123894
+ });
123895
+ }
123862
123896
  }
123863
123897
 
123864
123898
  const zeroVec = new Float64Array([0, 0, 1]);
@@ -127201,7 +127235,7 @@ class TreeViewPlugin extends Plugin {
127201
127235
  buildingNode = {
127202
127236
  nodeId: `${this._id}-${objectId}`,
127203
127237
  objectId: objectId,
127204
- title: (metaObject.metaModels.length === 0) ? "na" : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127238
+ title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127205
127239
  type: metaObjectType,
127206
127240
  parent: null,
127207
127241
  numEntities: 0,
@@ -127304,7 +127338,7 @@ class TreeViewPlugin extends Plugin {
127304
127338
  rootNode = {
127305
127339
  nodeId: `${this._id}-${objectId}`,
127306
127340
  objectId: objectId,
127307
- title: metaObject.metaModels.length === 0 ? "na" : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127341
+ title: metaObject.metaModels.length === 0 ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127308
127342
  type: metaObjectType,
127309
127343
  parent: null,
127310
127344
  numEntities: 0,
@@ -127385,7 +127419,7 @@ class TreeViewPlugin extends Plugin {
127385
127419
  const node = {
127386
127420
  nodeId: `${this._id}-${objectId}`,
127387
127421
  objectId: objectId,
127388
- title: (!parent) ? metaObject.metaModels.length === 0 ? "na" : (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType,
127422
+ title: (!parent) ? metaObject.metaModels.length === 0 ? metaObjectName : (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType,
127389
127423
  type: metaObjectType,
127390
127424
  parent: parent,
127391
127425
  numEntities: 0,
@@ -127421,8 +127455,8 @@ class TreeViewPlugin extends Plugin {
127421
127455
  if (!children || children.length === 0) {
127422
127456
  return;
127423
127457
  }
127424
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
127425
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
127458
+ const firstChild = children[0];
127459
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
127426
127460
  children.sort(this._getSpatialSortFunc());
127427
127461
  } else {
127428
127462
  children.sort(this._alphaSortFunc);
@@ -12932,9 +12932,6 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
12932
12932
  const mouseHoverCanvasPos = math.vec2();
12933
12933
  this._currentAngleMeasurement = null;
12934
12934
 
12935
- const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));
12936
- const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
12937
-
12938
12935
  const pagePos = math.vec2();
12939
12936
 
12940
12937
  const hoverOn = event => {
@@ -12969,8 +12966,10 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
12969
12966
  this.markerDiv.style.left = `${pagePos[0] - 5}px`;
12970
12967
  this.markerDiv.style.top = `${pagePos[1] - 5}px`;
12971
12968
  } else {
12972
- this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
12973
- this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
12969
+ const markerPos = math.vec2(canvasPos);
12970
+ transformToNode(canvas, this.markerDiv.parentNode, markerPos);
12971
+ this.markerDiv.style.left = `${markerPos[0] - 5}px`;
12972
+ this.markerDiv.style.top = `${markerPos[1] - 5}px`;
12974
12973
  }
12975
12974
  break;
12976
12975
  case MOUSE_FINDING_CORNER:
@@ -84276,13 +84275,7 @@ class SceneModel extends Component {
84276
84275
  */
84277
84276
  set matrix(value) {
84278
84277
  this._matrix.set(value || DEFAULT_MATRIX);
84279
-
84280
- math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84281
- math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84282
- math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);
84283
- this._matrix.set(this._worldRotationMatrix);
84284
- math.translateMat4v(this._position, this._matrix);
84285
-
84278
+ math.decomposeMat4(this._matrix, this._position, this._quaternion, this._scale);
84286
84279
  this._matrixDirty = false;
84287
84280
  this._setWorldMatrixDirty();
84288
84281
  this._sceneModelDirty();
@@ -84316,6 +84309,8 @@ class SceneModel extends Component {
84316
84309
  math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
84317
84310
  math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
84318
84311
  math.quaternionToRotationMat4(this._conjugateQuaternion, this._worldRotationMatrixConjugate);
84312
+ math.scaleMat4v(this._scale, this._worldRotationMatrix);
84313
+ math.scaleMat4v(this._scale, this._worldRotationMatrixConjugate);
84319
84314
  this._matrix.set(this._worldRotationMatrix);
84320
84315
  math.translateMat4v(this._position, this._matrix);
84321
84316
  this._matrixDirty = false;
@@ -89378,9 +89373,6 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
89378
89373
 
89379
89374
  this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
89380
89375
 
89381
- const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));
89382
- const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
89383
-
89384
89376
  const pagePos = math.vec2();
89385
89377
 
89386
89378
  const hoverOn = event => {
@@ -89395,8 +89387,10 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
89395
89387
  this._markerDiv.style.left = `${pagePos[0] - 5}px`;
89396
89388
  this._markerDiv.style.top = `${pagePos[1] - 5}px`;
89397
89389
  } else {
89398
- this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
89399
- this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
89390
+ const markerPos = math.vec2(canvasPos);
89391
+ transformToNode(canvas, this._markerDiv.parentNode, markerPos);
89392
+ this._markerDiv.style.left = `${markerPos[0] - 5}px`;
89393
+ this._markerDiv.style.top = `${markerPos[1] - 5}px`;
89400
89394
  }
89401
89395
 
89402
89396
  this._markerDiv.style.background = "pink";
@@ -101683,8 +101677,8 @@ class MetaModel {
101683
101677
 
101684
101678
  for (let modelId in metaScene.metaModels) {
101685
101679
  const metaModel = metaScene.metaModels[modelId];
101686
- for (let i = 0, len = metaModel.metaObjects.length; i < len; i++) {
101687
- const metaObject = metaModel.metaObjects[i];
101680
+ for (let objectId in metaModel.metaObjects) {
101681
+ const metaObject = metaModel.metaObjects[objectId];
101688
101682
  metaObject.metaModels.push(metaModel);
101689
101683
  }
101690
101684
  }
@@ -122961,7 +122955,7 @@ class Storey {
122961
122955
  /**
122962
122956
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122963
122957
  *
122964
- * The boundary is a six-element Float32Array containing the min/max extents of the
122958
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122965
122959
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122966
122960
  *
122967
122961
  * @property storeyAABB
@@ -122972,7 +122966,7 @@ class Storey {
122972
122966
  /**
122973
122967
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the IfcBuildingStorey.
122974
122968
  *
122975
- * The boundary is a six-element Float32Array containing the min/max extents of the
122969
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122976
122970
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122977
122971
  *
122978
122972
  * @deprecated
@@ -122984,7 +122978,7 @@ class Storey {
122984
122978
  /**
122985
122979
  * Axis-aligned World-space boundary of the {@link Entity}s that represent the model.
122986
122980
  *
122987
- * The boundary is a six-element Float32Array containing the min/max extents of the
122981
+ * The boundary is a six-element Float64Array containing the min/max extents of the
122988
122982
  * axis-aligned boundary, ie. ````[xmin, ymin, zmin, xmax, ymax, zmax]````
122989
122983
  *
122990
122984
  * @property modelAABB
@@ -123309,6 +123303,8 @@ class StoreyViewsPlugin extends Plugin {
123309
123303
  */
123310
123304
  this.storeys = {};
123311
123305
 
123306
+ this._storeysList = null;
123307
+
123312
123308
  /**
123313
123309
  * A set of {@link Storey}s for each {@link MetaModel}.
123314
123310
  *
@@ -123350,6 +123346,7 @@ class StoreyViewsPlugin extends Plugin {
123350
123346
  this.fire("storeys", this.storeys);
123351
123347
  });
123352
123348
  this.storeys[storeyId] = storey;
123349
+ this._storeysList= null;
123353
123350
  if (!this.modelStoreys[modelId]) {
123354
123351
  this.modelStoreys[modelId] = {};
123355
123352
  }
@@ -123370,6 +123367,7 @@ class StoreyViewsPlugin extends Plugin {
123370
123367
  model.off(storey._onModelDestroyed);
123371
123368
  }
123372
123369
  delete this.storeys[storyObjectId];
123370
+ this._storeysList= null;
123373
123371
  }
123374
123372
  }
123375
123373
  delete this.modelStoreys[modelId];
@@ -123474,7 +123472,7 @@ class StoreyViewsPlugin extends Plugin {
123474
123472
  * @param {String} storeyId ID of the ````IfcBuildingStorey```` object.
123475
123473
  * @param {*} [options] Options for showing the Entitys within the storey.
123476
123474
  * @param {Boolean} [options.hideOthers=false] When ````true````, hide all other {@link Entity}s.
123477
- */
123475
+ */
123478
123476
  showStoreyObjects(storeyId, options = {}) {
123479
123477
 
123480
123478
  const storey = this.storeys[storeyId];
@@ -123499,7 +123497,7 @@ class StoreyViewsPlugin extends Plugin {
123499
123497
 
123500
123498
  this.withStoreyObjects(storeyId, (entity, metaObject) => {
123501
123499
  if (entity) {
123502
- entity.visible = true;
123500
+ entity.visible = true;
123503
123501
  }
123504
123502
  });
123505
123503
  }
@@ -123735,7 +123733,7 @@ class StoreyViewsPlugin extends Plugin {
123735
123733
 
123736
123734
  /**
123737
123735
  * Gets the ID of the storey which's bounding box contains the y point of the world position
123738
- *
123736
+ *
123739
123737
  * @param {Number[]} worldPos 3D World-space position.
123740
123738
  * @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
123741
123739
  */
@@ -123855,6 +123853,42 @@ class StoreyViewsPlugin extends Plugin {
123855
123853
  this.viewer.scene.off(this._onModelLoaded);
123856
123854
  super.destroy();
123857
123855
  }
123856
+
123857
+ /**
123858
+ * Gets Storeys in a list, spatially sorted on the vertical World axis, the lowest Storey first.
123859
+ *
123860
+ * @returns {null}
123861
+ */
123862
+ get storeysList() {
123863
+ if (!this._storeysList) {
123864
+ this._storeysList = Object.values(this.storeys);
123865
+ this._storeysList.sort(this._getSpatialSortFunc());
123866
+ }
123867
+ return this._storeysList;
123868
+ }
123869
+
123870
+ _getSpatialSortFunc() {
123871
+ const viewer = this.viewer;
123872
+ const scene = viewer.scene;
123873
+ const camera = scene.camera;
123874
+ return this._spatialSortFunc || (this._spatialSortFunc = (storey1, storey2) => {
123875
+ let idx = 0;
123876
+ if (camera.xUp) {
123877
+ idx = 0;
123878
+ } else if (camera.yUp) {
123879
+ idx = 1;
123880
+ } else {
123881
+ idx = 2;
123882
+ }
123883
+ if (storey1.aabb[idx] > storey2.aabb[idx]) {
123884
+ return -1;
123885
+ }
123886
+ if (storey1.aabb[idx] < storey2.aabb[idx]) {
123887
+ return 1;
123888
+ }
123889
+ return 0;
123890
+ });
123891
+ }
123858
123892
  }
123859
123893
 
123860
123894
  const zeroVec = new Float64Array([0, 0, 1]);
@@ -127197,7 +127231,7 @@ class TreeViewPlugin extends Plugin {
127197
127231
  buildingNode = {
127198
127232
  nodeId: `${this._id}-${objectId}`,
127199
127233
  objectId: objectId,
127200
- title: (metaObject.metaModels.length === 0) ? "na" : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127234
+ title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127201
127235
  type: metaObjectType,
127202
127236
  parent: null,
127203
127237
  numEntities: 0,
@@ -127300,7 +127334,7 @@ class TreeViewPlugin extends Plugin {
127300
127334
  rootNode = {
127301
127335
  nodeId: `${this._id}-${objectId}`,
127302
127336
  objectId: objectId,
127303
- title: metaObject.metaModels.length === 0 ? "na" : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127337
+ title: metaObject.metaModels.length === 0 ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
127304
127338
  type: metaObjectType,
127305
127339
  parent: null,
127306
127340
  numEntities: 0,
@@ -127381,7 +127415,7 @@ class TreeViewPlugin extends Plugin {
127381
127415
  const node = {
127382
127416
  nodeId: `${this._id}-${objectId}`,
127383
127417
  objectId: objectId,
127384
- title: (!parent) ? metaObject.metaModels.length === 0 ? "na" : (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType,
127418
+ title: (!parent) ? metaObject.metaModels.length === 0 ? metaObjectName : (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType,
127385
127419
  type: metaObjectType,
127386
127420
  parent: parent,
127387
127421
  numEntities: 0,
@@ -127417,8 +127451,8 @@ class TreeViewPlugin extends Plugin {
127417
127451
  if (!children || children.length === 0) {
127418
127452
  return;
127419
127453
  }
127420
- if (this._hierarchy === "storeys" && node.type === "IfcBuilding") {
127421
- // Assumes that children of an IfcBuilding will always be IfcBuildingStoreys
127454
+ const firstChild = children[0];
127455
+ if (this._hierarchy === "storeys" && firstChild.type === "IfcBuildingStorey") {
127422
127456
  children.sort(this._getSpatialSortFunc());
127423
127457
  } else {
127424
127458
  children.sort(this._alphaSortFunc);