@xeokit/xeokit-sdk 2.6.26 → 2.6.28
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 -83
- package/dist/xeokit-sdk.es.js +74 -83
- package/dist/xeokit-sdk.es5.js +39 -30
- package/dist/xeokit-sdk.min.cjs.js +3 -3
- package/dist/xeokit-sdk.min.es.js +3 -3
- package/dist/xeokit-sdk.min.es5.js +4 -4
- package/package.json +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.js +1 -1
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsMouseControl.js +10 -10
- package/src/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsPlugin.js +1 -1
- package/src/plugins/ZonesPlugin/index.js +3 -3
- package/src/plugins/lib/ui/index.js +1 -1
- package/src/viewer/scene/CameraControl/lib/handlers/MousePickHandler.js +2 -3
- package/src/viewer/scene/math/math.js +29 -34
- package/src/viewer/scene/mesh/Mesh.js +4 -4
- package/src/viewer/scene/scene/Scene.js +2 -18
- package/src/viewer/scene/webgl/Renderer.js +21 -8
- package/types/plugins/AngleMeasurementsPlugin/AngleMeasurement.d.ts +14 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurement.d.ts +13 -0
- package/types/plugins/DistanceMeasurementsPlugin/DistanceMeasurementsControl.d.ts +15 -0
package/package.json
CHANGED
|
@@ -539,7 +539,7 @@ class DistanceMeasurement extends Component {
|
|
|
539
539
|
}
|
|
540
540
|
|
|
541
541
|
if (!this._zAxisLabelCulled) {
|
|
542
|
-
if(this._measurementOrientation === 'Vertical') {
|
|
542
|
+
if(this._measurementOrientation === 'Vertical' && this.useRotationAdjustment) {
|
|
543
543
|
this._zAxisLabel.setPrefix("");
|
|
544
544
|
this._zAxisLabel.setText(tilde + Math.abs(math.lenVec3(math.subVec3(this._targetWorld, [this._originWorld[0], this._targetWorld[1], this._originWorld[2]], distVec3)) * scale).toFixed(2) + unitAbbrev);
|
|
545
545
|
}
|
|
@@ -353,27 +353,27 @@ export class DistanceMeasurementsMouseControl extends DistanceMeasurementsContro
|
|
|
353
353
|
if (!this._active) {
|
|
354
354
|
return;
|
|
355
355
|
}
|
|
356
|
-
|
|
356
|
+
|
|
357
357
|
this.fire("activated", false);
|
|
358
358
|
|
|
359
359
|
if (this.pointerLens) {
|
|
360
360
|
this.pointerLens.visible = false;
|
|
361
361
|
}
|
|
362
|
-
if (this._markerDiv) {
|
|
363
|
-
|
|
364
|
-
}
|
|
365
|
-
this.reset();
|
|
362
|
+
// if (this._markerDiv) {
|
|
363
|
+
// this._destroyMarkerDiv()
|
|
364
|
+
// }
|
|
365
|
+
// this.reset();
|
|
366
366
|
const canvas = this.scene.canvas.canvas;
|
|
367
367
|
canvas.removeEventListener("mousedown", this._onMouseDown);
|
|
368
368
|
canvas.removeEventListener("mouseup", this._onMouseUp);
|
|
369
369
|
const cameraControl = this.distanceMeasurementsPlugin.viewer.cameraControl;
|
|
370
370
|
cameraControl.off(this._onCameraControlHoverSnapOrSurface);
|
|
371
371
|
cameraControl.off(this._onCameraControlHoverSnapOrSurfaceOff);
|
|
372
|
-
if (this._currentDistanceMeasurement) {
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
}
|
|
372
|
+
// if (this._currentDistanceMeasurement) {
|
|
373
|
+
// this.distanceMeasurementsPlugin.fire("measurementCancel", this._currentDistanceMeasurement);
|
|
374
|
+
// this._currentDistanceMeasurement.destroy();
|
|
375
|
+
// this._currentDistanceMeasurement = null;
|
|
376
|
+
// }
|
|
377
377
|
this._active = false;
|
|
378
378
|
}
|
|
379
379
|
|
|
@@ -489,7 +489,7 @@ class DistanceMeasurementsPlugin extends Plugin {
|
|
|
489
489
|
axisVisible: params.axisVisible !== false && this.defaultAxisVisible !== false,
|
|
490
490
|
xAxisVisible: params.xAxisVisible !== false && this.defaultXAxisVisible !== false,
|
|
491
491
|
yAxisVisible: params.yAxisVisible !== false && this.defaultYAxisVisible !== false,
|
|
492
|
-
|
|
492
|
+
zAxisVisible: params.zAxisVisible !== false && this.defaultZAxisVisible !== false,
|
|
493
493
|
xLabelEnabled: params.xLabelEnabled !== false && this.defaultXLabelEnabled !== false,
|
|
494
494
|
yLabelEnabled: params.yLabelEnabled !== false && this.defaultYLabelEnabled !== false,
|
|
495
495
|
zLabelEnabled: params.zLabelEnabled !== false && this.defaultZLabelEnabled !== false,
|
|
@@ -393,7 +393,7 @@ const mousePointSelector = function(viewer, ray2WorldPos) {
|
|
|
393
393
|
const pickWorldPos = canvasPos => {
|
|
394
394
|
const origin = math.vec3();
|
|
395
395
|
const direction = math.vec3();
|
|
396
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
396
|
+
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, canvasPos, origin, direction);
|
|
397
397
|
return ray2WorldPos(origin, direction);
|
|
398
398
|
};
|
|
399
399
|
|
|
@@ -468,7 +468,7 @@ const touchPointSelector = function(viewer, pointerCircle, ray2WorldPos) {
|
|
|
468
468
|
const pickWorldPos = canvasPos => {
|
|
469
469
|
const origin = math.vec3();
|
|
470
470
|
const direction = math.vec3();
|
|
471
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
471
|
+
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, canvasPos, origin, direction);
|
|
472
472
|
return ray2WorldPos(origin, direction);
|
|
473
473
|
};
|
|
474
474
|
|
|
@@ -1711,7 +1711,7 @@ export class ZoneTranslateControl extends Component {
|
|
|
1711
1711
|
const pickWorldPos = canvasPos => {
|
|
1712
1712
|
const origin = math.vec3();
|
|
1713
1713
|
const direction = math.vec3();
|
|
1714
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
1714
|
+
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, canvasPos, origin, direction);
|
|
1715
1715
|
return ray2WorldPos(origin, direction);
|
|
1716
1716
|
};
|
|
1717
1717
|
|
|
@@ -111,7 +111,7 @@ export function activateDraggableDot(dot, cfg) {
|
|
|
111
111
|
const pickWorldPos = canvasPos => {
|
|
112
112
|
const origin = math.vec3();
|
|
113
113
|
const direction = math.vec3();
|
|
114
|
-
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, canvasPos, origin, direction);
|
|
114
|
+
math.canvasPosToWorldRay(canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, canvasPos, origin, direction);
|
|
115
115
|
return ray2WorldPos(origin, direction, canvasPos);
|
|
116
116
|
};
|
|
117
117
|
|
|
@@ -59,8 +59,7 @@ class MousePickHandler {
|
|
|
59
59
|
{
|
|
60
60
|
const origin = math.vec3();
|
|
61
61
|
const direction = math.vec3();
|
|
62
|
-
|
|
63
|
-
math.canvasPosToWorldRay(scene.canvas.canvas, scene.camera.viewMatrix, scene.camera.projMatrix, states.pointerCanvasPos, origin, direction);
|
|
62
|
+
math.canvasPosToWorldRay(scene.canvas.canvas, scene.camera.viewMatrix, scene.camera.projMatrix, scene.camera.projection, states.pointerCanvasPos, origin, direction);
|
|
64
63
|
cameraControl.fire("rayMove", { canvasPos: states.pointerCanvasPos, ray: { origin: origin, direction: direction, canvasPos: states.pointerCanvasPos } }, true);
|
|
65
64
|
}
|
|
66
65
|
|
|
@@ -267,7 +266,7 @@ class MousePickHandler {
|
|
|
267
266
|
|
|
268
267
|
this._timeout = setTimeout(() => {
|
|
269
268
|
|
|
270
|
-
if (firstClickPickResult) {
|
|
269
|
+
if (firstClickPickResult && firstClickPickResult.worldPos) {
|
|
271
270
|
|
|
272
271
|
cameraControl.fire("picked", firstClickPickResult, true);
|
|
273
272
|
|
|
@@ -4909,54 +4909,49 @@ const math = {
|
|
|
4909
4909
|
@static
|
|
4910
4910
|
@param {Number[]} viewMatrix View matrix
|
|
4911
4911
|
@param {Number[]} projMatrix Projection matrix
|
|
4912
|
+
@param {String} projection Projection type (e.g. "ortho")
|
|
4912
4913
|
@param {Number[]} canvasPos The Canvas-space position.
|
|
4913
4914
|
@param {Number[]} worldRayOrigin The World-space ray origin.
|
|
4914
4915
|
@param {Number[]} worldRayDir The World-space ray direction.
|
|
4915
4916
|
*/
|
|
4916
4917
|
canvasPosToWorldRay: ((() => {
|
|
4917
4918
|
|
|
4918
|
-
const
|
|
4919
|
-
const
|
|
4920
|
-
const
|
|
4921
|
-
const tempVec4b = new FloatArrayType(4);
|
|
4922
|
-
const tempVec4c = new FloatArrayType(4);
|
|
4923
|
-
const tempVec4d = new FloatArrayType(4);
|
|
4924
|
-
|
|
4925
|
-
return (canvas, viewMatrix, projMatrix, canvasPos, worldRayOrigin, worldRayDir) => {
|
|
4919
|
+
const pvMatInv = new FloatArrayType(16);
|
|
4920
|
+
const vec4Near = new FloatArrayType(4);
|
|
4921
|
+
const vec4Far = new FloatArrayType(4);
|
|
4926
4922
|
|
|
4927
|
-
|
|
4928
|
-
|
|
4923
|
+
const clipToWorld = (clipX, clipY, clipZ, isOrtho, outVec4) => {
|
|
4924
|
+
outVec4[0] = clipX;
|
|
4925
|
+
outVec4[1] = clipY;
|
|
4926
|
+
outVec4[2] = clipZ;
|
|
4927
|
+
outVec4[3] = 1;
|
|
4929
4928
|
|
|
4930
|
-
|
|
4931
|
-
|
|
4929
|
+
math.transformVec4(pvMatInv, outVec4, outVec4);
|
|
4930
|
+
if (! isOrtho)
|
|
4931
|
+
math.mulVec4Scalar(outVec4, 1 / outVec4[3]);
|
|
4932
|
+
};
|
|
4932
4933
|
|
|
4933
|
-
|
|
4934
|
-
const
|
|
4934
|
+
return (canvas, viewMatrix, projMatrix, projection, canvasPos, worldRayOrigin, worldRayDir) => {
|
|
4935
|
+
const isOrtho = projection === "ortho";
|
|
4935
4936
|
|
|
4936
|
-
|
|
4937
|
-
|
|
4937
|
+
math.mulMat4(projMatrix, viewMatrix, pvMatInv);
|
|
4938
|
+
math.inverseMat4(pvMatInv, pvMatInv);
|
|
4938
4939
|
|
|
4939
|
-
|
|
4940
|
-
|
|
4941
|
-
tempVec4a[2] = -1;
|
|
4942
|
-
tempVec4a[3] = 1;
|
|
4940
|
+
// Calculate clip space coordinates, which will be in range
|
|
4941
|
+
// of x=[-1..1] and y=[-1..1], with y=(+1) at top
|
|
4943
4942
|
|
|
4944
|
-
|
|
4945
|
-
|
|
4943
|
+
const clipX = 2 * canvasPos[0] / canvas.width - 1; // Calculate clip space coordinates
|
|
4944
|
+
const clipY = 1 - 2 * canvasPos[1] / canvas.height;
|
|
4946
4945
|
|
|
4947
|
-
|
|
4948
|
-
tempVec4c[1] = clipY;
|
|
4949
|
-
tempVec4c[2] = 1;
|
|
4950
|
-
tempVec4c[3] = 1;
|
|
4946
|
+
clipToWorld(clipX, clipY, -1, isOrtho, vec4Near);
|
|
4951
4947
|
|
|
4952
|
-
|
|
4953
|
-
math.mulVec4Scalar(tempVec4d, 1 / tempVec4d[3]);
|
|
4948
|
+
clipToWorld(clipX, clipY, 1, isOrtho, vec4Far);
|
|
4954
4949
|
|
|
4955
|
-
worldRayOrigin[0] =
|
|
4956
|
-
worldRayOrigin[1] =
|
|
4957
|
-
worldRayOrigin[2] =
|
|
4950
|
+
worldRayOrigin[0] = vec4Near[0];
|
|
4951
|
+
worldRayOrigin[1] = vec4Near[1];
|
|
4952
|
+
worldRayOrigin[2] = vec4Near[2];
|
|
4958
4953
|
|
|
4959
|
-
math.subVec3(
|
|
4954
|
+
math.subVec3(vec4Far, vec4Near, worldRayDir);
|
|
4960
4955
|
|
|
4961
4956
|
math.normalizeVec3(worldRayDir);
|
|
4962
4957
|
};
|
|
@@ -4980,8 +4975,8 @@ const math = {
|
|
|
4980
4975
|
const worldRayOrigin = new FloatArrayType(3);
|
|
4981
4976
|
const worldRayDir = new FloatArrayType(3);
|
|
4982
4977
|
|
|
4983
|
-
return (canvas, viewMatrix, projMatrix, worldMatrix, canvasPos, localRayOrigin, localRayDir) => {
|
|
4984
|
-
math.canvasPosToWorldRay(canvas, viewMatrix, projMatrix, canvasPos, worldRayOrigin, worldRayDir);
|
|
4978
|
+
return (canvas, viewMatrix, projMatrix, projection, worldMatrix, canvasPos, localRayOrigin, localRayDir) => {
|
|
4979
|
+
math.canvasPosToWorldRay(canvas, viewMatrix, projMatrix, projection, canvasPos, worldRayOrigin, worldRayDir);
|
|
4985
4980
|
math.worldRayToLocalRay(worldMatrix, worldRayOrigin, worldRayDir, localRayOrigin, localRayDir);
|
|
4986
4981
|
};
|
|
4987
4982
|
}))(),
|
|
@@ -1898,8 +1898,8 @@ class Mesh extends Component {
|
|
|
1898
1898
|
}
|
|
1899
1899
|
|
|
1900
1900
|
/** @private */
|
|
1901
|
-
pickTriangleSurface(pickViewMatrix, pickProjMatrix, pickResult) {
|
|
1902
|
-
pickTriangleSurface(this, pickViewMatrix, pickProjMatrix, pickResult);
|
|
1901
|
+
pickTriangleSurface(pickViewMatrix, pickProjMatrix, projection, pickResult) {
|
|
1902
|
+
pickTriangleSurface(this, pickViewMatrix, pickProjMatrix, projection, pickResult);
|
|
1903
1903
|
}
|
|
1904
1904
|
|
|
1905
1905
|
/** @private */
|
|
@@ -1991,7 +1991,7 @@ const pickTriangleSurface = (function () {
|
|
|
1991
1991
|
const tempVec3j = math.vec3();
|
|
1992
1992
|
const tempVec3k = math.vec3();
|
|
1993
1993
|
|
|
1994
|
-
return function (mesh, pickViewMatrix, pickProjMatrix, pickResult) {
|
|
1994
|
+
return function (mesh, pickViewMatrix, pickProjMatrix, projection, pickResult) {
|
|
1995
1995
|
|
|
1996
1996
|
var primIndex = pickResult.primIndex;
|
|
1997
1997
|
|
|
@@ -2070,7 +2070,7 @@ const pickTriangleSurface = (function () {
|
|
|
2070
2070
|
// Attempt to ray-pick the triangle in local space
|
|
2071
2071
|
|
|
2072
2072
|
if (pickResult.canvasPos) {
|
|
2073
|
-
math.canvasPosToLocalRay(canvas.canvas, mesh.origin ? createRTCViewMat(pickViewMatrix, mesh.origin) : pickViewMatrix, pickProjMatrix, mesh.worldMatrix, pickResult.canvasPos, localRayOrigin, localRayDir);
|
|
2073
|
+
math.canvasPosToLocalRay(canvas.canvas, mesh.origin ? createRTCViewMat(pickViewMatrix, mesh.origin) : pickViewMatrix, pickProjMatrix, projection, mesh.worldMatrix, pickResult.canvasPos, localRayOrigin, localRayDir);
|
|
2074
2074
|
|
|
2075
2075
|
} else if (pickResult.origin && pickResult.direction) {
|
|
2076
2076
|
math.worldRayToLocalRay(mesh.worldMatrix, pickResult.origin, pickResult.direction, localRayOrigin, localRayDir);
|
|
@@ -2303,11 +2303,6 @@ class Scene extends Component {
|
|
|
2303
2303
|
return null;
|
|
2304
2304
|
}
|
|
2305
2305
|
|
|
2306
|
-
if ((params.snapToVertex || params.snapToEdge) && !params.canvasPos) {
|
|
2307
|
-
this.error("Scene.snapPick() `canvasPos` parameter expected for `snapToVertex:true` or `snapToEdge:true`");
|
|
2308
|
-
return;
|
|
2309
|
-
}
|
|
2310
|
-
|
|
2311
2306
|
params = params || {};
|
|
2312
2307
|
|
|
2313
2308
|
params.pickSurface = params.pickSurface || params.rayPick; // Backwards compatibility
|
|
@@ -2333,13 +2328,7 @@ class Scene extends Component {
|
|
|
2333
2328
|
}
|
|
2334
2329
|
|
|
2335
2330
|
if (params.snapToEdge || params.snapToVertex) {
|
|
2336
|
-
pickResult = this._renderer.snapPick(
|
|
2337
|
-
params.canvasPos,
|
|
2338
|
-
params.snapRadius || 30,
|
|
2339
|
-
params.snapToVertex,
|
|
2340
|
-
params.snapToEdge,
|
|
2341
|
-
pickResult
|
|
2342
|
-
);
|
|
2331
|
+
pickResult = this._renderer.snapPick(params, pickResult);
|
|
2343
2332
|
} else {
|
|
2344
2333
|
pickResult = this._renderer.pick(params, pickResult);
|
|
2345
2334
|
}
|
|
@@ -2370,12 +2359,7 @@ class Scene extends Component {
|
|
|
2370
2359
|
this.error("Scene.snapPick() canvasPos parameter expected");
|
|
2371
2360
|
return;
|
|
2372
2361
|
}
|
|
2373
|
-
return this._renderer.snapPick(
|
|
2374
|
-
params.canvasPos,
|
|
2375
|
-
params.snapRadius || 30,
|
|
2376
|
-
params.snapToVertex,
|
|
2377
|
-
params.snapToEdge,
|
|
2378
|
-
);
|
|
2362
|
+
return this._renderer.snapPick(params);
|
|
2379
2363
|
}
|
|
2380
2364
|
|
|
2381
2365
|
/**
|
|
@@ -932,6 +932,7 @@ const Renderer = function (scene, options) {
|
|
|
932
932
|
let look;
|
|
933
933
|
let pickViewMatrix = null;
|
|
934
934
|
let pickProjMatrix = null;
|
|
935
|
+
let projection = null;
|
|
935
936
|
|
|
936
937
|
pickResult.pickSurface = params.pickSurface;
|
|
937
938
|
|
|
@@ -942,6 +943,7 @@ const Renderer = function (scene, options) {
|
|
|
942
943
|
|
|
943
944
|
pickViewMatrix = scene.camera.viewMatrix;
|
|
944
945
|
pickProjMatrix = scene.camera.projMatrix;
|
|
946
|
+
projection = scene.camera.projection;
|
|
945
947
|
|
|
946
948
|
pickResult.canvasPos = params.canvasPos;
|
|
947
949
|
|
|
@@ -954,6 +956,7 @@ const Renderer = function (scene, options) {
|
|
|
954
956
|
|
|
955
957
|
pickViewMatrix = params.matrix;
|
|
956
958
|
pickProjMatrix = scene.camera.projMatrix;
|
|
959
|
+
projection = scene.camera.projection;
|
|
957
960
|
|
|
958
961
|
} else {
|
|
959
962
|
|
|
@@ -972,6 +975,7 @@ const Renderer = function (scene, options) {
|
|
|
972
975
|
pickViewMatrix = math.lookAtMat4v(worldRayOrigin, look, up, tempMat4b);
|
|
973
976
|
// pickProjMatrix = scene.camera.projMatrix;
|
|
974
977
|
pickProjMatrix = scene.camera.ortho.matrix;
|
|
978
|
+
projection = "ortho";
|
|
975
979
|
|
|
976
980
|
pickResult.origin = worldRayOrigin;
|
|
977
981
|
pickResult.direction = worldRayDir;
|
|
@@ -1019,7 +1023,7 @@ const Renderer = function (scene, options) {
|
|
|
1019
1023
|
|
|
1020
1024
|
gpuPickTriangle(pickBuffer, pickable, canvasPos, pickViewMatrix, pickProjMatrix, pickResult);
|
|
1021
1025
|
|
|
1022
|
-
pickable.pickTriangleSurface(pickViewMatrix, pickProjMatrix, pickResult);
|
|
1026
|
+
pickable.pickTriangleSurface(pickViewMatrix, pickProjMatrix, projection, pickResult);
|
|
1023
1027
|
|
|
1024
1028
|
pickResult.pickSurfacePrecision = false;
|
|
1025
1029
|
|
|
@@ -1292,7 +1296,9 @@ const Renderer = function (scene, options) {
|
|
|
1292
1296
|
|
|
1293
1297
|
const _pickResult = new PickResult();
|
|
1294
1298
|
|
|
1295
|
-
return function (
|
|
1299
|
+
return function (params, pickResult = _pickResult) {
|
|
1300
|
+
|
|
1301
|
+
const {canvasPos, origin, direction, snapRadius, snapToVertex, snapToEdge} = params;
|
|
1296
1302
|
|
|
1297
1303
|
if (!snapToVertex && !snapToEdge) {
|
|
1298
1304
|
return this.pick({canvasPos, pickSurface: true});
|
|
@@ -1306,7 +1312,7 @@ const Renderer = function (scene, options) {
|
|
|
1306
1312
|
frameCtx.pickZNear = scene.camera.project.near;
|
|
1307
1313
|
frameCtx.pickZFar = scene.camera.project.far;
|
|
1308
1314
|
|
|
1309
|
-
snapRadiusInPixels =
|
|
1315
|
+
const snapRadiusInPixels = snapRadius || 30;
|
|
1310
1316
|
|
|
1311
1317
|
const vertexPickBuffer = renderBufferManager.getRenderBuffer("uniquePickColors-aabs", {
|
|
1312
1318
|
depthTexture: true,
|
|
@@ -1317,8 +1323,8 @@ const Renderer = function (scene, options) {
|
|
|
1317
1323
|
});
|
|
1318
1324
|
|
|
1319
1325
|
frameCtx.snapVectorA = [
|
|
1320
|
-
getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth),
|
|
1321
|
-
getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight),
|
|
1326
|
+
canvasPos ? getClipPosX(canvasPos[0] * resolutionScale, gl.drawingBufferWidth) : 0,
|
|
1327
|
+
canvasPos ? getClipPosY(canvasPos[1] * resolutionScale, gl.drawingBufferHeight) : 0,
|
|
1322
1328
|
];
|
|
1323
1329
|
|
|
1324
1330
|
frameCtx.snapInvVectorAB = [
|
|
@@ -1345,7 +1351,14 @@ const Renderer = function (scene, options) {
|
|
|
1345
1351
|
// Set view and proj mats for VBO renderers
|
|
1346
1352
|
///////////////////////////////////////
|
|
1347
1353
|
|
|
1348
|
-
|
|
1354
|
+
frameCtx.pickViewMatrix = (canvasPos
|
|
1355
|
+
? scene.camera.viewMatrix
|
|
1356
|
+
: math.lookAtMat4v(
|
|
1357
|
+
origin,
|
|
1358
|
+
math.addVec3(origin, direction, math.vec3()),
|
|
1359
|
+
math.vec3([0, 1, 0]),
|
|
1360
|
+
math.mat4()));
|
|
1361
|
+
|
|
1349
1362
|
const pickProjMatrix = scene.camera.projMatrix;
|
|
1350
1363
|
|
|
1351
1364
|
for (let type in drawableTypeInfo) {
|
|
@@ -1354,7 +1367,7 @@ const Renderer = function (scene, options) {
|
|
|
1354
1367
|
for (let i = 0, len = drawableList.length; i < len; i++) {
|
|
1355
1368
|
const drawable = drawableList[i];
|
|
1356
1369
|
if (drawable.setPickMatrices) { // Eg. SceneModel, which needs pre-loading into texture
|
|
1357
|
-
drawable.setPickMatrices(pickViewMatrix, pickProjMatrix);
|
|
1370
|
+
drawable.setPickMatrices(frameCtx.pickViewMatrix, pickProjMatrix);
|
|
1358
1371
|
}
|
|
1359
1372
|
}
|
|
1360
1373
|
}
|
|
@@ -1533,7 +1546,7 @@ const Renderer = function (scene, options) {
|
|
|
1533
1546
|
pickResult.worldPos = snappedWorldPos;
|
|
1534
1547
|
pickResult.worldNormal = snappedWorldNormal;
|
|
1535
1548
|
pickResult.entity = snappedEntity;
|
|
1536
|
-
pickResult.canvasPos = canvasPos;
|
|
1549
|
+
pickResult.canvasPos = canvasPos || scene.camera.projectWorldPos(worldPos || snappedWorldPos);
|
|
1537
1550
|
pickResult.snappedCanvasPos = snappedCanvasPos || canvasPos;
|
|
1538
1551
|
|
|
1539
1552
|
return pickResult;
|
|
@@ -40,6 +40,20 @@ export declare class AngleMeasurement extends Component {
|
|
|
40
40
|
* @type {Boolean}
|
|
41
41
|
*/
|
|
42
42
|
get visible(): boolean;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Sets whether this AngleMeasurement is highlighted or not.
|
|
46
|
+
*
|
|
47
|
+
* @type {Boolean}
|
|
48
|
+
*/
|
|
49
|
+
set highlighted(arg: boolean);
|
|
50
|
+
/**
|
|
51
|
+
* Gets whether this AngleMeasurement is highlighted or not.
|
|
52
|
+
*
|
|
53
|
+
* @type {Boolean}
|
|
54
|
+
*/
|
|
55
|
+
get highlighted(): boolean;
|
|
56
|
+
|
|
43
57
|
/**
|
|
44
58
|
* Sets if the origin {@link Marker} is visible.
|
|
45
59
|
*
|
|
@@ -44,6 +44,19 @@ export declare class DistanceMeasurement extends Component {
|
|
|
44
44
|
*/
|
|
45
45
|
get visible(): boolean;
|
|
46
46
|
|
|
47
|
+
/**
|
|
48
|
+
* Sets whether this DistanceMeasurement is highlighted or not.
|
|
49
|
+
*
|
|
50
|
+
* @type {Boolean}
|
|
51
|
+
*/
|
|
52
|
+
set highlighted(arg: boolean);
|
|
53
|
+
/**
|
|
54
|
+
* Gets whether this DistanceMeasurement is highlighted or not.
|
|
55
|
+
*
|
|
56
|
+
* @type {Boolean}
|
|
57
|
+
*/
|
|
58
|
+
get highlighted(): boolean;
|
|
59
|
+
|
|
47
60
|
/**
|
|
48
61
|
* Sets if the origin {@link Marker} is visible.
|
|
49
62
|
*
|
|
@@ -102,3 +102,18 @@ export declare class DistanceMeasurementsControl extends Component {
|
|
|
102
102
|
*/
|
|
103
103
|
on(event: "activated", callback: (activated: boolean) => void, scope?: any): string
|
|
104
104
|
}
|
|
105
|
+
|
|
106
|
+
export declare class DistanceMeasurementEditControl extends Component {
|
|
107
|
+
/**
|
|
108
|
+
* Deactivates a {@link DistanceMeasurementEditControl}.
|
|
109
|
+
*/
|
|
110
|
+
deactivate(): void;
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
export declare class DistanceMeasurementEditMouseControl extends DistanceMeasurementEditControl {
|
|
114
|
+
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export declare class DistanceMeasurementEditTouchControl extends DistanceMeasurementEditControl {
|
|
118
|
+
|
|
119
|
+
}
|