@xeokit/xeokit-sdk 2.6.50 → 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 +50 -37
- package/dist/xeokit-sdk.es.js +50 -37
- package/dist/xeokit-sdk.es5.js +126 -126
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +3 -3
- package/dist/xeokit-sdk.min.es5.js +3 -3
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +5 -5
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +5 -5
- package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +36 -15
- package/src/plugins/TreeViewPlugin/TreeViewPlugin.js +3 -3
- package/src/viewer/metadata/MetaModel.js +2 -2
- package/src/viewer/scene/model/SceneModel.js +1 -7
- package/types/plugins/TreeViewPlugin/renderService.d.ts +1 -1
package/package.json
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {math} from "../../viewer/scene/math/math.js";
|
|
2
|
+
import {transformToNode} from "../lib/ui/index.js";
|
|
2
3
|
import {AngleMeasurementsControl} from "./AngleMeasurementsControl.js";
|
|
3
4
|
|
|
4
5
|
const MOUSE_FINDING_ORIGIN = 0;
|
|
@@ -172,9 +173,6 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
172
173
|
const mouseHoverCanvasPos = math.vec2();
|
|
173
174
|
this._currentAngleMeasurement = null;
|
|
174
175
|
|
|
175
|
-
const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));
|
|
176
|
-
const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
|
|
177
|
-
|
|
178
176
|
const pagePos = math.vec2();
|
|
179
177
|
|
|
180
178
|
const hoverOn = event => {
|
|
@@ -209,8 +207,10 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
209
207
|
this.markerDiv.style.left = `${pagePos[0] - 5}px`;
|
|
210
208
|
this.markerDiv.style.top = `${pagePos[1] - 5}px`;
|
|
211
209
|
} else {
|
|
212
|
-
|
|
213
|
-
this.markerDiv.
|
|
210
|
+
const markerPos = math.vec2(canvasPos);
|
|
211
|
+
transformToNode(canvas, this.markerDiv.parentNode, markerPos);
|
|
212
|
+
this.markerDiv.style.left = `${markerPos[0] - 5}px`;
|
|
213
|
+
this.markerDiv.style.top = `${markerPos[1] - 5}px`;
|
|
214
214
|
}
|
|
215
215
|
break;
|
|
216
216
|
case MOUSE_FINDING_CORNER:
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {math} from "../../viewer/scene/math/math.js";
|
|
2
|
+
import {transformToNode} from "../lib/ui/index.js";
|
|
2
3
|
import {DistanceMeasurementsControl} from "./DistanceMeasurementsControl.js";
|
|
3
4
|
|
|
4
5
|
const MOUSE_FIRST_CLICK_EXPECTED = 0;
|
|
@@ -181,9 +182,6 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
181
182
|
|
|
182
183
|
this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
|
|
183
184
|
|
|
184
|
-
const getTop = el => el.offsetTop + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getTop(el.offsetParent));
|
|
185
|
-
const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
|
|
186
|
-
|
|
187
185
|
const pagePos = math.vec2();
|
|
188
186
|
|
|
189
187
|
const hoverOn = event => {
|
|
@@ -198,8 +196,10 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
198
196
|
this._markerDiv.style.left = `${pagePos[0] - 5}px`;
|
|
199
197
|
this._markerDiv.style.top = `${pagePos[1] - 5}px`;
|
|
200
198
|
} else {
|
|
201
|
-
|
|
202
|
-
this._markerDiv.
|
|
199
|
+
const markerPos = math.vec2(canvasPos);
|
|
200
|
+
transformToNode(canvas, this._markerDiv.parentNode, markerPos);
|
|
201
|
+
this._markerDiv.style.left = `${markerPos[0] - 5}px`;
|
|
202
|
+
this._markerDiv.style.top = `${markerPos[1] - 5}px`;
|
|
203
203
|
}
|
|
204
204
|
|
|
205
205
|
this._markerDiv.style.background = "pink";
|
|
@@ -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
|
}
|
|
@@ -984,7 +984,7 @@ export class TreeViewPlugin extends Plugin {
|
|
|
984
984
|
buildingNode = {
|
|
985
985
|
nodeId: `${this._id}-${objectId}`,
|
|
986
986
|
objectId: objectId,
|
|
987
|
-
title: (metaObject.metaModels.length === 0) ?
|
|
987
|
+
title: (metaObject.metaModels.length === 0) ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
|
|
988
988
|
type: metaObjectType,
|
|
989
989
|
parent: null,
|
|
990
990
|
numEntities: 0,
|
|
@@ -1087,7 +1087,7 @@ export class TreeViewPlugin extends Plugin {
|
|
|
1087
1087
|
rootNode = {
|
|
1088
1088
|
nodeId: `${this._id}-${objectId}`,
|
|
1089
1089
|
objectId: objectId,
|
|
1090
|
-
title: metaObject.metaModels.length === 0 ?
|
|
1090
|
+
title: metaObject.metaModels.length === 0 ? metaObjectName : this._rootNames[metaObject.metaModels[0].id] || ((metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType),
|
|
1091
1091
|
type: metaObjectType,
|
|
1092
1092
|
parent: null,
|
|
1093
1093
|
numEntities: 0,
|
|
@@ -1168,7 +1168,7 @@ export class TreeViewPlugin extends Plugin {
|
|
|
1168
1168
|
const node = {
|
|
1169
1169
|
nodeId: `${this._id}-${objectId}`,
|
|
1170
1170
|
objectId: objectId,
|
|
1171
|
-
title: (!parent) ? metaObject.metaModels.length === 0 ?
|
|
1171
|
+
title: (!parent) ? metaObject.metaModels.length === 0 ? metaObjectName : (this._rootNames[metaObject.metaModels[0].id] || metaObjectName) : (metaObjectName && metaObjectName !== "" && metaObjectName !== "Undefined" && metaObjectName !== "Default") ? metaObjectName : metaObjectType,
|
|
1172
1172
|
type: metaObjectType,
|
|
1173
1173
|
parent: parent,
|
|
1174
1174
|
numEntities: 0,
|
|
@@ -304,8 +304,8 @@ class MetaModel {
|
|
|
304
304
|
|
|
305
305
|
for (let modelId in metaScene.metaModels) {
|
|
306
306
|
const metaModel = metaScene.metaModels[modelId];
|
|
307
|
-
for (let
|
|
308
|
-
const metaObject = metaModel.metaObjects[
|
|
307
|
+
for (let objectId in metaModel.metaObjects) {
|
|
308
|
+
const metaObject = metaModel.metaObjects[objectId];
|
|
309
309
|
metaObject.metaModels.push(metaModel);
|
|
310
310
|
}
|
|
311
311
|
}
|
|
@@ -1562,13 +1562,7 @@ export class SceneModel extends Component {
|
|
|
1562
1562
|
*/
|
|
1563
1563
|
set matrix(value) {
|
|
1564
1564
|
this._matrix.set(value || DEFAULT_MATRIX);
|
|
1565
|
-
|
|
1566
|
-
math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrix);
|
|
1567
|
-
math.conjugateQuaternion(this._quaternion, this._conjugateQuaternion);
|
|
1568
|
-
math.quaternionToRotationMat4(this._quaternion, this._worldRotationMatrixConjugate);
|
|
1569
|
-
this._matrix.set(this._worldRotationMatrix);
|
|
1570
|
-
math.translateMat4v(this._position, this._matrix);
|
|
1571
|
-
|
|
1565
|
+
math.decomposeMat4(this._matrix, this._position, this._quaternion, this._scale);
|
|
1572
1566
|
this._matrixDirty = false;
|
|
1573
1567
|
this._setWorldMatrixDirty();
|
|
1574
1568
|
this._sceneModelDirty();
|
|
@@ -107,7 +107,7 @@ export declare interface ITreeViewRenderService {
|
|
|
107
107
|
* @param nodeId {String} The node id.
|
|
108
108
|
* @param checked {Boolean} Whether the node is checked.
|
|
109
109
|
*/
|
|
110
|
-
setCheckbox(nodeId: string, checked: boolean): void;
|
|
110
|
+
setCheckbox(nodeId: string, checked: boolean, indeterminate?: boolean): void;
|
|
111
111
|
|
|
112
112
|
/**
|
|
113
113
|
* Sets the node's xrayed state.
|