brep-io-kernel 1.0.23 → 1.0.24

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.
@@ -43327,7 +43327,34 @@ function Kx(i = {}) {
43327
43327
  }, B.parentSolid = this;
43328
43328
  try {
43329
43329
  const Q = (s?.materialKey || "OVERLAY").toUpperCase(), h = og?.EDGE || {}, u = h[Q] || (Q === "OVERLAY" ? h.OVERLAY : null) || h.BASE;
43330
- u && (B.material = u), u && ut.setBaseMaterial(B, u, { force: !1 }), B.material && Q !== "BASE" && (B.material.depthTest = !1, B.material.depthWrite = !1);
43330
+ let l = u;
43331
+ if (u && Q !== "BASE" && !(u.depthTest === !1 && u.depthWrite === !1)) {
43332
+ const D = Object.values(h).includes(u);
43333
+ let p = !1;
43334
+ if (D && typeof u.clone == "function") {
43335
+ try {
43336
+ l = u.clone(), p = !!l && l !== u;
43337
+ } catch {
43338
+ l = u, p = !1;
43339
+ }
43340
+ if (p)
43341
+ try {
43342
+ u.resolution && l.resolution && typeof l.resolution.copy == "function" && l.resolution.copy(u.resolution);
43343
+ } catch {
43344
+ }
43345
+ }
43346
+ if ((p || !D) && l) {
43347
+ try {
43348
+ l.depthTest = !1;
43349
+ } catch {
43350
+ }
43351
+ try {
43352
+ l.depthWrite = !1;
43353
+ } catch {
43354
+ }
43355
+ }
43356
+ }
43357
+ l && (B.material = l), l && ut.setBaseMaterial(B, l, { force: !1 });
43331
43358
  try {
43332
43359
  B.computeLineDistances();
43333
43360
  } catch {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "brep-io-kernel",
3
- "version": "1.0.23",
3
+ "version": "1.0.24",
4
4
  "scripts": {
5
5
  "dev": "pnpm generateLicenses && pnpm build:kernel && vite --host 0.0.0.0",
6
6
  "build": "pnpm generateLicenses && vite build",
@@ -354,12 +354,34 @@ export function visualize(options = {}) {
354
354
  const key = (aux?.materialKey || 'OVERLAY').toUpperCase();
355
355
  const edgeMats = CADmaterials?.EDGE || {};
356
356
  const mat = edgeMats[key] || (key === 'OVERLAY' ? edgeMats.OVERLAY : null) || edgeMats.BASE;
357
- if (mat) edgeObj.material = mat;
358
- if (mat) SelectionState.setBaseMaterial(edgeObj, mat, { force: false });
359
- if (edgeObj.material && (key !== 'BASE')) {
360
- edgeObj.material.depthTest = false;
361
- edgeObj.material.depthWrite = false;
357
+ let appliedMat = mat;
358
+ const wantsOverlay = key !== 'BASE';
359
+ if (mat && wantsOverlay) {
360
+ const alreadyOverlay = mat.depthTest === false && mat.depthWrite === false;
361
+ if (!alreadyOverlay) {
362
+ const shared = Object.values(edgeMats).includes(mat);
363
+ let cloned = false;
364
+ if (shared && typeof mat.clone === 'function') {
365
+ try {
366
+ appliedMat = mat.clone();
367
+ cloned = !!appliedMat && appliedMat !== mat;
368
+ } catch { appliedMat = mat; cloned = false; }
369
+ if (cloned) {
370
+ try {
371
+ if (mat.resolution && appliedMat.resolution && typeof appliedMat.resolution.copy === 'function') {
372
+ appliedMat.resolution.copy(mat.resolution);
373
+ }
374
+ } catch { }
375
+ }
376
+ }
377
+ if ((cloned || !shared) && appliedMat) {
378
+ try { appliedMat.depthTest = false; } catch { }
379
+ try { appliedMat.depthWrite = false; } catch { }
380
+ }
381
+ }
362
382
  }
383
+ if (appliedMat) edgeObj.material = appliedMat;
384
+ if (appliedMat) SelectionState.setBaseMaterial(edgeObj, appliedMat, { force: false });
363
385
  try { edgeObj.computeLineDistances(); } catch { }
364
386
  edgeObj.renderOrder = 10020;
365
387
  } catch { }