@tscircuit/3d-viewer 0.0.527 → 0.0.528

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.
Files changed (2) hide show
  1. package/dist/index.js +17 -4
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -28769,7 +28769,7 @@ import * as THREE16 from "three";
28769
28769
  // package.json
28770
28770
  var package_default = {
28771
28771
  name: "@tscircuit/3d-viewer",
28772
- version: "0.0.526",
28772
+ version: "0.0.527",
28773
28773
  main: "./dist/index.js",
28774
28774
  module: "./dist/index.js",
28775
28775
  type: "module",
@@ -28798,7 +28798,7 @@ var package_default = {
28798
28798
  dependencies: {
28799
28799
  "@jscad/regl-renderer": "^2.6.12",
28800
28800
  "@jscad/stl-serializer": "^2.1.20",
28801
- "circuit-json": "^0.0.372",
28801
+ "circuit-json": "^0.0.391",
28802
28802
  "circuit-to-canvas": "^0.0.87",
28803
28803
  "react-hot-toast": "^2.6.0",
28804
28804
  three: "^0.165.0",
@@ -31925,8 +31925,16 @@ function createPadTextureForLayer({
31925
31925
  }
31926
31926
 
31927
31927
  // src/utils/panel-outline-texture.ts
31928
- import * as THREE20 from "three";
31929
31928
  import { su as su6 } from "@tscircuit/circuit-json-util";
31929
+ import * as THREE20 from "three";
31930
+ var resolvePanelIdForTexture = (circuitJson) => {
31931
+ const panels = circuitJson.filter(
31932
+ (e) => e.type === "pcb_panel"
31933
+ );
31934
+ if (panels.length === 0) return null;
31935
+ if (panels.length === 1) return panels[0].pcb_panel_id;
31936
+ return null;
31937
+ };
31930
31938
  function createPanelOutlineTextureForLayer({
31931
31939
  layer,
31932
31940
  circuitJson,
@@ -31934,7 +31942,12 @@ function createPanelOutlineTextureForLayer({
31934
31942
  outlineColor = "black",
31935
31943
  traceTextureResolution
31936
31944
  }) {
31937
- const boardsInPanel = su6(circuitJson).pcb_board.list().filter((b) => b.pcb_panel_id === panelData.pcb_board_id);
31945
+ const panelId = resolvePanelIdForTexture(circuitJson);
31946
+ if (!panelId) return null;
31947
+ const allBoards = su6(circuitJson).pcb_board.list();
31948
+ const boardsInPanel = allBoards.filter(
31949
+ (b) => b.pcb_panel_id === panelId || b.position_mode === "relative_to_panel_anchor" && !b.pcb_panel_id
31950
+ );
31938
31951
  if (boardsInPanel.length === 0) {
31939
31952
  return null;
31940
31953
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tscircuit/3d-viewer",
3
- "version": "0.0.527",
3
+ "version": "0.0.528",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "type": "module",
@@ -29,7 +29,7 @@
29
29
  "dependencies": {
30
30
  "@jscad/regl-renderer": "^2.6.12",
31
31
  "@jscad/stl-serializer": "^2.1.20",
32
- "circuit-json": "^0.0.372",
32
+ "circuit-json": "^0.0.391",
33
33
  "circuit-to-canvas": "^0.0.87",
34
34
  "react-hot-toast": "^2.6.0",
35
35
  "three": "^0.165.0",