@inweb/viewer-visualize 26.12.6 → 26.12.7
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/viewer-visualize.js +53 -20
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +51 -18
- package/dist/viewer-visualize.module.js.map +1 -1
- package/package.json +5 -5
- package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +3 -8
- package/src/Viewer/Viewer.ts +79 -11
package/dist/viewer-visualize.js
CHANGED
|
@@ -17062,7 +17062,7 @@ js: import "konva/skia-backend";
|
|
|
17062
17062
|
}
|
|
17063
17063
|
getViewpoint(viewpoint) {
|
|
17064
17064
|
if (!viewpoint)
|
|
17065
|
-
viewpoint = {};
|
|
17065
|
+
viewpoint = { custom_fields: {} };
|
|
17066
17066
|
viewpoint.lines = this.getMarkupLines();
|
|
17067
17067
|
viewpoint.texts = this.getMarkupTexts();
|
|
17068
17068
|
viewpoint.arrows = this.getMarkupArrows();
|
|
@@ -17070,8 +17070,8 @@ js: import "konva/skia-backend";
|
|
|
17070
17070
|
viewpoint.ellipses = this.getMarkupEllipses();
|
|
17071
17071
|
viewpoint.images = this.getMarkupImages();
|
|
17072
17072
|
viewpoint.rectangles = this.getMarkupRectangles();
|
|
17073
|
-
viewpoint.custom_fields = { markup_color: this.getMarkupColor() };
|
|
17074
17073
|
viewpoint.snapshot = { data: this.combineMarkupWithDrawing() };
|
|
17074
|
+
viewpoint.custom_fields.markup_color = this.getMarkupColor();
|
|
17075
17075
|
return viewpoint;
|
|
17076
17076
|
}
|
|
17077
17077
|
enableEditMode(mode) {
|
|
@@ -17953,7 +17953,7 @@ js: import "konva/skia-backend";
|
|
|
17953
17953
|
const visLib = this._viewer.visLib();
|
|
17954
17954
|
const visViewer = this._viewer.visViewer();
|
|
17955
17955
|
if (!viewpoint)
|
|
17956
|
-
viewpoint = {};
|
|
17956
|
+
viewpoint = { custom_fields: {} };
|
|
17957
17957
|
viewpoint.lines = [];
|
|
17958
17958
|
viewpoint.texts = [];
|
|
17959
17959
|
const model = visViewer.getMarkupModel();
|
|
@@ -17995,12 +17995,8 @@ js: import "konva/skia-backend";
|
|
|
17995
17995
|
entityPtr.delete();
|
|
17996
17996
|
}
|
|
17997
17997
|
itr.delete();
|
|
17998
|
-
viewpoint.snapshot = {
|
|
17999
|
-
|
|
18000
|
-
};
|
|
18001
|
-
viewpoint.custom_fields = {
|
|
18002
|
-
markup_color: this.getMarkupColor(),
|
|
18003
|
-
};
|
|
17998
|
+
viewpoint.snapshot = { data: visLib.canvas.toDataURL("image/jpeg", 0.25) };
|
|
17999
|
+
viewpoint.custom_fields.markup_color = this.getMarkupColor();
|
|
18004
18000
|
return viewpoint;
|
|
18005
18001
|
}
|
|
18006
18002
|
enableEditMode(mode) {
|
|
@@ -18600,11 +18596,27 @@ js: import "konva/skia-backend";
|
|
|
18600
18596
|
const setOrthogonalCamera = (orthogonal_camera) => {
|
|
18601
18597
|
if (orthogonal_camera) {
|
|
18602
18598
|
activeView.setView(getPoint3dAsArray(orthogonal_camera.view_point), getPoint3dAsArray(orthogonal_camera.direction), getPoint3dAsArray(orthogonal_camera.up_vector), orthogonal_camera.field_width, orthogonal_camera.field_height, true);
|
|
18603
|
-
this.
|
|
18599
|
+
this.options.cameraMode = "orthographic";
|
|
18604
18600
|
this.emitEvent({ type: "changecameramode", mode: "orthographic" });
|
|
18605
18601
|
}
|
|
18606
18602
|
};
|
|
18607
|
-
const setPerspectiveCamera = (perspective_camera) => {
|
|
18603
|
+
const setPerspectiveCamera = (perspective_camera) => {
|
|
18604
|
+
if (perspective_camera) {
|
|
18605
|
+
const aspectRatio = this.canvas.width / this.canvas.height;
|
|
18606
|
+
const position = perspective_camera.view_point;
|
|
18607
|
+
const target = perspective_camera.direction;
|
|
18608
|
+
const fov = (perspective_camera.field_of_view * Math.PI) / 180;
|
|
18609
|
+
const dx = target.x - position.x;
|
|
18610
|
+
const dy = target.y - position.y;
|
|
18611
|
+
const dz = target.z - position.z;
|
|
18612
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
18613
|
+
const fieldHeight = 2 * distance * Math.tan(fov / 2);
|
|
18614
|
+
const fieldWidth = fieldHeight * aspectRatio;
|
|
18615
|
+
activeView.setView(getPoint3dAsArray(perspective_camera.view_point), getPoint3dAsArray(perspective_camera.direction), getPoint3dAsArray(perspective_camera.up_vector), fieldWidth, fieldHeight, false);
|
|
18616
|
+
this.options.cameraMode = "perspective";
|
|
18617
|
+
this.emitEvent({ type: "changecameramode", mode: "perspective" });
|
|
18618
|
+
}
|
|
18619
|
+
};
|
|
18608
18620
|
const setClippingPlanes = (clipping_planes) => {
|
|
18609
18621
|
if (clipping_planes) {
|
|
18610
18622
|
for (const clipping_plane of clipping_planes) {
|
|
@@ -18631,6 +18643,7 @@ js: import "konva/skia-backend";
|
|
|
18631
18643
|
setClippingPlanes(viewpoint.clipping_planes);
|
|
18632
18644
|
setSelection(((_b = viewpoint.custom_fields) === null || _b === void 0 ? void 0 : _b.selection2) || viewpoint.selection);
|
|
18633
18645
|
this._markup.setViewpoint(viewpoint);
|
|
18646
|
+
this.syncOverlay();
|
|
18634
18647
|
this.setActiveDragger(draggerName);
|
|
18635
18648
|
this.emitEvent({ type: "drawviewpoint", data: viewpoint });
|
|
18636
18649
|
this.update();
|
|
@@ -18644,17 +18657,37 @@ js: import "konva/skia-backend";
|
|
|
18644
18657
|
return { x: array[0], y: array[1], z: array[2] };
|
|
18645
18658
|
};
|
|
18646
18659
|
const getOrthogonalCamera = () => {
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18660
|
+
if (!activeView.perspective)
|
|
18661
|
+
return {
|
|
18662
|
+
view_point: getPoint3dFromArray(activeView.viewPosition),
|
|
18663
|
+
direction: getPoint3dFromArray(activeView.viewTarget),
|
|
18664
|
+
up_vector: getPoint3dFromArray(activeView.upVector),
|
|
18665
|
+
field_width: activeView.viewFieldWidth,
|
|
18666
|
+
field_height: activeView.viewFieldHeight,
|
|
18667
|
+
view_to_world_scale: 1,
|
|
18668
|
+
};
|
|
18669
|
+
else
|
|
18670
|
+
return undefined;
|
|
18655
18671
|
};
|
|
18656
18672
|
const getPerspectiveCamera = () => {
|
|
18657
|
-
|
|
18673
|
+
if (activeView.perspective) {
|
|
18674
|
+
const position = activeView.viewPosition;
|
|
18675
|
+
const target = activeView.viewTarget;
|
|
18676
|
+
const fieldHeight = activeView.viewFieldHeight;
|
|
18677
|
+
const dx = target[0] - position[0];
|
|
18678
|
+
const dy = target[1] - position[1];
|
|
18679
|
+
const dz = target[2] - position[2];
|
|
18680
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
18681
|
+
const fov = 2 * Math.atan(fieldHeight / (2 * distance));
|
|
18682
|
+
return {
|
|
18683
|
+
view_point: getPoint3dFromArray(activeView.viewPosition),
|
|
18684
|
+
direction: getPoint3dFromArray(activeView.viewTarget),
|
|
18685
|
+
up_vector: getPoint3dFromArray(activeView.upVector),
|
|
18686
|
+
field_of_view: (fov * 180) / Math.PI,
|
|
18687
|
+
};
|
|
18688
|
+
}
|
|
18689
|
+
else
|
|
18690
|
+
return undefined;
|
|
18658
18691
|
};
|
|
18659
18692
|
const getClippingPlanes = () => {
|
|
18660
18693
|
const clipping_planes = [];
|