@inweb/viewer-three 27.1.4 → 27.1.5
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-three.js +45 -19
- package/dist/viewer-three.js.map +1 -1
- package/dist/viewer-three.min.js +2 -2
- package/dist/viewer-three.module.js +45 -19
- package/dist/viewer-three.module.js.map +1 -1
- package/lib/Viewer/components/CanvasRemoveComponent.d.ts +9 -0
- package/lib/Viewer/components/{ResizeCanvasComponent.d.ts → CanvasResizeComponent.d.ts} +1 -1
- package/package.json +5 -5
- package/src/Viewer/Viewer.ts +1 -1
- package/src/Viewer/components/CameraComponent.ts +1 -1
- package/src/Viewer/components/CanvasRemoveComponent.ts +55 -0
- package/src/Viewer/components/{ResizeCanvasComponent.ts → CanvasResizeComponent.ts} +1 -1
- package/src/Viewer/components/index.ts +4 -2
package/dist/viewer-three.js
CHANGED
|
@@ -36134,7 +36134,7 @@ void main() {
|
|
|
36134
36134
|
if (camera.isOrthographicCamera) {
|
|
36135
36135
|
camera.left = camera.bottom * aspectRatio;
|
|
36136
36136
|
camera.right = camera.top * aspectRatio;
|
|
36137
|
-
camera.near =
|
|
36137
|
+
camera.near = -extentsSize * 1000;
|
|
36138
36138
|
camera.far = extentsSize * 1000;
|
|
36139
36139
|
}
|
|
36140
36140
|
camera.updateProjectionMatrix();
|
|
@@ -36400,22 +36400,7 @@ void main() {
|
|
|
36400
36400
|
}
|
|
36401
36401
|
}
|
|
36402
36402
|
|
|
36403
|
-
class
|
|
36404
|
-
constructor(viewer) {
|
|
36405
|
-
this.animate = (time) => {
|
|
36406
|
-
this.requestId = requestAnimationFrame(this.animate);
|
|
36407
|
-
this.viewer.render(time);
|
|
36408
|
-
this.viewer.emitEvent({ type: "animate", time });
|
|
36409
|
-
};
|
|
36410
|
-
this.viewer = viewer;
|
|
36411
|
-
this.requestId = requestAnimationFrame(this.animate);
|
|
36412
|
-
}
|
|
36413
|
-
dispose() {
|
|
36414
|
-
cancelAnimationFrame(this.requestId);
|
|
36415
|
-
}
|
|
36416
|
-
}
|
|
36417
|
-
|
|
36418
|
-
class ResizeCanvasComponent {
|
|
36403
|
+
class CanvasResizeComponent {
|
|
36419
36404
|
constructor(viewer) {
|
|
36420
36405
|
this.resizeViewer = (entries) => {
|
|
36421
36406
|
const { width, height } = entries[0].contentRect;
|
|
@@ -36432,6 +36417,46 @@ void main() {
|
|
|
36432
36417
|
}
|
|
36433
36418
|
}
|
|
36434
36419
|
|
|
36420
|
+
class CanvasRemoveComponent {
|
|
36421
|
+
constructor(viewer) {
|
|
36422
|
+
this.cleanupViewer = (mutations) => {
|
|
36423
|
+
for (const mutation of mutations) {
|
|
36424
|
+
if (mutation.type === "childList" && mutation.removedNodes.length > 0) {
|
|
36425
|
+
for (const node of mutation.removedNodes) {
|
|
36426
|
+
if (node === this.viewer.canvas || node.contains(this.viewer.canvas)) {
|
|
36427
|
+
this.viewer.emitEvent({ type: "canvasremoved" });
|
|
36428
|
+
this.viewer.dispose();
|
|
36429
|
+
return;
|
|
36430
|
+
}
|
|
36431
|
+
}
|
|
36432
|
+
}
|
|
36433
|
+
}
|
|
36434
|
+
};
|
|
36435
|
+
this.viewer = viewer;
|
|
36436
|
+
this.mutationObserver = new MutationObserver(this.cleanupViewer);
|
|
36437
|
+
this.mutationObserver.observe(document, { childList: true, subtree: true });
|
|
36438
|
+
}
|
|
36439
|
+
dispose() {
|
|
36440
|
+
this.mutationObserver.disconnect();
|
|
36441
|
+
this.mutationObserver = undefined;
|
|
36442
|
+
}
|
|
36443
|
+
}
|
|
36444
|
+
|
|
36445
|
+
class RenderLoopComponent {
|
|
36446
|
+
constructor(viewer) {
|
|
36447
|
+
this.animate = (time) => {
|
|
36448
|
+
this.requestId = requestAnimationFrame(this.animate);
|
|
36449
|
+
this.viewer.render(time);
|
|
36450
|
+
this.viewer.emitEvent({ type: "animate", time });
|
|
36451
|
+
};
|
|
36452
|
+
this.viewer = viewer;
|
|
36453
|
+
this.requestId = requestAnimationFrame(this.animate);
|
|
36454
|
+
}
|
|
36455
|
+
dispose() {
|
|
36456
|
+
cancelAnimationFrame(this.requestId);
|
|
36457
|
+
}
|
|
36458
|
+
}
|
|
36459
|
+
|
|
36435
36460
|
const _box = new Box3();
|
|
36436
36461
|
const _vector = new Vector3();
|
|
36437
36462
|
class LineSegmentsGeometry extends InstancedBufferGeometry {
|
|
@@ -37527,7 +37552,8 @@ void main() {
|
|
|
37527
37552
|
components.registerComponent("BackgroundComponent", (viewer) => new BackgroundComponent(viewer));
|
|
37528
37553
|
components.registerComponent("LightComponent", (viewer) => new LightComponent(viewer));
|
|
37529
37554
|
components.registerComponent("InfoComponent", (viewer) => new InfoComponent(viewer));
|
|
37530
|
-
components.registerComponent("
|
|
37555
|
+
components.registerComponent("CanvasResizeComponent", (viewer) => new CanvasResizeComponent(viewer));
|
|
37556
|
+
components.registerComponent("CanvasRemoveComponent", (viewer) => new CanvasRemoveComponent(viewer));
|
|
37531
37557
|
components.registerComponent("RenderLoopComponent", (viewer) => new RenderLoopComponent(viewer));
|
|
37532
37558
|
components.registerComponent("HighlighterComponent", (viewer) => new HighlighterComponent(viewer));
|
|
37533
37559
|
components.registerComponent("SelectionComponent", (viewer) => new SelectionComponent(viewer));
|
|
@@ -57652,7 +57678,7 @@ js: import "konva/skia-backend";
|
|
|
57652
57678
|
camera.bottom = -orthogonal_camera.field_height / 2;
|
|
57653
57679
|
camera.left = camera.bottom * aspectRatio;
|
|
57654
57680
|
camera.right = camera.top * aspectRatio;
|
|
57655
|
-
camera.near =
|
|
57681
|
+
camera.near = -extentsSize * 1000;
|
|
57656
57682
|
camera.far = extentsSize * 1000;
|
|
57657
57683
|
camera.zoom = orthogonal_camera.view_to_world_scale;
|
|
57658
57684
|
camera.updateProjectionMatrix();
|