@xeokit/xeokit-sdk 2.6.51 → 2.6.52
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/xeokit-sdk.cjs.js +36 -15
- package/dist/xeokit-sdk.es.js +36 -15
- package/dist/xeokit-sdk.es5.js +67 -67
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +1 -1
- package/package.json +1 -1
- package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +36 -15
package/package.json
CHANGED
|
@@ -301,7 +301,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
301
301
|
this.fire("storeys", this.storeys);
|
|
302
302
|
});
|
|
303
303
|
this.storeys[storeyId] = storey;
|
|
304
|
-
this._storeysList= null;
|
|
304
|
+
this._storeysList = null;
|
|
305
305
|
if (!this.modelStoreys[modelId]) {
|
|
306
306
|
this.modelStoreys[modelId] = {};
|
|
307
307
|
}
|
|
@@ -322,7 +322,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
322
322
|
model.off(storey._onModelDestroyed);
|
|
323
323
|
}
|
|
324
324
|
delete this.storeys[storyObjectId];
|
|
325
|
-
this._storeysList= null;
|
|
325
|
+
this._storeysList = null;
|
|
326
326
|
}
|
|
327
327
|
}
|
|
328
328
|
delete this.modelStoreys[modelId];
|
|
@@ -541,7 +541,11 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
541
541
|
height = Math.round(width * aspect);
|
|
542
542
|
}
|
|
543
543
|
|
|
544
|
-
|
|
544
|
+
const mask = {
|
|
545
|
+
visible: true,
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
this._objectsMemento.saveObjects(scene, mask);
|
|
545
549
|
this._cameraMemento.saveCamera(scene);
|
|
546
550
|
|
|
547
551
|
this.showStoreyObjects(storeyId, utils.apply(options, {
|
|
@@ -556,7 +560,7 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
556
560
|
format: format,
|
|
557
561
|
});
|
|
558
562
|
|
|
559
|
-
this._objectsMemento.restoreObjects(scene);
|
|
563
|
+
this._objectsMemento.restoreObjects(scene, mask);
|
|
560
564
|
this._cameraMemento.restoreCamera(scene);
|
|
561
565
|
|
|
562
566
|
return new StoreyMap(storeyId, src, format, width, height, padding);
|
|
@@ -693,9 +697,9 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
693
697
|
* @returns {String} ID of the storey containing the position, or null if the position falls outside all the storeys.
|
|
694
698
|
*/
|
|
695
699
|
getStoreyInVerticalRange(worldPos) {
|
|
696
|
-
for(let storeyId in this.storeys) {
|
|
700
|
+
for (let storeyId in this.storeys) {
|
|
697
701
|
const storey = this.storeys[storeyId];
|
|
698
|
-
const aabb = [0,0,0,0,0,0], pos = [0,0,0];
|
|
702
|
+
const aabb = [0, 0, 0, 0, 0, 0], pos = [0, 0, 0];
|
|
699
703
|
aabb[1] = storey.storeyAABB[1];
|
|
700
704
|
aabb[4] = storey.storeyAABB[4];
|
|
701
705
|
pos[1] = worldPos[1];
|
|
@@ -708,14 +712,14 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
708
712
|
|
|
709
713
|
/**
|
|
710
714
|
* Returns whether a position is above or below a building
|
|
711
|
-
*
|
|
715
|
+
*
|
|
712
716
|
* @param {Number[]} worldPos 3D World-space position.
|
|
713
717
|
* @returns {String} ID of the lowest/highest story or null.
|
|
714
718
|
*/
|
|
715
719
|
isPositionAboveOrBelowBuilding(worldPos) {
|
|
716
720
|
const keys = Object.keys(this.storeys);
|
|
717
|
-
const ids = [keys[0], keys[keys.length-1]];
|
|
718
|
-
if(worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
721
|
+
const ids = [keys[0], keys[keys.length - 1]];
|
|
722
|
+
if (worldPos[1] < this.storeys[ids[0]].storeyAABB[1])
|
|
719
723
|
return ids[0];
|
|
720
724
|
else if (worldPos[1] > this.storeys[ids[1]].storeyAABB[4])
|
|
721
725
|
return ids[1];
|
|
@@ -835,13 +839,30 @@ class StoreyViewsPlugin extends Plugin {
|
|
|
835
839
|
} else {
|
|
836
840
|
idx = 2;
|
|
837
841
|
}
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
842
|
+
const metaScene = this.viewer.metaScene;
|
|
843
|
+
const storey1MetaObject = metaScene.metaObjects[storey1.storeyId];
|
|
844
|
+
const storey2MetaObject = metaScene.metaObjects[storey2.storeyId];
|
|
845
|
+
|
|
846
|
+
if (storey1MetaObject && (storey1MetaObject.attributes && storey1MetaObject.attributes.elevation !== undefined) &&
|
|
847
|
+
storey2MetaObject && (storey2MetaObject.attributes && storey2MetaObject.attributes.elevation !== undefined)) {
|
|
848
|
+
const elevation1 = storey1MetaObject.attributes.elevation;
|
|
849
|
+
const elevation2 = storey2MetaObject.attributes.elevation;
|
|
850
|
+
if (elevation1 > elevation2) {
|
|
851
|
+
return -1;
|
|
852
|
+
}
|
|
853
|
+
if (elevation1 < elevation2) {
|
|
854
|
+
return 1;
|
|
855
|
+
}
|
|
856
|
+
return 0;
|
|
857
|
+
} else {
|
|
858
|
+
if (storey1.aabb[idx] > storey2.aabb[idx]) {
|
|
859
|
+
return -1;
|
|
860
|
+
}
|
|
861
|
+
if (storey1.aabb[idx] < storey2.aabb[idx]) {
|
|
862
|
+
return 1;
|
|
863
|
+
}
|
|
864
|
+
return 0;
|
|
843
865
|
}
|
|
844
|
-
return 0;
|
|
845
866
|
});
|
|
846
867
|
}
|
|
847
868
|
}
|