@tscircuit/pcb-viewer 1.11.303 → 1.11.305

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
@@ -7604,64 +7604,6 @@ var convertElementToPrimitives = (element, allElements) => {
7604
7604
  }
7605
7605
  return [];
7606
7606
  }
7607
- case "pcb_cutout": {
7608
- switch (element.shape) {
7609
- case "rect": {
7610
- const cutoutElement = element;
7611
- const corner_radius = cutoutElement.corner_radius;
7612
- const ccw_rotation = cutoutElement.rotation ?? cutoutElement.rotation;
7613
- return [
7614
- {
7615
- _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_rect"),
7616
- pcb_drawing_type: "rect",
7617
- x: cutoutElement.center.x,
7618
- y: cutoutElement.center.y,
7619
- w: cutoutElement.width,
7620
- h: cutoutElement.height,
7621
- layer: "drill",
7622
- roundness: corner_radius,
7623
- ccw_rotation,
7624
- _element: element,
7625
- _parent_pcb_component,
7626
- _parent_source_component
7627
- }
7628
- ];
7629
- }
7630
- case "circle": {
7631
- const cutoutElement = element;
7632
- return [
7633
- {
7634
- _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_circle"),
7635
- pcb_drawing_type: "circle",
7636
- x: cutoutElement.center.x,
7637
- y: cutoutElement.center.y,
7638
- r: cutoutElement.radius,
7639
- layer: "drill",
7640
- _element: element,
7641
- _parent_pcb_component,
7642
- _parent_source_component
7643
- }
7644
- ];
7645
- }
7646
- case "polygon": {
7647
- const cutoutElement = element;
7648
- return [
7649
- {
7650
- _pcb_drawing_object_id: getNewPcbDrawingObjectId("pcb_cutout_polygon"),
7651
- pcb_drawing_type: "polygon",
7652
- points: normalizePolygonPoints(cutoutElement.points),
7653
- layer: "drill",
7654
- _element: element,
7655
- _parent_pcb_component,
7656
- _parent_source_component
7657
- }
7658
- ];
7659
- }
7660
- default:
7661
- console.warn(`Unsupported pcb_cutout shape: ${element.shape}`);
7662
- return [];
7663
- }
7664
- }
7665
7607
  }
7666
7608
  return [];
7667
7609
  };
@@ -8936,6 +8878,18 @@ function drawPcbBoardElements(canvas, elements, layers, realToCanvasMat) {
8936
8878
  drawer.drawElements(pcbBoardElements, { layers });
8937
8879
  }
8938
8880
 
8881
+ // src/lib/draw-pcb-cutout.ts
8882
+ import { CircuitToCanvasDrawer as CircuitToCanvasDrawer7 } from "circuit-to-canvas";
8883
+ function isPcbCutout(element) {
8884
+ return element.type === "pcb_cutout";
8885
+ }
8886
+ function drawPcbCutoutElementsForLayer(canvas, elements, layers, realToCanvasMat) {
8887
+ const drawer = new CircuitToCanvasDrawer7(canvas);
8888
+ drawer.realToCanvasMat = realToCanvasMat;
8889
+ const cutoutElements = elements.filter(isPcbCutout);
8890
+ drawer.drawElements(cutoutElements, { layers });
8891
+ }
8892
+
8939
8893
  // src/components/CanvasPrimitiveRenderer.tsx
8940
8894
  import { jsx as jsx3, jsxs } from "react/jsx-runtime";
8941
8895
  var orderedLayers = [
@@ -8957,6 +8911,7 @@ var orderedLayers = [
8957
8911
  "inner5",
8958
8912
  "inner6",
8959
8913
  "drill",
8914
+ "edge_cuts",
8960
8915
  "bottom_notes",
8961
8916
  "top_notes",
8962
8917
  "other"
@@ -9062,6 +9017,15 @@ var CanvasPrimitiveRenderer = ({
9062
9017
  if (boardCanvas) {
9063
9018
  drawPcbBoardElements(boardCanvas, elements, [], transform);
9064
9019
  }
9020
+ const edgeCutsCanvas = canvasRefs.current.edge_cuts;
9021
+ if (edgeCutsCanvas) {
9022
+ drawPcbCutoutElementsForLayer(
9023
+ edgeCutsCanvas,
9024
+ elements,
9025
+ ["edge_cuts"],
9026
+ transform
9027
+ );
9028
+ }
9065
9029
  }
9066
9030
  drawer.orderAndFadeLayers();
9067
9031
  }, [primitives, elements, transform, selectedLayer, isShowingSolderMask]);
@@ -13099,7 +13063,7 @@ import { css as css3 } from "@emotion/css";
13099
13063
  // package.json
13100
13064
  var package_default = {
13101
13065
  name: "@tscircuit/pcb-viewer",
13102
- version: "1.11.302",
13066
+ version: "1.11.304",
13103
13067
  main: "dist/index.js",
13104
13068
  type: "module",
13105
13069
  repository: "tscircuit/pcb-viewer",
@@ -13153,7 +13117,7 @@ var package_default = {
13153
13117
  "@tscircuit/math-utils": "^0.0.29",
13154
13118
  "@vitejs/plugin-react": "^5.0.2",
13155
13119
  "circuit-json": "^0.0.353",
13156
- "circuit-to-canvas": "^0.0.37",
13120
+ "circuit-to-canvas": "^0.0.41",
13157
13121
  "circuit-to-svg": "^0.0.271",
13158
13122
  color: "^4.2.3",
13159
13123
  "react-supergrid": "^1.0.10",