@xeokit/xeokit-sdk 2.6.0-beta-9 → 2.6.0-beta-11
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/web-ifc.wasm +0 -0
- package/dist/xeokit-sdk.cjs.js +27 -6
- package/dist/xeokit-sdk.es.js +27 -6
- package/dist/xeokit-sdk.es5.js +7 -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 +13 -3
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +13 -2
package/package.json
CHANGED
|
@@ -48,6 +48,7 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
48
48
|
*
|
|
49
49
|
* @param {AngleMeasurementsPlugin} angleMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
50
50
|
* @param {*} [cfg] Configuration
|
|
51
|
+
* @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.
|
|
51
52
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
52
53
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this AngleMeasurementsMouseControl.
|
|
53
54
|
*/
|
|
@@ -55,6 +56,8 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
55
56
|
|
|
56
57
|
super(angleMeasurementsPlugin.viewer.scene);
|
|
57
58
|
|
|
59
|
+
this._canvasToPagePos = cfg.canvasToPagePos;
|
|
60
|
+
|
|
58
61
|
this.pointerLens = cfg.pointerLens;
|
|
59
62
|
|
|
60
63
|
this._active = false;
|
|
@@ -193,6 +196,8 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
193
196
|
const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));
|
|
194
197
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
195
198
|
|
|
199
|
+
const pagePos = math.vec2();
|
|
200
|
+
|
|
196
201
|
this._onMouseHoverSurface = cameraControl.on(
|
|
197
202
|
this._snapping
|
|
198
203
|
? "hoverSnapOrSurface"
|
|
@@ -224,9 +229,14 @@ export class AngleMeasurementsMouseControl extends AngleMeasurementsControl {
|
|
|
224
229
|
mouseHoverCanvasPos.set(canvasPos);
|
|
225
230
|
switch (this._mouseState) {
|
|
226
231
|
case MOUSE_FINDING_ORIGIN:
|
|
227
|
-
this.
|
|
228
|
-
|
|
229
|
-
|
|
232
|
+
if (this._canvasToPagePos) {
|
|
233
|
+
this._canvasToPagePos(canvas, canvasPos, pagePos);
|
|
234
|
+
this.markerDiv.style.left = `${pagePos[0] - 5}px`;
|
|
235
|
+
this.markerDiv.style.top = `${pagePos[1] - 5}px`;
|
|
236
|
+
} else {
|
|
237
|
+
this.markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
|
|
238
|
+
this.markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
|
|
239
|
+
}
|
|
230
240
|
break;
|
|
231
241
|
case MOUSE_FINDING_CORNER:
|
|
232
242
|
if (this._currentAngleMeasurement) {
|
|
@@ -353,7 +353,7 @@ class DistanceMeasurement extends Component {
|
|
|
353
353
|
|
|
354
354
|
if (this._sectionPlanesDirty) {
|
|
355
355
|
|
|
356
|
-
if (this._isSliced(this.
|
|
356
|
+
if (this._isSliced(this._originWorld) || this._isSliced(this._targetWorld)) {
|
|
357
357
|
this._xAxisLabel.setCulled(true);
|
|
358
358
|
this._yAxisLabel.setCulled(true);
|
|
359
359
|
this._zAxisLabel.setCulled(true);
|
|
@@ -47,6 +47,7 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
47
47
|
*
|
|
48
48
|
* @param {DistanceMeasurementsPlugin} distanceMeasurementsPlugin The AngleMeasurementsPlugin to control.
|
|
49
49
|
* @param [cfg] Configuration
|
|
50
|
+
* @param {function} [cfg.canvasToPagePos] Optional function to map canvas-space coordinates to page coordinates.
|
|
50
51
|
* @param {PointerLens} [cfg.pointerLens] A PointerLens to use to provide a magnified view of the cursor when snapping is enabled.
|
|
51
52
|
* @param {boolean} [cfg.snapping=true] Whether to initially enable snap-to-vertex and snap-to-edge for this DistanceMeasurementsMouseControl.
|
|
52
53
|
*/
|
|
@@ -54,6 +55,8 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
54
55
|
|
|
55
56
|
super(distanceMeasurementsPlugin.viewer.scene);
|
|
56
57
|
|
|
58
|
+
this._canvasToPagePos = cfg.canvasToPagePos;
|
|
59
|
+
|
|
57
60
|
this.pointerLens = cfg.pointerLens;
|
|
58
61
|
|
|
59
62
|
this._active = false;
|
|
@@ -200,6 +203,8 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
200
203
|
const getTop = el => el.offsetTop + (el.offsetParent && getTop(el.offsetParent));
|
|
201
204
|
const getLeft = el => el.offsetLeft + (el.offsetParent && getLeft(el.offsetParent));
|
|
202
205
|
|
|
206
|
+
const pagePos = math.vec2();
|
|
207
|
+
|
|
203
208
|
this._onCameraControlHoverSnapOrSurface = cameraControl.on(
|
|
204
209
|
this._snapping
|
|
205
210
|
? "hoverSnapOrSurface"
|
|
@@ -210,8 +215,14 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
210
215
|
pointerCanvasPos.set(event.canvasPos);
|
|
211
216
|
if (this._mouseState === MOUSE_FIRST_CLICK_EXPECTED) {
|
|
212
217
|
|
|
213
|
-
this.
|
|
214
|
-
|
|
218
|
+
if (this._canvasToPagePos) {
|
|
219
|
+
this._canvasToPagePos(canvas, canvasPos, pagePos);
|
|
220
|
+
this._markerDiv.style.left = `${pagePos[0] - 5}px`;
|
|
221
|
+
this._markerDiv.style.top = `${pagePos[1] - 5}px`;
|
|
222
|
+
} else {
|
|
223
|
+
this._markerDiv.style.left = `${getLeft(canvas) + canvasPos[0] - 5}px`;
|
|
224
|
+
this._markerDiv.style.top = `${getTop(canvas) + canvasPos[1] - 5}px`;
|
|
225
|
+
}
|
|
215
226
|
|
|
216
227
|
this._markerDiv.style.background = "pink";
|
|
217
228
|
if (event.snappedToVertex || event.snappedToEdge) {
|