@inweb/viewer-visualize 25.8.21 → 25.9.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inweb/viewer-visualize",
3
- "version": "25.8.21",
3
+ "version": "25.9.0",
4
4
  "description": "3D viewer powered by VisualizeJS",
5
5
  "homepage": "https://cloud.opendesign.com/docs/index.html",
6
6
  "license": "SEE LICENSE IN LICENSE",
@@ -29,10 +29,10 @@
29
29
  "docs": "typedoc"
30
30
  },
31
31
  "dependencies": {
32
- "@inweb/client": "~25.8.21",
33
- "@inweb/eventemitter2": "~25.8.21",
34
- "@inweb/markup": "~25.8.21",
35
- "@inweb/viewer-core": "~25.8.21"
32
+ "@inweb/client": "~25.9.0",
33
+ "@inweb/eventemitter2": "~25.9.0",
34
+ "@inweb/markup": "~25.9.0",
35
+ "@inweb/viewer-core": "~25.9.0"
36
36
  },
37
37
  "visualizeJS": "https://opencloud.azureedge.net/libs/visualizejs/master/Visualize.js"
38
38
  }
@@ -21,7 +21,7 @@
21
21
  // acknowledge and accept the above terms.
22
22
  ///////////////////////////////////////////////////////////////////////////////
23
23
 
24
- import { Model, File, Assembly, version } from "@inweb/client";
24
+ import { Model, File, Assembly } from "@inweb/client";
25
25
  import { commands } from "@inweb/viewer-core";
26
26
  import { Viewer } from "../Viewer";
27
27
 
@@ -46,7 +46,7 @@ async function autoTransformAllModelsToCentralPoint(viewer: Viewer, model: Model
46
46
  const modelPtr = modelItr.getModel();
47
47
 
48
48
  if (!isTemplateModel(modelPtr)) {
49
- let ext = modelPtr.getExtents();
49
+ const ext = modelPtr.getExtents();
50
50
 
51
51
  const unitsMatrix = modelPtr.getUnitsMatrix();
52
52
  ext.transformBy(modelPtr.getUnitsMatrix()); // ext in wcs
@@ -331,6 +331,9 @@ export class Viewer
331
331
  if (!this.visualizeJs) return this;
332
332
 
333
333
  const { clientWidth, clientHeight } = this.canvas;
334
+
335
+ if (!clientWidth || !clientHeight) return this; // <- invisible viewer, or viewer with parent removed
336
+
334
337
  this.canvas.width = clientWidth * window.devicePixelRatio;
335
338
  this.canvas.height = clientHeight * window.devicePixelRatio;
336
339