@xeokit/xeokit-sdk 2.6.28 → 2.6.30
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/README.md +1 -0
- package/dist/xeokit-sdk.cjs.js +1425 -649
- package/dist/xeokit-sdk.es.js +1420 -650
- package/dist/xeokit-sdk.es5.js +629 -552
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +5 -5
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/extras/PointerCircle/PointerCircle.js +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +22 -41
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +3 -18
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +20 -41
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +4 -20
- package/src/plugins/DistanceMeasurementsPlugin/index.js +1 -1
- package/src/plugins/GLTFLoaderPlugin/GLTFLoaderPlugin.js +2 -110
- package/src/plugins/GLTFLoaderPlugin/GLTFSceneModelLoader.js +252 -222
- package/src/plugins/StoreyViewsPlugin/StoreyViewsPlugin.js +31 -1
- package/src/plugins/XKTLoaderPlugin/XKTLoaderPlugin.js +20 -8
- package/src/plugins/ZonesPlugin/ZonesPlugin.js +1939 -0
- package/src/plugins/ZonesPlugin/index.js +1 -1875
- package/src/viewer/Viewer.js +2 -2
- package/src/viewer/metadata/MetaScene.js +0 -2
- package/src/viewer/scene/math/MeshSurfaceArea.js +90 -0
- package/src/viewer/scene/math/MeshVolume.js +102 -0
- package/src/viewer/scene/math/index.js +3 -0
- package/src/viewer/scene/math/isTriangleMeshSolid.js +162 -0
- package/src/viewer/scene/math/math.js +8 -0
- package/src/viewer/scene/model/SceneModel.js +73 -34
- package/src/viewer/scene/model/SceneModelEntity.js +46 -1
- package/src/viewer/scene/model/SceneModelMesh.js +74 -1
- package/src/viewer/scene/model/SceneModelTextureSet.js +5 -0
- package/src/viewer/scene/model/dtx/lines/DTXLinesLayer.js +7 -1
- package/src/viewer/scene/model/dtx/triangles/DTXTrianglesLayer.js +77 -1
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapInitRenderer.js +8 -0
- package/src/viewer/scene/model/dtx/triangles/renderers/DTXTrianglesSnapRenderer.js +8 -0
- package/src/viewer/scene/model/vbo/VBORenderer.js +10 -1
- package/src/viewer/scene/model/vbo/batching/lines/VBOBatchingLinesLayer.js +6 -1
- package/src/viewer/scene/model/vbo/batching/lines/renderers/VBOBatchingLinesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/batching/points/VBOBatchingPointsLayer.js +6 -1
- package/src/viewer/scene/model/vbo/batching/triangles/VBOBatchingTrianglesLayer.js +59 -18
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/Renderers.js +40 -12
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesBatchingRenderer.js +2 -3
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesColorTextureRenderer.js +25 -7
- package/src/viewer/scene/model/vbo/batching/triangles/renderers/TrianglesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/lines/VBOInstancingLinesLayer.js +6 -1
- package/src/viewer/scene/model/vbo/instancing/lines/renderers/VBOInstancingLinesSnapRenderer.js +1 -1
- package/src/viewer/scene/model/vbo/instancing/points/VBOInstancingPointsLayer.js +6 -1
- package/src/viewer/scene/model/vbo/instancing/triangles/VBOInstancingTrianglesLayer.js +48 -14
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/Renderers.js +74 -47
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesColorTextureRenderer.js +29 -14
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesInstancingRenderer.js +5 -4
- package/src/viewer/scene/model/vbo/instancing/triangles/renderers/TrianglesSnapRenderer.js +1 -1
- package/src/viewer/scene/scene/Scene.js +16 -5
- package/src/viewer/scene/webgl/occlusion/OcclusionLayer.js +1 -1
- package/src/viewer/scene/webgl/occlusion/OcclusionTester.js +1 -5
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +7 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +26 -1
- package/types/plugins/DistanceMeasurementsPlugin/index.d.ts +3 -1
package/package.json
CHANGED
|
@@ -61,22 +61,13 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
61
61
|
this.pointerLens = cfg.pointerLens;
|
|
62
62
|
|
|
63
63
|
this._active = false;
|
|
64
|
-
this._mouseState = MOUSE_FINDING_ORIGIN;
|
|
65
64
|
|
|
66
65
|
this._currentAngleMeasurement = null;
|
|
67
66
|
|
|
68
|
-
// init markerDiv element (think about making its style configurable)
|
|
69
67
|
this._initMarkerDiv()
|
|
70
68
|
|
|
71
|
-
this._onMouseHoverSurface = null;
|
|
72
|
-
this._onHoverNothing = null;
|
|
73
|
-
this._onPickedNothing = null;
|
|
74
|
-
this._onPickedSurface = null;
|
|
75
|
-
|
|
76
|
-
this._onInputMouseDown = null;
|
|
77
|
-
this._onInputMouseUp = null;
|
|
78
|
-
|
|
79
69
|
this._snapping = cfg.snapping !== false;
|
|
70
|
+
this._mouseState = MOUSE_FINDING_ORIGIN;
|
|
80
71
|
|
|
81
72
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
82
73
|
}
|
|
@@ -141,20 +132,10 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
141
132
|
*
|
|
142
133
|
* This is `true` by default.
|
|
143
134
|
*
|
|
144
|
-
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
145
|
-
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
146
|
-
* and rebinds various input handlers.
|
|
147
|
-
*
|
|
148
135
|
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
149
136
|
*/
|
|
150
137
|
set snapping(snapping) {
|
|
151
|
-
|
|
152
|
-
this._snapping = snapping;
|
|
153
|
-
this.deactivate();
|
|
154
|
-
this.activate();
|
|
155
|
-
} else {
|
|
156
|
-
this._snapping = snapping;
|
|
157
|
-
}
|
|
138
|
+
this._snapping = snapping;
|
|
158
139
|
}
|
|
159
140
|
|
|
160
141
|
/**
|
|
@@ -198,11 +179,7 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
198
179
|
|
|
199
180
|
const pagePos = math.vec2();
|
|
200
181
|
|
|
201
|
-
|
|
202
|
-
this._snapping
|
|
203
|
-
? "hoverSnapOrSurface"
|
|
204
|
-
: "hoverSurface",
|
|
205
|
-
event => {
|
|
182
|
+
const hoverOn = event => {
|
|
206
183
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
207
184
|
if (pointerLens) {
|
|
208
185
|
pointerLens.visible = true;
|
|
@@ -264,7 +241,10 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
264
241
|
canvas.style.cursor = "pointer";
|
|
265
242
|
break;
|
|
266
243
|
}
|
|
267
|
-
|
|
244
|
+
};
|
|
245
|
+
this._onHoverSnapOrSurface = cameraControl.on("hoverSnapOrSurface", e => { if (this._snapping) hoverOn(e); });
|
|
246
|
+
this._onHoverSurface = cameraControl.on("hoverSurface", e => { if (! this._snapping) hoverOn(e); });
|
|
247
|
+
|
|
268
248
|
canvas.addEventListener('mousedown', this._onMouseDown = (e) => {
|
|
269
249
|
if (e.which !== 1) {
|
|
270
250
|
return;
|
|
@@ -352,11 +332,8 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
352
332
|
break;
|
|
353
333
|
}
|
|
354
334
|
});
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
? "hoverSnapOrSurfaceOff"
|
|
358
|
-
: "hoverOff",
|
|
359
|
-
event => {
|
|
335
|
+
|
|
336
|
+
const hoverOff = event => {
|
|
360
337
|
mouseHovering = false;
|
|
361
338
|
if (pointerLens) {
|
|
362
339
|
pointerLens.visible = true;
|
|
@@ -386,7 +363,10 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
386
363
|
}
|
|
387
364
|
canvas.style.cursor = "default";
|
|
388
365
|
}
|
|
389
|
-
|
|
366
|
+
};
|
|
367
|
+
this._onHoverSnapOrSurfaceOff = cameraControl.on("hoverSnapOrSurfaceOff", e => { if (this._snapping) hoverOff(e); });
|
|
368
|
+
this._onHoverOff = cameraControl.on("hoverOff", e => { if (! this._snapping) hoverOff(e); });
|
|
369
|
+
|
|
390
370
|
this._active = true;
|
|
391
371
|
}
|
|
392
372
|
|
|
@@ -399,22 +379,22 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
399
379
|
if (!this._active) {
|
|
400
380
|
return;
|
|
401
381
|
}
|
|
382
|
+
|
|
402
383
|
if (this.pointerLens) {
|
|
403
384
|
this.pointerLens.visible = false;
|
|
404
385
|
}
|
|
405
|
-
|
|
406
|
-
this._destroyMarkerDiv()
|
|
407
|
-
}
|
|
386
|
+
|
|
408
387
|
this.reset();
|
|
388
|
+
|
|
409
389
|
const canvas = this.scene.canvas.canvas;
|
|
410
390
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
411
391
|
canvas.removeEventListener("mouseup", this._onMouseUp);
|
|
412
392
|
const cameraControl = this.angleMeasurementsPlugin.viewer.cameraControl;
|
|
413
|
-
cameraControl.off(this.
|
|
414
|
-
cameraControl.off(this.
|
|
415
|
-
cameraControl.off(this.
|
|
416
|
-
cameraControl.off(this.
|
|
417
|
-
|
|
393
|
+
cameraControl.off(this._onHoverSnapOrSurface);
|
|
394
|
+
cameraControl.off(this._onHoverSurface);
|
|
395
|
+
cameraControl.off(this._onHoverSnapOrSurfaceOff);
|
|
396
|
+
cameraControl.off(this._onHoverOff);
|
|
397
|
+
|
|
418
398
|
this._active = false;
|
|
419
399
|
}
|
|
420
400
|
|
|
@@ -437,6 +417,7 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
437
417
|
this._currentAngleMeasurement.destroy();
|
|
438
418
|
this._currentAngleMeasurement = null;
|
|
439
419
|
}
|
|
420
|
+
|
|
440
421
|
this._mouseState = MOUSE_FINDING_ORIGIN;
|
|
441
422
|
}
|
|
442
423
|
|
|
@@ -55,8 +55,6 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
55
55
|
|
|
56
56
|
this._currentAngleMeasurement = null;
|
|
57
57
|
|
|
58
|
-
this._onCanvasTouchStart = null;
|
|
59
|
-
this._onCanvasTouchEnd = null;
|
|
60
58
|
this._longTouchTimeoutMs = 300;
|
|
61
59
|
this._snapping = cfg.snapping !== false;
|
|
62
60
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
@@ -92,20 +90,10 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
92
90
|
*
|
|
93
91
|
* This is `true` by default.
|
|
94
92
|
*
|
|
95
|
-
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
96
|
-
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
97
|
-
* and rebinds various input handlers.
|
|
98
|
-
*
|
|
99
93
|
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
100
94
|
*/
|
|
101
95
|
set snapping(snapping) {
|
|
102
|
-
|
|
103
|
-
this._snapping = snapping;
|
|
104
|
-
this.deactivate();
|
|
105
|
-
this.activate();
|
|
106
|
-
} else {
|
|
107
|
-
this._snapping = snapping;
|
|
108
|
-
}
|
|
96
|
+
this._snapping = snapping;
|
|
109
97
|
}
|
|
110
98
|
|
|
111
99
|
/**
|
|
@@ -878,14 +866,11 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
878
866
|
this.plugin.pointerLens.visible = false;
|
|
879
867
|
}
|
|
880
868
|
this.reset();
|
|
869
|
+
|
|
881
870
|
const canvas = this.plugin.viewer.scene.canvas.canvas;
|
|
882
871
|
canvas.removeEventListener("touchstart", this._onCanvasTouchStart);
|
|
883
872
|
canvas.removeEventListener("touchend", this._onCanvasTouchEnd);
|
|
884
|
-
|
|
885
|
-
this.angleMeasurementsPlugin.fire("measurementCancel", this._currentAngleMeasurement);
|
|
886
|
-
this._currentAngleMeasurement.destroy();
|
|
887
|
-
this._currentAngleMeasurement = null;
|
|
888
|
-
}
|
|
873
|
+
|
|
889
874
|
this._active = false;
|
|
890
875
|
this.plugin.viewer.cameraControl.active = true;
|
|
891
876
|
}
|
|
@@ -74,12 +74,6 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
74
74
|
|
|
75
75
|
this._initMarkerDiv()
|
|
76
76
|
|
|
77
|
-
this._onCameraControlHoverSnapOrSurface = null;
|
|
78
|
-
this._onCameraControlHoverSnapOrSurfaceOff = null;
|
|
79
|
-
this._onMouseDown = null;
|
|
80
|
-
this._onMouseUp = null;
|
|
81
|
-
this._onCanvasTouchStart = null;
|
|
82
|
-
this._onCanvasTouchEnd = null;
|
|
83
77
|
this._snapping = cfg.snapping !== false;
|
|
84
78
|
this._mouseState = MOUSE_FIRST_CLICK_EXPECTED;
|
|
85
79
|
|
|
@@ -143,20 +137,10 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
143
137
|
*
|
|
144
138
|
* This is `true` by default.
|
|
145
139
|
*
|
|
146
|
-
* Internally, this deactivates then activates the DistanceMeasurementsMouseControl when changed, which means that
|
|
147
|
-
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
148
|
-
* and rebinds various input handlers.
|
|
149
|
-
*
|
|
150
140
|
* @param snapping
|
|
151
141
|
*/
|
|
152
142
|
set snapping(snapping) {
|
|
153
|
-
|
|
154
|
-
this._snapping = snapping;
|
|
155
|
-
this.deactivate();
|
|
156
|
-
this.activate();
|
|
157
|
-
} else {
|
|
158
|
-
this._snapping = snapping;
|
|
159
|
-
}
|
|
143
|
+
this._snapping = snapping;
|
|
160
144
|
}
|
|
161
145
|
|
|
162
146
|
/**
|
|
@@ -168,7 +152,7 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
168
152
|
get snapping() {
|
|
169
153
|
return this._snapping;
|
|
170
154
|
}
|
|
171
|
-
|
|
155
|
+
|
|
172
156
|
/**
|
|
173
157
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
174
158
|
*/
|
|
@@ -203,11 +187,8 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
203
187
|
const getLeft = el => el.offsetLeft + (el.offsetParent && (el.offsetParent !== canvas.parentNode) && getLeft(el.offsetParent));
|
|
204
188
|
|
|
205
189
|
const pagePos = math.vec2();
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
this._snapping
|
|
209
|
-
? "hoverSnapOrSurface"
|
|
210
|
-
: "hoverSurface", event => {
|
|
190
|
+
|
|
191
|
+
const hoverOn = event => {
|
|
211
192
|
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
212
193
|
mouseHovering = true;
|
|
213
194
|
pointerWorldPos.set(event.worldPos);
|
|
@@ -260,7 +241,9 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
260
241
|
this._markerDiv.style.left = `-10000px`;
|
|
261
242
|
this._markerDiv.style.top = `-10000px`;
|
|
262
243
|
}
|
|
263
|
-
|
|
244
|
+
};
|
|
245
|
+
this._onHoverSnapOrSurface = cameraControl.on("hoverSnapOrSurface", e => { if (this._snapping) hoverOn(e); });
|
|
246
|
+
this._onHoverSurface = cameraControl.on("hoverSurface", e => { if (! this._snapping) hoverOn(e); });
|
|
264
247
|
|
|
265
248
|
canvas.addEventListener('mousedown', this._onMouseDown = (e) => {
|
|
266
249
|
if (e.which !== 1) {
|
|
@@ -321,10 +304,7 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
321
304
|
}
|
|
322
305
|
});
|
|
323
306
|
|
|
324
|
-
|
|
325
|
-
this._snapping
|
|
326
|
-
? "hoverSnapOrSurfaceOff"
|
|
327
|
-
: "hoverOff", event => {
|
|
307
|
+
const hoverOff = event => {
|
|
328
308
|
if (this.pointerLens) {
|
|
329
309
|
this.pointerLens.visible = true;
|
|
330
310
|
this.pointerLens.canvasPos = event.canvasPos;
|
|
@@ -339,7 +319,9 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
339
319
|
this._currentDistanceMeasurement.axisVisible = false;
|
|
340
320
|
}
|
|
341
321
|
canvas.style.cursor = "default";
|
|
342
|
-
|
|
322
|
+
};
|
|
323
|
+
this._onHoverSnapOrSurfaceOff = cameraControl.on("hoverSnapOrSurfaceOff", e => { if (this._snapping) hoverOff(e); });
|
|
324
|
+
this._onHoverOff = cameraControl.on("hoverOff", e => { if (! this._snapping) hoverOff(e); });
|
|
343
325
|
|
|
344
326
|
this._active = true;
|
|
345
327
|
}
|
|
@@ -353,27 +335,24 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
353
335
|
if (!this._active) {
|
|
354
336
|
return;
|
|
355
337
|
}
|
|
356
|
-
|
|
338
|
+
|
|
357
339
|
this.fire("activated", false);
|
|
358
340
|
|
|
359
341
|
if (this.pointerLens) {
|
|
360
342
|
this.pointerLens.visible = false;
|
|
361
343
|
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
// this.reset();
|
|
344
|
+
|
|
345
|
+
this.reset();
|
|
346
|
+
|
|
366
347
|
const canvas = this.scene.canvas.canvas;
|
|
367
348
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
368
349
|
canvas.removeEventListener("mouseup", this._onMouseUp);
|
|
369
350
|
const cameraControl = this.distanceMeasurementsPlugin.viewer.cameraControl;
|
|
370
|
-
cameraControl.off(this.
|
|
371
|
-
cameraControl.off(this.
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
// this._currentDistanceMeasurement = null;
|
|
376
|
-
// }
|
|
351
|
+
cameraControl.off(this._onHoverSnapOrSurface);
|
|
352
|
+
cameraControl.off(this._onHoverSurface);
|
|
353
|
+
cameraControl.off(this._onHoverSnapOrSurfaceOff);
|
|
354
|
+
cameraControl.off(this._onHoverOff);
|
|
355
|
+
|
|
377
356
|
this._active = false;
|
|
378
357
|
}
|
|
379
358
|
|
|
@@ -60,11 +60,8 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
|
|
|
60
60
|
targetVisible: null,
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
this._onCanvasTouchStart = null;
|
|
64
|
-
this._onCanvasTouchEnd = null;
|
|
65
63
|
this._longTouchTimeoutMs = 300;
|
|
66
64
|
this._snapping = cfg.snapping !== false;
|
|
67
|
-
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
68
65
|
|
|
69
66
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
70
67
|
}
|
|
@@ -97,20 +94,10 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
|
|
|
97
94
|
*
|
|
98
95
|
* This is `true` by default.
|
|
99
96
|
*
|
|
100
|
-
* Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that
|
|
101
|
-
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
102
|
-
* and rebinds various input handlers.
|
|
103
|
-
*
|
|
104
97
|
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.
|
|
105
98
|
*/
|
|
106
99
|
set snapping(snapping) {
|
|
107
|
-
|
|
108
|
-
this._snapping = snapping;
|
|
109
|
-
this.deactivate();
|
|
110
|
-
this.activate();
|
|
111
|
-
} else {
|
|
112
|
-
this._snapping = snapping;
|
|
113
|
-
}
|
|
100
|
+
this._snapping = snapping;
|
|
114
101
|
}
|
|
115
102
|
|
|
116
103
|
/**
|
|
@@ -725,14 +712,11 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
|
|
|
725
712
|
this.plugin.pointerLens.visible = false;
|
|
726
713
|
}
|
|
727
714
|
this.reset();
|
|
715
|
+
|
|
728
716
|
const canvas = this.plugin.viewer.scene.canvas.canvas;
|
|
729
717
|
canvas.removeEventListener("touchstart", this._onCanvasTouchStart);
|
|
730
718
|
canvas.removeEventListener("touchend", this._onCanvasTouchEnd);
|
|
731
|
-
|
|
732
|
-
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
|
|
733
|
-
this._currentDistanceMeasurement.destroy();
|
|
734
|
-
this._currentDistanceMeasurement = null;
|
|
735
|
-
}
|
|
719
|
+
|
|
736
720
|
this._active = false;
|
|
737
721
|
this.plugin.viewer.cameraControl.active = true;
|
|
738
722
|
}
|
|
@@ -748,12 +732,12 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
|
|
|
748
732
|
if (!this._active) {
|
|
749
733
|
return;
|
|
750
734
|
}
|
|
735
|
+
|
|
751
736
|
if (this._currentDistanceMeasurement) {
|
|
752
737
|
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
|
|
753
738
|
this._currentDistanceMeasurement.destroy();
|
|
754
739
|
this._currentDistanceMeasurement = null;
|
|
755
740
|
}
|
|
756
|
-
this._mouseState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
757
741
|
}
|
|
758
742
|
|
|
759
743
|
/**
|
|
@@ -7,7 +7,7 @@ import {Component} from "../../viewer/scene/Component.js";
|
|
|
7
7
|
import {math} from "../../viewer/scene/math/math.js";
|
|
8
8
|
import {activateDraggableDots} from "../../../src/plugins/lib/ui/index.js";
|
|
9
9
|
|
|
10
|
-
class DistanceMeasurementEditControl extends Component {
|
|
10
|
+
export class DistanceMeasurementEditControl extends Component {
|
|
11
11
|
|
|
12
12
|
/**
|
|
13
13
|
* Edits {@link DistanceMeasurement} with mouse and/or touch input.
|
|
@@ -306,8 +306,6 @@ class GLTFLoaderPlugin extends Plugin {
|
|
|
306
306
|
* @param {String} [params.metaModelSrc] Path to an optional metadata file, as an alternative to the ````metaModelJSON```` parameter.
|
|
307
307
|
* @param {*} [params.metaModelJSON] JSON model metadata, as an alternative to the ````metaModelSrc```` parameter.
|
|
308
308
|
* @param {{String:Object}} [params.objectDefaults] Map of initial default states for each loaded {@link Entity} that represents an object. Default value is {@link IFCObjectDefaults}.
|
|
309
|
-
* @param {String[]} [params.includeTypes] When loading metadata, only loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
310
|
-
* @param {String[]} [params.excludeTypes] When loading metadata, never loads objects that have {@link MetaObject}s with {@link MetaObject#type} values in this list.
|
|
311
309
|
* @param {Boolean} [params.edges=false] Whether or not xeokit renders the model with edges emphasized.
|
|
312
310
|
* @param {Number[]} [params.origin=[0,0,0]] The double-precision World-space origin of the model's coordinates.
|
|
313
311
|
* @param {Number[]} [params.position=[0,0,0]] The single-precision position, relative to ````origin````.
|
|
@@ -323,153 +321,47 @@ class GLTFLoaderPlugin extends Plugin {
|
|
|
323
321
|
* represent the returned model. Set false to always use vertex buffer objects (VBOs). Note that DTX is only applicable
|
|
324
322
|
* to non-textured triangle meshes, and that VBOs are always used for meshes that have textures, line segments, or point
|
|
325
323
|
* primitives. Only works while {@link DTX#enabled} is also ````true````.
|
|
326
|
-
* @param {
|
|
324
|
+
* @param {Boolean} [params.autoMetaModel] When supplied, creates a default MetaModel with a single MetaObject.
|
|
327
325
|
* @returns {Entity} Entity representing the model, which will have {@link Entity#isModel} set ````true```` and will be registered by {@link Entity#id} in {@link Scene#models}
|
|
328
326
|
*/
|
|
329
327
|
load(params = {}) {
|
|
330
|
-
|
|
331
328
|
if (params.id && this.viewer.scene.components[params.id]) {
|
|
332
329
|
this.error("Component with this ID already exists in viewer: " + params.id + " - will autogenerate this ID");
|
|
333
330
|
delete params.id;
|
|
334
331
|
}
|
|
335
|
-
|
|
336
332
|
const sceneModel = new SceneModel(this.viewer.scene, utils.apply(params, {
|
|
337
333
|
isModel: true,
|
|
338
334
|
dtxEnabled: params.dtxEnabled
|
|
339
335
|
}));
|
|
340
|
-
|
|
341
336
|
const modelId = sceneModel.id; // In case ID was auto-generated
|
|
342
|
-
|
|
343
337
|
if (!params.src && !params.gltf) {
|
|
344
338
|
this.error("load() param expected: src or gltf");
|
|
345
339
|
return sceneModel; // Return new empty model
|
|
346
340
|
}
|
|
347
|
-
|
|
348
341
|
if (params.metaModelSrc || params.metaModelJSON) {
|
|
349
|
-
|
|
350
|
-
const objectDefaults = params.objectDefaults || this._objectDefaults || IFCObjectDefaults;
|
|
351
|
-
|
|
352
342
|
const processMetaModelJSON = (metaModelJSON) => {
|
|
353
|
-
|
|
354
|
-
this.viewer.metaScene.createMetaModel(modelId, metaModelJSON, {
|
|
355
|
-
includeTypes: params.includeTypes,
|
|
356
|
-
excludeTypes: params.excludeTypes
|
|
357
|
-
});
|
|
358
|
-
|
|
343
|
+
this.viewer.metaScene.createMetaModel(modelId, metaModelJSON, {});
|
|
359
344
|
this.viewer.scene.canvas.spinner.processes--;
|
|
360
|
-
|
|
361
|
-
let includeTypes;
|
|
362
|
-
if (params.includeTypes) {
|
|
363
|
-
includeTypes = {};
|
|
364
|
-
for (let i = 0, len = params.includeTypes.length; i < len; i++) {
|
|
365
|
-
includeTypes[params.includeTypes[i]] = true;
|
|
366
|
-
}
|
|
367
|
-
}
|
|
368
|
-
|
|
369
|
-
let excludeTypes;
|
|
370
|
-
if (params.excludeTypes) {
|
|
371
|
-
excludeTypes = {};
|
|
372
|
-
if (!includeTypes) {
|
|
373
|
-
includeTypes = {};
|
|
374
|
-
}
|
|
375
|
-
for (let i = 0, len = params.excludeTypes.length; i < len; i++) {
|
|
376
|
-
includeTypes[params.excludeTypes[i]] = true;
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
params.readableGeometry = false;
|
|
381
|
-
|
|
382
|
-
params.handleGLTFNode = (modelId, glTFNode, actions) => {
|
|
383
|
-
|
|
384
|
-
const name = glTFNode.name;
|
|
385
|
-
|
|
386
|
-
if (!name) {
|
|
387
|
-
return true; // Continue descending this node subtree
|
|
388
|
-
}
|
|
389
|
-
|
|
390
|
-
const nodeId = name;
|
|
391
|
-
const metaObject = this.viewer.metaScene.metaObjects[nodeId];
|
|
392
|
-
const type = (metaObject ? metaObject.type : "DEFAULT") || "DEFAULT";
|
|
393
|
-
|
|
394
|
-
actions.createEntity = {
|
|
395
|
-
id: nodeId,
|
|
396
|
-
isObject: true // Registers the Entity in Scene#objects
|
|
397
|
-
};
|
|
398
|
-
|
|
399
|
-
const props = objectDefaults[type];
|
|
400
|
-
|
|
401
|
-
if (props) { // Set Entity's initial rendering state for recognized type
|
|
402
|
-
|
|
403
|
-
if (props.visible === false) {
|
|
404
|
-
actions.createEntity.visible = false;
|
|
405
|
-
}
|
|
406
|
-
|
|
407
|
-
if (props.colorize) {
|
|
408
|
-
actions.createEntity.colorize = props.colorize;
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
if (props.pickable === false) {
|
|
412
|
-
actions.createEntity.pickable = false;
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
if (props.opacity !== undefined && props.opacity !== null) {
|
|
416
|
-
actions.createEntity.opacity = props.opacity;
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
return true; // Continue descending this glTF node subtree
|
|
421
|
-
};
|
|
422
|
-
|
|
423
345
|
if (params.src) {
|
|
424
346
|
this._sceneModelLoader.load(this, params.src, metaModelJSON, params, sceneModel);
|
|
425
347
|
} else {
|
|
426
348
|
this._sceneModelLoader.parse(this, params.gltf, metaModelJSON, params, sceneModel);
|
|
427
349
|
}
|
|
428
350
|
};
|
|
429
|
-
|
|
430
351
|
if (params.metaModelSrc) {
|
|
431
|
-
|
|
432
352
|
const metaModelSrc = params.metaModelSrc;
|
|
433
|
-
|
|
434
353
|
this.viewer.scene.canvas.spinner.processes++;
|
|
435
|
-
|
|
436
354
|
this._dataSource.getMetaModel(metaModelSrc, (metaModelJSON) => {
|
|
437
|
-
|
|
438
355
|
this.viewer.scene.canvas.spinner.processes--;
|
|
439
|
-
|
|
440
356
|
processMetaModelJSON(metaModelJSON);
|
|
441
|
-
|
|
442
357
|
}, (errMsg) => {
|
|
443
358
|
this.error(`load(): Failed to load model metadata for model '${modelId} from '${metaModelSrc}' - ${errMsg}`);
|
|
444
359
|
this.viewer.scene.canvas.spinner.processes--;
|
|
445
360
|
});
|
|
446
|
-
|
|
447
361
|
} else if (params.metaModelJSON) {
|
|
448
|
-
|
|
449
362
|
processMetaModelJSON(params.metaModelJSON);
|
|
450
363
|
}
|
|
451
|
-
|
|
452
364
|
} else {
|
|
453
|
-
|
|
454
|
-
params.handleGLTFNode = (modelId, glTFNode, actions) => {
|
|
455
|
-
|
|
456
|
-
const name = glTFNode.name;
|
|
457
|
-
|
|
458
|
-
if (!name) {
|
|
459
|
-
return true; // Continue descending this node subtree
|
|
460
|
-
}
|
|
461
|
-
|
|
462
|
-
const id = name;
|
|
463
|
-
|
|
464
|
-
actions.createEntity = { // Create an Entity for this glTF scene node
|
|
465
|
-
id: id,
|
|
466
|
-
isObject: true // Registers the Entity in Scene#objects
|
|
467
|
-
};
|
|
468
|
-
|
|
469
|
-
return true; // Continue descending this glTF node subtree
|
|
470
|
-
};
|
|
471
|
-
|
|
472
|
-
|
|
473
365
|
if (params.src) {
|
|
474
366
|
this._sceneModelLoader.load(this, params.src, null, params, sceneModel);
|
|
475
367
|
} else {
|