@xeokit/xeokit-sdk 2.6.3 → 2.6.6

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xeokit/xeokit-sdk",
3
- "version": "2.6.3",
3
+ "version": "2.6.6",
4
4
  "description": "Web Programming Toolkit for 3D/2D BIM and AEC Graphics",
5
5
  "module": "./dist/xeokit-sdk.es.js",
6
6
  "main": "./dist/xeokit-sdk.cjs.js",
@@ -766,6 +766,27 @@ class ContextMenu {
766
766
  self._updateItemsEnabledStatus();
767
767
  }
768
768
  });
769
+ item.itemElement.addEventListener("mouseup", (event) => {
770
+ if (event.which !== 3) {
771
+ return;
772
+ }
773
+ event.preventDefault();
774
+ if (!self._context) {
775
+ return;
776
+ }
777
+ if (item.enabled === false) {
778
+ return;
779
+ }
780
+ if (item.doAction) {
781
+ item.doAction(self._context);
782
+ }
783
+ if (this._hideOnAction) {
784
+ self.hide();
785
+ } else {
786
+ self._updateItemsTitles();
787
+ self._updateItemsEnabledStatus();
788
+ }
789
+ });
769
790
  item.itemElement.addEventListener("mouseenter", (event) => {
770
791
  event.preventDefault();
771
792
  if (item.enabled === false) {
@@ -58,8 +58,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
58
58
  this._onCanvasTouchStart = null;
59
59
  this._onCanvasTouchEnd = null;
60
60
  this._longTouchTimeoutMs = 300;
61
- this._snapToEdge = cfg.snapToEdge !== false;
62
- this._snapToVertex = cfg.snapToVertex !== false;
61
+ this._snapping = cfg.snapping !== false;
63
62
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
64
63
 
65
64
  this._attachPlugin(angleMeasurementsPlugin, cfg);
@@ -89,39 +88,35 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
89
88
  }
90
89
 
91
90
  /**
92
- * Sets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
93
- * This is `true` by default.
94
- * @param snapToVertex
95
- */
96
- set snapToVertex(snapToVertex) {
97
- this._snapToVertex = snapToVertex;
98
- }
99
-
100
- /**
101
- * Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
102
- * This is `true` by default.
103
- * @returns {*}
104
- */
105
- get snapToVertex() {
106
- return this._snapToVertex;
107
- }
108
-
109
- /**
110
- * Sets whether snap-to-edge is enabled for this AngleMeasurementsTouchControl.
91
+ * Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
92
+ *
111
93
  * This is `true` by default.
112
- * @param snapToEdge
94
+ *
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
+ * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
113
100
  */
114
- set snapToEdge(snapToEdge) {
115
- this._snapToEdge = snapToEdge;
101
+ set snapping(snapping) {
102
+ if (snapping !== this._snapping) {
103
+ this._snapping = snapping;
104
+ this.deactivate();
105
+ this.activate();
106
+ } else {
107
+ this._snapping = snapping;
108
+ }
116
109
  }
117
110
 
118
111
  /**
119
- * Gets whether snap-to-edge is enabled for this AngleMeasurementsTouchControl.
112
+ * Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
113
+ *
120
114
  * This is `true` by default.
121
- * @returns {*}
115
+ *
116
+ * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
122
117
  */
123
- get snapToEdge() {
124
- return this._snapToEdge;
118
+ get snapping() {
119
+ return this._snapping;
125
120
  }
126
121
 
127
122
  /**
@@ -151,11 +146,11 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
151
146
 
152
147
  let touchId = null;
153
148
 
154
- const disableCameraMouseControl = () => {
149
+ const disableCameraNavigation = () => {
155
150
  this.plugin.viewer.cameraControl.active = false;
156
151
  }
157
152
 
158
- const enableCameraMouseControl = () => {
153
+ const enableCameraNavigation = () => {
159
154
  this.plugin.viewer.cameraControl.active = true;
160
155
  }
161
156
 
@@ -168,7 +163,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
168
163
  this._currentAngleMeasurement.destroy();
169
164
  this._currentAngleMeasurement = null;
170
165
  }
171
- enableCameraMouseControl();
166
+ enableCameraNavigation();
172
167
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
173
168
  }
174
169
 
@@ -200,8 +195,8 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
200
195
  }
201
196
  const snapPickResult = scene.pick({
202
197
  canvasPos: touchMoveCanvasPos,
203
- snapToVertex: this._snapToVertex,
204
- snapToEdge: this._snapToEdge
198
+ snapToVertex: this._snapping,
199
+ snapToEdge: this._snapping
205
200
  });
206
201
  if (snapPickResult && snapPickResult.snapped) {
207
202
  pointerWorldPos.set(snapPickResult.worldPos);
@@ -275,7 +270,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
275
270
  // }
276
271
  this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
277
272
  // console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
278
- disableCameraMouseControl();
273
+ disableCameraNavigation();
279
274
  }, this._longTouchTimeoutMs);
280
275
  this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
281
276
  //console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
@@ -312,8 +307,8 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
312
307
 
313
308
  const snapPickResult = scene.pick({
314
309
  canvasPos: touchMoveCanvasPos,
315
- snapToVertex: this._snapToVertex,
316
- snapToEdge: this._snapToEdge
310
+ snapToVertex: this._snapping,
311
+ snapToEdge: this._snapping
317
312
  });
318
313
  if (snapPickResult && snapPickResult.snapped) {
319
314
  if (this.pointerLens) {
@@ -365,7 +360,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
365
360
  this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
366
361
  // console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
367
362
 
368
- disableCameraMouseControl();
363
+ disableCameraNavigation();
369
364
 
370
365
  }, this._longTouchTimeoutMs);
371
366
 
@@ -405,8 +400,8 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
405
400
 
406
401
  const snapPickResult = scene.pick({
407
402
  canvasPos: touchMoveCanvasPos,
408
- snapToVertex: this._snapToVertex,
409
- snapToEdge: this._snapToEdge
403
+ snapToVertex: this._snapping,
404
+ snapToEdge: this._snapping
410
405
  });
411
406
  if (snapPickResult && snapPickResult.snapped) {
412
407
  if (this.pointerLens) {
@@ -458,7 +453,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
458
453
  this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
459
454
  // console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
460
455
 
461
- disableCameraMouseControl();
456
+ disableCameraNavigation();
462
457
 
463
458
  }, this._longTouchTimeoutMs);
464
459
 
@@ -519,8 +514,8 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
519
514
  }
520
515
  snapPickResult = scene.pick({
521
516
  canvasPos: touchMoveCanvasPos,
522
- snapToVertex: this._snapToVertex,
523
- snapToEdge: this._snapToEdge
517
+ snapToVertex: this._snapping,
518
+ snapToEdge: this._snapping
524
519
  });
525
520
  if (snapPickResult && (snapPickResult.snapped)) {
526
521
  if (this.pointerLens) {
@@ -568,8 +563,8 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
568
563
  }
569
564
  snapPickResult = scene.pick({
570
565
  canvasPos: touchMoveCanvasPos,
571
- snapToVertex: this._snapToVertex,
572
- snapToEdge: this._snapToEdge
566
+ snapToVertex: this._snapping,
567
+ snapToEdge: this._snapping
573
568
  });
574
569
  if (snapPickResult && snapPickResult.worldPos) {
575
570
  if (this.pointerLens) {
@@ -624,8 +619,8 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
624
619
  }
625
620
  snapPickResult = scene.pick({
626
621
  canvasPos: touchMoveCanvasPos,
627
- snapToVertex: this._snapToVertex,
628
- snapToEdge: this._snapToEdge
622
+ snapToVertex: this._snapping,
623
+ snapToEdge: this._snapping
629
624
  });
630
625
  if (snapPickResult && snapPickResult.worldPos) {
631
626
  if (this.pointerLens) {
@@ -740,7 +735,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
740
735
  // console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
741
736
  }
742
737
  }
743
- enableCameraMouseControl();
738
+ enableCameraNavigation();
744
739
  break;
745
740
 
746
741
  case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
@@ -758,7 +753,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
758
753
  this._touchState = WAITING_FOR_CORNER_TOUCH_START;
759
754
  // console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
760
755
  }
761
- enableCameraMouseControl();
756
+ enableCameraNavigation();
762
757
  break;
763
758
 
764
759
  case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
@@ -795,7 +790,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
795
790
  }
796
791
 
797
792
  }
798
- enableCameraMouseControl();
793
+ enableCameraNavigation();
799
794
  break;
800
795
 
801
796
  case WAITING_FOR_CORNER_LONG_TOUCH_END:
@@ -804,7 +799,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
804
799
  }
805
800
  this._touchState = WAITING_FOR_TARGET_TOUCH_START;
806
801
  // console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
807
- enableCameraMouseControl();
802
+ enableCameraNavigation();
808
803
  break;
809
804
 
810
805
  case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
@@ -840,7 +835,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
840
835
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
841
836
  // console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
842
837
  }
843
- enableCameraMouseControl();
838
+ enableCameraNavigation();
844
839
  break;
845
840
 
846
841
  case WAITING_FOR_TARGET_LONG_TOUCH_END:
@@ -861,7 +856,7 @@ export class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
861
856
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
862
857
  // console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
863
858
  }
864
- enableCameraMouseControl();
859
+ enableCameraNavigation();
865
860
  break;
866
861
  }
867
862
 
@@ -757,7 +757,7 @@ class BCFViewpointsPlugin extends Plugin {
757
757
  const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
758
758
  if (view_setup_hints) {
759
759
  if (view_setup_hints.spaces_visible === false) {
760
- scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
760
+ scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
761
761
  }
762
762
  if (view_setup_hints.spaces_translucent !== undefined) {
763
763
  scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
@@ -147,7 +147,7 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
147
147
  * it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
148
148
  * and rebinds various input handlers.
149
149
  *
150
- * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsMouseControl.
150
+ * @param snapping
151
151
  */
152
152
  set snapping(snapping) {
153
153
  if (snapping !== this._snapping) {
@@ -163,13 +163,12 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
163
163
  * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
164
164
  *
165
165
  * This is `true` by default.
166
- *
167
- * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
166
+ * @returns {*}
168
167
  */
169
168
  get snapping() {
170
169
  return this._snapping;
171
170
  }
172
-
171
+
173
172
  /**
174
173
  * Activates this DistanceMeasurementsMouseControl, ready to respond to input.
175
174
  */
@@ -204,12 +203,12 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
204
203
  const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
205
204
 
206
205
  const pagePos = math.vec2();
207
-
206
+
208
207
  this._onCameraControlHoverSnapOrSurface = cameraControl.on(
209
208
  this._snapping
210
209
  ? "hoverSnapOrSurface"
211
210
  : "hoverSurface", event => {
212
- const canvasPos = event.snappedCanvasPos ||event.canvasPos;
211
+ const canvasPos = event.snappedCanvasPos || event.canvasPos;
213
212
  mouseHovering = true;
214
213
  pointerWorldPos.set(event.worldPos);
215
214
  pointerCanvasPos.set(event.canvasPos);
@@ -237,7 +236,7 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
237
236
  } else {
238
237
  if (this.pointerLens) {
239
238
  this.pointerLens.visible = true;
240
- this.pointerLens.canvasPos = event.canvasPos;
239
+ this.pointerLens.canvasPos = event.canvasPos;
241
240
  this.pointerLens.snappedCanvasPos = event.canvasPos;
242
241
  this.pointerLens.snapped = false;
243
242
  }
@@ -271,7 +270,7 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
271
270
  pointerDownCanvasY = e.clientY;
272
271
  });
273
272
 
274
- canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
273
+ canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
275
274
  if (e.which !== 1) {
276
275
  return;
277
276
  }
@@ -326,21 +325,21 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
326
325
  this._snapping
327
326
  ? "hoverSnapOrSurfaceOff"
328
327
  : "hoverOff", event => {
329
- if (this.pointerLens) {
330
- this.pointerLens.visible = true;
331
- this.pointerLens.canvasPos = event.canvasPos;
332
- this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
333
- }
334
- mouseHovering = false;
335
- this._markerDiv.style.left = `-100px`;
336
- this._markerDiv.style.top = `-100px`;
337
- if (this._currentDistanceMeasurement) {
338
- this._currentDistanceMeasurement.wireVisible = false;
339
- this._currentDistanceMeasurement.targetVisible = false;
340
- this._currentDistanceMeasurement.axisVisible = false;
341
- }
342
- canvas.style.cursor = "default";
343
- });
328
+ if (this.pointerLens) {
329
+ this.pointerLens.visible = true;
330
+ this.pointerLens.canvasPos = event.canvasPos;
331
+ this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
332
+ }
333
+ mouseHovering = false;
334
+ this._markerDiv.style.left = `-100px`;
335
+ this._markerDiv.style.top = `-100px`;
336
+ if (this._currentDistanceMeasurement) {
337
+ this._currentDistanceMeasurement.wireVisible = false;
338
+ this._currentDistanceMeasurement.targetVisible = false;
339
+ this._currentDistanceMeasurement.axisVisible = false;
340
+ }
341
+ canvas.style.cursor = "default";
342
+ });
344
343
 
345
344
  this._active = true;
346
345
  }
@@ -63,8 +63,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
63
63
  this._onCanvasTouchStart = null;
64
64
  this._onCanvasTouchEnd = null;
65
65
  this._longTouchTimeoutMs = 300;
66
- this._snapToEdge = cfg.snapToEdge !== false;
67
- this._snapToVertex = cfg.snapToVertex !== false;
66
+ this._snapping = cfg.snapping !== false;
68
67
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
69
68
 
70
69
  this._attachPlugin(distanceMeasurementsPlugin, cfg);
@@ -94,39 +93,35 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
94
93
  }
95
94
 
96
95
  /**
97
- * Sets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
98
- * This is `true` by default.
99
- * @param snapToVertex
100
- */
101
- set snapToVertex(snapToVertex) {
102
- this._snapToVertex = snapToVertex;
103
- }
104
-
105
- /**
106
- * Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
107
- * This is `true` by default.
108
- * @returns {*}
109
- */
110
- get snapToVertex() {
111
- return this._snapToVertex;
112
- }
113
-
114
- /**
115
- * Sets whether snap-to-edge is enabled for this DistanceMeasurementsTouchControl.
96
+ * Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
97
+ *
116
98
  * This is `true` by default.
117
- * @param snapToEdge
99
+ *
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
+ * @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.
118
105
  */
119
- set snapToEdge(snapToEdge) {
120
- this._snapToEdge = snapToEdge;
106
+ set snapping(snapping) {
107
+ if (snapping !== this._snapping) {
108
+ this._snapping = snapping;
109
+ this.deactivate();
110
+ this.activate();
111
+ } else {
112
+ this._snapping = snapping;
113
+ }
121
114
  }
122
115
 
123
116
  /**
124
- * Gets whether snap-to-edge is enabled for this DistanceMeasurementsTouchControl.
117
+ * Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
118
+ *
125
119
  * This is `true` by default.
126
- * @returns {*}
120
+ *
121
+ * @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
127
122
  */
128
- get snapToEdge() {
129
- return this._snapToEdge;
123
+ get snapping() {
124
+ return this._snapping;
130
125
  }
131
126
 
132
127
  /**
@@ -156,11 +151,11 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
156
151
 
157
152
  let touchId = null;
158
153
 
159
- const disableCameraMouseControl = () => {
154
+ const disableCameraNavigation = () => {
160
155
  this.plugin.viewer.cameraControl.active = false;
161
156
  }
162
157
 
163
- const enableCameraMouseControl = () => {
158
+ const enableCameraNavigation = () => {
164
159
  this.plugin.viewer.cameraControl.active = true;
165
160
  }
166
161
 
@@ -173,7 +168,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
173
168
  this._currentDistanceMeasurement.destroy();
174
169
  this._currentDistanceMeasurement = null;
175
170
  }
176
- enableCameraMouseControl();
171
+ enableCameraNavigation();
177
172
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
178
173
  }
179
174
 
@@ -205,8 +200,8 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
205
200
  }
206
201
  const snapPickResult = scene.pick({
207
202
  canvasPos: touchMoveCanvasPos,
208
- snapToVertex: this._snapToVertex,
209
- snapToEdge: this._snapToEdge
203
+ snapping: this._snapping,
204
+ snapToEdge: this._snapping
210
205
  });
211
206
  if (snapPickResult && snapPickResult.snapped) {
212
207
  pointerWorldPos.set(snapPickResult.worldPos);
@@ -276,7 +271,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
276
271
  // }
277
272
  this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
278
273
  // console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
279
- disableCameraMouseControl();
274
+ disableCameraNavigation();
280
275
  }, this._longTouchTimeoutMs);
281
276
  this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
282
277
  // console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
@@ -314,8 +309,8 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
314
309
 
315
310
  const snapPickResult = scene.pick({
316
311
  canvasPos: touchMoveCanvasPos,
317
- snapToVertex: this._snapToVertex,
318
- snapToEdge: this._snapToEdge
312
+ snapToVertex: this._snapping,
313
+ snapToEdge: this._snapping
319
314
  });
320
315
  if (snapPickResult && snapPickResult.snapped) {
321
316
  if (this.pointerLens) {
@@ -359,7 +354,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
359
354
  this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
360
355
  // console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
361
356
 
362
- disableCameraMouseControl();
357
+ disableCameraNavigation();
363
358
 
364
359
  }, this._longTouchTimeoutMs);
365
360
 
@@ -419,10 +414,8 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
419
414
  }
420
415
  snapPickResult = scene.pick({
421
416
  canvasPos: touchMoveCanvasPos,
422
-
423
-
424
- snapToVertex: this._snapToVertex,
425
- snapToEdge: this._snapToEdge
417
+ snapToVertex: this._snapping,
418
+ snapToEdge: this._snapping
426
419
  });
427
420
  if (snapPickResult && (snapPickResult.snapped)) {
428
421
  if (this.pointerLens) {
@@ -523,8 +516,8 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
523
516
  }
524
517
  snapPickResult = scene.pick({
525
518
  canvasPos: touchMoveCanvasPos,
526
- snapToVertex: this._snapToVertex,
527
- snapToEdge: this._snapToEdge
519
+ snapToVertex: this._snapping,
520
+ snapToEdge: this._snapping
528
521
  });
529
522
  if (snapPickResult && snapPickResult.worldPos) {
530
523
  if (this.pointerLens) {
@@ -633,7 +626,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
633
626
  // console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
634
627
  }
635
628
  }
636
- enableCameraMouseControl();
629
+ enableCameraNavigation();
637
630
  break;
638
631
 
639
632
  case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
@@ -651,7 +644,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
651
644
  this._touchState = WAITING_FOR_TARGET_TOUCH_START;
652
645
  // console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
653
646
  }
654
- enableCameraMouseControl();
647
+ enableCameraNavigation();
655
648
  break;
656
649
 
657
650
  case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
@@ -684,7 +677,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
684
677
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
685
678
  // console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
686
679
  }
687
- enableCameraMouseControl();
680
+ enableCameraNavigation();
688
681
  break;
689
682
 
690
683
  case WAITING_FOR_TARGET_LONG_TOUCH_END:
@@ -705,7 +698,7 @@ export class DistanceMeasurementsTouchControl extends DistanceMeasurementsContro
705
698
  this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
706
699
  // console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
707
700
  }
708
- enableCameraMouseControl();
701
+ enableCameraNavigation();
709
702
  break;
710
703
  }
711
704
 
@@ -73,6 +73,10 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
73
73
  const geometryState = mesh._geometry._state;
74
74
  const origin = mesh.origin;
75
75
 
76
+ if (materialState.alpha < 1.0) {
77
+ return;
78
+ }
79
+
76
80
  if (frameCtx.lastProgramId !== this._program.id) {
77
81
  frameCtx.lastProgramId = this._program.id;
78
82
  this._bindProgram(frameCtx);
@@ -67,7 +67,7 @@ export class SceneModelTransform {
67
67
  this._childTransforms.push(childTransform);
68
68
  childTransform._parentTransform = this;
69
69
  childTransform._transformDirty();
70
- childTransform._setAABBDirty();
70
+ childTransform._setSubtreeAABBsDirty(this);
71
71
  }
72
72
 
73
73
  _addMesh(mesh) {
@@ -8,6 +8,7 @@ import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin";
8
8
  * Once the AngleMeasurementControl is activated, the first click on any {@link Entity} begins constructing a {@link AngleMeasurement}, fixing its origin to that Entity. The next click on any Entity will complete the AngleMeasurement, fixing its target to that second Entity. The AngleMeasurementControl will then wait for the next click on any Entity, to begin constructing another AngleMeasurement, and so on, until deactivated.
9
9
  */
10
10
  export declare class AngleMeasurementsControl extends Component {
11
+
11
12
  /**
12
13
  * The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsControl.
13
14
  * @type {AngleMeasurementsPlugin}
@@ -86,4 +87,12 @@ export declare class AngleMeasurementsControl extends Component {
86
87
  * @param scope Scope for the callback
87
88
  */
88
89
  on(event: "measurementStart", callback: (measurement: AngleMeasurement) => void, scope?: any): string
90
+
91
+ /**
92
+ * Fires when the control is (de)activated
93
+ * @param event The activation event
94
+ * @param callback Called fired on the event
95
+ * @param scope Scope for the callback
96
+ */
97
+ on(event: "activated", callback: (activated: boolean) => void, scope?: any): string
89
98
  }
@@ -1,7 +1,6 @@
1
1
  import { AngleMeasurementsControl } from "./AngleMeasurementsControl.js";
2
- import { math } from "../../viewer/scene/math/math.js";
3
2
  import {AngleMeasurementsPlugin} from "./AngleMeasurementsPlugin";
4
- import {PointerLens} from "../../extras/PointerLens/PointerLens";
3
+ import {PointerLens} from "../../extras/";
5
4
 
6
5
  /**
7
6
  * Creates {@link AngleMeasurement}s in an {@link AngleMeasurementsPlugin} from mouse input.
@@ -3,12 +3,16 @@ import { AngleMeasurement } from "./AngleMeasurement";
3
3
  import { AngleMeasurementsControl } from "./AngleMeasurementsControl";
4
4
 
5
5
  export declare type AngleMeasurementsPluginConfiguration = {
6
+
6
7
  /** Optional ID for this plugin, so that we can find it within {@link Viewer.plugins}. */
7
8
  id?: string;
9
+
8
10
  /** Container DOM element for markers and labels. Defaults to ````document.body````. */
9
11
  container?: HTMLElement;
12
+
10
13
  /** The default color of the dots, wire and label. */
11
14
  defaultColor?: string;
15
+
12
16
  /** If set, the wires, dots and labels will have this zIndex (+1 for dots and +2 for labels). */
13
17
  zIndex?: number;
14
18
  };