three-cad-viewer 4.3.4 → 4.3.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "three-cad-viewer",
3
- "version": "4.3.4",
3
+ "version": "4.3.5",
4
4
  "type": "module",
5
5
  "description": "WebGL-based CAD viewer built on Three.js with clipping planes, measurement tools, and tree navigation",
6
6
  "repository": {
package/src/_version.ts CHANGED
@@ -1 +1 @@
1
- export const version: string = "4.3.4";
1
+ export const version: string = "4.3.5";
@@ -154,6 +154,16 @@ class CenteredPlane extends THREE.Plane {
154
154
  const z = this.distanceToPoint(new THREE.Vector3(0, 0, 0));
155
155
  this.constant = z - c + value;
156
156
  }
157
+
158
+ /**
159
+ * Clone this CenteredPlane.
160
+ * Overrides THREE.Plane.clone() which calls `new this.constructor()` without
161
+ * arguments, causing `center` to be undefined during shadow map generation.
162
+ */
163
+ // @ts-expect-error -- THREE.Plane.clone() returns `this`, but we need a concrete CenteredPlane
164
+ clone(): CenteredPlane {
165
+ return new CenteredPlane(this.normal.clone(), this.centeredConstant, [...this.center]);
166
+ }
157
167
  }
158
168
 
159
169
  // ============================================================================
@@ -336,12 +336,16 @@ class NestedGroup {
336
336
  );
337
337
  return null;
338
338
  }
339
- const resolved: MaterialAppearance = { ...preset, ...appearance };
339
+ // Strip preset color unless the user explicitly provides one,
340
+ // so the leaf node's CAD color is used as fallback.
341
+ const { color: presetColor, ...presetRest } = preset;
342
+ const resolved: MaterialAppearance = "color" in appearance
343
+ ? { ...preset, ...appearance }
344
+ : { ...presetRest, ...appearance };
340
345
  this.resolvedMaterials.set(tag, resolved);
341
346
  return resolved;
342
347
  }
343
348
 
344
- // Should not happen with current type, but guard anyway
345
349
  logger.warn(`Unrecognised material entry for tag '${tag}' on '${objectPath}'`);
346
350
  return null;
347
351
  }