@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.
@@ -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 = 0;
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 RenderLoopComponent {
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("ResizeCanvasComponent", (viewer) => new ResizeCanvasComponent(viewer));
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 = 0;
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();