@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.es.js
CHANGED
|
@@ -808,6 +808,27 @@ class ContextMenu {
|
|
|
808
808
|
self._updateItemsEnabledStatus();
|
|
809
809
|
}
|
|
810
810
|
});
|
|
811
|
+
item.itemElement.addEventListener("mouseup", (event) => {
|
|
812
|
+
if (event.which !== 3) {
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
event.preventDefault();
|
|
816
|
+
if (!self._context) {
|
|
817
|
+
return;
|
|
818
|
+
}
|
|
819
|
+
if (item.enabled === false) {
|
|
820
|
+
return;
|
|
821
|
+
}
|
|
822
|
+
if (item.doAction) {
|
|
823
|
+
item.doAction(self._context);
|
|
824
|
+
}
|
|
825
|
+
if (this._hideOnAction) {
|
|
826
|
+
self.hide();
|
|
827
|
+
} else {
|
|
828
|
+
self._updateItemsTitles();
|
|
829
|
+
self._updateItemsEnabledStatus();
|
|
830
|
+
}
|
|
831
|
+
});
|
|
811
832
|
item.itemElement.addEventListener("mouseenter", (event) => {
|
|
812
833
|
event.preventDefault();
|
|
813
834
|
if (item.enabled === false) {
|
|
@@ -13061,8 +13082,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13061
13082
|
this._onCanvasTouchStart = null;
|
|
13062
13083
|
this._onCanvasTouchEnd = null;
|
|
13063
13084
|
this._longTouchTimeoutMs = 300;
|
|
13064
|
-
this.
|
|
13065
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
13085
|
+
this._snapping = cfg.snapping !== false;
|
|
13066
13086
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13067
13087
|
|
|
13068
13088
|
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
@@ -13092,39 +13112,35 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13092
13112
|
}
|
|
13093
13113
|
|
|
13094
13114
|
/**
|
|
13095
|
-
* Sets whether snap-to-vertex
|
|
13096
|
-
*
|
|
13097
|
-
* @param snapToVertex
|
|
13098
|
-
*/
|
|
13099
|
-
set snapToVertex(snapToVertex) {
|
|
13100
|
-
this._snapToVertex = snapToVertex;
|
|
13101
|
-
}
|
|
13102
|
-
|
|
13103
|
-
/**
|
|
13104
|
-
* Gets whether snap-to-vertex is enabled for this AngleMeasurementsTouchControl.
|
|
13105
|
-
* This is `true` by default.
|
|
13106
|
-
* @returns {*}
|
|
13107
|
-
*/
|
|
13108
|
-
get snapToVertex() {
|
|
13109
|
-
return this._snapToVertex;
|
|
13110
|
-
}
|
|
13111
|
-
|
|
13112
|
-
/**
|
|
13113
|
-
* 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
|
+
*
|
|
13114
13117
|
* This is `true` by default.
|
|
13115
|
-
*
|
|
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.
|
|
13116
13124
|
*/
|
|
13117
|
-
set
|
|
13118
|
-
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
|
+
}
|
|
13119
13133
|
}
|
|
13120
13134
|
|
|
13121
13135
|
/**
|
|
13122
|
-
* Gets whether snap-to-edge
|
|
13136
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13137
|
+
*
|
|
13123
13138
|
* This is `true` by default.
|
|
13124
|
-
*
|
|
13139
|
+
*
|
|
13140
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this AngleMeasurementsMouseControl.
|
|
13125
13141
|
*/
|
|
13126
|
-
get
|
|
13127
|
-
return this.
|
|
13142
|
+
get snapping() {
|
|
13143
|
+
return this._snapping;
|
|
13128
13144
|
}
|
|
13129
13145
|
|
|
13130
13146
|
/**
|
|
@@ -13154,11 +13170,11 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13154
13170
|
|
|
13155
13171
|
let touchId = null;
|
|
13156
13172
|
|
|
13157
|
-
const
|
|
13173
|
+
const disableCameraNavigation = () => {
|
|
13158
13174
|
this.plugin.viewer.cameraControl.active = false;
|
|
13159
13175
|
};
|
|
13160
13176
|
|
|
13161
|
-
const
|
|
13177
|
+
const enableCameraNavigation = () => {
|
|
13162
13178
|
this.plugin.viewer.cameraControl.active = true;
|
|
13163
13179
|
};
|
|
13164
13180
|
|
|
@@ -13171,7 +13187,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13171
13187
|
this._currentAngleMeasurement.destroy();
|
|
13172
13188
|
this._currentAngleMeasurement = null;
|
|
13173
13189
|
}
|
|
13174
|
-
|
|
13190
|
+
enableCameraNavigation();
|
|
13175
13191
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13176
13192
|
};
|
|
13177
13193
|
|
|
@@ -13203,8 +13219,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13203
13219
|
}
|
|
13204
13220
|
const snapPickResult = scene.pick({
|
|
13205
13221
|
canvasPos: touchMoveCanvasPos,
|
|
13206
|
-
snapToVertex: this.
|
|
13207
|
-
snapToEdge: this.
|
|
13222
|
+
snapToVertex: this._snapping,
|
|
13223
|
+
snapToEdge: this._snapping
|
|
13208
13224
|
});
|
|
13209
13225
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13210
13226
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -13278,7 +13294,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13278
13294
|
// }
|
|
13279
13295
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END$1;
|
|
13280
13296
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
13281
|
-
|
|
13297
|
+
disableCameraNavigation();
|
|
13282
13298
|
}, this._longTouchTimeoutMs);
|
|
13283
13299
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END$1;
|
|
13284
13300
|
//console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -13315,8 +13331,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13315
13331
|
|
|
13316
13332
|
const snapPickResult = scene.pick({
|
|
13317
13333
|
canvasPos: touchMoveCanvasPos,
|
|
13318
|
-
snapToVertex: this.
|
|
13319
|
-
snapToEdge: this.
|
|
13334
|
+
snapToVertex: this._snapping,
|
|
13335
|
+
snapToEdge: this._snapping
|
|
13320
13336
|
});
|
|
13321
13337
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13322
13338
|
if (this.pointerLens) {
|
|
@@ -13368,7 +13384,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13368
13384
|
this._touchState = WAITING_FOR_CORNER_LONG_TOUCH_END;
|
|
13369
13385
|
// console.log("touchstart: this._touchState= WAITING_FOR_CORNER_TOUCH_START -> WAITING_FOR_CORNER_LONG_TOUCH_END")
|
|
13370
13386
|
|
|
13371
|
-
|
|
13387
|
+
disableCameraNavigation();
|
|
13372
13388
|
|
|
13373
13389
|
}, this._longTouchTimeoutMs);
|
|
13374
13390
|
|
|
@@ -13408,8 +13424,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13408
13424
|
|
|
13409
13425
|
const snapPickResult = scene.pick({
|
|
13410
13426
|
canvasPos: touchMoveCanvasPos,
|
|
13411
|
-
snapToVertex: this.
|
|
13412
|
-
snapToEdge: this.
|
|
13427
|
+
snapToVertex: this._snapping,
|
|
13428
|
+
snapToEdge: this._snapping
|
|
13413
13429
|
});
|
|
13414
13430
|
if (snapPickResult && snapPickResult.snapped) {
|
|
13415
13431
|
if (this.pointerLens) {
|
|
@@ -13461,7 +13477,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13461
13477
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END$1;
|
|
13462
13478
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
13463
13479
|
|
|
13464
|
-
|
|
13480
|
+
disableCameraNavigation();
|
|
13465
13481
|
|
|
13466
13482
|
}, this._longTouchTimeoutMs);
|
|
13467
13483
|
|
|
@@ -13522,8 +13538,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13522
13538
|
}
|
|
13523
13539
|
snapPickResult = scene.pick({
|
|
13524
13540
|
canvasPos: touchMoveCanvasPos,
|
|
13525
|
-
snapToVertex: this.
|
|
13526
|
-
snapToEdge: this.
|
|
13541
|
+
snapToVertex: this._snapping,
|
|
13542
|
+
snapToEdge: this._snapping
|
|
13527
13543
|
});
|
|
13528
13544
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
13529
13545
|
if (this.pointerLens) {
|
|
@@ -13571,8 +13587,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13571
13587
|
}
|
|
13572
13588
|
snapPickResult = scene.pick({
|
|
13573
13589
|
canvasPos: touchMoveCanvasPos,
|
|
13574
|
-
snapToVertex: this.
|
|
13575
|
-
snapToEdge: this.
|
|
13590
|
+
snapToVertex: this._snapping,
|
|
13591
|
+
snapToEdge: this._snapping
|
|
13576
13592
|
});
|
|
13577
13593
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13578
13594
|
if (this.pointerLens) {
|
|
@@ -13627,8 +13643,8 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13627
13643
|
}
|
|
13628
13644
|
snapPickResult = scene.pick({
|
|
13629
13645
|
canvasPos: touchMoveCanvasPos,
|
|
13630
|
-
snapToVertex: this.
|
|
13631
|
-
snapToEdge: this.
|
|
13646
|
+
snapToVertex: this._snapping,
|
|
13647
|
+
snapToEdge: this._snapping
|
|
13632
13648
|
});
|
|
13633
13649
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
13634
13650
|
if (this.pointerLens) {
|
|
@@ -13740,7 +13756,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13740
13756
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13741
13757
|
}
|
|
13742
13758
|
}
|
|
13743
|
-
|
|
13759
|
+
enableCameraNavigation();
|
|
13744
13760
|
break;
|
|
13745
13761
|
|
|
13746
13762
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END$1:
|
|
@@ -13758,7 +13774,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13758
13774
|
this._touchState = WAITING_FOR_CORNER_TOUCH_START;
|
|
13759
13775
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_CORNER_TOUCH_START")
|
|
13760
13776
|
}
|
|
13761
|
-
|
|
13777
|
+
enableCameraNavigation();
|
|
13762
13778
|
break;
|
|
13763
13779
|
|
|
13764
13780
|
case WAITING_FOR_CORNER_QUICK_TOUCH_END: {
|
|
@@ -13795,7 +13811,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13795
13811
|
}
|
|
13796
13812
|
|
|
13797
13813
|
}
|
|
13798
|
-
|
|
13814
|
+
enableCameraNavigation();
|
|
13799
13815
|
break;
|
|
13800
13816
|
|
|
13801
13817
|
case WAITING_FOR_CORNER_LONG_TOUCH_END:
|
|
@@ -13804,7 +13820,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13804
13820
|
}
|
|
13805
13821
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START$1;
|
|
13806
13822
|
// console.log("touchend: this._touchState= WAITING_FOR_CORNER_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13807
|
-
|
|
13823
|
+
enableCameraNavigation();
|
|
13808
13824
|
break;
|
|
13809
13825
|
|
|
13810
13826
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END$1: {
|
|
@@ -13840,7 +13856,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13840
13856
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13841
13857
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13842
13858
|
}
|
|
13843
|
-
|
|
13859
|
+
enableCameraNavigation();
|
|
13844
13860
|
break;
|
|
13845
13861
|
|
|
13846
13862
|
case WAITING_FOR_TARGET_LONG_TOUCH_END$1:
|
|
@@ -13861,7 +13877,7 @@ class AngleMeasurementsTouchControl extends AngleMeasurementsControl {
|
|
|
13861
13877
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START$1;
|
|
13862
13878
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
13863
13879
|
}
|
|
13864
|
-
|
|
13880
|
+
enableCameraNavigation();
|
|
13865
13881
|
break;
|
|
13866
13882
|
}
|
|
13867
13883
|
|
|
@@ -36428,6 +36444,10 @@ OcclusionRenderer.prototype.drawMesh = function (frameCtx, mesh) {
|
|
|
36428
36444
|
const geometryState = mesh._geometry._state;
|
|
36429
36445
|
const origin = mesh.origin;
|
|
36430
36446
|
|
|
36447
|
+
if (materialState.alpha < 1.0) {
|
|
36448
|
+
return;
|
|
36449
|
+
}
|
|
36450
|
+
|
|
36431
36451
|
if (frameCtx.lastProgramId !== this._program.id) {
|
|
36432
36452
|
frameCtx.lastProgramId = this._program.id;
|
|
36433
36453
|
this._bindProgram(frameCtx);
|
|
@@ -80394,7 +80414,7 @@ class SceneModelTransform {
|
|
|
80394
80414
|
this._childTransforms.push(childTransform);
|
|
80395
80415
|
childTransform._parentTransform = this;
|
|
80396
80416
|
childTransform._transformDirty();
|
|
80397
|
-
childTransform.
|
|
80417
|
+
childTransform._setSubtreeAABBsDirty(this);
|
|
80398
80418
|
}
|
|
80399
80419
|
|
|
80400
80420
|
_addMesh(mesh) {
|
|
@@ -85618,7 +85638,7 @@ class BCFViewpointsPlugin extends Plugin {
|
|
|
85618
85638
|
const view_setup_hints = bcfViewpoint.components.visibility.view_setup_hints;
|
|
85619
85639
|
if (view_setup_hints) {
|
|
85620
85640
|
if (view_setup_hints.spaces_visible === false) {
|
|
85621
|
-
scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"),
|
|
85641
|
+
scene.setObjectsVisible(viewer.metaScene.getObjectIDsByType("IfcSpace"), false);
|
|
85622
85642
|
}
|
|
85623
85643
|
if (view_setup_hints.spaces_translucent !== undefined) {
|
|
85624
85644
|
scene.setObjectsXRayed(viewer.metaScene.getObjectIDsByType("IfcSpace"), true);
|
|
@@ -87050,7 +87070,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87050
87070
|
* it will destroy any DistanceMeasurements currently under construction, and incurs some overhead, since it unbinds
|
|
87051
87071
|
* and rebinds various input handlers.
|
|
87052
87072
|
*
|
|
87053
|
-
* @param
|
|
87073
|
+
* @param snapping
|
|
87054
87074
|
*/
|
|
87055
87075
|
set snapping(snapping) {
|
|
87056
87076
|
if (snapping !== this._snapping) {
|
|
@@ -87066,13 +87086,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87066
87086
|
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87067
87087
|
*
|
|
87068
87088
|
* This is `true` by default.
|
|
87069
|
-
*
|
|
87070
|
-
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
87089
|
+
* @returns {*}
|
|
87071
87090
|
*/
|
|
87072
87091
|
get snapping() {
|
|
87073
87092
|
return this._snapping;
|
|
87074
87093
|
}
|
|
87075
|
-
|
|
87094
|
+
|
|
87076
87095
|
/**
|
|
87077
87096
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
87078
87097
|
*/
|
|
@@ -87107,12 +87126,12 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87107
87126
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
87108
87127
|
|
|
87109
87128
|
const pagePos = math.vec2();
|
|
87110
|
-
|
|
87129
|
+
|
|
87111
87130
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
87112
87131
|
this._snapping
|
|
87113
87132
|
? "hoverSnapOrSurface"
|
|
87114
87133
|
: "hoverSurface", event => {
|
|
87115
|
-
|
|
87134
|
+
const canvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
87116
87135
|
mouseHovering = true;
|
|
87117
87136
|
pointerWorldPos.set(event.worldPos);
|
|
87118
87137
|
pointerCanvasPos.set(event.canvasPos);
|
|
@@ -87140,7 +87159,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87140
87159
|
} else {
|
|
87141
87160
|
if (this.pointerLens) {
|
|
87142
87161
|
this.pointerLens.visible = true;
|
|
87143
|
-
this.pointerLens.canvasPos =
|
|
87162
|
+
this.pointerLens.canvasPos = event.canvasPos;
|
|
87144
87163
|
this.pointerLens.snappedCanvasPos = event.canvasPos;
|
|
87145
87164
|
this.pointerLens.snapped = false;
|
|
87146
87165
|
}
|
|
@@ -87174,7 +87193,7 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87174
87193
|
pointerDownCanvasY = e.clientY;
|
|
87175
87194
|
});
|
|
87176
87195
|
|
|
87177
|
-
canvas.addEventListener("mouseup", this._onMouseUp =(e) => {
|
|
87196
|
+
canvas.addEventListener("mouseup", this._onMouseUp = (e) => {
|
|
87178
87197
|
if (e.which !== 1) {
|
|
87179
87198
|
return;
|
|
87180
87199
|
}
|
|
@@ -87229,21 +87248,21 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
87229
87248
|
this._snapping
|
|
87230
87249
|
? "hoverSnapOrSurfaceOff"
|
|
87231
87250
|
: "hoverOff", event => {
|
|
87232
|
-
|
|
87233
|
-
|
|
87234
|
-
|
|
87235
|
-
|
|
87236
|
-
|
|
87237
|
-
|
|
87238
|
-
|
|
87239
|
-
|
|
87240
|
-
|
|
87241
|
-
|
|
87242
|
-
|
|
87243
|
-
|
|
87244
|
-
|
|
87245
|
-
|
|
87246
|
-
|
|
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
|
+
});
|
|
87247
87266
|
|
|
87248
87267
|
this._active = true;
|
|
87249
87268
|
}
|
|
@@ -87918,8 +87937,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87918
87937
|
this._onCanvasTouchStart = null;
|
|
87919
87938
|
this._onCanvasTouchEnd = null;
|
|
87920
87939
|
this._longTouchTimeoutMs = 300;
|
|
87921
|
-
this.
|
|
87922
|
-
this._snapToVertex = cfg.snapToVertex !== false;
|
|
87940
|
+
this._snapping = cfg.snapping !== false;
|
|
87923
87941
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
87924
87942
|
|
|
87925
87943
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
@@ -87949,39 +87967,35 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
87949
87967
|
}
|
|
87950
87968
|
|
|
87951
87969
|
/**
|
|
87952
|
-
* Sets whether snap-to-vertex
|
|
87953
|
-
*
|
|
87954
|
-
* @param snapToVertex
|
|
87955
|
-
*/
|
|
87956
|
-
set snapToVertex(snapToVertex) {
|
|
87957
|
-
this._snapToVertex = snapToVertex;
|
|
87958
|
-
}
|
|
87959
|
-
|
|
87960
|
-
/**
|
|
87961
|
-
* Gets whether snap-to-vertex is enabled for this DistanceMeasurementsTouchControl.
|
|
87962
|
-
* This is `true` by default.
|
|
87963
|
-
* @returns {*}
|
|
87964
|
-
*/
|
|
87965
|
-
get snapToVertex() {
|
|
87966
|
-
return this._snapToVertex;
|
|
87967
|
-
}
|
|
87968
|
-
|
|
87969
|
-
/**
|
|
87970
|
-
* 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
|
+
*
|
|
87971
87972
|
* This is `true` by default.
|
|
87972
|
-
*
|
|
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.
|
|
87973
87979
|
*/
|
|
87974
|
-
set
|
|
87975
|
-
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
|
+
}
|
|
87976
87988
|
}
|
|
87977
87989
|
|
|
87978
87990
|
/**
|
|
87979
|
-
* Gets whether snap-to-edge
|
|
87991
|
+
* Gets whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87992
|
+
*
|
|
87980
87993
|
* This is `true` by default.
|
|
87981
|
-
*
|
|
87994
|
+
*
|
|
87995
|
+
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsTouchControl.
|
|
87982
87996
|
*/
|
|
87983
|
-
get
|
|
87984
|
-
return this.
|
|
87997
|
+
get snapping() {
|
|
87998
|
+
return this._snapping;
|
|
87985
87999
|
}
|
|
87986
88000
|
|
|
87987
88001
|
/**
|
|
@@ -88011,11 +88025,11 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88011
88025
|
|
|
88012
88026
|
let touchId = null;
|
|
88013
88027
|
|
|
88014
|
-
const
|
|
88028
|
+
const disableCameraNavigation = () => {
|
|
88015
88029
|
this.plugin.viewer.cameraControl.active = false;
|
|
88016
88030
|
};
|
|
88017
88031
|
|
|
88018
|
-
const
|
|
88032
|
+
const enableCameraNavigation = () => {
|
|
88019
88033
|
this.plugin.viewer.cameraControl.active = true;
|
|
88020
88034
|
};
|
|
88021
88035
|
|
|
@@ -88028,7 +88042,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88028
88042
|
this._currentDistanceMeasurement.destroy();
|
|
88029
88043
|
this._currentDistanceMeasurement = null;
|
|
88030
88044
|
}
|
|
88031
|
-
|
|
88045
|
+
enableCameraNavigation();
|
|
88032
88046
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88033
88047
|
};
|
|
88034
88048
|
|
|
@@ -88060,8 +88074,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88060
88074
|
}
|
|
88061
88075
|
const snapPickResult = scene.pick({
|
|
88062
88076
|
canvasPos: touchMoveCanvasPos,
|
|
88063
|
-
|
|
88064
|
-
snapToEdge: this.
|
|
88077
|
+
snapping: this._snapping,
|
|
88078
|
+
snapToEdge: this._snapping
|
|
88065
88079
|
});
|
|
88066
88080
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88067
88081
|
pointerWorldPos.set(snapPickResult.worldPos);
|
|
@@ -88131,7 +88145,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88131
88145
|
// }
|
|
88132
88146
|
this._touchState = WAITING_FOR_ORIGIN_LONG_TOUCH_END;
|
|
88133
88147
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_LONG_TOUCH_END")
|
|
88134
|
-
|
|
88148
|
+
disableCameraNavigation();
|
|
88135
88149
|
}, this._longTouchTimeoutMs);
|
|
88136
88150
|
this._touchState = WAITING_FOR_ORIGIN_QUICK_TOUCH_END;
|
|
88137
88151
|
// console.log("touchstart: this._touchState= WAITING_FOR_ORIGIN_TOUCH_START -> WAITING_FOR_ORIGIN_QUICK_TOUCH_END")
|
|
@@ -88169,8 +88183,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88169
88183
|
|
|
88170
88184
|
const snapPickResult = scene.pick({
|
|
88171
88185
|
canvasPos: touchMoveCanvasPos,
|
|
88172
|
-
snapToVertex: this.
|
|
88173
|
-
snapToEdge: this.
|
|
88186
|
+
snapToVertex: this._snapping,
|
|
88187
|
+
snapToEdge: this._snapping
|
|
88174
88188
|
});
|
|
88175
88189
|
if (snapPickResult && snapPickResult.snapped) {
|
|
88176
88190
|
if (this.pointerLens) {
|
|
@@ -88214,7 +88228,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88214
88228
|
this._touchState = WAITING_FOR_TARGET_LONG_TOUCH_END;
|
|
88215
88229
|
// console.log("touchstart: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_TARGET_LONG_TOUCH_END")
|
|
88216
88230
|
|
|
88217
|
-
|
|
88231
|
+
disableCameraNavigation();
|
|
88218
88232
|
|
|
88219
88233
|
}, this._longTouchTimeoutMs);
|
|
88220
88234
|
|
|
@@ -88274,10 +88288,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88274
88288
|
}
|
|
88275
88289
|
snapPickResult = scene.pick({
|
|
88276
88290
|
canvasPos: touchMoveCanvasPos,
|
|
88277
|
-
|
|
88278
|
-
|
|
88279
|
-
snapToVertex: this._snapToVertex,
|
|
88280
|
-
snapToEdge: this._snapToEdge
|
|
88291
|
+
snapToVertex: this._snapping,
|
|
88292
|
+
snapToEdge: this._snapping
|
|
88281
88293
|
});
|
|
88282
88294
|
if (snapPickResult && (snapPickResult.snapped)) {
|
|
88283
88295
|
if (this.pointerLens) {
|
|
@@ -88378,8 +88390,8 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88378
88390
|
}
|
|
88379
88391
|
snapPickResult = scene.pick({
|
|
88380
88392
|
canvasPos: touchMoveCanvasPos,
|
|
88381
|
-
snapToVertex: this.
|
|
88382
|
-
snapToEdge: this.
|
|
88393
|
+
snapToVertex: this._snapping,
|
|
88394
|
+
snapToEdge: this._snapping
|
|
88383
88395
|
});
|
|
88384
88396
|
if (snapPickResult && snapPickResult.worldPos) {
|
|
88385
88397
|
if (this.pointerLens) {
|
|
@@ -88485,7 +88497,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88485
88497
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_QUICK_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88486
88498
|
}
|
|
88487
88499
|
}
|
|
88488
|
-
|
|
88500
|
+
enableCameraNavigation();
|
|
88489
88501
|
break;
|
|
88490
88502
|
|
|
88491
88503
|
case WAITING_FOR_ORIGIN_LONG_TOUCH_END:
|
|
@@ -88503,7 +88515,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88503
88515
|
this._touchState = WAITING_FOR_TARGET_TOUCH_START;
|
|
88504
88516
|
// console.log("touchend: this._touchState= WAITING_FOR_ORIGIN_LONG_TOUCH_END (picked, begin measurement) -> WAITING_FOR_TARGET_TOUCH_START")
|
|
88505
88517
|
}
|
|
88506
|
-
|
|
88518
|
+
enableCameraNavigation();
|
|
88507
88519
|
break;
|
|
88508
88520
|
|
|
88509
88521
|
case WAITING_FOR_TARGET_QUICK_TOUCH_END: {
|
|
@@ -88536,7 +88548,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88536
88548
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88537
88549
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_TOUCH_START -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88538
88550
|
}
|
|
88539
|
-
|
|
88551
|
+
enableCameraNavigation();
|
|
88540
88552
|
break;
|
|
88541
88553
|
|
|
88542
88554
|
case WAITING_FOR_TARGET_LONG_TOUCH_END:
|
|
@@ -88557,7 +88569,7 @@ class DistanceMeasurementsTouchControl extends DistanceMeasurementsControl {
|
|
|
88557
88569
|
this._touchState = WAITING_FOR_ORIGIN_TOUCH_START;
|
|
88558
88570
|
// console.log("touchend: this._touchState= WAITING_FOR_TARGET_LONG_TOUCH_END -> WAITING_FOR_ORIGIN_TOUCH_START")
|
|
88559
88571
|
}
|
|
88560
|
-
|
|
88572
|
+
enableCameraNavigation();
|
|
88561
88573
|
break;
|
|
88562
88574
|
}
|
|
88563
88575
|
|