@inweb/viewer-visualize 26.12.6 → 27.1.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/viewer-visualize.js +163 -74
- package/dist/viewer-visualize.js.map +1 -1
- package/dist/viewer-visualize.min.js +1 -1
- package/dist/viewer-visualize.module.js +161 -72
- package/dist/viewer-visualize.module.js.map +1 -1
- package/lib/Viewer/Components/InfoComponent.d.ts +22 -0
- package/lib/Viewer/Viewer.d.ts +1 -0
- package/package.json +5 -5
- package/src/Viewer/Components/InfoComponent.ts +139 -0
- package/src/Viewer/Components/index.ts +2 -0
- package/src/Viewer/Loaders/VSFCloudLoader.ts +0 -4
- package/src/Viewer/Loaders/VSFXCloudLoader.ts +0 -4
- package/src/Viewer/Loaders/VSFXCloudPartialLoader.ts +7 -12
- package/src/Viewer/Loaders/VSFXCloudStreamingLoader.ts +6 -15
- package/src/Viewer/Markup/Visualize/VisualizeMarkup.ts +3 -8
- package/src/Viewer/Viewer.ts +88 -14
- package/lib/Viewer/Loaders/UpdateController.d.ts +0 -14
- package/src/Viewer/Loaders/UpdateController.ts +0 -60
package/dist/viewer-visualize.js
CHANGED
|
@@ -3336,6 +3336,99 @@
|
|
|
3336
3336
|
}
|
|
3337
3337
|
}
|
|
3338
3338
|
|
|
3339
|
+
class InfoComponent {
|
|
3340
|
+
constructor(viewer) {
|
|
3341
|
+
this.initialize = () => {
|
|
3342
|
+
this.resize();
|
|
3343
|
+
this.optionsChange({ data: this.viewer.options });
|
|
3344
|
+
};
|
|
3345
|
+
this.clear = () => {
|
|
3346
|
+
this.viewer.info.performance.timeToFirstRender = 0;
|
|
3347
|
+
this.viewer.info.performance.loadTime = 0;
|
|
3348
|
+
this.viewer.info.scene.objects = 0;
|
|
3349
|
+
this.viewer.info.scene.triangles = 0;
|
|
3350
|
+
this.viewer.info.scene.points = 0;
|
|
3351
|
+
this.viewer.info.scene.lines = 0;
|
|
3352
|
+
this.viewer.info.scene.edges = 0;
|
|
3353
|
+
this.viewer.info.optimizedScene.objects = 0;
|
|
3354
|
+
this.viewer.info.optimizedScene.triangles = 0;
|
|
3355
|
+
this.viewer.info.optimizedScene.points = 0;
|
|
3356
|
+
this.viewer.info.optimizedScene.lines = 0;
|
|
3357
|
+
this.viewer.info.optimizedScene.edges = 0;
|
|
3358
|
+
this.viewer.info.memory.geometries = 0;
|
|
3359
|
+
this.viewer.info.memory.geometryBytes = 0;
|
|
3360
|
+
this.viewer.info.memory.textures = 0;
|
|
3361
|
+
this.viewer.info.memory.textureBytes = 0;
|
|
3362
|
+
this.viewer.info.memory.materials = 0;
|
|
3363
|
+
this.viewer.info.memory.totalEstimatedGpuBytes = 0;
|
|
3364
|
+
this.viewer.info.memory.usedJSHeapSize = 0;
|
|
3365
|
+
};
|
|
3366
|
+
this.optionsChange = ({ data: options }) => {
|
|
3367
|
+
const antialiasing = options.antialiasing === true || options.antialiasing === "fxaa";
|
|
3368
|
+
if (antialiasing)
|
|
3369
|
+
this.viewer.info.render.antialiasing = "fxaa";
|
|
3370
|
+
else
|
|
3371
|
+
this.viewer.info.render.antialiasing = "";
|
|
3372
|
+
};
|
|
3373
|
+
this.geometryStart = () => {
|
|
3374
|
+
this.startTime = performance.now();
|
|
3375
|
+
};
|
|
3376
|
+
this.databaseChunk = () => {
|
|
3377
|
+
this.viewer.info.performance.timeToFirstRender += performance.now() - this.startTime;
|
|
3378
|
+
console.log("Time to first render:", this.viewer.info.performance.timeToFirstRender, "ms");
|
|
3379
|
+
};
|
|
3380
|
+
this.geometryEnd = () => {
|
|
3381
|
+
const memory = performance["memory"];
|
|
3382
|
+
if (memory)
|
|
3383
|
+
this.viewer.info.memory.usedJSHeapSize = memory.usedJSHeapSize;
|
|
3384
|
+
this.viewer.info.performance.loadTime += performance.now() - this.startTime;
|
|
3385
|
+
console.log("File load time:", this.viewer.info.performance.loadTime, "ms");
|
|
3386
|
+
};
|
|
3387
|
+
this.resize = () => {
|
|
3388
|
+
const { width, height } = this.viewer.canvas;
|
|
3389
|
+
this.viewer.info.render.viewport.width = width;
|
|
3390
|
+
this.viewer.info.render.viewport.height = height;
|
|
3391
|
+
};
|
|
3392
|
+
this.render = () => { };
|
|
3393
|
+
this.animate = () => {
|
|
3394
|
+
const time = performance.now();
|
|
3395
|
+
this.viewer.info.performance.frameTime = Math.round(time - this.beginTime);
|
|
3396
|
+
this.beginTime = time;
|
|
3397
|
+
this.frames++;
|
|
3398
|
+
if (time - this.prevTime >= 1000) {
|
|
3399
|
+
this.viewer.info.performance.fps = Math.round((this.frames * 1000) / (time - this.prevTime));
|
|
3400
|
+
this.prevTime = time;
|
|
3401
|
+
this.frames = 0;
|
|
3402
|
+
}
|
|
3403
|
+
};
|
|
3404
|
+
this.viewer = viewer;
|
|
3405
|
+
this.startTime = 0;
|
|
3406
|
+
this.beginTime = performance.now();
|
|
3407
|
+
this.prevTime = performance.now();
|
|
3408
|
+
this.frames = 0;
|
|
3409
|
+
this.viewer.addEventListener("initialize", this.initialize);
|
|
3410
|
+
this.viewer.addEventListener("clear", this.clear);
|
|
3411
|
+
this.viewer.addEventListener("optionschange", this.optionsChange);
|
|
3412
|
+
this.viewer.addEventListener("geometrystart", this.geometryStart);
|
|
3413
|
+
this.viewer.addEventListener("databasechunk", this.databaseChunk);
|
|
3414
|
+
this.viewer.addEventListener("geometryend", this.geometryEnd);
|
|
3415
|
+
this.viewer.addEventListener("resize", this.resize);
|
|
3416
|
+
this.viewer.addEventListener("render", this.render);
|
|
3417
|
+
this.viewer.addEventListener("animate", this.animate);
|
|
3418
|
+
}
|
|
3419
|
+
dispose() {
|
|
3420
|
+
this.viewer.removeEventListener("initialize", this.initialize);
|
|
3421
|
+
this.viewer.removeEventListener("clear", this.clear);
|
|
3422
|
+
this.viewer.removeEventListener("optionschange", this.optionsChange);
|
|
3423
|
+
this.viewer.removeEventListener("geometrystart", this.geometryStart);
|
|
3424
|
+
this.viewer.removeEventListener("databasechunk", this.databaseChunk);
|
|
3425
|
+
this.viewer.removeEventListener("geometryend", this.geometryEnd);
|
|
3426
|
+
this.viewer.removeEventListener("resize", this.resize);
|
|
3427
|
+
this.viewer.removeEventListener("render", this.render);
|
|
3428
|
+
this.viewer.addEventListener("animate", this.animate);
|
|
3429
|
+
}
|
|
3430
|
+
}
|
|
3431
|
+
|
|
3339
3432
|
class RenderLoopComponent {
|
|
3340
3433
|
constructor(viewer) {
|
|
3341
3434
|
this.animate = (time = 0) => {
|
|
@@ -3621,6 +3714,7 @@
|
|
|
3621
3714
|
|
|
3622
3715
|
const components = componentsRegistry("visualizejs");
|
|
3623
3716
|
components.registerComponent("CameraComponent", (viewer) => new CameraComponent(viewer));
|
|
3717
|
+
components.registerComponent("InfoComponent", (viewer) => new InfoComponent(viewer));
|
|
3624
3718
|
components.registerComponent("ResizeCanvasComponent", (viewer) => new ResizeCanvasComponent(viewer));
|
|
3625
3719
|
components.registerComponent("RenderLoopComponent", (viewer) => new RenderLoopComponent(viewer));
|
|
3626
3720
|
components.registerComponent("ZoomWheelComponent", (viewer) => new ZoomWheelComponent(viewer));
|
|
@@ -3765,7 +3859,6 @@
|
|
|
3765
3859
|
return this;
|
|
3766
3860
|
const visViewer = this.viewer.visViewer();
|
|
3767
3861
|
const filesToDownload = [model.database, ...model.geometry];
|
|
3768
|
-
console.time("File load time");
|
|
3769
3862
|
for (let i = 0; i < filesToDownload.length; i++) {
|
|
3770
3863
|
const dataId = filesToDownload[i];
|
|
3771
3864
|
const progress = (progress) => {
|
|
@@ -3797,7 +3890,6 @@
|
|
|
3797
3890
|
this.viewer.emitEvent({ type: "geometrychunk", data, file: model.file, model });
|
|
3798
3891
|
}
|
|
3799
3892
|
}
|
|
3800
|
-
console.timeEnd("File load time");
|
|
3801
3893
|
return this;
|
|
3802
3894
|
}
|
|
3803
3895
|
}
|
|
@@ -3865,7 +3957,6 @@
|
|
|
3865
3957
|
const progress = (progress) => {
|
|
3866
3958
|
this.viewer.emitEvent({ type: "geometryprogress", data: progress, file: model.file, model });
|
|
3867
3959
|
};
|
|
3868
|
-
console.time("File load time");
|
|
3869
3960
|
const arrayBuffer = await model.downloadResource(model.database, progress, this.abortController.signal);
|
|
3870
3961
|
const data = new Uint8Array(arrayBuffer);
|
|
3871
3962
|
if (!this.viewer.visualizeJs)
|
|
@@ -3884,39 +3975,10 @@
|
|
|
3884
3975
|
this.viewer.syncOverlay();
|
|
3885
3976
|
this.viewer.update(true);
|
|
3886
3977
|
this.viewer.emitEvent({ type: "databasechunk", data, file: model.file, model });
|
|
3887
|
-
console.timeEnd("File load time");
|
|
3888
3978
|
return this;
|
|
3889
3979
|
}
|
|
3890
3980
|
}
|
|
3891
3981
|
|
|
3892
|
-
const DELAY_TIME_MULTIPLEXER = 2.0;
|
|
3893
|
-
const START_UPDATE_TIME = 1000;
|
|
3894
|
-
var UpdateType;
|
|
3895
|
-
(function (UpdateType) {
|
|
3896
|
-
UpdateType[UpdateType["kDelay"] = 0] = "kDelay";
|
|
3897
|
-
UpdateType[UpdateType["kNormal"] = 1] = "kNormal";
|
|
3898
|
-
UpdateType[UpdateType["kForce"] = 2] = "kForce";
|
|
3899
|
-
})(UpdateType || (UpdateType = {}));
|
|
3900
|
-
class UpdateController {
|
|
3901
|
-
constructor() {
|
|
3902
|
-
this.lastUpdate = 0;
|
|
3903
|
-
this.delayUpdateTime = START_UPDATE_TIME;
|
|
3904
|
-
}
|
|
3905
|
-
initialize(viewer) {
|
|
3906
|
-
this.viewer = viewer;
|
|
3907
|
-
this.lastUpdate = performance.now();
|
|
3908
|
-
}
|
|
3909
|
-
update(type) {
|
|
3910
|
-
const isNeedUpdate = type !== UpdateType.kDelay || performance.now() - this.lastUpdate >= this.delayUpdateTime;
|
|
3911
|
-
const isForce = type === UpdateType.kForce;
|
|
3912
|
-
if (isNeedUpdate) {
|
|
3913
|
-
this.viewer.update(isForce);
|
|
3914
|
-
this.lastUpdate = performance.now();
|
|
3915
|
-
this.delayUpdateTime *= DELAY_TIME_MULTIPLEXER;
|
|
3916
|
-
}
|
|
3917
|
-
}
|
|
3918
|
-
}
|
|
3919
|
-
|
|
3920
3982
|
class VSFXCloudStreamingLoader extends Loader {
|
|
3921
3983
|
constructor(viewer) {
|
|
3922
3984
|
super();
|
|
@@ -3936,9 +3998,7 @@
|
|
|
3936
3998
|
return this;
|
|
3937
3999
|
const visLib = this.viewer.visLib();
|
|
3938
4000
|
const visViewer = this.viewer.visViewer();
|
|
3939
|
-
|
|
3940
|
-
updateController.initialize(this.viewer);
|
|
3941
|
-
let isFireDatabaseChunk = false;
|
|
4001
|
+
let isServiceDataReady = false;
|
|
3942
4002
|
const chunkLoadHandler = (progress, chunk) => {
|
|
3943
4003
|
if (!this.viewer.visualizeJs)
|
|
3944
4004
|
return;
|
|
@@ -3953,8 +4013,8 @@
|
|
|
3953
4013
|
this.viewer.emitEvent({ type: "geometryprogress", data: progress, file: model.file, model });
|
|
3954
4014
|
let isDatabaseChunk = false;
|
|
3955
4015
|
if (status === visLib.DatabaseStreamStatus.ReadyServiceData ||
|
|
3956
|
-
(status === visLib.DatabaseStreamStatus.Complete && !
|
|
3957
|
-
|
|
4016
|
+
(status === visLib.DatabaseStreamStatus.Complete && !isServiceDataReady)) {
|
|
4017
|
+
isServiceDataReady = true;
|
|
3958
4018
|
isDatabaseChunk = true;
|
|
3959
4019
|
}
|
|
3960
4020
|
if (isDatabaseChunk) {
|
|
@@ -3963,19 +4023,16 @@
|
|
|
3963
4023
|
this.viewer.models.push(modelImpl);
|
|
3964
4024
|
this.viewer.syncOptions();
|
|
3965
4025
|
this.viewer.syncOverlay();
|
|
3966
|
-
|
|
4026
|
+
this.viewer.update(true);
|
|
3967
4027
|
this.viewer.emitEvent({ type: "databasechunk", data: chunk, file: model.file, model });
|
|
3968
4028
|
}
|
|
3969
4029
|
else {
|
|
3970
|
-
|
|
4030
|
+
this.viewer.update();
|
|
3971
4031
|
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
|
|
3972
4032
|
}
|
|
3973
4033
|
};
|
|
3974
|
-
console.time("File load time");
|
|
3975
4034
|
await model.downloadResource(model.database, chunkLoadHandler, this.abortController.signal);
|
|
3976
|
-
|
|
3977
|
-
console.timeEnd("File load time");
|
|
3978
|
-
return Promise.resolve(this);
|
|
4035
|
+
return this;
|
|
3979
4036
|
}
|
|
3980
4037
|
}
|
|
3981
4038
|
|
|
@@ -3999,15 +4056,13 @@
|
|
|
3999
4056
|
if (!this.viewer.visualizeJs)
|
|
4000
4057
|
return this;
|
|
4001
4058
|
const visViewer = this.viewer.visViewer();
|
|
4059
|
+
visViewer.memoryLimit = this.viewer.options.memoryLimit;
|
|
4002
4060
|
let servicePartAborted = false;
|
|
4003
4061
|
const pendingRequestsMap = new Map();
|
|
4004
4062
|
let pendingRequestsTimerId = 0;
|
|
4005
4063
|
const pendingRequestsAbortHandler = () => clearTimeout(pendingRequestsTimerId);
|
|
4006
4064
|
const pendingRequestsAbortController = new AbortController();
|
|
4007
4065
|
this.abortControllerForRequestMap.set(0, pendingRequestsAbortController);
|
|
4008
|
-
const updateController = new UpdateController();
|
|
4009
|
-
updateController.initialize(this.viewer);
|
|
4010
|
-
visViewer.memoryLimit = this.viewer.options.memoryLimit;
|
|
4011
4066
|
const chunkLoadHandler = (progress, chunk, requestId = 0) => {
|
|
4012
4067
|
if (!this.viewer.visualizeJs)
|
|
4013
4068
|
return;
|
|
@@ -4026,11 +4081,11 @@
|
|
|
4026
4081
|
this.viewer.models.push(modelImpl);
|
|
4027
4082
|
this.viewer.syncOptions();
|
|
4028
4083
|
this.viewer.syncOverlay();
|
|
4029
|
-
|
|
4084
|
+
this.viewer.update(true);
|
|
4030
4085
|
this.viewer.emitEvent({ type: "databasechunk", data: chunk, file: model.file, model });
|
|
4031
4086
|
}
|
|
4032
4087
|
else {
|
|
4033
|
-
|
|
4088
|
+
this.viewer.update();
|
|
4034
4089
|
this.viewer.emitEvent({ type: "geometrychunk", data: chunk, file: model.file, model });
|
|
4035
4090
|
}
|
|
4036
4091
|
};
|
|
@@ -4046,7 +4101,6 @@
|
|
|
4046
4101
|
finally {
|
|
4047
4102
|
ranges.forEach((range) => visViewer.onRequestResponseComplete(range.requestId));
|
|
4048
4103
|
this.abortControllerForRequestMap.delete(requestId);
|
|
4049
|
-
updateController.update(UpdateType.kNormal);
|
|
4050
4104
|
}
|
|
4051
4105
|
};
|
|
4052
4106
|
const requestRecordsToRanges = (requestId, records) => {
|
|
@@ -4074,11 +4128,10 @@
|
|
|
4074
4128
|
downloadResourceRange(model.database, requestId, ranges);
|
|
4075
4129
|
},
|
|
4076
4130
|
onFullLoaded: () => {
|
|
4077
|
-
|
|
4131
|
+
this.viewer.update(true);
|
|
4078
4132
|
},
|
|
4079
4133
|
onRequestResponseParsed: (requestId) => {
|
|
4080
4134
|
this.abortControllerForRequestMap.delete(requestId);
|
|
4081
|
-
updateController.update(UpdateType.kNormal);
|
|
4082
4135
|
},
|
|
4083
4136
|
onRequestAborted: (requestId) => {
|
|
4084
4137
|
const abortCtrl = this.abortControllerForRequestMap.get(requestId);
|
|
@@ -17062,7 +17115,7 @@ js: import "konva/skia-backend";
|
|
|
17062
17115
|
}
|
|
17063
17116
|
getViewpoint(viewpoint) {
|
|
17064
17117
|
if (!viewpoint)
|
|
17065
|
-
viewpoint = {};
|
|
17118
|
+
viewpoint = { custom_fields: {} };
|
|
17066
17119
|
viewpoint.lines = this.getMarkupLines();
|
|
17067
17120
|
viewpoint.texts = this.getMarkupTexts();
|
|
17068
17121
|
viewpoint.arrows = this.getMarkupArrows();
|
|
@@ -17070,8 +17123,8 @@ js: import "konva/skia-backend";
|
|
|
17070
17123
|
viewpoint.ellipses = this.getMarkupEllipses();
|
|
17071
17124
|
viewpoint.images = this.getMarkupImages();
|
|
17072
17125
|
viewpoint.rectangles = this.getMarkupRectangles();
|
|
17073
|
-
viewpoint.custom_fields = { markup_color: this.getMarkupColor() };
|
|
17074
17126
|
viewpoint.snapshot = { data: this.combineMarkupWithDrawing() };
|
|
17127
|
+
viewpoint.custom_fields.markup_color = this.getMarkupColor();
|
|
17075
17128
|
return viewpoint;
|
|
17076
17129
|
}
|
|
17077
17130
|
enableEditMode(mode) {
|
|
@@ -17953,7 +18006,7 @@ js: import "konva/skia-backend";
|
|
|
17953
18006
|
const visLib = this._viewer.visLib();
|
|
17954
18007
|
const visViewer = this._viewer.visViewer();
|
|
17955
18008
|
if (!viewpoint)
|
|
17956
|
-
viewpoint = {};
|
|
18009
|
+
viewpoint = { custom_fields: {} };
|
|
17957
18010
|
viewpoint.lines = [];
|
|
17958
18011
|
viewpoint.texts = [];
|
|
17959
18012
|
const model = visViewer.getMarkupModel();
|
|
@@ -17995,12 +18048,8 @@ js: import "konva/skia-backend";
|
|
|
17995
18048
|
entityPtr.delete();
|
|
17996
18049
|
}
|
|
17997
18050
|
itr.delete();
|
|
17998
|
-
viewpoint.snapshot = {
|
|
17999
|
-
|
|
18000
|
-
};
|
|
18001
|
-
viewpoint.custom_fields = {
|
|
18002
|
-
markup_color: this.getMarkupColor(),
|
|
18003
|
-
};
|
|
18051
|
+
viewpoint.snapshot = { data: visLib.canvas.toDataURL("image/jpeg", 0.25) };
|
|
18052
|
+
viewpoint.custom_fields.markup_color = this.getMarkupColor();
|
|
18004
18053
|
return viewpoint;
|
|
18005
18054
|
}
|
|
18006
18055
|
enableEditMode(mode) {
|
|
@@ -18053,6 +18102,7 @@ js: import "konva/skia-backend";
|
|
|
18053
18102
|
this.canvaseventlistener = (event) => this.emit(event);
|
|
18054
18103
|
this._activeDragger = null;
|
|
18055
18104
|
this._components = [];
|
|
18105
|
+
this._updateDelay = 1000;
|
|
18056
18106
|
this._renderNeeded = false;
|
|
18057
18107
|
this._renderTime = 0;
|
|
18058
18108
|
this._enableAutoUpdate = (_a = params.enableAutoUpdate) !== null && _a !== void 0 ? _a : true;
|
|
@@ -18175,12 +18225,14 @@ js: import "konva/skia-backend";
|
|
|
18175
18225
|
return this;
|
|
18176
18226
|
}
|
|
18177
18227
|
update(force = false) {
|
|
18228
|
+
const time = performance.now();
|
|
18229
|
+
force = force || time - this._renderTime >= this._updateDelay;
|
|
18178
18230
|
if (this._enableAutoUpdate) {
|
|
18179
18231
|
this._renderNeeded = true;
|
|
18180
18232
|
if (force)
|
|
18181
|
-
this.render();
|
|
18233
|
+
this.render(time);
|
|
18182
18234
|
}
|
|
18183
|
-
this.emitEvent({ type: "update",
|
|
18235
|
+
this.emitEvent({ type: "update", force });
|
|
18184
18236
|
}
|
|
18185
18237
|
render(time) {
|
|
18186
18238
|
var _a, _b;
|
|
@@ -18600,11 +18652,27 @@ js: import "konva/skia-backend";
|
|
|
18600
18652
|
const setOrthogonalCamera = (orthogonal_camera) => {
|
|
18601
18653
|
if (orthogonal_camera) {
|
|
18602
18654
|
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.
|
|
18655
|
+
this.options.cameraMode = "orthographic";
|
|
18604
18656
|
this.emitEvent({ type: "changecameramode", mode: "orthographic" });
|
|
18605
18657
|
}
|
|
18606
18658
|
};
|
|
18607
|
-
const setPerspectiveCamera = (perspective_camera) => {
|
|
18659
|
+
const setPerspectiveCamera = (perspective_camera) => {
|
|
18660
|
+
if (perspective_camera) {
|
|
18661
|
+
const aspectRatio = this.canvas.width / this.canvas.height;
|
|
18662
|
+
const position = perspective_camera.view_point;
|
|
18663
|
+
const target = perspective_camera.direction;
|
|
18664
|
+
const fov = (perspective_camera.field_of_view * Math.PI) / 180;
|
|
18665
|
+
const dx = target.x - position.x;
|
|
18666
|
+
const dy = target.y - position.y;
|
|
18667
|
+
const dz = target.z - position.z;
|
|
18668
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
18669
|
+
const fieldHeight = 2 * distance * Math.tan(fov / 2);
|
|
18670
|
+
const fieldWidth = fieldHeight * aspectRatio;
|
|
18671
|
+
activeView.setView(getPoint3dAsArray(perspective_camera.view_point), getPoint3dAsArray(perspective_camera.direction), getPoint3dAsArray(perspective_camera.up_vector), fieldWidth, fieldHeight, false);
|
|
18672
|
+
this.options.cameraMode = "perspective";
|
|
18673
|
+
this.emitEvent({ type: "changecameramode", mode: "perspective" });
|
|
18674
|
+
}
|
|
18675
|
+
};
|
|
18608
18676
|
const setClippingPlanes = (clipping_planes) => {
|
|
18609
18677
|
if (clipping_planes) {
|
|
18610
18678
|
for (const clipping_plane of clipping_planes) {
|
|
@@ -18631,6 +18699,7 @@ js: import "konva/skia-backend";
|
|
|
18631
18699
|
setClippingPlanes(viewpoint.clipping_planes);
|
|
18632
18700
|
setSelection(((_b = viewpoint.custom_fields) === null || _b === void 0 ? void 0 : _b.selection2) || viewpoint.selection);
|
|
18633
18701
|
this._markup.setViewpoint(viewpoint);
|
|
18702
|
+
this.syncOverlay();
|
|
18634
18703
|
this.setActiveDragger(draggerName);
|
|
18635
18704
|
this.emitEvent({ type: "drawviewpoint", data: viewpoint });
|
|
18636
18705
|
this.update();
|
|
@@ -18644,17 +18713,37 @@ js: import "konva/skia-backend";
|
|
|
18644
18713
|
return { x: array[0], y: array[1], z: array[2] };
|
|
18645
18714
|
};
|
|
18646
18715
|
const getOrthogonalCamera = () => {
|
|
18647
|
-
|
|
18648
|
-
|
|
18649
|
-
|
|
18650
|
-
|
|
18651
|
-
|
|
18652
|
-
|
|
18653
|
-
|
|
18654
|
-
|
|
18716
|
+
if (!activeView.perspective)
|
|
18717
|
+
return {
|
|
18718
|
+
view_point: getPoint3dFromArray(activeView.viewPosition),
|
|
18719
|
+
direction: getPoint3dFromArray(activeView.viewTarget),
|
|
18720
|
+
up_vector: getPoint3dFromArray(activeView.upVector),
|
|
18721
|
+
field_width: activeView.viewFieldWidth,
|
|
18722
|
+
field_height: activeView.viewFieldHeight,
|
|
18723
|
+
view_to_world_scale: 1,
|
|
18724
|
+
};
|
|
18725
|
+
else
|
|
18726
|
+
return undefined;
|
|
18655
18727
|
};
|
|
18656
18728
|
const getPerspectiveCamera = () => {
|
|
18657
|
-
|
|
18729
|
+
if (activeView.perspective) {
|
|
18730
|
+
const position = activeView.viewPosition;
|
|
18731
|
+
const target = activeView.viewTarget;
|
|
18732
|
+
const fieldHeight = activeView.viewFieldHeight;
|
|
18733
|
+
const dx = target[0] - position[0];
|
|
18734
|
+
const dy = target[1] - position[1];
|
|
18735
|
+
const dz = target[2] - position[2];
|
|
18736
|
+
const distance = Math.sqrt(dx * dx + dy * dy + dz * dz);
|
|
18737
|
+
const fov = 2 * Math.atan(fieldHeight / (2 * distance));
|
|
18738
|
+
return {
|
|
18739
|
+
view_point: getPoint3dFromArray(activeView.viewPosition),
|
|
18740
|
+
direction: getPoint3dFromArray(activeView.viewTarget),
|
|
18741
|
+
up_vector: getPoint3dFromArray(activeView.upVector),
|
|
18742
|
+
field_of_view: (fov * 180) / Math.PI,
|
|
18743
|
+
};
|
|
18744
|
+
}
|
|
18745
|
+
else
|
|
18746
|
+
return undefined;
|
|
18658
18747
|
};
|
|
18659
18748
|
const getClippingPlanes = () => {
|
|
18660
18749
|
const clipping_planes = [];
|
|
@@ -18760,7 +18849,7 @@ js: import "konva/skia-backend";
|
|
|
18760
18849
|
(_a = this.visViewer()) === null || _a === void 0 ? void 0 : _a.update(maxScheduleUpdateTimeInMs);
|
|
18761
18850
|
(_c = (_b = this._activeDragger) === null || _b === void 0 ? void 0 : _b.updatePreview) === null || _c === void 0 ? void 0 : _c.call(_b);
|
|
18762
18851
|
}
|
|
18763
|
-
this.emitEvent({ type: "update",
|
|
18852
|
+
this.emitEvent({ type: "update", force: false });
|
|
18764
18853
|
resolve();
|
|
18765
18854
|
}
|
|
18766
18855
|
catch (e) {
|