@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.cjs.js
CHANGED
|
@@ -13086,8 +13086,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13086
13086
|
this._onCanvasTouchStart = null;
|
|
13087
13087
|
this._onCanvasTouchEnd = null;
|
|
13088
13088
|
this._longTouchTimeoutMs = 300;
|
|
13089
|
-
this.
|
|
13090
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
13089
|
+
this._snapping = cfg.snapping !== false;
|
|
13091
13090
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13092
13091
|
|
|
13093
13092
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
@@ -13117,39 +13116,35 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13117
13116
|
}
|
|
13118
13117
|
|
|
13119
13118
|
/**
|
|
13120
|
-
* Sets whether snap-to-vertex
|
|
13121
|
-
*
|
|
13122
|
-
* @param snapToVertex
|
|
13123
|
-
*/
|
|
13124
|
-
set snapToVertex(snapToVertex) {
|
|
13125
|
-
this._snapToVertex = snapToVertex;
|
|
13126
|
-
}
|
|
13127
|
-
|
|
13128
|
-
/**
|
|
13129
|
-
* Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
|
|
13130
|
-
* This is `true` by default.
|
|
13131
|
-
* @returns {*}
|
|
13132
|
-
*/
|
|
13133
|
-
get snapToVertex() {
|
|
13134
|
-
return this._snapToVertex;
|
|
13135
|
-
}
|
|
13136
|
-
|
|
13137
|
-
/**
|
|
13138
|
-
* 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
|
+
*
|
|
13139
13121
|
* This is `true` by default.
|
|
13140
|
-
*
|
|
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.
|
|
13141
13128
|
*/
|
|
13142
|
-
set
|
|
13143
|
-
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
|
+
}
|
|
13144
13137
|
}
|
|
13145
13138
|
|
|
13146
13139
|
/**
|
|
13147
|
-
* Gets whether snap-to-edge
|
|
13140
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13141
|
+
*
|
|
13148
13142
|
* This is `true` by default.
|
|
13149
|
-
*
|
|
13143
|
+
*
|
|
13144
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13150
13145
|
*/
|
|
13151
|
-
get
|
|
13152
|
-
return this.
|
|
13146
|
+
get snapping() {
|
|
13147
|
+
return this._snapping;
|
|
13153
13148
|
}
|
|
13154
13149
|
|
|
13155
13150
|
/**
|
|
@@ -13179,11 +13174,11 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13179
13174
|
|
|
13180
13175
|
let touchId = null;
|
|
13181
13176
|
|
|
13182
|
-
const
|
|
13177
|
+
const disableCameraNavigation = () => {
|
|
13183
13178
|
this.plugin.viewer.cameraControl.active = false;
|
|
13184
13179
|
};
|
|
13185
13180
|
|
|
13186
|
-
const
|
|
13181
|
+
const enableCameraNavigation = () => {
|
|
13187
13182
|
this.plugin.viewer.cameraControl.active = true;
|
|
13188
13183
|
};
|
|
13189
13184
|
|
|
@@ -13196,7 +13191,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13196
13191
|
this._currentAngleMeasurement.destroy();
|
|
13197
13192
|
this._currentAngleMeasurement = null;
|
|
13198
13193
|
}
|
|
13199
|
-
|
|
13194
|
+
enableCameraNavigation();
|
|
13200
13195
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13201
13196
|
};
|
|
13202
13197
|
|
|
@@ -13228,8 +13223,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13228
13223
|
}
|
|
13229
13224
|
const snapPickResult = scene.pick({
|
|
13230
13225
|
canvasPos: touchMoveCanvasPos,
|
|
13231
|
-
snapToVertex: this.
|
|
13232
|
-
snapToEdge: this.
|
|
13226
|
+
snapToVertex: this._snapping,
|
|
13227
|
+
snapToEdge: this._snapping
|
|
13233
13228
|
});
|
|
13234
13229
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13235
13230
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -13303,7 +13298,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13303
13298
|
// }
|
|
13304
13299
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;
|
|
13305
13300
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
13306
|
-
|
|
13301
|
+
disableCameraNavigation();
|
|
13307
13302
|
}, this._longTouchTimeoutMs);
|
|
13308
13303
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1;
|
|
13309
13304
|
//console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -13340,8 +13335,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13340
13335
|
|
|
13341
13336
|
const snapPickResult = scene.pick({
|
|
13342
13337
|
canvasPos: touchMoveCanvasPos,
|
|
13343
|
-
snapToVertex: this.
|
|
13344
|
-
snapToEdge: this.
|
|
13338
|
+
snapToVertex: this._snapping,
|
|
13339
|
+
snapToEdge: this._snapping
|
|
13345
13340
|
});
|
|
13346
13341
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13347
13342
|
if (this.pointerLens) {
|
|
@@ -13393,7 +13388,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13393
13388
|
this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
|
|
13394
13389
|
// console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
|
|
13395
13390
|
|
|
13396
|
-
|
|
13391
|
+
disableCameraNavigation();
|
|
13397
13392
|
|
|
13398
13393
|
}, this._longTouchTimeoutMs);
|
|
13399
13394
|
|
|
@@ -13433,8 +13428,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13433
13428
|
|
|
13434
13429
|
const snapPickResult = scene.pick({
|
|
13435
13430
|
canvasPos: touchMoveCanvasPos,
|
|
13436
|
-
snapToVertex: this.
|
|
13437
|
-
snapToEdge: this.
|
|
13431
|
+
snapToVertex: this._snapping,
|
|
13432
|
+
snapToEdge: this._snapping
|
|
13438
13433
|
});
|
|
13439
13434
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13440
13435
|
if (this.pointerLens) {
|
|
@@ -13486,7 +13481,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13486
13481
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END$1;
|
|
13487
13482
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
13488
13483
|
|
|
13489
|
-
|
|
13484
|
+
disableCameraNavigation();
|
|
13490
13485
|
|
|
13491
13486
|
}, this._longTouchTimeoutMs);
|
|
13492
13487
|
|
|
@@ -13547,8 +13542,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13547
13542
|
}
|
|
13548
13543
|
snapPickResult = scene.pick({
|
|
13549
13544
|
canvasPos: touchMoveCanvasPos,
|
|
13550
|
-
snapToVertex: this.
|
|
13551
|
-
snapToEdge: this.
|
|
13545
|
+
snapToVertex: this._snapping,
|
|
13546
|
+
snapToEdge: this._snapping
|
|
13552
13547
|
});
|
|
13553
13548
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
13554
13549
|
if (this.pointerLens) {
|
|
@@ -13596,8 +13591,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13596
13591
|
}
|
|
13597
13592
|
snapPickResult = scene.pick({
|
|
13598
13593
|
canvasPos: touchMoveCanvasPos,
|
|
13599
|
-
snapToVertex: this.
|
|
13600
|
-
snapToEdge: this.
|
|
13594
|
+
snapToVertex: this._snapping,
|
|
13595
|
+
snapToEdge: this._snapping
|
|
13601
13596
|
});
|
|
13602
13597
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13603
13598
|
if (this.pointerLens) {
|
|
@@ -13652,8 +13647,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13652
13647
|
}
|
|
13653
13648
|
snapPickResult = scene.pick({
|
|
13654
13649
|
canvasPos: touchMoveCanvasPos,
|
|
13655
|
-
snapToVertex: this.
|
|
13656
|
-
snapToEdge: this.
|
|
13650
|
+
snapToVertex: this._snapping,
|
|
13651
|
+
snapToEdge: this._snapping
|
|
13657
13652
|
});
|
|
13658
13653
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13659
13654
|
if (this.pointerLens) {
|
|
@@ -13765,7 +13760,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13765
13760
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13766
13761
|
}
|
|
13767
13762
|
}
|
|
13768
|
-
|
|
13763
|
+
enableCameraNavigation();
|
|
13769
13764
|
break;
|
|
13770
13765
|
|
|
13771
13766
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
@@ -13783,7 +13778,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13783
13778
|
this._touchState = WAITING_FOR_CORNER_TOUCH_START;
|
|
13784
13779
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
|
|
13785
13780
|
}
|
|
13786
|
-
|
|
13781
|
+
enableCameraNavigation();
|
|
13787
13782
|
break;
|
|
13788
13783
|
|
|
13789
13784
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
|
|
@@ -13820,7 +13815,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13820
13815
|
}
|
|
13821
13816
|
|
|
13822
13817
|
}
|
|
13823
|
-
|
|
13818
|
+
enableCameraNavigation();
|
|
13824
13819
|
break;
|
|
13825
13820
|
|
|
13826
13821
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
@@ -13829,7 +13824,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13829
13824
|
}
|
|
13830
13825
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START$1;
|
|
13831
13826
|
// console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13832
|
-
|
|
13827
|
+
enableCameraNavigation();
|
|
13833
13828
|
break;
|
|
13834
13829
|
|
|
13835
13830
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1: {
|
|
@@ -13865,7 +13860,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13865
13860
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13866
13861
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13867
13862
|
}
|
|
13868
|
-
|
|
13863
|
+
enableCameraNavigation();
|
|
13869
13864
|
break;
|
|
13870
13865
|
|
|
13871
13866
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
@@ -13886,7 +13881,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13886
13881
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13887
13882
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13888
13883
|
}
|
|
13889
|
-
|
|
13884
|
+
enableCameraNavigation();
|
|
13890
13885
|
break;
|
|
13891
13886
|
}
|
|
13892
13887
|
|
|
@@ -80423,7 +80418,7 @@ class SceneModelTransform {
|
|
|
80423
80418
|
this._childTransforms.push(childTransform);
|
|
80424
80419
|
childTransform._parentTransform = this;
|
|
80425
80420
|
childTransform._transformDirty();
|
|
80426
|
-
childTransform.
|
|
80421
|
+
childTransform._setSubtreeAABBsDirty(this);
|
|
80427
80422
|
}
|
|
80428
80423
|
|
|
80429
80424
|
_addMesh(mesh) {
|
|
@@ -87079,7 +87074,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87079
87074
|
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87080
87075
|
* and rebinds various input handlers.
|
|
87081
87076
|
*
|
|
87082
|
-
* @param
|
|
87077
|
+
* @param snapping
|
|
87083
87078
|
*/
|
|
87084
87079
|
set snapping(snapping) {
|
|
87085
87080
|
if (snapping !== this._snapping) {
|
|
@@ -87095,13 +87090,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87095
87090
|
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87096
87091
|
*
|
|
87097
87092
|
* This is `true` by default.
|
|
87098
|
-
*
|
|
87099
|
-
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87093
|
+
* @returns {*}
|
|
87100
87094
|
*/
|
|
87101
87095
|
get snapping() {
|
|
87102
87096
|
return this._snapping;
|
|
87103
87097
|
}
|
|
87104
|
-
|
|
87098
|
+
|
|
87105
87099
|
/**
|
|
87106
87100
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
87107
87101
|
*/
|
|
@@ -87136,12 +87130,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87136
87130
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
87137
87131
|
|
|
87138
87132
|
const pagePos = math.vec2();
|
|
87139
|
-
|
|
87133
|
+
|
|
87140
87134
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
87141
87135
|
this._snapping
|
|
87142
87136
|
? "hoverSnapOrSurface"
|
|
87143
87137
|
: "hoverSurface", event => {
|
|
87144
|
-
|
|
87138
|
+
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87145
87139
|
mouseHovering = true;
|
|
87146
87140
|
pointerWorldPos.set(event.worldPos);
|
|
87147
87141
|
pointerCanvasPos.set(event.canvasPos);
|
|
@@ -87169,7 +87163,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87169
87163
|
} else {
|
|
87170
87164
|
if (this.pointerLens) {
|
|
87171
87165
|
this.pointerLens.visible = true;
|
|
87172
|
-
this.pointerLens.canvasPos =
|
|
87166
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87173
87167
|
this.pointerLens.snappedCanvasPos = event.canvasPos;
|
|
87174
87168
|
this.pointerLens.snapped = false;
|
|
87175
87169
|
}
|
|
@@ -87203,7 +87197,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87203
87197
|
pointerDownCanvasY = e.clientY;
|
|
87204
87198
|
});
|
|
87205
87199
|
|
|
87206
|
-
canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
|
|
87200
|
+
canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
|
|
87207
87201
|
if (e.which !== 1) {
|
|
87208
87202
|
return;
|
|
87209
87203
|
}
|
|
@@ -87258,21 +87252,21 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87258
87252
|
this._snapping
|
|
87259
87253
|
? "hoverSnapOrSurfaceOff"
|
|
87260
87254
|
: "hoverOff", event => {
|
|
87261
|
-
|
|
87262
|
-
|
|
87263
|
-
|
|
87264
|
-
|
|
87265
|
-
|
|
87266
|
-
|
|
87267
|
-
|
|
87268
|
-
|
|
87269
|
-
|
|
87270
|
-
|
|
87271
|
-
|
|
87272
|
-
|
|
87273
|
-
|
|
87274
|
-
|
|
87275
|
-
|
|
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
|
+
});
|
|
87276
87270
|
|
|
87277
87271
|
this._active = true;
|
|
87278
87272
|
}
|
|
@@ -87947,8 +87941,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87947
87941
|
this._onCanvasTouchStart = null;
|
|
87948
87942
|
this._onCanvasTouchEnd = null;
|
|
87949
87943
|
this._longTouchTimeoutMs = 300;
|
|
87950
|
-
this.
|
|
87951
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
87944
|
+
this._snapping = cfg.snapping !== false;
|
|
87952
87945
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
87953
87946
|
|
|
87954
87947
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
@@ -87978,39 +87971,35 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87978
87971
|
}
|
|
87979
87972
|
|
|
87980
87973
|
/**
|
|
87981
|
-
* Sets whether snap-to-vertex
|
|
87982
|
-
*
|
|
87983
|
-
* @param snapToVertex
|
|
87984
|
-
*/
|
|
87985
|
-
set snapToVertex(snapToVertex) {
|
|
87986
|
-
this._snapToVertex = snapToVertex;
|
|
87987
|
-
}
|
|
87988
|
-
|
|
87989
|
-
/**
|
|
87990
|
-
* Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
|
|
87991
|
-
* This is `true` by default.
|
|
87992
|
-
* @returns {*}
|
|
87993
|
-
*/
|
|
87994
|
-
get snapToVertex() {
|
|
87995
|
-
return this._snapToVertex;
|
|
87996
|
-
}
|
|
87997
|
-
|
|
87998
|
-
/**
|
|
87999
|
-
* 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
|
+
*
|
|
88000
87976
|
* This is `true` by default.
|
|
88001
|
-
*
|
|
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.
|
|
88002
87983
|
*/
|
|
88003
|
-
set
|
|
88004
|
-
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
|
+
}
|
|
88005
87992
|
}
|
|
88006
87993
|
|
|
88007
87994
|
/**
|
|
88008
|
-
* Gets whether snap-to-edge
|
|
87995
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87996
|
+
*
|
|
88009
87997
|
* This is `true` by default.
|
|
88010
|
-
*
|
|
87998
|
+
*
|
|
87999
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
88011
88000
|
*/
|
|
88012
|
-
get
|
|
88013
|
-
return this.
|
|
88001
|
+
get snapping() {
|
|
88002
|
+
return this._snapping;
|
|
88014
88003
|
}
|
|
88015
88004
|
|
|
88016
88005
|
/**
|
|
@@ -88040,11 +88029,11 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88040
88029
|
|
|
88041
88030
|
let touchId = null;
|
|
88042
88031
|
|
|
88043
|
-
const
|
|
88032
|
+
const disableCameraNavigation = () => {
|
|
88044
88033
|
this.plugin.viewer.cameraControl.active = false;
|
|
88045
88034
|
};
|
|
88046
88035
|
|
|
88047
|
-
const
|
|
88036
|
+
const enableCameraNavigation = () => {
|
|
88048
88037
|
this.plugin.viewer.cameraControl.active = true;
|
|
88049
88038
|
};
|
|
88050
88039
|
|
|
@@ -88057,7 +88046,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88057
88046
|
this._currentDistanceMeasurement.destroy();
|
|
88058
88047
|
this._currentDistanceMeasurement = null;
|
|
88059
88048
|
}
|
|
88060
|
-
|
|
88049
|
+
enableCameraNavigation();
|
|
88061
88050
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88062
88051
|
};
|
|
88063
88052
|
|
|
@@ -88089,8 +88078,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88089
88078
|
}
|
|
88090
88079
|
const snapPickResult = scene.pick({
|
|
88091
88080
|
canvasPos: touchMoveCanvasPos,
|
|
88092
|
-
|
|
88093
|
-
snapToEdge: this.
|
|
88081
|
+
snapping: this._snapping,
|
|
88082
|
+
snapToEdge: this._snapping
|
|
88094
88083
|
});
|
|
88095
88084
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88096
88085
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -88160,7 +88149,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88160
88149
|
// }
|
|
88161
88150
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
|
|
88162
88151
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
88163
|
-
|
|
88152
|
+
disableCameraNavigation();
|
|
88164
88153
|
}, this._longTouchTimeoutMs);
|
|
88165
88154
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
|
|
88166
88155
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -88198,8 +88187,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88198
88187
|
|
|
88199
88188
|
const snapPickResult = scene.pick({
|
|
88200
88189
|
canvasPos: touchMoveCanvasPos,
|
|
88201
|
-
snapToVertex: this.
|
|
88202
|
-
snapToEdge: this.
|
|
88190
|
+
snapToVertex: this._snapping,
|
|
88191
|
+
snapToEdge: this._snapping
|
|
88203
88192
|
});
|
|
88204
88193
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88205
88194
|
if (this.pointerLens) {
|
|
@@ -88243,7 +88232,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88243
88232
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
|
|
88244
88233
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
88245
88234
|
|
|
88246
|
-
|
|
88235
|
+
disableCameraNavigation();
|
|
88247
88236
|
|
|
88248
88237
|
}, this._longTouchTimeoutMs);
|
|
88249
88238
|
|
|
@@ -88303,10 +88292,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88303
88292
|
}
|
|
88304
88293
|
snapPickResult = scene.pick({
|
|
88305
88294
|
canvasPos: touchMoveCanvasPos,
|
|
88306
|
-
|
|
88307
|
-
|
|
88308
|
-
snapToVertex: this._snapToVertex,
|
|
88309
|
-
snapToEdge: this._snapToEdge
|
|
88295
|
+
snapToVertex: this._snapping,
|
|
88296
|
+
snapToEdge: this._snapping
|
|
88310
88297
|
});
|
|
88311
88298
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
88312
88299
|
if (this.pointerLens) {
|
|
@@ -88407,8 +88394,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88407
88394
|
}
|
|
88408
88395
|
snapPickResult = scene.pick({
|
|
88409
88396
|
canvasPos: touchMoveCanvasPos,
|
|
88410
|
-
snapToVertex: this.
|
|
88411
|
-
snapToEdge: this.
|
|
88397
|
+
snapToVertex: this._snapping,
|
|
88398
|
+
snapToEdge: this._snapping
|
|
88412
88399
|
});
|
|
88413
88400
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
88414
88401
|
if (this.pointerLens) {
|
|
@@ -88514,7 +88501,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88514
88501
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88515
88502
|
}
|
|
88516
88503
|
}
|
|
88517
|
-
|
|
88504
|
+
enableCameraNavigation();
|
|
88518
88505
|
break;
|
|
88519
88506
|
|
|
88520
88507
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
|
|
@@ -88532,7 +88519,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88532
88519
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88533
88520
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
88534
88521
|
}
|
|
88535
|
-
|
|
88522
|
+
enableCameraNavigation();
|
|
88536
88523
|
break;
|
|
88537
88524
|
|
|
88538
88525
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
|
|
@@ -88565,7 +88552,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88565
88552
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88566
88553
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88567
88554
|
}
|
|
88568
|
-
|
|
88555
|
+
enableCameraNavigation();
|
|
88569
88556
|
break;
|
|
88570
88557
|
|
|
88571
88558
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:
|
|
@@ -88586,7 +88573,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88586
88573
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88587
88574
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88588
88575
|
}
|
|
88589
|
-
|
|
88576
|
+
enableCameraNavigation();
|
|
88590
88577
|
break;
|
|
88591
88578
|
}
|
|
88592
88579
|
|