@xeokit/xeokit-sdk 2.4.2-beta-31 → 2.4.2-beta-32
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 +74 -25
- package/dist/xeokit-sdk.es.js +74 -25
- package/dist/xeokit-sdk.es5.js +10 -8
- package/dist/xeokit-sdk.min.cjs.js +1 -1
- package/dist/xeokit-sdk.min.es.js +1 -1
- package/dist/xeokit-sdk.min.es5.js +1 -1
- package/package.json +1 -1
- package/src/plugins/AngleMeasurementsPlugin/AngleMeasurementsMouseControl.js +35 -10
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +39 -15
package/package.json
CHANGED
|
@@ -62,7 +62,25 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
62
62
|
|
|
63
63
|
this._currentAngleMeasurement = null;
|
|
64
64
|
|
|
65
|
+
// init markerDiv element (think about making its style configurable)
|
|
66
|
+
this._initMarkerDiv()
|
|
67
|
+
|
|
68
|
+
this._onMouseHoverSurface = null;
|
|
69
|
+
this._onHoverNothing = null;
|
|
70
|
+
this._onPickedNothing = null;
|
|
71
|
+
this._onPickedSurface = null;
|
|
72
|
+
|
|
73
|
+
this._onInputMouseDown = null;
|
|
74
|
+
this._onInputMouseUp = null;
|
|
75
|
+
|
|
76
|
+
this._snapping = cfg.snapping !== false;
|
|
77
|
+
|
|
78
|
+
this._attachPlugin(angleMeasurementsPlugin, cfg);
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
_initMarkerDiv() {
|
|
65
82
|
const markerDiv = document.createElement('div');
|
|
83
|
+
markerDiv.setAttribute('id', 'myMarkerDiv');
|
|
66
84
|
const canvas = this.scene.canvas.canvas;
|
|
67
85
|
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
68
86
|
|
|
@@ -77,17 +95,14 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
77
95
|
markerDiv.style.pointerEvents = "none";
|
|
78
96
|
|
|
79
97
|
this.markerDiv = markerDiv;
|
|
80
|
-
|
|
81
|
-
this._onHoverNothing = null;
|
|
82
|
-
this._onPickedNothing = null;
|
|
83
|
-
this._onPickedSurface = null;
|
|
84
|
-
|
|
85
|
-
this._onInputMouseDown = null;
|
|
86
|
-
this._onInputMouseUp = null;
|
|
87
|
-
|
|
88
|
-
this._snapping = cfg.snapping !== false;
|
|
98
|
+
}
|
|
89
99
|
|
|
90
|
-
|
|
100
|
+
_destroyMarkerDiv() {
|
|
101
|
+
if (this._markerDiv) {
|
|
102
|
+
const element = document.getElementById('myMarkerDiv')
|
|
103
|
+
element.parentNode.removeChild(element)
|
|
104
|
+
this._markerDiv = null
|
|
105
|
+
}
|
|
91
106
|
}
|
|
92
107
|
|
|
93
108
|
_attachPlugin(angleMeasurementsPlugin, cfg = {}) {
|
|
@@ -155,6 +170,9 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
155
170
|
if (this._active) {
|
|
156
171
|
return;
|
|
157
172
|
}
|
|
173
|
+
if (!this.markerDiv) {
|
|
174
|
+
this._initMarkerDiv() // if the marker is destroyed after deactivation, we recreate it
|
|
175
|
+
}
|
|
158
176
|
const angleMeasurementsPlugin = this.angleMeasurementsPlugin;
|
|
159
177
|
const scene = this.scene;
|
|
160
178
|
const input = scene.input;
|
|
@@ -359,6 +377,9 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
359
377
|
if (this.pointerLens) {
|
|
360
378
|
this.pointerLens.visible = false;
|
|
361
379
|
}
|
|
380
|
+
if (this._markerDiv) {
|
|
381
|
+
this._destroyMarkerDiv()
|
|
382
|
+
}
|
|
362
383
|
this.reset();
|
|
363
384
|
const canvas = this.scene.canvas.canvas;
|
|
364
385
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
@@ -383,6 +404,10 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
383
404
|
if (!this._active) {
|
|
384
405
|
return;
|
|
385
406
|
}
|
|
407
|
+
|
|
408
|
+
this._destroyMarkerDiv()
|
|
409
|
+
this._initMarkerDiv()
|
|
410
|
+
|
|
386
411
|
if (this._currentAngleMeasurement) {
|
|
387
412
|
this._currentAngleMeasurement.destroy();
|
|
388
413
|
this._currentAngleMeasurement = null;
|
|
@@ -58,21 +58,6 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
58
58
|
|
|
59
59
|
this._active = false;
|
|
60
60
|
|
|
61
|
-
const markerDiv = document.createElement('div');
|
|
62
|
-
const canvas = this.scene.canvas.canvas;
|
|
63
|
-
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
64
|
-
markerDiv.style.background = "black";
|
|
65
|
-
markerDiv.style.border = "2px solid blue";
|
|
66
|
-
markerDiv.style.borderRadius = "10px";
|
|
67
|
-
markerDiv.style.width = "5px";
|
|
68
|
-
markerDiv.style.height = "5px";
|
|
69
|
-
markerDiv.style.margin = "-200px -200px";
|
|
70
|
-
markerDiv.style.zIndex = "100";
|
|
71
|
-
markerDiv.style.position = "absolute";
|
|
72
|
-
markerDiv.style.pointerEvents = "none";
|
|
73
|
-
|
|
74
|
-
this._markerDiv = markerDiv;
|
|
75
|
-
|
|
76
61
|
this._currentDistanceMeasurement = null;
|
|
77
62
|
|
|
78
63
|
this._currentDistanceMeasurementInitState = {
|
|
@@ -84,6 +69,8 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
84
69
|
targetVisible: null,
|
|
85
70
|
}
|
|
86
71
|
|
|
72
|
+
this._initMarkerDiv()
|
|
73
|
+
|
|
87
74
|
this._onCameraControlHoverSnapOrSurface = null;
|
|
88
75
|
this._onCameraControlHoverSnapOrSurfaceOff = null;
|
|
89
76
|
this._onMouseDown = null;
|
|
@@ -96,6 +83,32 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
96
83
|
this._attachPlugin(distanceMeasurementsPlugin, cfg);
|
|
97
84
|
}
|
|
98
85
|
|
|
86
|
+
_initMarkerDiv() {
|
|
87
|
+
const markerDiv = document.createElement('div');
|
|
88
|
+
markerDiv.setAttribute('id', 'myMarkerDiv');
|
|
89
|
+
const canvas = this.scene.canvas.canvas;
|
|
90
|
+
canvas.parentNode.insertBefore(markerDiv, canvas);
|
|
91
|
+
markerDiv.style.background = "black";
|
|
92
|
+
markerDiv.style.border = "2px solid blue";
|
|
93
|
+
markerDiv.style.borderRadius = "10px";
|
|
94
|
+
markerDiv.style.width = "5px";
|
|
95
|
+
markerDiv.style.height = "5px";
|
|
96
|
+
markerDiv.style.margin = "-200px -200px";
|
|
97
|
+
markerDiv.style.zIndex = "100";
|
|
98
|
+
markerDiv.style.position = "absolute";
|
|
99
|
+
markerDiv.style.pointerEvents = "none";
|
|
100
|
+
|
|
101
|
+
this._markerDiv = markerDiv;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
_destroyMarkerDiv() {
|
|
105
|
+
if (this._markerDiv) {
|
|
106
|
+
const element = document.getElementById('myMarkerDiv')
|
|
107
|
+
element.parentNode.removeChild(element)
|
|
108
|
+
this._markerDiv = null
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
99
112
|
_attachPlugin(distanceMeasurementsPlugin, cfg = {}) {
|
|
100
113
|
|
|
101
114
|
/**
|
|
@@ -161,6 +174,10 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
161
174
|
return;
|
|
162
175
|
}
|
|
163
176
|
|
|
177
|
+
if (!this._markerDiv) {
|
|
178
|
+
this._initMarkerDiv()
|
|
179
|
+
}
|
|
180
|
+
|
|
164
181
|
this.fire("activated", true);
|
|
165
182
|
|
|
166
183
|
const distanceMeasurementsPlugin = this.distanceMeasurementsPlugin;
|
|
@@ -316,6 +333,9 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
316
333
|
if (this.pointerLens) {
|
|
317
334
|
this.pointerLens.visible = false;
|
|
318
335
|
}
|
|
336
|
+
if (this._markerDiv) {
|
|
337
|
+
this._destroyMarkerDiv()
|
|
338
|
+
}
|
|
319
339
|
this.reset();
|
|
320
340
|
const canvas = this.scene.canvas.canvas;
|
|
321
341
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
@@ -342,6 +362,10 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
342
362
|
if (!this._active) {
|
|
343
363
|
return;
|
|
344
364
|
}
|
|
365
|
+
|
|
366
|
+
this._destroyMarkerDiv()
|
|
367
|
+
this._initMarkerDiv()
|
|
368
|
+
|
|
345
369
|
if (this._currentDistanceMeasurement) {
|
|
346
370
|
this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
|
|
347
371
|
this._currentDistanceMeasurement.destroy();
|