@tscircuit/pcb-viewer 1.11.261 → 1.11.263

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/dist/index.js CHANGED
@@ -7573,6 +7573,88 @@ var convertElementToPrimitives = (element, allElements) => {
7573
7573
  ccw_rotation: hole_ccw_rotation
7574
7574
  }
7575
7575
  ];
7576
+ } else if (element.shape === "hole_with_polygon_pad") {
7577
+ const {
7578
+ x,
7579
+ y,
7580
+ pad_outline,
7581
+ hole_shape,
7582
+ hole_diameter,
7583
+ hole_width,
7584
+ hole_height,
7585
+ layers
7586
+ } = element;
7587
+ const hole_offset_x = distance2.parse(
7588
+ element.hole_offset_x ?? 0
7589
+ );
7590
+ const hole_offset_y = distance2.parse(
7591
+ element.hole_offset_y ?? 0
7592
+ );
7593
+ const pcb_outline = pad_outline;
7594
+ const padPrimitives = [];
7595
+ if (pcb_outline && Array.isArray(pcb_outline)) {
7596
+ const translatedPoints = normalizePolygonPoints(pcb_outline).map(
7597
+ (p) => ({ x: p.x + x, y: p.y + y })
7598
+ );
7599
+ for (const layer of layers || ["top", "bottom"]) {
7600
+ padPrimitives.push({
7601
+ _pcb_drawing_object_id: `polygon_${globalPcbDrawingObjectCount++}`,
7602
+ pcb_drawing_type: "polygon",
7603
+ points: translatedPoints,
7604
+ layer,
7605
+ _element: element,
7606
+ _parent_pcb_component,
7607
+ _parent_source_component,
7608
+ _source_port
7609
+ });
7610
+ }
7611
+ }
7612
+ const holeCenter = {
7613
+ x: x + hole_offset_x,
7614
+ y: y + hole_offset_y
7615
+ };
7616
+ const holePrimitives = [];
7617
+ if (hole_shape === "circle") {
7618
+ holePrimitives.push({
7619
+ _pcb_drawing_object_id: `circle_${globalPcbDrawingObjectCount++}`,
7620
+ pcb_drawing_type: "circle",
7621
+ x: holeCenter.x,
7622
+ y: holeCenter.y,
7623
+ r: (hole_diameter ?? 0) / 2,
7624
+ layer: "drill",
7625
+ _element: element,
7626
+ _parent_pcb_component,
7627
+ _parent_source_component
7628
+ });
7629
+ } else if (hole_shape === "oval") {
7630
+ holePrimitives.push({
7631
+ _pcb_drawing_object_id: `oval_${globalPcbDrawingObjectCount++}`,
7632
+ pcb_drawing_type: "oval",
7633
+ x: holeCenter.x,
7634
+ y: holeCenter.y,
7635
+ rX: (hole_width ?? 0) / 2,
7636
+ rY: (hole_height ?? 0) / 2,
7637
+ layer: "drill",
7638
+ _element: element,
7639
+ _parent_pcb_component,
7640
+ _parent_source_component
7641
+ });
7642
+ } else if (hole_shape === "pill" || hole_shape === "rotated_pill") {
7643
+ holePrimitives.push({
7644
+ _pcb_drawing_object_id: `pill_${globalPcbDrawingObjectCount++}`,
7645
+ pcb_drawing_type: "pill",
7646
+ x: holeCenter.x,
7647
+ y: holeCenter.y,
7648
+ w: hole_width ?? 0,
7649
+ h: hole_height ?? 0,
7650
+ layer: "drill",
7651
+ _element: element,
7652
+ _parent_pcb_component,
7653
+ _parent_source_component,
7654
+ ccw_rotation: element.ccw_rotation
7655
+ });
7656
+ }
7657
+ return [...padPrimitives, ...holePrimitives];
7576
7658
  } else {
7577
7659
  return [];
7578
7660
  }
@@ -8072,9 +8154,11 @@ var convertElementToPrimitives = (element, allElements) => {
8072
8154
  ];
8073
8155
  }
8074
8156
  case "pcb_cutout": {
8075
- const cutoutElement = element;
8076
- switch (cutoutElement.shape) {
8157
+ switch (element.shape) {
8077
8158
  case "rect": {
8159
+ const cutoutElement = element;
8160
+ const corner_radius = cutoutElement.corner_radius;
8161
+ const ccw_rotation = cutoutElement.rotation ?? cutoutElement.rotation;
8078
8162
  return [
8079
8163
  {
8080
8164
  _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_rect"),
@@ -8084,6 +8168,8 @@ var convertElementToPrimitives = (element, allElements) => {
8084
8168
  w: cutoutElement.width,
8085
8169
  h: cutoutElement.height,
8086
8170
  layer: "drill",
8171
+ roundness: corner_radius,
8172
+ ccw_rotation,
8087
8173
  _element: element,
8088
8174
  _parent_pcb_component,
8089
8175
  _parent_source_component
@@ -8091,6 +8177,7 @@ var convertElementToPrimitives = (element, allElements) => {
8091
8177
  ];
8092
8178
  }
8093
8179
  case "circle": {
8180
+ const cutoutElement = element;
8094
8181
  return [
8095
8182
  {
8096
8183
  _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_circle"),
@@ -8106,6 +8193,7 @@ var convertElementToPrimitives = (element, allElements) => {
8106
8193
  ];
8107
8194
  }
8108
8195
  case "polygon": {
8196
+ const cutoutElement = element;
8109
8197
  return [
8110
8198
  {
8111
8199
  _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_polygon"),
@@ -8119,7 +8207,7 @@ var convertElementToPrimitives = (element, allElements) => {
8119
8207
  ];
8120
8208
  }
8121
8209
  default:
8122
- console.warn(`Unsupported pcb_cutout shape: ${cutoutElement.shape}`);
8210
+ console.warn(`Unsupported pcb_cutout shape: ${element.shape}`);
8123
8211
  return [];
8124
8212
  }
8125
8213
  }
@@ -12737,7 +12825,7 @@ import { css as css3 } from "@emotion/css";
12737
12825
  // package.json
12738
12826
  var package_default = {
12739
12827
  name: "@tscircuit/pcb-viewer",
12740
- version: "1.11.260",
12828
+ version: "1.11.262",
12741
12829
  main: "dist/index.js",
12742
12830
  type: "module",
12743
12831
  repository: "tscircuit/pcb-viewer",
@@ -12789,8 +12877,8 @@ var package_default = {
12789
12877
  "@emotion/css": "^11.11.2",
12790
12878
  "@tscircuit/alphabet": "^0.0.3",
12791
12879
  "@vitejs/plugin-react": "^5.0.2",
12792
- "circuit-json": "^0.0.307",
12793
- "circuit-to-svg": "^0.0.265",
12880
+ "circuit-json": "^0.0.317",
12881
+ "circuit-to-svg": "^0.0.271",
12794
12882
  color: "^4.2.3",
12795
12883
  "react-supergrid": "^1.0.10",
12796
12884
  "react-toastify": "^10.0.5",