@xeokit/xeokit-sdk 2.5.2-beta-27 → 2.5.2-beta-29
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 +31 -24
- package/dist/xeokit-sdk.es.js +31 -24
- package/dist/xeokit-sdk.es5.js +6 -5
- package/dist/xeokit-sdk.min.cjs.js +2 -2
- package/dist/xeokit-sdk.min.es.js +2 -2
- package/dist/xeokit-sdk.min.es5.js +2 -2
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +11 -9
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +17 -12
- package/src/viewer/scene/CameraControl/lib/handlers/MouseMiscHandler.js +3 -3
package/dist/xeokit-sdk.cjs.js
CHANGED
|
@@ -12068,7 +12068,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12068
12068
|
markerDiv.style.borderRadius = "10px";
|
|
12069
12069
|
markerDiv.style.width = "5px";
|
|
12070
12070
|
markerDiv.style.height = "5px";
|
|
12071
|
-
markerDiv.style.
|
|
12071
|
+
markerDiv.style.top = "-200px";
|
|
12072
|
+
markerDiv.style.left = "-200px";
|
|
12073
|
+
markerDiv.style.margin = "0 0";
|
|
12072
12074
|
markerDiv.style.zIndex = "100";
|
|
12073
12075
|
markerDiv.style.position = "absolute";
|
|
12074
12076
|
markerDiv.style.pointerEvents = "none";
|
|
@@ -12202,8 +12204,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12202
12204
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
12203
12205
|
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
12204
12206
|
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
12205
|
-
this.markerDiv.style.
|
|
12206
|
-
this.markerDiv.style.
|
|
12207
|
+
this.markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
12208
|
+
this.markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
12207
12209
|
break;
|
|
12208
12210
|
case MOUSE_FINDING_CORNER:
|
|
12209
12211
|
if (this._currentAngleMeasurement) {
|
|
@@ -12214,8 +12216,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12214
12216
|
this._currentAngleMeasurement.corner.worldPos = event.worldPos;
|
|
12215
12217
|
this._currentAngleMeasurement.corner.entity = event.entity;
|
|
12216
12218
|
}
|
|
12217
|
-
this.markerDiv.style.
|
|
12218
|
-
this.markerDiv.style.
|
|
12219
|
+
this.markerDiv.style.left = `-10000px`;
|
|
12220
|
+
this.markerDiv.style.top = `-10000px`;
|
|
12219
12221
|
canvas.style.cursor = "pointer";
|
|
12220
12222
|
break;
|
|
12221
12223
|
case MOUSE_FINDING_TARGET:
|
|
@@ -12226,8 +12228,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12226
12228
|
this._currentAngleMeasurement.target.worldPos = event.worldPos;
|
|
12227
12229
|
this._currentAngleMeasurement.target.entity = event.entity;
|
|
12228
12230
|
}
|
|
12229
|
-
this.markerDiv.style.
|
|
12230
|
-
this.markerDiv.style.
|
|
12231
|
+
this.markerDiv.style.left = `-10000px`;
|
|
12232
|
+
this.markerDiv.style.top = `-10000px`;
|
|
12231
12233
|
canvas.style.cursor = "pointer";
|
|
12232
12234
|
break;
|
|
12233
12235
|
}
|
|
@@ -12328,8 +12330,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12328
12330
|
pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
12329
12331
|
pointerLens.snapped = false;
|
|
12330
12332
|
}
|
|
12331
|
-
this.markerDiv.style.
|
|
12332
|
-
this.markerDiv.style.
|
|
12333
|
+
this.markerDiv.style.left = `-100px`;
|
|
12334
|
+
this.markerDiv.style.top = `-100px`;
|
|
12333
12335
|
if (this._currentAngleMeasurement) {
|
|
12334
12336
|
switch (this._mouseState) {
|
|
12335
12337
|
case MOUSE_FINDING_ORIGIN:
|
|
@@ -85874,7 +85876,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85874
85876
|
markerDiv.style.borderRadius = "10px";
|
|
85875
85877
|
markerDiv.style.width = "5px";
|
|
85876
85878
|
markerDiv.style.height = "5px";
|
|
85877
|
-
markerDiv.style.
|
|
85879
|
+
markerDiv.style.top = "-200px";
|
|
85880
|
+
markerDiv.style.left = "-200px";
|
|
85881
|
+
markerDiv.style.margin = "0 0";
|
|
85878
85882
|
markerDiv.style.zIndex = "100";
|
|
85879
85883
|
markerDiv.style.position = "absolute";
|
|
85880
85884
|
markerDiv.style.pointerEvents = "none";
|
|
@@ -85980,20 +85984,23 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85980
85984
|
this._snapping
|
|
85981
85985
|
? "hoverSnapOrSurface"
|
|
85982
85986
|
: "hoverSurface", event => {
|
|
85983
|
-
|
|
85987
|
+
const canvasPos = event.snappedCanvasPos ||event.canvasPos;
|
|
85984
85988
|
mouseHovering = true;
|
|
85985
85989
|
pointerWorldPos.set(event.worldPos);
|
|
85986
85990
|
pointerCanvasPos.set(event.canvasPos);
|
|
85987
85991
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
85988
|
-
|
|
85992
|
+
|
|
85993
|
+
// const canvasBoundary = getCanvasBoundary();
|
|
85994
|
+
|
|
85989
85995
|
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
85990
85996
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
85991
85997
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
85992
85998
|
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
85993
85999
|
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
85994
|
-
|
|
85995
|
-
this._markerDiv.style.
|
|
85996
|
-
this._markerDiv.style.
|
|
86000
|
+
|
|
86001
|
+
this._markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
86002
|
+
this._markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
86003
|
+
|
|
85997
86004
|
this._markerDiv.style.background = "pink";
|
|
85998
86005
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
85999
86006
|
if (this.pointerLens) {
|
|
@@ -86016,8 +86023,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86016
86023
|
}
|
|
86017
86024
|
hoveredEntity = event.entity;
|
|
86018
86025
|
} else {
|
|
86019
|
-
this._markerDiv.style.
|
|
86020
|
-
this._markerDiv.style.
|
|
86026
|
+
this._markerDiv.style.left = `-10000px`;
|
|
86027
|
+
this._markerDiv.style.top = `-10000px`;
|
|
86021
86028
|
}
|
|
86022
86029
|
canvas.style.cursor = "pointer";
|
|
86023
86030
|
if (this._currentDistanceMeasurement) {
|
|
@@ -86028,8 +86035,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86028
86035
|
this._currentDistanceMeasurement.zAxisVisible = this._currentDistanceMeasurementInitState.zAxisVisible && this.distanceMeasurementsPlugin.defaultZAxisVisible;
|
|
86029
86036
|
this._currentDistanceMeasurement.targetVisible = this._currentDistanceMeasurementInitState.targetVisible;
|
|
86030
86037
|
this._currentDistanceMeasurement.target.worldPos = pointerWorldPos.slice();
|
|
86031
|
-
this._markerDiv.style.
|
|
86032
|
-
this._markerDiv.style.
|
|
86038
|
+
this._markerDiv.style.left = `-10000px`;
|
|
86039
|
+
this._markerDiv.style.top = `-10000px`;
|
|
86033
86040
|
}
|
|
86034
86041
|
});
|
|
86035
86042
|
|
|
@@ -86100,8 +86107,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86100
86107
|
this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
86101
86108
|
}
|
|
86102
86109
|
mouseHovering = false;
|
|
86103
|
-
this._markerDiv.style.
|
|
86104
|
-
this._markerDiv.style.
|
|
86110
|
+
this._markerDiv.style.left = `-100px`;
|
|
86111
|
+
this._markerDiv.style.top = `-100px`;
|
|
86105
86112
|
if (this._currentDistanceMeasurement) {
|
|
86106
86113
|
this._currentDistanceMeasurement.wireVisible = false;
|
|
86107
86114
|
this._currentDistanceMeasurement.targetVisible = false;
|
|
@@ -94360,9 +94367,9 @@ function getCanvasPosFromEvent$2(event, canvas, canvasPos) {
|
|
|
94360
94367
|
canvasPos[0] = event.x;
|
|
94361
94368
|
canvasPos[1] = event.y;
|
|
94362
94369
|
} else {
|
|
94363
|
-
const {
|
|
94364
|
-
canvasPos[0] = event.clientX -
|
|
94365
|
-
canvasPos[1] = event.clientY -
|
|
94370
|
+
const { left, top } = canvas.getBoundingClientRect();
|
|
94371
|
+
canvasPos[0] = event.clientX - left - window.scrollX;
|
|
94372
|
+
canvasPos[1] = event.clientY - top - window.scrollY;
|
|
94366
94373
|
}
|
|
94367
94374
|
return canvasPos;
|
|
94368
94375
|
}
|
package/dist/xeokit-sdk.es.js
CHANGED
|
@@ -12064,7 +12064,9 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12064
12064
|
markerDiv.style.borderRadius = "10px";
|
|
12065
12065
|
markerDiv.style.width = "5px";
|
|
12066
12066
|
markerDiv.style.height = "5px";
|
|
12067
|
-
markerDiv.style.
|
|
12067
|
+
markerDiv.style.top = "-200px";
|
|
12068
|
+
markerDiv.style.left = "-200px";
|
|
12069
|
+
markerDiv.style.margin = "0 0";
|
|
12068
12070
|
markerDiv.style.zIndex = "100";
|
|
12069
12071
|
markerDiv.style.position = "absolute";
|
|
12070
12072
|
markerDiv.style.pointerEvents = "none";
|
|
@@ -12198,8 +12200,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12198
12200
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
12199
12201
|
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
12200
12202
|
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
12201
|
-
this.markerDiv.style.
|
|
12202
|
-
this.markerDiv.style.
|
|
12203
|
+
this.markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
12204
|
+
this.markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
12203
12205
|
break;
|
|
12204
12206
|
case MOUSE_FINDING_CORNER:
|
|
12205
12207
|
if (this._currentAngleMeasurement) {
|
|
@@ -12210,8 +12212,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12210
12212
|
this._currentAngleMeasurement.corner.worldPos = event.worldPos;
|
|
12211
12213
|
this._currentAngleMeasurement.corner.entity = event.entity;
|
|
12212
12214
|
}
|
|
12213
|
-
this.markerDiv.style.
|
|
12214
|
-
this.markerDiv.style.
|
|
12215
|
+
this.markerDiv.style.left = `-10000px`;
|
|
12216
|
+
this.markerDiv.style.top = `-10000px`;
|
|
12215
12217
|
canvas.style.cursor = "pointer";
|
|
12216
12218
|
break;
|
|
12217
12219
|
case MOUSE_FINDING_TARGET:
|
|
@@ -12222,8 +12224,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12222
12224
|
this._currentAngleMeasurement.target.worldPos = event.worldPos;
|
|
12223
12225
|
this._currentAngleMeasurement.target.entity = event.entity;
|
|
12224
12226
|
}
|
|
12225
|
-
this.markerDiv.style.
|
|
12226
|
-
this.markerDiv.style.
|
|
12227
|
+
this.markerDiv.style.left = `-10000px`;
|
|
12228
|
+
this.markerDiv.style.top = `-10000px`;
|
|
12227
12229
|
canvas.style.cursor = "pointer";
|
|
12228
12230
|
break;
|
|
12229
12231
|
}
|
|
@@ -12324,8 +12326,8 @@ class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
12324
12326
|
pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
12325
12327
|
pointerLens.snapped = false;
|
|
12326
12328
|
}
|
|
12327
|
-
this.markerDiv.style.
|
|
12328
|
-
this.markerDiv.style.
|
|
12329
|
+
this.markerDiv.style.left = `-100px`;
|
|
12330
|
+
this.markerDiv.style.top = `-100px`;
|
|
12329
12331
|
if (this._currentAngleMeasurement) {
|
|
12330
12332
|
switch (this._mouseState) {
|
|
12331
12333
|
case MOUSE_FINDING_ORIGIN:
|
|
@@ -85870,7 +85872,9 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85870
85872
|
markerDiv.style.borderRadius = "10px";
|
|
85871
85873
|
markerDiv.style.width = "5px";
|
|
85872
85874
|
markerDiv.style.height = "5px";
|
|
85873
|
-
markerDiv.style.
|
|
85875
|
+
markerDiv.style.top = "-200px";
|
|
85876
|
+
markerDiv.style.left = "-200px";
|
|
85877
|
+
markerDiv.style.margin = "0 0";
|
|
85874
85878
|
markerDiv.style.zIndex = "100";
|
|
85875
85879
|
markerDiv.style.position = "absolute";
|
|
85876
85880
|
markerDiv.style.pointerEvents = "none";
|
|
@@ -85976,20 +85980,23 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
85976
85980
|
this._snapping
|
|
85977
85981
|
? "hoverSnapOrSurface"
|
|
85978
85982
|
: "hoverSurface", event => {
|
|
85979
|
-
|
|
85983
|
+
const canvasPos = event.snappedCanvasPos ||event.canvasPos;
|
|
85980
85984
|
mouseHovering = true;
|
|
85981
85985
|
pointerWorldPos.set(event.worldPos);
|
|
85982
85986
|
pointerCanvasPos.set(event.canvasPos);
|
|
85983
85987
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
85984
|
-
|
|
85988
|
+
|
|
85989
|
+
// const canvasBoundary = getCanvasBoundary();
|
|
85990
|
+
|
|
85985
85991
|
const canvasBoundRect = canvas.getBoundingClientRect();
|
|
85986
85992
|
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
85987
85993
|
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
85988
85994
|
const canvasLeftEdge = canvasBoundRect.left + scrollLeft;
|
|
85989
85995
|
const canvasTopEdge = canvasBoundRect.top + scrollTop;
|
|
85990
|
-
|
|
85991
|
-
this._markerDiv.style.
|
|
85992
|
-
this._markerDiv.style.
|
|
85996
|
+
|
|
85997
|
+
this._markerDiv.style.left = `${canvasLeftEdge + canvasPos[0] - 5}px`;
|
|
85998
|
+
this._markerDiv.style.top = `${canvasTopEdge + canvasPos[1] - 5}px`;
|
|
85999
|
+
|
|
85993
86000
|
this._markerDiv.style.background = "pink";
|
|
85994
86001
|
if (event.snappedToVertex || event.snappedToEdge) {
|
|
85995
86002
|
if (this.pointerLens) {
|
|
@@ -86012,8 +86019,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86012
86019
|
}
|
|
86013
86020
|
hoveredEntity = event.entity;
|
|
86014
86021
|
} else {
|
|
86015
|
-
this._markerDiv.style.
|
|
86016
|
-
this._markerDiv.style.
|
|
86022
|
+
this._markerDiv.style.left = `-10000px`;
|
|
86023
|
+
this._markerDiv.style.top = `-10000px`;
|
|
86017
86024
|
}
|
|
86018
86025
|
canvas.style.cursor = "pointer";
|
|
86019
86026
|
if (this._currentDistanceMeasurement) {
|
|
@@ -86024,8 +86031,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86024
86031
|
this._currentDistanceMeasurement.zAxisVisible = this._currentDistanceMeasurementInitState.zAxisVisible && this.distanceMeasurementsPlugin.defaultZAxisVisible;
|
|
86025
86032
|
this._currentDistanceMeasurement.targetVisible = this._currentDistanceMeasurementInitState.targetVisible;
|
|
86026
86033
|
this._currentDistanceMeasurement.target.worldPos = pointerWorldPos.slice();
|
|
86027
|
-
this._markerDiv.style.
|
|
86028
|
-
this._markerDiv.style.
|
|
86034
|
+
this._markerDiv.style.left = `-10000px`;
|
|
86035
|
+
this._markerDiv.style.top = `-10000px`;
|
|
86029
86036
|
}
|
|
86030
86037
|
});
|
|
86031
86038
|
|
|
@@ -86096,8 +86103,8 @@ class DistanceMeasurementsMouseControl extends DistanceMeasurementsControl {
|
|
|
86096
86103
|
this.pointerLens.snappedCanvasPos = event.snappedCanvasPos || event.canvasPos;
|
|
86097
86104
|
}
|
|
86098
86105
|
mouseHovering = false;
|
|
86099
|
-
this._markerDiv.style.
|
|
86100
|
-
this._markerDiv.style.
|
|
86106
|
+
this._markerDiv.style.left = `-100px`;
|
|
86107
|
+
this._markerDiv.style.top = `-100px`;
|
|
86101
86108
|
if (this._currentDistanceMeasurement) {
|
|
86102
86109
|
this._currentDistanceMeasurement.wireVisible = false;
|
|
86103
86110
|
this._currentDistanceMeasurement.targetVisible = false;
|
|
@@ -94356,9 +94363,9 @@ function getCanvasPosFromEvent$2(event, canvas, canvasPos) {
|
|
|
94356
94363
|
canvasPos[0] = event.x;
|
|
94357
94364
|
canvasPos[1] = event.y;
|
|
94358
94365
|
} else {
|
|
94359
|
-
const {
|
|
94360
|
-
canvasPos[0] = event.clientX -
|
|
94361
|
-
canvasPos[1] = event.clientY -
|
|
94366
|
+
const { left, top } = canvas.getBoundingClientRect();
|
|
94367
|
+
canvasPos[0] = event.clientX - left - window.scrollX;
|
|
94368
|
+
canvasPos[1] = event.clientY - top - window.scrollY;
|
|
94362
94369
|
}
|
|
94363
94370
|
return canvasPos;
|
|
94364
94371
|
}
|
package/dist/xeokit-sdk.es5.js
CHANGED
|
@@ -2956,7 +2956,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._cornerDot.s
|
|
|
2956
2956
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
2957
2957
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
2958
2958
|
*/function AngleMeasurementsMouseControl(angleMeasurementsPlugin){var _this18;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,AngleMeasurementsMouseControl);_this18=_super7.call(this,angleMeasurementsPlugin.viewer.scene);_this18.pointerLens=cfg.pointerLens;_this18._active=false;_this18._mouseState=MOUSE_FINDING_ORIGIN;_this18._currentAngleMeasurement=null;// init markerDiv element (think about making its style configurable)
|
|
2959
|
-
_this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myMarkerDiv');var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.
|
|
2959
|
+
_this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothing=null;_this18._onPickedNothing=null;_this18._onPickedSurface=null;_this18._onInputMouseDown=null;_this18._onInputMouseUp=null;_this18._snapping=cfg.snapping!==false;_this18._attachPlugin(angleMeasurementsPlugin,cfg);return _this18;}_createClass(AngleMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myMarkerDiv');var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.top="-200px";markerDiv.style.left="-200px";markerDiv.style.margin="0 0";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this.markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){var element=document.getElementById('myMarkerDiv');element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(angleMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
2960
2960
|
* The {@link AngleMeasurementsPlugin} that owns this AngleMeasurementsMouseControl.
|
|
2961
2961
|
*
|
|
2962
2962
|
* @type {AngleMeasurementsPlugin}
|
|
@@ -2987,7 +2987,7 @@ _this18._initMarkerDiv();_this18._onMouseHoverSurface=null;_this18._onHoverNothi
|
|
|
2987
2987
|
*/function get(){return this._snapping;}/**
|
|
2988
2988
|
* Activates this AngleMeasurementsMouseControl, ready to respond to input.
|
|
2989
2989
|
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this19=this;if(this._active){return;}if(!this.markerDiv){this._initMarkerDiv();// if the marker is destroyed after deactivation, we recreate it
|
|
2990
|
-
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this19.markerDiv.style.
|
|
2990
|
+
}this.angleMeasurementsPlugin;var scene=this.scene;scene.input;var canvas=scene.canvas.canvas;var clickTolerance=20;var cameraControl=this.angleMeasurementsPlugin.viewer.cameraControl;var pointerLens=this.pointerLens;var mouseHovering=false;var hoveredEntity=null;var lastMouseCanvasX=0;var lastMouseCanvasY=0;var mouseWorldPos=math.vec3();var mouseHoverCanvasPos=math.vec2();this._currentAngleMeasurement=null;this._onMouseHoverSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){if(event.snappedToVertex||event.snappedToEdge){if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=true;}_this19.markerDiv.style.background="greenyellow";_this19.markerDiv.style.border="2px solid green";}else{if(pointerLens){pointerLens.visible=true;pointerLens.canvasPos=event.canvasPos;pointerLens.snappedCanvasPos=event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.background="pink";_this19.markerDiv.style.border="2px solid red";}var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;hoveredEntity=event.entity;mouseWorldPos.set(event.worldPos);mouseHoverCanvasPos.set(canvasPos);switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this19.markerDiv.style.left="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this19.markerDiv.style.top="".concat(canvasTopEdge+canvasPos[1]-5,"px");break;case MOUSE_FINDING_CORNER:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.cornerVisible=true;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.corner.worldPos=event.worldPos;_this19._currentAngleMeasurement.corner.entity=event.entity;}_this19.markerDiv.style.left="-10000px";_this19.markerDiv.style.top="-10000px";canvas.style.cursor="pointer";break;case MOUSE_FINDING_TARGET:if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.targetWireVisible=true;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.worldPos=event.worldPos;_this19._currentAngleMeasurement.target.entity=event.entity;}_this19.markerDiv.style.left="-10000px";_this19.markerDiv.style.top="-10000px";canvas.style.cursor="pointer";break;}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}lastMouseCanvasX=e.clientX;lastMouseCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>lastMouseCanvasX+clickTolerance||e.clientX<lastMouseCanvasX-clickTolerance||e.clientY>lastMouseCanvasY+clickTolerance||e.clientY<lastMouseCanvasY-clickTolerance){return;}switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:if(mouseHovering){_this19._currentAngleMeasurement=_this19.angleMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:mouseWorldPos},corner:{worldPos:mouseWorldPos},target:{worldPos:mouseWorldPos},approximate:true});_this19._currentAngleMeasurement.clickable=false;_this19._currentAngleMeasurement.originVisible=true;_this19._currentAngleMeasurement.originWireVisible=true;_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.angleVisible=false;_this19._currentAngleMeasurement.origin.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_CORNER;_this19.angleMeasurementsPlugin.fire("measurementStart",_this19._currentAngleMeasurement);}break;case MOUSE_FINDING_CORNER:if(mouseHovering){_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.corner.entity=hoveredEntity;_this19._mouseState=MOUSE_FINDING_TARGET;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;case MOUSE_FINDING_TARGET:if(mouseHovering){_this19._currentAngleMeasurement.targetVisible=true;_this19._currentAngleMeasurement.angleVisible=true;_this19._currentAngleMeasurement.target.entity=hoveredEntity;_this19._currentAngleMeasurement.clickable=true;hoveredEntity=null;_this19.angleMeasurementsPlugin.fire("measurementEnd",_this19._currentAngleMeasurement);_this19._currentAngleMeasurement=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;}else{if(_this19._currentAngleMeasurement){_this19._currentAngleMeasurement.destroy();_this19._currentAngleMeasurement=null;hoveredEntity=null;_this19._mouseState=MOUSE_FINDING_ORIGIN;_this19.angleMeasurementsPlugin.fire("measurementCancel",_this19._currentAngleMeasurement);}}break;}});this._onMouseHoverOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){mouseHovering=false;if(pointerLens){pointerLens.visible=true;pointerLens.pointerPos=event.canvasPos;pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;pointerLens.snapped=false;}_this19.markerDiv.style.left="-100px";_this19.markerDiv.style.top="-100px";if(_this19._currentAngleMeasurement){switch(_this19._mouseState){case MOUSE_FINDING_ORIGIN:_this19._currentAngleMeasurement.originVisible=false;break;case MOUSE_FINDING_CORNER:_this19._currentAngleMeasurement.cornerVisible=false;_this19._currentAngleMeasurement.originWireVisible=false;_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;case MOUSE_FINDING_TARGET:_this19._currentAngleMeasurement.targetVisible=false;_this19._currentAngleMeasurement.targetWireVisible=false;_this19._currentAngleMeasurement.angleVisible=false;break;}canvas.style.cursor="default";}});this._active=true;}/**
|
|
2991
2991
|
* Deactivates this AngleMeasurementsMouseControl, making it unresponsive to input.
|
|
2992
2992
|
*
|
|
2993
2993
|
* Destroys any {@link AngleMeasurement} under construction by this AngleMeasurementsMouseControl.
|
|
@@ -19225,7 +19225,7 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19225
19225
|
* @param [cfg] Configuration
|
|
19226
19226
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
19227
19227
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
19228
|
-
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this81;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this81=_super117.call(this,distanceMeasurementsPlugin.viewer.scene);_this81.pointerLens=cfg.pointerLens;_this81._active=false;_this81._currentDistanceMeasurement=null;_this81._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this81._initMarkerDiv();_this81._onCameraControlHoverSnapOrSurface=null;_this81._onCameraControlHoverSnapOrSurfaceOff=null;_this81._onMouseDown=null;_this81._onMouseUp=null;_this81._onCanvasTouchStart=null;_this81._onCanvasTouchEnd=null;_this81._snapping=cfg.snapping!==false;_this81._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this81._attachPlugin(distanceMeasurementsPlugin,cfg);return _this81;}_createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myMarkerDiv');var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.
|
|
19228
|
+
*/function DistanceMeasurementsMouseControl(distanceMeasurementsPlugin){var _this81;var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};_classCallCheck(this,DistanceMeasurementsMouseControl);_this81=_super117.call(this,distanceMeasurementsPlugin.viewer.scene);_this81.pointerLens=cfg.pointerLens;_this81._active=false;_this81._currentDistanceMeasurement=null;_this81._currentDistanceMeasurementInitState={wireVisible:null,axisVisible:null,xAxisVisible:null,yaxisVisible:null,zAxisVisible:null,targetVisible:null};_this81._initMarkerDiv();_this81._onCameraControlHoverSnapOrSurface=null;_this81._onCameraControlHoverSnapOrSurfaceOff=null;_this81._onMouseDown=null;_this81._onMouseUp=null;_this81._onCanvasTouchStart=null;_this81._onCanvasTouchEnd=null;_this81._snapping=cfg.snapping!==false;_this81._mouseState=MOUSE_FIRST_CLICK_EXPECTED;_this81._attachPlugin(distanceMeasurementsPlugin,cfg);return _this81;}_createClass(DistanceMeasurementsMouseControl,[{key:"_initMarkerDiv",value:function _initMarkerDiv(){var markerDiv=document.createElement('div');markerDiv.setAttribute('id','myMarkerDiv');var canvas=this.scene.canvas.canvas;canvas.parentNode.insertBefore(markerDiv,canvas);markerDiv.style.background="black";markerDiv.style.border="2px solid blue";markerDiv.style.borderRadius="10px";markerDiv.style.width="5px";markerDiv.style.height="5px";markerDiv.style.top="-200px";markerDiv.style.left="-200px";markerDiv.style.margin="0 0";markerDiv.style.zIndex="100";markerDiv.style.position="absolute";markerDiv.style.pointerEvents="none";this._markerDiv=markerDiv;}},{key:"_destroyMarkerDiv",value:function _destroyMarkerDiv(){if(this._markerDiv){var element=document.getElementById('myMarkerDiv');element.parentNode.removeChild(element);this._markerDiv=null;}}},{key:"_attachPlugin",value:function _attachPlugin(distanceMeasurementsPlugin){var cfg=arguments.length>1&&arguments[1]!==undefined?arguments[1]:{};/**
|
|
19229
19229
|
* The {@link DistanceMeasurementsPlugin} that owns this DistanceMeasurementsMouseControl.
|
|
19230
19230
|
* @type {DistanceMeasurementsPlugin}
|
|
19231
19231
|
*/this.distanceMeasurementsPlugin=distanceMeasurementsPlugin;/**
|
|
@@ -19253,7 +19253,8 @@ this._originDot.setVisible(this._visible&&this._originVisible);this._targetDot.s
|
|
|
19253
19253
|
* @returns {boolean} Whether snap-to-vertex and snap-to-edge are enabled for this DistanceMeasurementsMouseControl.
|
|
19254
19254
|
*/function get(){return this._snapping;}/**
|
|
19255
19255
|
* Activates this DistanceMeasurementsMouseControl, ready to respond to input.
|
|
19256
|
-
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){
|
|
19256
|
+
*/,set:function set(snapping){if(snapping!==this._snapping){this._snapping=snapping;this.deactivate();this.activate();}else{this._snapping=snapping;}}},{key:"activate",value:function activate(){var _this82=this;if(this._active){return;}if(!this._markerDiv){this._initMarkerDiv();}this.fire("activated",true);var distanceMeasurementsPlugin=this.distanceMeasurementsPlugin;var scene=this.scene;var cameraControl=distanceMeasurementsPlugin.viewer.cameraControl;var canvas=scene.canvas.canvas;scene.input;var mouseHovering=false;var pointerWorldPos=math.vec3();var pointerCanvasPos=math.vec2();var pointerDownCanvasX;var pointerDownCanvasY;var clickTolerance=20;var hoveredEntity=null;this._mouseState=MOUSE_FIRST_CLICK_EXPECTED;this._onCameraControlHoverSnapOrSurface=cameraControl.on(this._snapping?"hoverSnapOrSurface":"hoverSurface",function(event){var canvasPos=event.snappedCanvasPos||event.canvasPos;mouseHovering=true;pointerWorldPos.set(event.worldPos);pointerCanvasPos.set(event.canvasPos);if(_this82._mouseState===MOUSE_FIRST_CLICK_EXPECTED){// const canvasBoundary = getCanvasBoundary();
|
|
19257
|
+
var canvasBoundRect=canvas.getBoundingClientRect();var scrollLeft=window.pageXOffset||document.documentElement.scrollLeft;var scrollTop=window.pageYOffset||document.documentElement.scrollTop;var canvasLeftEdge=canvasBoundRect.left+scrollLeft;var canvasTopEdge=canvasBoundRect.top+scrollTop;_this82._markerDiv.style.left="".concat(canvasLeftEdge+canvasPos[0]-5,"px");_this82._markerDiv.style.top="".concat(canvasTopEdge+canvasPos[1]-5,"px");_this82._markerDiv.style.background="pink";if(event.snappedToVertex||event.snappedToEdge){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;_this82.pointerLens.snapped=true;}_this82._markerDiv.style.background="greenyellow";_this82._markerDiv.style.border="2px solid green";}else{if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.canvasPos;_this82.pointerLens.snapped=false;}_this82._markerDiv.style.background="pink";_this82._markerDiv.style.border="2px solid red";}hoveredEntity=event.entity;}else{_this82._markerDiv.style.left="-10000px";_this82._markerDiv.style.top="-10000px";}canvas.style.cursor="pointer";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=_this82._currentDistanceMeasurementInitState.wireVisible;_this82._currentDistanceMeasurement.axisVisible=_this82._currentDistanceMeasurementInitState.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurement.xAxisVisible=_this82._currentDistanceMeasurementInitState.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurement.yAxisVisible=_this82._currentDistanceMeasurementInitState.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurement.zAxisVisible=_this82._currentDistanceMeasurementInitState.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurement.targetVisible=_this82._currentDistanceMeasurementInitState.targetVisible;_this82._currentDistanceMeasurement.target.worldPos=pointerWorldPos.slice();_this82._markerDiv.style.left="-10000px";_this82._markerDiv.style.top="-10000px";}});canvas.addEventListener('mousedown',this._onMouseDown=function(e){if(e.which!==1){return;}pointerDownCanvasX=e.clientX;pointerDownCanvasY=e.clientY;});canvas.addEventListener("mouseup",this._onMouseUp=function(e){if(e.which!==1){return;}if(e.clientX>pointerDownCanvasX+clickTolerance||e.clientX<pointerDownCanvasX-clickTolerance||e.clientY>pointerDownCanvasY+clickTolerance||e.clientY<pointerDownCanvasY-clickTolerance){return;}if(_this82._currentDistanceMeasurement){if(mouseHovering){_this82._currentDistanceMeasurement.target.entity=hoveredEntity;hoveredEntity=null;_this82._currentDistanceMeasurement.clickable=true;_this82.distanceMeasurementsPlugin.fire("measurementEnd",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;}else{_this82._currentDistanceMeasurement.destroy();_this82.distanceMeasurementsPlugin.fire("measurementCancel",_this82._currentDistanceMeasurement);_this82._currentDistanceMeasurement=null;hoveredEntity=null;}}else{if(mouseHovering){_this82._currentDistanceMeasurement=distanceMeasurementsPlugin.createMeasurement({id:math.createUUID(),origin:{worldPos:pointerWorldPos.slice()},target:{worldPos:pointerWorldPos.slice()},approximate:true});_this82._currentDistanceMeasurementInitState.axisVisible=_this82._currentDistanceMeasurement.axisVisible&&_this82.distanceMeasurementsPlugin.defaultAxisVisible;_this82._currentDistanceMeasurementInitState.xAxisVisible=_this82._currentDistanceMeasurement.xAxisVisible&&_this82.distanceMeasurementsPlugin.defaultXAxisVisible;_this82._currentDistanceMeasurementInitState.yAxisVisible=_this82._currentDistanceMeasurement.yAxisVisible&&_this82.distanceMeasurementsPlugin.defaultYAxisVisible;_this82._currentDistanceMeasurementInitState.zAxisVisible=_this82._currentDistanceMeasurement.zAxisVisible&&_this82.distanceMeasurementsPlugin.defaultZAxisVisible;_this82._currentDistanceMeasurementInitState.wireVisible=_this82._currentDistanceMeasurement.wireVisible;_this82._currentDistanceMeasurementInitState.targetVisible=_this82._currentDistanceMeasurement.targetVisible;_this82._currentDistanceMeasurement.clickable=false;_this82._currentDistanceMeasurement.origin.entity=hoveredEntity;hoveredEntity=null;_this82.fire("measurementStart",_this82._currentDistanceMeasurement);}}});this._onCameraControlHoverSnapOrSurfaceOff=cameraControl.on(this._snapping?"hoverSnapOrSurfaceOff":"hoverOff",function(event){if(_this82.pointerLens){_this82.pointerLens.visible=true;_this82.pointerLens.canvasPos=event.canvasPos;_this82.pointerLens.snappedCanvasPos=event.snappedCanvasPos||event.canvasPos;}mouseHovering=false;_this82._markerDiv.style.left="-100px";_this82._markerDiv.style.top="-100px";if(_this82._currentDistanceMeasurement){_this82._currentDistanceMeasurement.wireVisible=false;_this82._currentDistanceMeasurement.targetVisible=false;_this82._currentDistanceMeasurement.axisVisible=false;}canvas.style.cursor="default";});this._active=true;}/**
|
|
19257
19258
|
* Deactivates this DistanceMeasurementsMouseControl, making it unresponsive to input.
|
|
19258
19259
|
*
|
|
19259
19260
|
* Destroys any {@link DistanceMeasurement} under construction by this DistanceMeasurementsMouseControl.
|
|
@@ -22152,7 +22153,7 @@ if(Math.abs(updates.panDeltaX)<EPSILON){updates.panDeltaX=0;}if(Math.abs(updates
|
|
|
22152
22153
|
if(dollyDeltaForDist!==0){if(dollyDeltaForDist<0){cursorType="zoom-in";}else{cursorType="zoom-out";}if(configs.firstPerson){var _verticalEye;var _verticalLook;if(configs.constrainVertical){if(camera.xUp){_verticalEye=camera.eye[0];_verticalLook=camera.look[0];}else if(camera.yUp){_verticalEye=camera.eye[1];_verticalLook=camera.look[1];}else if(camera.zUp){_verticalEye=camera.eye[2];_verticalLook=camera.look[2];}}if(configs.followPointer){var dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.pan([0,0,dollyDeltaForDist]);camera.ortho.scale=camera.ortho.scale-dollyDeltaForDist;}if(configs.constrainVertical){var _eye=camera.eye;var _look=camera.look;if(camera.xUp){_eye[0]=_verticalEye;_look[0]=_verticalLook;}else if(camera.yUp){_eye[1]=_verticalEye;_look[1]=_verticalLook;}else if(camera.zUp){_eye[2]=_verticalEye;_look[2]=_verticalLook;}camera.eye=_eye;camera.look=_look;}}else if(configs.planView){if(configs.followPointer){var _dolliedThroughSurface=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}else{// Orbiting
|
|
22153
22154
|
if(configs.followPointer){var _dolliedThroughSurface2=panController.dollyToCanvasPos(followPointerWorldPos,states.pointerCanvasPos,-dollyDeltaForDist);if(_dolliedThroughSurface2){states.followPointerDirty=true;}}else{camera.ortho.scale=camera.ortho.scale+dollyDeltaForDist;camera.zoom(dollyDeltaForDist);}}updates.dollyDelta*=configs.dollyInertia;}pickController.fireEvents();document.body.style.cursor=cursorType;});}_createClass(CameraUpdater,[{key:"destroy",value:function destroy(){this._scene.off(this._onTick);}}]);return CameraUpdater;}();/**
|
|
22154
22155
|
* @private
|
|
22155
|
-
*/var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){_classCallCheck(this,MouseMiscHandler);this._scene=scene;var canvas=this._scene.canvas.canvas;canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,canvas,states.pointerCanvasPos);});canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,canvas,states.pointerCanvasPos);states.mouseover=true;});canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}_createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler);canvas.removeEventListener("mouseenter",this._mouseEnterHandler);canvas.removeEventListener("mouseleave",this._mouseLeaveHandler);canvas.removeEventListener("mousedown",this._mouseDownHandler);canvas.removeEventListener("mouseup",this._mouseUpHandler);}}]);return MouseMiscHandler;}();function getCanvasPosFromEvent$2(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var _canvas$getBoundingCl=canvas.getBoundingClientRect(),
|
|
22156
|
+
*/var MouseMiscHandler=/*#__PURE__*/function(){function MouseMiscHandler(scene,controllers,configs,states,updates){_classCallCheck(this,MouseMiscHandler);this._scene=scene;var canvas=this._scene.canvas.canvas;canvas.addEventListener("mouseenter",this._mouseEnterHandler=function(){states.mouseover=true;});canvas.addEventListener("mouseleave",this._mouseLeaveHandler=function(){states.mouseover=false;canvas.style.cursor=null;});document.addEventListener("mousemove",this._mouseMoveHandler=function(e){getCanvasPosFromEvent$2(e,canvas,states.pointerCanvasPos);});canvas.addEventListener("mousedown",this._mouseDownHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}getCanvasPosFromEvent$2(e,canvas,states.pointerCanvasPos);states.mouseover=true;});canvas.addEventListener("mouseup",this._mouseUpHandler=function(e){if(!(configs.active&&configs.pointerEnabled)){return;}});}_createClass(MouseMiscHandler,[{key:"reset",value:function reset(){}},{key:"destroy",value:function destroy(){var canvas=this._scene.canvas.canvas;document.removeEventListener("mousemove",this._mouseMoveHandler);canvas.removeEventListener("mouseenter",this._mouseEnterHandler);canvas.removeEventListener("mouseleave",this._mouseLeaveHandler);canvas.removeEventListener("mousedown",this._mouseDownHandler);canvas.removeEventListener("mouseup",this._mouseUpHandler);}}]);return MouseMiscHandler;}();function getCanvasPosFromEvent$2(event,canvas,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var _canvas$getBoundingCl=canvas.getBoundingClientRect(),left=_canvas$getBoundingCl.left,top=_canvas$getBoundingCl.top;canvasPos[0]=event.clientX-left-window.scrollX;canvasPos[1]=event.clientY-top-window.scrollY;}return canvasPos;}var getCanvasPosFromEvent$1=function getCanvasPosFromEvent$1(event,canvasPos){if(!event){event=window.event;canvasPos[0]=event.x;canvasPos[1]=event.y;}else{var element=event.target;var totalOffsetLeft=0;var totalOffsetTop=0;while(element.offsetParent){totalOffsetLeft+=element.offsetLeft;totalOffsetTop+=element.offsetTop;element=element.offsetParent;}canvasPos[0]=event.pageX-totalOffsetLeft;canvasPos[1]=event.pageY-totalOffsetTop;}return canvasPos;};/**
|
|
22156
22157
|
* @private
|
|
22157
22158
|
*/var TouchPanRotateAndDollyHandler=/*#__PURE__*/function(){function TouchPanRotateAndDollyHandler(scene,controllers,configs,states,updates){_classCallCheck(this,TouchPanRotateAndDollyHandler);this._scene=scene;var pickController=controllers.pickController;var pivotController=controllers.pivotController;var tapStartCanvasPos=math.vec2();var tapCanvasPos0=math.vec2();var tapCanvasPos1=math.vec2();var touch0Vec=math.vec2();var lastCanvasTouchPosList=[];var canvas=this._scene.canvas.canvas;var numTouches=0;var waitForTick=false;this._onTick=scene.on("tick",function(){waitForTick=false;});canvas.addEventListener("touchstart",this._canvasTouchStartHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.preventDefault();var touches=event.touches;var changedTouches=event.changedTouches;states.touchStartTime=Date.now();if(touches.length===1&&changedTouches.length===1){getCanvasPosFromEvent$1(touches[0],tapStartCanvasPos);if(configs.followPointer){pickController.pickCursorPos=tapStartCanvasPos;pickController.schedulePickSurface=true;pickController.update();if(!configs.planView){if(pickController.picked&&pickController.pickedSurface&&pickController.pickResult&&pickController.pickResult.worldPos){pivotController.setPivotPos(pickController.pickResult.worldPos);if(!configs.firstPerson&&pivotController.startPivot()){pivotController.showPivot();}}else{if(configs.smartPivot){pivotController.setCanvasPivotPos(states.pointerCanvasPos);}else{pivotController.setPivotPos(scene.camera.look);}if(!configs.firstPerson&&pivotController.startPivot()){pivotController.showPivot();}}}}}while(lastCanvasTouchPosList.length<touches.length){lastCanvasTouchPosList.push(math.vec2());}for(var _i464=0,len=touches.length;_i464<len;++_i464){getCanvasPosFromEvent$1(touches[_i464],lastCanvasTouchPosList[_i464]);}numTouches=touches.length;});canvas.addEventListener("touchend",this._canvasTouchEndHandler=function(){if(pivotController.getPivoting()){pivotController.endPivot();}});canvas.addEventListener("touchmove",this._canvasTouchMoveHandler=function(event){if(!(configs.active&&configs.pointerEnabled)){return;}event.stopPropagation();event.preventDefault();if(waitForTick){// Limit changes detection to one per frame
|
|
22158
22159
|
return;}waitForTick=true;// Scaling drag-rotate to canvas boundary
|