@vertexvis/viewer 0.18.0 → 0.18.1-testing.0
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/cjs/{config-ee5af2fe.js → config-ace9f5d5.js} +2 -1
- package/dist/cjs/config-ace9f5d5.js.map +1 -0
- package/dist/cjs/{controller-6914028a.js → controller-ee852f01.js} +12 -3
- package/dist/cjs/controller-ee852f01.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -1
- package/dist/cjs/vertex-scene-tree.cjs.entry.js +2 -2
- package/dist/cjs/vertex-viewer-measurement-precise.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer-pin-group.cjs.entry.js +1 -1
- package/dist/cjs/vertex-viewer.cjs.entry.js +103 -35
- package/dist/cjs/vertex-viewer.cjs.entry.js.map +1 -1
- package/dist/collection/components/scene-tree/lib/controller.js +11 -2
- package/dist/collection/components/scene-tree/lib/controller.js.map +1 -1
- package/dist/collection/lib/interactions/interactionApi.js +0 -34
- package/dist/collection/lib/interactions/interactionApi.js.map +1 -1
- package/dist/collection/lib/interactions/interactionApiPerspective.js +103 -1
- package/dist/collection/lib/interactions/interactionApiPerspective.js.map +1 -1
- package/dist/collection/lib/types/interactions.js +1 -0
- package/dist/collection/lib/types/interactions.js.map +1 -1
- package/dist/custom-elements/index.js +114 -36
- package/dist/custom-elements/index.js.map +1 -1
- package/dist/esm/{config-65fd1bba.js → config-2b2e3f66.js} +2 -1
- package/dist/esm/config-2b2e3f66.js.map +1 -0
- package/dist/esm/{controller-1f6c87ab.js → controller-ea698f9b.js} +12 -3
- package/dist/esm/controller-ea698f9b.js.map +1 -0
- package/dist/esm/index.js +1 -1
- package/dist/esm/index.mjs +1 -1
- package/dist/esm/vertex-scene-tree.entry.js +2 -2
- package/dist/esm/vertex-viewer-measurement-precise.entry.js +1 -1
- package/dist/esm/vertex-viewer-pin-group.entry.js +1 -1
- package/dist/esm/vertex-viewer.entry.js +103 -35
- package/dist/esm/vertex-viewer.entry.js.map +1 -1
- package/dist/types/components/scene-tree/lib/controller.d.ts +1 -0
- package/dist/types/lib/interactions/interactionApi.d.ts +1 -1
- package/dist/types/lib/interactions/interactionApiPerspective.d.ts +3 -0
- package/dist/types/lib/types/interactions.d.ts +7 -0
- package/dist/viewer/index.esm.js +1 -1
- package/dist/viewer/p-0de95c4d.js +5 -0
- package/dist/viewer/p-0de95c4d.js.map +1 -0
- package/dist/viewer/{p-e2e7d01b.entry.js → p-2cca6daa.entry.js} +2 -2
- package/dist/viewer/{p-d8c70701.entry.js → p-2ce1d5a7.entry.js} +2 -2
- package/dist/viewer/{p-31c3b8d6.entry.js → p-4225576d.entry.js} +2 -2
- package/dist/viewer/p-5145f091.entry.js +5 -0
- package/dist/viewer/p-5145f091.entry.js.map +1 -0
- package/dist/viewer/{p-931247b6.js → p-bb131c4a.js} +2 -2
- package/dist/viewer/p-bb131c4a.js.map +1 -0
- package/dist/viewer/viewer.esm.js +1 -1
- package/package.json +7 -7
- package/dist/cjs/config-ee5af2fe.js.map +0 -1
- package/dist/cjs/controller-6914028a.js.map +0 -1
- package/dist/esm/config-65fd1bba.js.map +0 -1
- package/dist/esm/controller-1f6c87ab.js.map +0 -1
- package/dist/viewer/p-089d11bf.js +0 -5
- package/dist/viewer/p-089d11bf.js.map +0 -1
- package/dist/viewer/p-931247b6.js.map +0 -1
- package/dist/viewer/p-f1e718b4.entry.js +0 -5
- package/dist/viewer/p-f1e718b4.entry.js.map +0 -1
- /package/dist/viewer/{p-e2e7d01b.entry.js.map → p-2cca6daa.entry.js.map} +0 -0
- /package/dist/viewer/{p-d8c70701.entry.js.map → p-2ce1d5a7.entry.js.map} +0 -0
- /package/dist/viewer/{p-31c3b8d6.entry.js.map → p-4225576d.entry.js.map} +0 -0
package/dist/esm/index.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
export { c as ColorMaterial, l as LoadableResource, S as Scene, a as SynchronizedClock } from './scene-2e0df828.js';
|
|
5
|
-
export { S as SceneTreeController } from './controller-
|
|
5
|
+
export { S as SceneTreeController } from './controller-ea698f9b.js';
|
|
6
6
|
export { f as fromNodeProto, i as isLoadedRow } from './row-6d4f9dcc.js';
|
|
7
7
|
export { C as CursorManager, b as boxQueryCursor, l as labelPinCursor, m as measurementCursor, a as measurementWithArrowCursor, p as pinCursor } from './cursors-74998736.js';
|
|
8
8
|
export { M as MeasurementController, a as MeasurementEntity } from './entities-c1acb573.js';
|
package/dist/esm/index.mjs
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) 2023 Vertex Software LLC. All rights reserved.
|
|
3
3
|
*/
|
|
4
4
|
export { c as ColorMaterial, l as LoadableResource, S as Scene, a as SynchronizedClock } from './scene-2e0df828.js';
|
|
5
|
-
export { S as SceneTreeController } from './controller-
|
|
5
|
+
export { S as SceneTreeController } from './controller-ea698f9b.js';
|
|
6
6
|
export { f as fromNodeProto, i as isLoadedRow } from './row-6d4f9dcc.js';
|
|
7
7
|
export { C as CursorManager, b as boxQueryCursor, l as labelPinCursor, m as measurementCursor, a as measurementWithArrowCursor, p as pinCursor } from './cursors-74998736.js';
|
|
8
8
|
export { M as MeasurementController, a as MeasurementEntity } from './entities-c1acb573.js';
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, F as Fragment, r as registerInstance, c as createEvent, f as forceUpdate, H as Host, g as getElement } from './index-fd7d7b68.js';
|
|
5
5
|
import { o as __rest } from './bundle.esm-92fd4246.js';
|
|
6
|
-
import { a as SceneTreeAPIClient_1, w as webSocketSubscriptionTransportFactory, S as SceneTreeController, b as SceneTreeErrorDetails, c as SceneTreeErrorCode } from './controller-
|
|
7
|
-
import { p as parseConfig } from './config-
|
|
6
|
+
import { a as SceneTreeAPIClient_1, w as webSocketSubscriptionTransportFactory, S as SceneTreeController, b as SceneTreeErrorDetails, c as SceneTreeErrorCode } from './controller-ea698f9b.js';
|
|
7
|
+
import { p as parseConfig } from './config-2b2e3f66.js';
|
|
8
8
|
import { g as getSceneTreeContainsElement } from './dom-758547c9.js';
|
|
9
9
|
import { i as isLoadedRow } from './row-6d4f9dcc.js';
|
|
10
10
|
import './wrappers_pb-975c7885.js';
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
import { r as registerInstance, h, H as Host } from './index-fd7d7b68.js';
|
|
5
5
|
import { s as scene_view_api_pb } from './mapper-bdfe63be.js';
|
|
6
6
|
import { a as grpcWebClient_umd } from './wrappers_pb-975c7885.js';
|
|
7
|
-
import { p as parseConfig } from './config-
|
|
7
|
+
import { p as parseConfig } from './config-2b2e3f66.js';
|
|
8
8
|
import { a as MeasurementEntity, M as MeasurementController } from './entities-c1acb573.js';
|
|
9
9
|
import './streamAttributes-eb15cb1f.js';
|
|
10
10
|
import { M as MeasurementModel } from './model-a54addfd.js';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { h, F as Fragment, r as registerInstance } from './index-fd7d7b68.js';
|
|
5
5
|
import { p as point, m as matrix4, v as vector3 } from './bundle.esm-92fd4246.js';
|
|
6
|
-
import './controller-
|
|
6
|
+
import './controller-ea698f9b.js';
|
|
7
7
|
import './cursors-74998736.js';
|
|
8
8
|
import './mapper-bdfe63be.js';
|
|
9
9
|
import './wrappers_pb-975c7885.js';
|
|
@@ -6,7 +6,7 @@ import { p as point, v as vector3, c as angle, f as plane, r as ray, b as boundi
|
|
|
6
6
|
import { t as toProtoDuration, p as protoToDate, a as StreamApi, S as StreamRequestError, c as currentDateAsProtoTimestamp, W as WebSocketClientImpl } from './bundle.esm-5a5f6362.js';
|
|
7
7
|
import { E as EventDispatcher, m as mapper, c as color, o as objects, u as uri, a as async, b as uuid } from './browser.esm-595bfe2f.js';
|
|
8
8
|
import { c as classnames } from './index-ab0ec8dc.js';
|
|
9
|
-
import { p as parseConfig } from './config-
|
|
9
|
+
import { p as parseConfig } from './config-2b2e3f66.js';
|
|
10
10
|
import { C as CursorManager } from './cursors-74998736.js';
|
|
11
11
|
import { g as getMouseClientPosition, c as cssCursor } from './dom-c86a0050.js';
|
|
12
12
|
import { c as ImageLoadError, C as CustomError, W as WebsocketConnectionError, S as SceneRenderError, V as ViewerInitializationError, d as InteractionHandlerError, e as ComponentInitializationError } from './errors-a8d2dbd3.js';
|
|
@@ -563,40 +563,6 @@ class InteractionApi {
|
|
|
563
563
|
return newCamera;
|
|
564
564
|
});
|
|
565
565
|
}
|
|
566
|
-
async zoomCameraToPoint(point, delta) {
|
|
567
|
-
return this.transformCamera(({ camera, viewport, frame, depthBuffer }) => {
|
|
568
|
-
const cam = frame.scene.camera;
|
|
569
|
-
const dir = cam.direction;
|
|
570
|
-
const frameCam = camera.toFrameCamera();
|
|
571
|
-
const ray$1 = viewport.transformPointToRay(point, frame.image, frameCam);
|
|
572
|
-
if (this.zoomData == null) {
|
|
573
|
-
const fallbackPlane = plane.fromNormalAndCoplanarPoint(dir, cam.lookAt);
|
|
574
|
-
const fallbackPt = ray.intersectPlane(ray$1, fallbackPlane);
|
|
575
|
-
if (fallbackPt == null) {
|
|
576
|
-
console.warn('Cannot determine fallback point for zoom. Ray does not intersect plane.');
|
|
577
|
-
return camera;
|
|
578
|
-
}
|
|
579
|
-
const hitPt = depthBuffer != null
|
|
580
|
-
? this.getWorldPoint(point, depthBuffer, fallbackPt)
|
|
581
|
-
: fallbackPt;
|
|
582
|
-
const hitPlane = plane.fromNormalAndCoplanarPoint(dir, hitPt);
|
|
583
|
-
this.zoomData = { hitPt, hitPlane };
|
|
584
|
-
}
|
|
585
|
-
if (this.zoomData != null) {
|
|
586
|
-
const { hitPt, hitPlane } = this.zoomData;
|
|
587
|
-
const distance = vector3.distance(camera.position, hitPt);
|
|
588
|
-
const epsilon = (6 * distance * delta) / viewport.height;
|
|
589
|
-
const position = ray.at(ray$1, epsilon);
|
|
590
|
-
const lookAt = plane.projectPoint(hitPlane, position);
|
|
591
|
-
const newCamera = camera.update({ position, lookAt });
|
|
592
|
-
const newDistance = vector3.distance(position, lookAt);
|
|
593
|
-
if (newDistance >= newCamera.near) {
|
|
594
|
-
return newCamera;
|
|
595
|
-
}
|
|
596
|
-
}
|
|
597
|
-
return camera;
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
566
|
/**
|
|
601
567
|
* Performs a pivot operation of the scene's camera, updating the lookAt
|
|
602
568
|
* while maintaining the position, and requests a new image for the
|
|
@@ -848,6 +814,7 @@ class InteractionApiOrthographic extends InteractionApi {
|
|
|
848
814
|
}
|
|
849
815
|
}
|
|
850
816
|
|
|
817
|
+
const CAMERA_MIN_ZOOM_SCALAR = 0.2;
|
|
851
818
|
class InteractionApiPerspective extends InteractionApi {
|
|
852
819
|
constructor(stream, cursors, getConfig, getScene, getFrame, getViewport, tapEmitter, doubleTapEmitter, longPressEmitter, interactionStartedEmitter, interactionFinishedEmitter) {
|
|
853
820
|
super(stream, cursors, getConfig, getScene, getFrame, getViewport, tapEmitter, doubleTapEmitter, longPressEmitter, interactionStartedEmitter, interactionFinishedEmitter);
|
|
@@ -875,6 +842,48 @@ class InteractionApiPerspective extends InteractionApi {
|
|
|
875
842
|
return camera.moveBy(offset);
|
|
876
843
|
});
|
|
877
844
|
}
|
|
845
|
+
async zoomCameraToPoint(point, delta) {
|
|
846
|
+
return this.transformCamera(({ camera, viewport, frame, depthBuffer, boundingBox }) => {
|
|
847
|
+
const cam = frame.scene.camera;
|
|
848
|
+
const dir = cam.direction;
|
|
849
|
+
const frameCam = camera.toFrameCamera();
|
|
850
|
+
const ray$1 = viewport.transformPointToRay(point, frame.image, frameCam);
|
|
851
|
+
if (this.zoomData == null) {
|
|
852
|
+
const fallbackPlane = plane.fromNormalAndCoplanarPoint(dir, cam.lookAt);
|
|
853
|
+
const fallbackPt = ray.intersectPlane(ray$1, fallbackPlane);
|
|
854
|
+
if (fallbackPt == null) {
|
|
855
|
+
console.warn('Cannot determine fallback point for zoom. Ray does not intersect plane.');
|
|
856
|
+
return camera;
|
|
857
|
+
}
|
|
858
|
+
const hitPt = depthBuffer != null
|
|
859
|
+
? this.getWorldPoint(point, depthBuffer, fallbackPt)
|
|
860
|
+
: fallbackPt;
|
|
861
|
+
const hitPlane = plane.fromNormalAndCoplanarPoint(dir, hitPt);
|
|
862
|
+
this.zoomData = { hitPt, hitPlane };
|
|
863
|
+
}
|
|
864
|
+
if (this.zoomData != null) {
|
|
865
|
+
const { hitPlane } = this.zoomData;
|
|
866
|
+
const { position, distance, isPastHitPlane, keepCurrent } = this.computeZoomDistances(delta, camera, viewport, boundingBox, ray$1, this.zoomData);
|
|
867
|
+
if (isPastHitPlane && !keepCurrent) {
|
|
868
|
+
const viewVectorRay = ray.create({
|
|
869
|
+
origin: position,
|
|
870
|
+
direction: vector3.normalize(camera.viewVector),
|
|
871
|
+
});
|
|
872
|
+
return camera.update({
|
|
873
|
+
position,
|
|
874
|
+
lookAt: ray.at(viewVectorRay, distance),
|
|
875
|
+
});
|
|
876
|
+
}
|
|
877
|
+
else if (!keepCurrent) {
|
|
878
|
+
return camera.update({
|
|
879
|
+
position,
|
|
880
|
+
lookAt: plane.projectPoint(hitPlane, position),
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
}
|
|
884
|
+
return camera;
|
|
885
|
+
});
|
|
886
|
+
}
|
|
878
887
|
async transformCamera(t) {
|
|
879
888
|
var _a;
|
|
880
889
|
if (this.isInteracting()) {
|
|
@@ -896,6 +905,65 @@ class InteractionApiPerspective extends InteractionApi {
|
|
|
896
905
|
await ((_a = this.currentCamera) === null || _a === void 0 ? void 0 : _a.render());
|
|
897
906
|
}
|
|
898
907
|
}
|
|
908
|
+
computeZoomDistances(delta, camera, viewport, boundingBox, pointRay, zoomData) {
|
|
909
|
+
const config = this.getConfig();
|
|
910
|
+
const { hitPt, hitPlane } = zoomData;
|
|
911
|
+
const minDistance = config.useMinimumPerspectiveZoomDistance
|
|
912
|
+
? this.computeZoomMinimumDistance(camera, boundingBox)
|
|
913
|
+
: -1;
|
|
914
|
+
const expectedDistance = vector3.distance(camera.position, hitPt);
|
|
915
|
+
const actualDistance = Math.max(minDistance, expectedDistance);
|
|
916
|
+
const epsilon = (6 * actualDistance * delta) / viewport.height;
|
|
917
|
+
const expectedPosition = ray.at(pointRay, epsilon);
|
|
918
|
+
const expectedViewVector = ray.create({
|
|
919
|
+
origin: expectedPosition,
|
|
920
|
+
direction: vector3.normalize(camera.viewVector),
|
|
921
|
+
});
|
|
922
|
+
const expectedIntersection = ray.intersectPlane(expectedViewVector, hitPlane);
|
|
923
|
+
if (expectedIntersection == null &&
|
|
924
|
+
config.useMinimumPerspectiveZoomDistance) {
|
|
925
|
+
const minDistanceEpsilon = (6 * minDistance * delta) / viewport.height;
|
|
926
|
+
const position = ray.at(pointRay, minDistanceEpsilon);
|
|
927
|
+
return {
|
|
928
|
+
position,
|
|
929
|
+
distance: minDistance,
|
|
930
|
+
isPastHitPlane: true,
|
|
931
|
+
keepCurrent: false,
|
|
932
|
+
};
|
|
933
|
+
}
|
|
934
|
+
else if (expectedIntersection == null) {
|
|
935
|
+
return {
|
|
936
|
+
position: camera.position,
|
|
937
|
+
distance: actualDistance,
|
|
938
|
+
isPastHitPlane: true,
|
|
939
|
+
keepCurrent: true,
|
|
940
|
+
};
|
|
941
|
+
}
|
|
942
|
+
return {
|
|
943
|
+
position: expectedPosition,
|
|
944
|
+
distance: actualDistance,
|
|
945
|
+
isPastHitPlane: false,
|
|
946
|
+
keepCurrent: false,
|
|
947
|
+
};
|
|
948
|
+
}
|
|
949
|
+
computeZoomMinimumDistance(camera, boundingBox) {
|
|
950
|
+
const xLength = Math.abs(boundingBox.min.x) + Math.abs(boundingBox.max.x);
|
|
951
|
+
const yLength = Math.abs(boundingBox.min.y) + Math.abs(boundingBox.max.y);
|
|
952
|
+
const zLength = Math.abs(boundingBox.min.z) + Math.abs(boundingBox.max.z);
|
|
953
|
+
const maxLength = Math.max(xLength, yLength, zLength);
|
|
954
|
+
const absDotX = Math.abs(vector3.dot(vector3.normalize(camera.viewVector), vector3.right()));
|
|
955
|
+
const absDotY = Math.abs(vector3.dot(vector3.normalize(camera.viewVector), vector3.up()));
|
|
956
|
+
const absDotZ = Math.abs(vector3.dot(vector3.normalize(camera.viewVector), vector3.back()));
|
|
957
|
+
const scaledLengthX = xLength * absDotX;
|
|
958
|
+
const scaledLengthY = yLength * absDotY;
|
|
959
|
+
const scaledLengthZ = zLength * absDotZ;
|
|
960
|
+
const relevanceLengthX = maxLength / xLength;
|
|
961
|
+
const relevanceLengthY = maxLength / yLength;
|
|
962
|
+
const relevanceLengthZ = maxLength / zLength;
|
|
963
|
+
return (((scaledLengthX + scaledLengthY + scaledLengthZ) /
|
|
964
|
+
(relevanceLengthX + relevanceLengthY + relevanceLengthZ)) *
|
|
965
|
+
CAMERA_MIN_ZOOM_SCALAR);
|
|
966
|
+
}
|
|
899
967
|
}
|
|
900
968
|
|
|
901
969
|
class FlyToPositionKeyInteraction {
|