@archvisioninc/canvas 3.3.3 → 3.3.4

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.
@@ -29,13 +29,13 @@ export const getScaleFactor = sourceUnit => {
29
29
  export const getBoundingMeshData = meshArray => {
30
30
  const meshes = meshArray || getUserMeshes();
31
31
  const singleSelection = meshes.length === 1;
32
- const singleBox = singleSelection && meshes[0].getBoundingInfo?.().boundingBox;
32
+ const singleBox = singleSelection && meshes[0]?.getBoundingInfo?.().boundingBox;
33
33
  const scaling = singleSelection && meshes[0].scaling;
34
34
  const rotation = singleSelection && meshes[0].rotation;
35
35
  let minimum = newVector(0, 0, 0);
36
36
  let maximum = newVector(0, 0, 0);
37
37
  for (let i = 0; i < meshes.length; i++) {
38
- const boundingInfo = meshes[i].getBoundingInfo?.();
38
+ const boundingInfo = meshes[i]?.getBoundingInfo?.();
39
39
  if (boundingInfo) {
40
40
  const workingBoundingBox = boundingInfo.boundingBox;
41
41
  if (i === 0) {
@@ -124,7 +124,7 @@ export const resetSelectedMeshes = () => {
124
124
  const existingMaterial = scene.metadata?.materials?.find?.(mat => mat.materialId === firstMaterial.id);
125
125
  newMetaDataEntry('selectedMaterials', [existingMaterial]);
126
126
  }
127
- if (props.integration?.meshHighlighting !== false) {
127
+ if (props.integration?.meshHighlighting !== false && highlightManager) {
128
128
  highlightManager.removeAllMeshes();
129
129
  }
130
130
  selectedMeshes = [];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@archvisioninc/canvas",
3
- "version": "3.3.3",
3
+ "version": "3.3.4",
4
4
  "private": false,
5
5
  "main": "dist/Canvas.js",
6
6
  "module": "dist/Canvas.js",
@@ -37,14 +37,14 @@ export const getScaleFactor = sourceUnit => {
37
37
  export const getBoundingMeshData = meshArray => {
38
38
  const meshes = meshArray || getUserMeshes();
39
39
  const singleSelection = meshes.length === 1;
40
- const singleBox = singleSelection && meshes[0].getBoundingInfo?.().boundingBox;
40
+ const singleBox = singleSelection && meshes[0]?.getBoundingInfo?.().boundingBox;
41
41
  const scaling = singleSelection && meshes[0].scaling;
42
42
  const rotation = singleSelection && meshes[0].rotation;
43
43
  let minimum = newVector(0, 0, 0);
44
44
  let maximum = newVector(0, 0, 0);
45
45
 
46
46
  for (let i = 0; i < meshes.length; i++) {
47
- const boundingInfo = meshes[i].getBoundingInfo?.();
47
+ const boundingInfo = meshes[i]?.getBoundingInfo?.();
48
48
 
49
49
  if (boundingInfo) {
50
50
  const workingBoundingBox = boundingInfo.boundingBox;
@@ -192,4 +192,4 @@ export const getScaleToZeroOne = vertices => {
192
192
  });
193
193
 
194
194
  return scaledVertices;
195
- };
195
+ };
@@ -180,7 +180,7 @@ export const resetSelectedMeshes = () => {
180
180
  newMetaDataEntry('selectedMaterials', [ existingMaterial ]);
181
181
  }
182
182
 
183
- if (props.integration?.meshHighlighting !== false) {
183
+ if (props.integration?.meshHighlighting !== false && highlightManager) {
184
184
  highlightManager.removeAllMeshes();
185
185
  }
186
186
 
@@ -440,4 +440,4 @@ export const prepareAxes = () => {
440
440
  zAxisMesh.parent = zAxisTNode;
441
441
 
442
442
  new BABYLON.AxesViewer(scene, 1, null, xAxisTNode, yAxisTNode, zAxisTNode, 0.5);
443
- };
443
+ };