@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/dist/xeokit-sdk.cjs.js +136 -124
- package/dist/xeokit-sdk.es.js +136 -124
- package/dist/xeokit-sdk.es5.js +63 -64
- package/dist/xeokit-sdk.min.cjs.js +5 -5
- package/dist/xeokit-sdk.min.es.js +4 -4
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/extras/ContextMenu/ContextMenu.js +21 -0
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +47 -52
- package/src/plugins/BCFViewpointsPlugin/BCFViewpointsPlugin.js +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +22 -23
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +40 -47
- package/src/viewer/scene/mesh/occlusion/OcclusionRenderer.js +4 -0
- package/src/viewer/scene/model/SceneModelTransform.js +1 -1
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsControl.d.ts +9 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.d.ts +1 -2
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsPlugin.d.ts +4 -0
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.d.ts +92 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +1 -1
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.d.ts +13 -2
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.d.ts +70 -0
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -812,6 +812,27 @@ class ContextMenu {
|
|
|
812
812
|
self._updateItemsEnabledStatus();
|
|
813
813
|
}
|
|
814
814
|
});
|
|
815
|
+
item.itemElement.addEventListener("mouseup", (event) => {
|
|
816
|
+
if (event.which !== 3) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
event.preventDefault();
|
|
820
|
+
if (!self._context) {
|
|
821
|
+
return;
|
|
822
|
+
}
|
|
823
|
+
if (item.enabled === false) {
|
|
824
|
+
return;
|
|
825
|
+
}
|
|
826
|
+
if (item.doAction) {
|
|
827
|
+
item.doAction(self._context);
|
|
828
|
+
}
|
|
829
|
+
if (this._hideOnAction) {
|
|
830
|
+
self.hide();
|
|
831
|
+
} else {
|
|
832
|
+
self._updateItemsTitles();
|
|
833
|
+
self._updateItemsEnabledStatus();
|
|
834
|
+
}
|
|
835
|
+
});
|
|
815
836
|
item.itemElement.addEventListener("mouseenter", (event) => {
|
|
816
837
|
event.preventDefault();
|
|
817
838
|
if (item.enabled === false) {
|
|
@@ -13065,8 +13086,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13065
13086
|
this._onCanvasTouchStart = null;
|
|
13066
13087
|
this._onCanvasTouchEnd = null;
|
|
13067
13088
|
this._longTouchTimeoutMs = 300;
|
|
13068
|
-
this.
|
|
13069
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
13089
|
+
this._snapping = cfg.snapping !== false;
|
|
13070
13090
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13071
13091
|
|
|
13072
13092
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
@@ -13096,39 +13116,35 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13096
13116
|
}
|
|
13097
13117
|
|
|
13098
13118
|
/**
|
|
13099
|
-
* Sets whether snap-to-vertex
|
|
13100
|
-
*
|
|
13101
|
-
* @param snapToVertex
|
|
13102
|
-
*/
|
|
13103
|
-
set snapToVertex(snapToVertex) {
|
|
13104
|
-
this._snapToVertex = snapToVertex;
|
|
13105
|
-
}
|
|
13106
|
-
|
|
13107
|
-
/**
|
|
13108
|
-
* Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
|
|
13109
|
-
* This is `true` by default.
|
|
13110
|
-
* @returns {*}
|
|
13111
|
-
*/
|
|
13112
|
-
get snapToVertex() {
|
|
13113
|
-
return this._snapToVertex;
|
|
13114
|
-
}
|
|
13115
|
-
|
|
13116
|
-
/**
|
|
13117
|
-
* Sets whether snap-to-edge is enabled for this AngleMeasurementsTouchControl.
|
|
13119
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13120
|
+
*
|
|
13118
13121
|
* This is `true` by default.
|
|
13119
|
-
*
|
|
13122
|
+
*
|
|
13123
|
+
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
13124
|
+
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
13125
|
+
* and rebinds various input handlers.
|
|
13126
|
+
*
|
|
13127
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
13120
13128
|
*/
|
|
13121
|
-
set
|
|
13122
|
-
this.
|
|
13129
|
+
set snapping(snapping) {
|
|
13130
|
+
if (snapping !== this._snapping) {
|
|
13131
|
+
this._snapping = snapping;
|
|
13132
|
+
this.deactivate();
|
|
13133
|
+
this.activate();
|
|
13134
|
+
} else {
|
|
13135
|
+
this._snapping = snapping;
|
|
13136
|
+
}
|
|
13123
13137
|
}
|
|
13124
13138
|
|
|
13125
13139
|
/**
|
|
13126
|
-
* Gets whether snap-to-edge
|
|
13140
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13141
|
+
*
|
|
13127
13142
|
* This is `true` by default.
|
|
13128
|
-
*
|
|
13143
|
+
*
|
|
13144
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13129
13145
|
*/
|
|
13130
|
-
get
|
|
13131
|
-
return this.
|
|
13146
|
+
get snapping() {
|
|
13147
|
+
return this._snapping;
|
|
13132
13148
|
}
|
|
13133
13149
|
|
|
13134
13150
|
/**
|
|
@@ -13158,11 +13174,11 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13158
13174
|
|
|
13159
13175
|
let touchId = null;
|
|
13160
13176
|
|
|
13161
|
-
const
|
|
13177
|
+
const disableCameraNavigation = () => {
|
|
13162
13178
|
this.plugin.viewer.cameraControl.active = false;
|
|
13163
13179
|
};
|
|
13164
13180
|
|
|
13165
|
-
const
|
|
13181
|
+
const enableCameraNavigation = () => {
|
|
13166
13182
|
this.plugin.viewer.cameraControl.active = true;
|
|
13167
13183
|
};
|
|
13168
13184
|
|
|
@@ -13175,7 +13191,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13175
13191
|
this._currentAngleMeasurement.destroy();
|
|
13176
13192
|
this._currentAngleMeasurement = null;
|
|
13177
13193
|
}
|
|
13178
|
-
|
|
13194
|
+
enableCameraNavigation();
|
|
13179
13195
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13180
13196
|
};
|
|
13181
13197
|
|
|
@@ -13207,8 +13223,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13207
13223
|
}
|
|
13208
13224
|
const snapPickResult = scene.pick({
|
|
13209
13225
|
canvasPos: touchMoveCanvasPos,
|
|
13210
|
-
snapToVertex: this.
|
|
13211
|
-
snapToEdge: this.
|
|
13226
|
+
snapToVertex: this._snapping,
|
|
13227
|
+
snapToEdge: this._snapping
|
|
13212
13228
|
});
|
|
13213
13229
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13214
13230
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -13282,7 +13298,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13282
13298
|
// }
|
|
13283
13299
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;
|
|
13284
13300
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
13285
|
-
|
|
13301
|
+
disableCameraNavigation();
|
|
13286
13302
|
}, this._longTouchTimeoutMs);
|
|
13287
13303
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1;
|
|
13288
13304
|
//console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -13319,8 +13335,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13319
13335
|
|
|
13320
13336
|
const snapPickResult = scene.pick({
|
|
13321
13337
|
canvasPos: touchMoveCanvasPos,
|
|
13322
|
-
snapToVertex: this.
|
|
13323
|
-
snapToEdge: this.
|
|
13338
|
+
snapToVertex: this._snapping,
|
|
13339
|
+
snapToEdge: this._snapping
|
|
13324
13340
|
});
|
|
13325
13341
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13326
13342
|
if (this.pointerLens) {
|
|
@@ -13372,7 +13388,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13372
13388
|
this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
|
|
13373
13389
|
// console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
|
|
13374
13390
|
|
|
13375
|
-
|
|
13391
|
+
disableCameraNavigation();
|
|
13376
13392
|
|
|
13377
13393
|
}, this._longTouchTimeoutMs);
|
|
13378
13394
|
|
|
@@ -13412,8 +13428,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13412
13428
|
|
|
13413
13429
|
const snapPickResult = scene.pick({
|
|
13414
13430
|
canvasPos: touchMoveCanvasPos,
|
|
13415
|
-
snapToVertex: this.
|
|
13416
|
-
snapToEdge: this.
|
|
13431
|
+
snapToVertex: this._snapping,
|
|
13432
|
+
snapToEdge: this._snapping
|
|
13417
13433
|
});
|
|
13418
13434
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13419
13435
|
if (this.pointerLens) {
|
|
@@ -13465,7 +13481,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13465
13481
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END$1;
|
|
13466
13482
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
13467
13483
|
|
|
13468
|
-
|
|
13484
|
+
disableCameraNavigation();
|
|
13469
13485
|
|
|
13470
13486
|
}, this._longTouchTimeoutMs);
|
|
13471
13487
|
|
|
@@ -13526,8 +13542,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13526
13542
|
}
|
|
13527
13543
|
snapPickResult = scene.pick({
|
|
13528
13544
|
canvasPos: touchMoveCanvasPos,
|
|
13529
|
-
snapToVertex: this.
|
|
13530
|
-
snapToEdge: this.
|
|
13545
|
+
snapToVertex: this._snapping,
|
|
13546
|
+
snapToEdge: this._snapping
|
|
13531
13547
|
});
|
|
13532
13548
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
13533
13549
|
if (this.pointerLens) {
|
|
@@ -13575,8 +13591,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13575
13591
|
}
|
|
13576
13592
|
snapPickResult = scene.pick({
|
|
13577
13593
|
canvasPos: touchMoveCanvasPos,
|
|
13578
|
-
snapToVertex: this.
|
|
13579
|
-
snapToEdge: this.
|
|
13594
|
+
snapToVertex: this._snapping,
|
|
13595
|
+
snapToEdge: this._snapping
|
|
13580
13596
|
});
|
|
13581
13597
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13582
13598
|
if (this.pointerLens) {
|
|
@@ -13631,8 +13647,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13631
13647
|
}
|
|
13632
13648
|
snapPickResult = scene.pick({
|
|
13633
13649
|
canvasPos: touchMoveCanvasPos,
|
|
13634
|
-
snapToVertex: this.
|
|
13635
|
-
snapToEdge: this.
|
|
13650
|
+
snapToVertex: this._snapping,
|
|
13651
|
+
snapToEdge: this._snapping
|
|
13636
13652
|
});
|
|
13637
13653
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13638
13654
|
if (this.pointerLens) {
|
|
@@ -13744,7 +13760,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13744
13760
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13745
13761
|
}
|
|
13746
13762
|
}
|
|
13747
|
-
|
|
13763
|
+
enableCameraNavigation();
|
|
13748
13764
|
break;
|
|
13749
13765
|
|
|
13750
13766
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
@@ -13762,7 +13778,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13762
13778
|
this._touchState = WAITING_FOR_CORNER_TOUCH_START;
|
|
13763
13779
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
|
|
13764
13780
|
}
|
|
13765
|
-
|
|
13781
|
+
enableCameraNavigation();
|
|
13766
13782
|
break;
|
|
13767
13783
|
|
|
13768
13784
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
|
|
@@ -13799,7 +13815,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13799
13815
|
}
|
|
13800
13816
|
|
|
13801
13817
|
}
|
|
13802
|
-
|
|
13818
|
+
enableCameraNavigation();
|
|
13803
13819
|
break;
|
|
13804
13820
|
|
|
13805
13821
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
@@ -13808,7 +13824,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13808
13824
|
}
|
|
13809
13825
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START$1;
|
|
13810
13826
|
// console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13811
|
-
|
|
13827
|
+
enableCameraNavigation();
|
|
13812
13828
|
break;
|
|
13813
13829
|
|
|
13814
13830
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1: {
|
|
@@ -13844,7 +13860,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13844
13860
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13845
13861
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13846
13862
|
}
|
|
13847
|
-
|
|
13863
|
+
enableCameraNavigation();
|
|
13848
13864
|
break;
|
|
13849
13865
|
|
|
13850
13866
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
@@ -13865,7 +13881,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13865
13881
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13866
13882
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13867
13883
|
}
|
|
13868
|
-
|
|
13884
|
+
enableCameraNavigation();
|
|
13869
13885
|
break;
|
|
13870
13886
|
}
|
|
13871
13887
|
|
|
@@ -36432,6 +36448,10 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
|
|
|
36432
36448
|
const geometryState = mesh._geometry._state;
|
|
36433
36449
|
const origin = mesh.origin;
|
|
36434
36450
|
|
|
36451
|
+
if (materialState.alpha < 1.0) {
|
|
36452
|
+
return;
|
|
36453
|
+
}
|
|
36454
|
+
|
|
36435
36455
|
if (frameCtx.lastProgramId !== this._program.id) {
|
|
36436
36456
|
frameCtx.lastProgramId = this._program.id;
|
|
36437
36457
|
this._bindProgram(frameCtx);
|
|
@@ -80398,7 +80418,7 @@ class SceneModelTransform {
|
|
|
80398
80418
|
this._childTransforms.push(childTransform);
|
|
80399
80419
|
childTransform._parentTransform = this;
|
|
80400
80420
|
childTransform._transformDirty();
|
|
80401
|
-
childTransform.
|
|
80421
|
+
childTransform._setSubtreeAABBsDirty(this);
|
|
80402
80422
|
}
|
|
80403
80423
|
|
|
80404
80424
|
_addMesh(mesh) {
|
|
@@ -85622,7 +85642,7 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
85622
85642
|
const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
|
|
85623
85643
|
if (view_setup_hints) {
|
|
85624
85644
|
if (view_setup_hints.spaces_visible === false) {
|
|
85625
|
-
scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),
|
|
85645
|
+
scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
|
|
85626
85646
|
}
|
|
85627
85647
|
if (view_setup_hints.spaces_translucent !== undefined) {
|
|
85628
85648
|
scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
|
|
@@ -87054,7 +87074,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87054
87074
|
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87055
87075
|
* and rebinds various input handlers.
|
|
87056
87076
|
*
|
|
87057
|
-
* @param
|
|
87077
|
+
* @param snapping
|
|
87058
87078
|
*/
|
|
87059
87079
|
set snapping(snapping) {
|
|
87060
87080
|
if (snapping !== this._snapping) {
|
|
@@ -87070,13 +87090,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87070
87090
|
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87071
87091
|
*
|
|
87072
87092
|
* This is `true` by default.
|
|
87073
|
-
*
|
|
87074
|
-
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87093
|
+
* @returns {*}
|
|
87075
87094
|
*/
|
|
87076
87095
|
get snapping() {
|
|
87077
87096
|
return this._snapping;
|
|
87078
87097
|
}
|
|
87079
|
-
|
|
87098
|
+
|
|
87080
87099
|
/**
|
|
87081
87100
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
87082
87101
|
*/
|
|
@@ -87111,12 +87130,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87111
87130
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
87112
87131
|
|
|
87113
87132
|
const pagePos = math.vec2();
|
|
87114
|
-
|
|
87133
|
+
|
|
87115
87134
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
87116
87135
|
this._snapping
|
|
87117
87136
|
? "hoverSnapOrSurface"
|
|
87118
87137
|
: "hoverSurface", event => {
|
|
87119
|
-
|
|
87138
|
+
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87120
87139
|
mouseHovering = true;
|
|
87121
87140
|
pointerWorldPos.set(event.worldPos);
|
|
87122
87141
|
pointerCanvasPos.set(event.canvasPos);
|
|
@@ -87144,7 +87163,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87144
87163
|
} else {
|
|
87145
87164
|
if (this.pointerLens) {
|
|
87146
87165
|
this.pointerLens.visible = true;
|
|
87147
|
-
this.pointerLens.canvasPos =
|
|
87166
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87148
87167
|
this.pointerLens.snappedCanvasPos = event.canvasPos;
|
|
87149
87168
|
this.pointerLens.snapped = false;
|
|
87150
87169
|
}
|
|
@@ -87178,7 +87197,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87178
87197
|
pointerDownCanvasY = e.clientY;
|
|
87179
87198
|
});
|
|
87180
87199
|
|
|
87181
|
-
canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
|
|
87200
|
+
canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
|
|
87182
87201
|
if (e.which !== 1) {
|
|
87183
87202
|
return;
|
|
87184
87203
|
}
|
|
@@ -87233,21 +87252,21 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87233
87252
|
this._snapping
|
|
87234
87253
|
? "hoverSnapOrSurfaceOff"
|
|
87235
87254
|
: "hoverOff", event => {
|
|
87236
|
-
|
|
87237
|
-
|
|
87238
|
-
|
|
87239
|
-
|
|
87240
|
-
|
|
87241
|
-
|
|
87242
|
-
|
|
87243
|
-
|
|
87244
|
-
|
|
87245
|
-
|
|
87246
|
-
|
|
87247
|
-
|
|
87248
|
-
|
|
87249
|
-
|
|
87250
|
-
|
|
87255
|
+
if (this.pointerLens) {
|
|
87256
|
+
this.pointerLens.visible = true;
|
|
87257
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87258
|
+
this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87259
|
+
}
|
|
87260
|
+
mouseHovering = false;
|
|
87261
|
+
this._markerDiv.style.left = `-100px`;
|
|
87262
|
+
this._markerDiv.style.top = `-100px`;
|
|
87263
|
+
if (this._currentDistanceMeasurement) {
|
|
87264
|
+
this._currentDistanceMeasurement.wireVisible = false;
|
|
87265
|
+
this._currentDistanceMeasurement.targetVisible = false;
|
|
87266
|
+
this._currentDistanceMeasurement.axisVisible = false;
|
|
87267
|
+
}
|
|
87268
|
+
canvas.style.cursor = "default";
|
|
87269
|
+
});
|
|
87251
87270
|
|
|
87252
87271
|
this._active = true;
|
|
87253
87272
|
}
|
|
@@ -87922,8 +87941,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87922
87941
|
this._onCanvasTouchStart = null;
|
|
87923
87942
|
this._onCanvasTouchEnd = null;
|
|
87924
87943
|
this._longTouchTimeoutMs = 300;
|
|
87925
|
-
this.
|
|
87926
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
87944
|
+
this._snapping = cfg.snapping !== false;
|
|
87927
87945
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
87928
87946
|
|
|
87929
87947
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
@@ -87953,39 +87971,35 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87953
87971
|
}
|
|
87954
87972
|
|
|
87955
87973
|
/**
|
|
87956
|
-
* Sets whether snap-to-vertex
|
|
87957
|
-
*
|
|
87958
|
-
* @param snapToVertex
|
|
87959
|
-
*/
|
|
87960
|
-
set snapToVertex(snapToVertex) {
|
|
87961
|
-
this._snapToVertex = snapToVertex;
|
|
87962
|
-
}
|
|
87963
|
-
|
|
87964
|
-
/**
|
|
87965
|
-
* Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
|
|
87966
|
-
* This is `true` by default.
|
|
87967
|
-
* @returns {*}
|
|
87968
|
-
*/
|
|
87969
|
-
get snapToVertex() {
|
|
87970
|
-
return this._snapToVertex;
|
|
87971
|
-
}
|
|
87972
|
-
|
|
87973
|
-
/**
|
|
87974
|
-
* Sets whether snap-to-edge is enabled for this DistanceMeasurementsTouchControl.
|
|
87974
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87975
|
+
*
|
|
87975
87976
|
* This is `true` by default.
|
|
87976
|
-
*
|
|
87977
|
+
*
|
|
87978
|
+
* Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that
|
|
87979
|
+
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87980
|
+
* and rebinds various input handlers.
|
|
87981
|
+
*
|
|
87982
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.
|
|
87977
87983
|
*/
|
|
87978
|
-
set
|
|
87979
|
-
this.
|
|
87984
|
+
set snapping(snapping) {
|
|
87985
|
+
if (snapping !== this._snapping) {
|
|
87986
|
+
this._snapping = snapping;
|
|
87987
|
+
this.deactivate();
|
|
87988
|
+
this.activate();
|
|
87989
|
+
} else {
|
|
87990
|
+
this._snapping = snapping;
|
|
87991
|
+
}
|
|
87980
87992
|
}
|
|
87981
87993
|
|
|
87982
87994
|
/**
|
|
87983
|
-
* Gets whether snap-to-edge
|
|
87995
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87996
|
+
*
|
|
87984
87997
|
* This is `true` by default.
|
|
87985
|
-
*
|
|
87998
|
+
*
|
|
87999
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87986
88000
|
*/
|
|
87987
|
-
get
|
|
87988
|
-
return this.
|
|
88001
|
+
get snapping() {
|
|
88002
|
+
return this._snapping;
|
|
87989
88003
|
}
|
|
87990
88004
|
|
|
87991
88005
|
/**
|
|
@@ -88015,11 +88029,11 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88015
88029
|
|
|
88016
88030
|
let touchId = null;
|
|
88017
88031
|
|
|
88018
|
-
const
|
|
88032
|
+
const disableCameraNavigation = () => {
|
|
88019
88033
|
this.plugin.viewer.cameraControl.active = false;
|
|
88020
88034
|
};
|
|
88021
88035
|
|
|
88022
|
-
const
|
|
88036
|
+
const enableCameraNavigation = () => {
|
|
88023
88037
|
this.plugin.viewer.cameraControl.active = true;
|
|
88024
88038
|
};
|
|
88025
88039
|
|
|
@@ -88032,7 +88046,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88032
88046
|
this._currentDistanceMeasurement.destroy();
|
|
88033
88047
|
this._currentDistanceMeasurement = null;
|
|
88034
88048
|
}
|
|
88035
|
-
|
|
88049
|
+
enableCameraNavigation();
|
|
88036
88050
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88037
88051
|
};
|
|
88038
88052
|
|
|
@@ -88064,8 +88078,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88064
88078
|
}
|
|
88065
88079
|
const snapPickResult = scene.pick({
|
|
88066
88080
|
canvasPos: touchMoveCanvasPos,
|
|
88067
|
-
|
|
88068
|
-
snapToEdge: this.
|
|
88081
|
+
snapping: this._snapping,
|
|
88082
|
+
snapToEdge: this._snapping
|
|
88069
88083
|
});
|
|
88070
88084
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88071
88085
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -88135,7 +88149,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88135
88149
|
// }
|
|
88136
88150
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
|
|
88137
88151
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
88138
|
-
|
|
88152
|
+
disableCameraNavigation();
|
|
88139
88153
|
}, this._longTouchTimeoutMs);
|
|
88140
88154
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
|
|
88141
88155
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -88173,8 +88187,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88173
88187
|
|
|
88174
88188
|
const snapPickResult = scene.pick({
|
|
88175
88189
|
canvasPos: touchMoveCanvasPos,
|
|
88176
|
-
snapToVertex: this.
|
|
88177
|
-
snapToEdge: this.
|
|
88190
|
+
snapToVertex: this._snapping,
|
|
88191
|
+
snapToEdge: this._snapping
|
|
88178
88192
|
});
|
|
88179
88193
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88180
88194
|
if (this.pointerLens) {
|
|
@@ -88218,7 +88232,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88218
88232
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
|
|
88219
88233
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
88220
88234
|
|
|
88221
|
-
|
|
88235
|
+
disableCameraNavigation();
|
|
88222
88236
|
|
|
88223
88237
|
}, this._longTouchTimeoutMs);
|
|
88224
88238
|
|
|
@@ -88278,10 +88292,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88278
88292
|
}
|
|
88279
88293
|
snapPickResult = scene.pick({
|
|
88280
88294
|
canvasPos: touchMoveCanvasPos,
|
|
88281
|
-
|
|
88282
|
-
|
|
88283
|
-
snapToVertex: this._snapToVertex,
|
|
88284
|
-
snapToEdge: this._snapToEdge
|
|
88295
|
+
snapToVertex: this._snapping,
|
|
88296
|
+
snapToEdge: this._snapping
|
|
88285
88297
|
});
|
|
88286
88298
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
88287
88299
|
if (this.pointerLens) {
|
|
@@ -88382,8 +88394,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88382
88394
|
}
|
|
88383
88395
|
snapPickResult = scene.pick({
|
|
88384
88396
|
canvasPos: touchMoveCanvasPos,
|
|
88385
|
-
snapToVertex: this.
|
|
88386
|
-
snapToEdge: this.
|
|
88397
|
+
snapToVertex: this._snapping,
|
|
88398
|
+
snapToEdge: this._snapping
|
|
88387
88399
|
});
|
|
88388
88400
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
88389
88401
|
if (this.pointerLens) {
|
|
@@ -88489,7 +88501,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88489
88501
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88490
88502
|
}
|
|
88491
88503
|
}
|
|
88492
|
-
|
|
88504
|
+
enableCameraNavigation();
|
|
88493
88505
|
break;
|
|
88494
88506
|
|
|
88495
88507
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
|
|
@@ -88507,7 +88519,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88507
88519
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88508
88520
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
88509
88521
|
}
|
|
88510
|
-
|
|
88522
|
+
enableCameraNavigation();
|
|
88511
88523
|
break;
|
|
88512
88524
|
|
|
88513
88525
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
|
|
@@ -88540,7 +88552,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88540
88552
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88541
88553
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88542
88554
|
}
|
|
88543
|
-
|
|
88555
|
+
enableCameraNavigation();
|
|
88544
88556
|
break;
|
|
88545
88557
|
|
|
88546
88558
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:
|
|
@@ -88561,7 +88573,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88561
88573
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88562
88574
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88563
88575
|
}
|
|
88564
|
-
|
|
88576
|
+
enableCameraNavigation();
|
|
88565
88577
|
break;
|
|
88566
88578
|
}
|
|
88567
88579
|
|