@xeokit/xeokit-sdk 2.6.5 → 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 +110 -123
- package/dist/xeokit-sdk.es.js +110 -123
- package/dist/xeokit-sdk.es5.js +60 -61
- 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/plugins/AngleMeasurementsPlugin/AngleMeasurementsTouchControl.js +47 -52
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +22 -23
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsTouchControl.js +40 -47
- 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.es.js
CHANGED
|
@@ -13082,8 +13082,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13082
13082
|
this._onCanvasTouchStart = null;
|
|
13083
13083
|
this._onCanvasTouchEnd = null;
|
|
13084
13084
|
this._longTouchTimeoutMs = 300;
|
|
13085
|
-
this.
|
|
13086
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
13085
|
+
this._snapping = cfg.snapping !== false;
|
|
13087
13086
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13088
13087
|
|
|
13089
13088
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
@@ -13113,39 +13112,35 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13113
13112
|
}
|
|
13114
13113
|
|
|
13115
13114
|
/**
|
|
13116
|
-
* Sets whether snap-to-vertex
|
|
13117
|
-
*
|
|
13118
|
-
* @param snapToVertex
|
|
13119
|
-
*/
|
|
13120
|
-
set snapToVertex(snapToVertex) {
|
|
13121
|
-
this._snapToVertex = snapToVertex;
|
|
13122
|
-
}
|
|
13123
|
-
|
|
13124
|
-
/**
|
|
13125
|
-
* Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
|
|
13126
|
-
* This is `true` by default.
|
|
13127
|
-
* @returns {*}
|
|
13128
|
-
*/
|
|
13129
|
-
get snapToVertex() {
|
|
13130
|
-
return this._snapToVertex;
|
|
13131
|
-
}
|
|
13132
|
-
|
|
13133
|
-
/**
|
|
13134
|
-
* Sets whether snap-to-edge is enabled for this AngleMeasurementsTouchControl.
|
|
13115
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13116
|
+
*
|
|
13135
13117
|
* This is `true` by default.
|
|
13136
|
-
*
|
|
13118
|
+
*
|
|
13119
|
+
* Internally, this deactivates then activates the AngleMeasurementsMouseControl when changed, which means that
|
|
13120
|
+
* it will destroy any AngleMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
13121
|
+
* and rebinds various input handlers.
|
|
13122
|
+
*
|
|
13123
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this AngleMeasurementsMouseControl.
|
|
13137
13124
|
*/
|
|
13138
|
-
set
|
|
13139
|
-
this.
|
|
13125
|
+
set snapping(snapping) {
|
|
13126
|
+
if (snapping !== this._snapping) {
|
|
13127
|
+
this._snapping = snapping;
|
|
13128
|
+
this.deactivate();
|
|
13129
|
+
this.activate();
|
|
13130
|
+
} else {
|
|
13131
|
+
this._snapping = snapping;
|
|
13132
|
+
}
|
|
13140
13133
|
}
|
|
13141
13134
|
|
|
13142
13135
|
/**
|
|
13143
|
-
* Gets whether snap-to-edge
|
|
13136
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13137
|
+
*
|
|
13144
13138
|
* This is `true` by default.
|
|
13145
|
-
*
|
|
13139
|
+
*
|
|
13140
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13146
13141
|
*/
|
|
13147
|
-
get
|
|
13148
|
-
return this.
|
|
13142
|
+
get snapping() {
|
|
13143
|
+
return this._snapping;
|
|
13149
13144
|
}
|
|
13150
13145
|
|
|
13151
13146
|
/**
|
|
@@ -13175,11 +13170,11 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13175
13170
|
|
|
13176
13171
|
let touchId = null;
|
|
13177
13172
|
|
|
13178
|
-
const
|
|
13173
|
+
const disableCameraNavigation = () => {
|
|
13179
13174
|
this.plugin.viewer.cameraControl.active = false;
|
|
13180
13175
|
};
|
|
13181
13176
|
|
|
13182
|
-
const
|
|
13177
|
+
const enableCameraNavigation = () => {
|
|
13183
13178
|
this.plugin.viewer.cameraControl.active = true;
|
|
13184
13179
|
};
|
|
13185
13180
|
|
|
@@ -13192,7 +13187,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13192
13187
|
this._currentAngleMeasurement.destroy();
|
|
13193
13188
|
this._currentAngleMeasurement = null;
|
|
13194
13189
|
}
|
|
13195
|
-
|
|
13190
|
+
enableCameraNavigation();
|
|
13196
13191
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13197
13192
|
};
|
|
13198
13193
|
|
|
@@ -13224,8 +13219,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13224
13219
|
}
|
|
13225
13220
|
const snapPickResult = scene.pick({
|
|
13226
13221
|
canvasPos: touchMoveCanvasPos,
|
|
13227
|
-
snapToVertex: this.
|
|
13228
|
-
snapToEdge: this.
|
|
13222
|
+
snapToVertex: this._snapping,
|
|
13223
|
+
snapToEdge: this._snapping
|
|
13229
13224
|
});
|
|
13230
13225
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13231
13226
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -13299,7 +13294,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13299
13294
|
// }
|
|
13300
13295
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;
|
|
13301
13296
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
13302
|
-
|
|
13297
|
+
disableCameraNavigation();
|
|
13303
13298
|
}, this._longTouchTimeoutMs);
|
|
13304
13299
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1;
|
|
13305
13300
|
//console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -13336,8 +13331,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13336
13331
|
|
|
13337
13332
|
const snapPickResult = scene.pick({
|
|
13338
13333
|
canvasPos: touchMoveCanvasPos,
|
|
13339
|
-
snapToVertex: this.
|
|
13340
|
-
snapToEdge: this.
|
|
13334
|
+
snapToVertex: this._snapping,
|
|
13335
|
+
snapToEdge: this._snapping
|
|
13341
13336
|
});
|
|
13342
13337
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13343
13338
|
if (this.pointerLens) {
|
|
@@ -13389,7 +13384,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13389
13384
|
this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
|
|
13390
13385
|
// console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
|
|
13391
13386
|
|
|
13392
|
-
|
|
13387
|
+
disableCameraNavigation();
|
|
13393
13388
|
|
|
13394
13389
|
}, this._longTouchTimeoutMs);
|
|
13395
13390
|
|
|
@@ -13429,8 +13424,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13429
13424
|
|
|
13430
13425
|
const snapPickResult = scene.pick({
|
|
13431
13426
|
canvasPos: touchMoveCanvasPos,
|
|
13432
|
-
snapToVertex: this.
|
|
13433
|
-
snapToEdge: this.
|
|
13427
|
+
snapToVertex: this._snapping,
|
|
13428
|
+
snapToEdge: this._snapping
|
|
13434
13429
|
});
|
|
13435
13430
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13436
13431
|
if (this.pointerLens) {
|
|
@@ -13482,7 +13477,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13482
13477
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END$1;
|
|
13483
13478
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
13484
13479
|
|
|
13485
|
-
|
|
13480
|
+
disableCameraNavigation();
|
|
13486
13481
|
|
|
13487
13482
|
}, this._longTouchTimeoutMs);
|
|
13488
13483
|
|
|
@@ -13543,8 +13538,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13543
13538
|
}
|
|
13544
13539
|
snapPickResult = scene.pick({
|
|
13545
13540
|
canvasPos: touchMoveCanvasPos,
|
|
13546
|
-
snapToVertex: this.
|
|
13547
|
-
snapToEdge: this.
|
|
13541
|
+
snapToVertex: this._snapping,
|
|
13542
|
+
snapToEdge: this._snapping
|
|
13548
13543
|
});
|
|
13549
13544
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
13550
13545
|
if (this.pointerLens) {
|
|
@@ -13592,8 +13587,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13592
13587
|
}
|
|
13593
13588
|
snapPickResult = scene.pick({
|
|
13594
13589
|
canvasPos: touchMoveCanvasPos,
|
|
13595
|
-
snapToVertex: this.
|
|
13596
|
-
snapToEdge: this.
|
|
13590
|
+
snapToVertex: this._snapping,
|
|
13591
|
+
snapToEdge: this._snapping
|
|
13597
13592
|
});
|
|
13598
13593
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13599
13594
|
if (this.pointerLens) {
|
|
@@ -13648,8 +13643,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13648
13643
|
}
|
|
13649
13644
|
snapPickResult = scene.pick({
|
|
13650
13645
|
canvasPos: touchMoveCanvasPos,
|
|
13651
|
-
snapToVertex: this.
|
|
13652
|
-
snapToEdge: this.
|
|
13646
|
+
snapToVertex: this._snapping,
|
|
13647
|
+
snapToEdge: this._snapping
|
|
13653
13648
|
});
|
|
13654
13649
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13655
13650
|
if (this.pointerLens) {
|
|
@@ -13761,7 +13756,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13761
13756
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13762
13757
|
}
|
|
13763
13758
|
}
|
|
13764
|
-
|
|
13759
|
+
enableCameraNavigation();
|
|
13765
13760
|
break;
|
|
13766
13761
|
|
|
13767
13762
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
@@ -13779,7 +13774,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13779
13774
|
this._touchState = WAITING_FOR_CORNER_TOUCH_START;
|
|
13780
13775
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
|
|
13781
13776
|
}
|
|
13782
|
-
|
|
13777
|
+
enableCameraNavigation();
|
|
13783
13778
|
break;
|
|
13784
13779
|
|
|
13785
13780
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
|
|
@@ -13816,7 +13811,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13816
13811
|
}
|
|
13817
13812
|
|
|
13818
13813
|
}
|
|
13819
|
-
|
|
13814
|
+
enableCameraNavigation();
|
|
13820
13815
|
break;
|
|
13821
13816
|
|
|
13822
13817
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
@@ -13825,7 +13820,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13825
13820
|
}
|
|
13826
13821
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START$1;
|
|
13827
13822
|
// console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13828
|
-
|
|
13823
|
+
enableCameraNavigation();
|
|
13829
13824
|
break;
|
|
13830
13825
|
|
|
13831
13826
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1: {
|
|
@@ -13861,7 +13856,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13861
13856
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13862
13857
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13863
13858
|
}
|
|
13864
|
-
|
|
13859
|
+
enableCameraNavigation();
|
|
13865
13860
|
break;
|
|
13866
13861
|
|
|
13867
13862
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
@@ -13882,7 +13877,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13882
13877
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13883
13878
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13884
13879
|
}
|
|
13885
|
-
|
|
13880
|
+
enableCameraNavigation();
|
|
13886
13881
|
break;
|
|
13887
13882
|
}
|
|
13888
13883
|
|
|
@@ -80419,7 +80414,7 @@ class SceneModelTransform {
|
|
|
80419
80414
|
this._childTransforms.push(childTransform);
|
|
80420
80415
|
childTransform._parentTransform = this;
|
|
80421
80416
|
childTransform._transformDirty();
|
|
80422
|
-
childTransform.
|
|
80417
|
+
childTransform._setSubtreeAABBsDirty(this);
|
|
80423
80418
|
}
|
|
80424
80419
|
|
|
80425
80420
|
_addMesh(mesh) {
|
|
@@ -87075,7 +87070,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87075
87070
|
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87076
87071
|
* and rebinds various input handlers.
|
|
87077
87072
|
*
|
|
87078
|
-
* @param
|
|
87073
|
+
* @param snapping
|
|
87079
87074
|
*/
|
|
87080
87075
|
set snapping(snapping) {
|
|
87081
87076
|
if (snapping !== this._snapping) {
|
|
@@ -87091,13 +87086,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87091
87086
|
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87092
87087
|
*
|
|
87093
87088
|
* This is `true` by default.
|
|
87094
|
-
*
|
|
87095
|
-
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87089
|
+
* @returns {*}
|
|
87096
87090
|
*/
|
|
87097
87091
|
get snapping() {
|
|
87098
87092
|
return this._snapping;
|
|
87099
87093
|
}
|
|
87100
|
-
|
|
87094
|
+
|
|
87101
87095
|
/**
|
|
87102
87096
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
87103
87097
|
*/
|
|
@@ -87132,12 +87126,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87132
87126
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
87133
87127
|
|
|
87134
87128
|
const pagePos = math.vec2();
|
|
87135
|
-
|
|
87129
|
+
|
|
87136
87130
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
87137
87131
|
this._snapping
|
|
87138
87132
|
? "hoverSnapOrSurface"
|
|
87139
87133
|
: "hoverSurface", event => {
|
|
87140
|
-
|
|
87134
|
+
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87141
87135
|
mouseHovering = true;
|
|
87142
87136
|
pointerWorldPos.set(event.worldPos);
|
|
87143
87137
|
pointerCanvasPos.set(event.canvasPos);
|
|
@@ -87165,7 +87159,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87165
87159
|
} else {
|
|
87166
87160
|
if (this.pointerLens) {
|
|
87167
87161
|
this.pointerLens.visible = true;
|
|
87168
|
-
this.pointerLens.canvasPos =
|
|
87162
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87169
87163
|
this.pointerLens.snappedCanvasPos = event.canvasPos;
|
|
87170
87164
|
this.pointerLens.snapped = false;
|
|
87171
87165
|
}
|
|
@@ -87199,7 +87193,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87199
87193
|
pointerDownCanvasY = e.clientY;
|
|
87200
87194
|
});
|
|
87201
87195
|
|
|
87202
|
-
canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
|
|
87196
|
+
canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
|
|
87203
87197
|
if (e.which !== 1) {
|
|
87204
87198
|
return;
|
|
87205
87199
|
}
|
|
@@ -87254,21 +87248,21 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87254
87248
|
this._snapping
|
|
87255
87249
|
? "hoverSnapOrSurfaceOff"
|
|
87256
87250
|
: "hoverOff", event => {
|
|
87257
|
-
|
|
87258
|
-
|
|
87259
|
-
|
|
87260
|
-
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87251
|
+
if (this.pointerLens) {
|
|
87252
|
+
this.pointerLens.visible = true;
|
|
87253
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87254
|
+
this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87255
|
+
}
|
|
87256
|
+
mouseHovering = false;
|
|
87257
|
+
this._markerDiv.style.left = `-100px`;
|
|
87258
|
+
this._markerDiv.style.top = `-100px`;
|
|
87259
|
+
if (this._currentDistanceMeasurement) {
|
|
87260
|
+
this._currentDistanceMeasurement.wireVisible = false;
|
|
87261
|
+
this._currentDistanceMeasurement.targetVisible = false;
|
|
87262
|
+
this._currentDistanceMeasurement.axisVisible = false;
|
|
87263
|
+
}
|
|
87264
|
+
canvas.style.cursor = "default";
|
|
87265
|
+
});
|
|
87272
87266
|
|
|
87273
87267
|
this._active = true;
|
|
87274
87268
|
}
|
|
@@ -87943,8 +87937,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87943
87937
|
this._onCanvasTouchStart = null;
|
|
87944
87938
|
this._onCanvasTouchEnd = null;
|
|
87945
87939
|
this._longTouchTimeoutMs = 300;
|
|
87946
|
-
this.
|
|
87947
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
87940
|
+
this._snapping = cfg.snapping !== false;
|
|
87948
87941
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
87949
87942
|
|
|
87950
87943
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
@@ -87974,39 +87967,35 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87974
87967
|
}
|
|
87975
87968
|
|
|
87976
87969
|
/**
|
|
87977
|
-
* Sets whether snap-to-vertex
|
|
87978
|
-
*
|
|
87979
|
-
* @param snapToVertex
|
|
87980
|
-
*/
|
|
87981
|
-
set snapToVertex(snapToVertex) {
|
|
87982
|
-
this._snapToVertex = snapToVertex;
|
|
87983
|
-
}
|
|
87984
|
-
|
|
87985
|
-
/**
|
|
87986
|
-
* Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
|
|
87987
|
-
* This is `true` by default.
|
|
87988
|
-
* @returns {*}
|
|
87989
|
-
*/
|
|
87990
|
-
get snapToVertex() {
|
|
87991
|
-
return this._snapToVertex;
|
|
87992
|
-
}
|
|
87993
|
-
|
|
87994
|
-
/**
|
|
87995
|
-
* Sets whether snap-to-edge is enabled for this DistanceMeasurementsTouchControl.
|
|
87970
|
+
* Sets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87971
|
+
*
|
|
87996
87972
|
* This is `true` by default.
|
|
87997
|
-
*
|
|
87973
|
+
*
|
|
87974
|
+
* Internally, this deactivates then activates the DistanceMeasurementsTouchControl when changed, which means that
|
|
87975
|
+
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87976
|
+
* and rebinds various input handlers.
|
|
87977
|
+
*
|
|
87978
|
+
* @param {boolean} snapping Whether to enable snap-to-vertex and snap-edge for this DistanceMeasurementsTouchControl.
|
|
87998
87979
|
*/
|
|
87999
|
-
set
|
|
88000
|
-
this.
|
|
87980
|
+
set snapping(snapping) {
|
|
87981
|
+
if (snapping !== this._snapping) {
|
|
87982
|
+
this._snapping = snapping;
|
|
87983
|
+
this.deactivate();
|
|
87984
|
+
this.activate();
|
|
87985
|
+
} else {
|
|
87986
|
+
this._snapping = snapping;
|
|
87987
|
+
}
|
|
88001
87988
|
}
|
|
88002
87989
|
|
|
88003
87990
|
/**
|
|
88004
|
-
* Gets whether snap-to-edge
|
|
87991
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87992
|
+
*
|
|
88005
87993
|
* This is `true` by default.
|
|
88006
|
-
*
|
|
87994
|
+
*
|
|
87995
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88007
87996
|
*/
|
|
88008
|
-
get
|
|
88009
|
-
return this.
|
|
87997
|
+
get snapping() {
|
|
87998
|
+
return this._snapping;
|
|
88010
87999
|
}
|
|
88011
88000
|
|
|
88012
88001
|
/**
|
|
@@ -88036,11 +88025,11 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88036
88025
|
|
|
88037
88026
|
let touchId = null;
|
|
88038
88027
|
|
|
88039
|
-
const
|
|
88028
|
+
const disableCameraNavigation = () => {
|
|
88040
88029
|
this.plugin.viewer.cameraControl.active = false;
|
|
88041
88030
|
};
|
|
88042
88031
|
|
|
88043
|
-
const
|
|
88032
|
+
const enableCameraNavigation = () => {
|
|
88044
88033
|
this.plugin.viewer.cameraControl.active = true;
|
|
88045
88034
|
};
|
|
88046
88035
|
|
|
@@ -88053,7 +88042,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88053
88042
|
this._currentDistanceMeasurement.destroy();
|
|
88054
88043
|
this._currentDistanceMeasurement = null;
|
|
88055
88044
|
}
|
|
88056
|
-
|
|
88045
|
+
enableCameraNavigation();
|
|
88057
88046
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88058
88047
|
};
|
|
88059
88048
|
|
|
@@ -88085,8 +88074,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88085
88074
|
}
|
|
88086
88075
|
const snapPickResult = scene.pick({
|
|
88087
88076
|
canvasPos: touchMoveCanvasPos,
|
|
88088
|
-
|
|
88089
|
-
snapToEdge: this.
|
|
88077
|
+
snapping: this._snapping,
|
|
88078
|
+
snapToEdge: this._snapping
|
|
88090
88079
|
});
|
|
88091
88080
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88092
88081
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -88156,7 +88145,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88156
88145
|
// }
|
|
88157
88146
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
|
|
88158
88147
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
88159
|
-
|
|
88148
|
+
disableCameraNavigation();
|
|
88160
88149
|
}, this._longTouchTimeoutMs);
|
|
88161
88150
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
|
|
88162
88151
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -88194,8 +88183,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88194
88183
|
|
|
88195
88184
|
const snapPickResult = scene.pick({
|
|
88196
88185
|
canvasPos: touchMoveCanvasPos,
|
|
88197
|
-
snapToVertex: this.
|
|
88198
|
-
snapToEdge: this.
|
|
88186
|
+
snapToVertex: this._snapping,
|
|
88187
|
+
snapToEdge: this._snapping
|
|
88199
88188
|
});
|
|
88200
88189
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88201
88190
|
if (this.pointerLens) {
|
|
@@ -88239,7 +88228,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88239
88228
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
|
|
88240
88229
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
88241
88230
|
|
|
88242
|
-
|
|
88231
|
+
disableCameraNavigation();
|
|
88243
88232
|
|
|
88244
88233
|
}, this._longTouchTimeoutMs);
|
|
88245
88234
|
|
|
@@ -88299,10 +88288,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88299
88288
|
}
|
|
88300
88289
|
snapPickResult = scene.pick({
|
|
88301
88290
|
canvasPos: touchMoveCanvasPos,
|
|
88302
|
-
|
|
88303
|
-
|
|
88304
|
-
snapToVertex: this._snapToVertex,
|
|
88305
|
-
snapToEdge: this._snapToEdge
|
|
88291
|
+
snapToVertex: this._snapping,
|
|
88292
|
+
snapToEdge: this._snapping
|
|
88306
88293
|
});
|
|
88307
88294
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
88308
88295
|
if (this.pointerLens) {
|
|
@@ -88403,8 +88390,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88403
88390
|
}
|
|
88404
88391
|
snapPickResult = scene.pick({
|
|
88405
88392
|
canvasPos: touchMoveCanvasPos,
|
|
88406
|
-
snapToVertex: this.
|
|
88407
|
-
snapToEdge: this.
|
|
88393
|
+
snapToVertex: this._snapping,
|
|
88394
|
+
snapToEdge: this._snapping
|
|
88408
88395
|
});
|
|
88409
88396
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
88410
88397
|
if (this.pointerLens) {
|
|
@@ -88510,7 +88497,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88510
88497
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88511
88498
|
}
|
|
88512
88499
|
}
|
|
88513
|
-
|
|
88500
|
+
enableCameraNavigation();
|
|
88514
88501
|
break;
|
|
88515
88502
|
|
|
88516
88503
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
|
|
@@ -88528,7 +88515,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88528
88515
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88529
88516
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
88530
88517
|
}
|
|
88531
|
-
|
|
88518
|
+
enableCameraNavigation();
|
|
88532
88519
|
break;
|
|
88533
88520
|
|
|
88534
88521
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
|
|
@@ -88561,7 +88548,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88561
88548
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88562
88549
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88563
88550
|
}
|
|
88564
|
-
|
|
88551
|
+
enableCameraNavigation();
|
|
88565
88552
|
break;
|
|
88566
88553
|
|
|
88567
88554
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:
|
|
@@ -88582,7 +88569,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88582
88569
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88583
88570
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88584
88571
|
}
|
|
88585
|
-
|
|
88572
|
+
enableCameraNavigation();
|
|
88586
88573
|
break;
|
|
88587
88574
|
}
|
|
88588
88575
|
|