@tscircuit/pcb-viewer 1.11.379 → 1.11.381

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
@@ -9751,15 +9751,31 @@ var filterTraceByLayers = (trace, targetLayers) => {
9751
9751
  route: filteredRoute
9752
9752
  };
9753
9753
  };
9754
+ var showTraceSegmentsInsideHiddenCopperPours = (trace) => ({
9755
+ ...trace,
9756
+ route: trace.route.map((routePoint) => {
9757
+ if (!("is_inside_copper_pour" in routePoint) || routePoint.is_inside_copper_pour !== true) {
9758
+ return routePoint;
9759
+ }
9760
+ return {
9761
+ ...routePoint,
9762
+ is_inside_copper_pour: false
9763
+ };
9764
+ })
9765
+ });
9766
+ var getTraceClipContextElements = (elements, showCopperPours) => showCopperPours ? elements : [];
9754
9767
  function drawPcbTraceElementsForLayer({
9755
9768
  canvas,
9756
9769
  elements,
9757
9770
  layers,
9758
9771
  realToCanvasMat,
9759
- primitives
9772
+ primitives,
9773
+ showCopperPours
9760
9774
  }) {
9761
9775
  const targetLayers = new Set(normalizeCopperRenderLayers(layers));
9762
- const traceElements = elements.filter(isPcbTrace).map((trace) => filterTraceByLayers(trace, targetLayers)).filter((trace) => trace !== null);
9776
+ const traceElements = elements.filter(isPcbTrace).map((trace) => filterTraceByLayers(trace, targetLayers)).filter((trace) => trace !== null).map(
9777
+ (trace) => showCopperPours ? trace : showTraceSegmentsInsideHiddenCopperPours(trace)
9778
+ );
9763
9779
  if (traceElements.length === 0) return;
9764
9780
  const highlightedElementIds = /* @__PURE__ */ new Set();
9765
9781
  if (primitives) {
@@ -9778,16 +9794,26 @@ function drawPcbTraceElementsForLayer({
9778
9794
  nonHighlightedElements.push(element);
9779
9795
  }
9780
9796
  }
9797
+ const clipContextElements = getTraceClipContextElements(
9798
+ elements,
9799
+ showCopperPours
9800
+ );
9781
9801
  if (nonHighlightedElements.length > 0) {
9782
9802
  const drawer = new CircuitToCanvasDrawer11(canvas);
9783
9803
  drawer.realToCanvasMat = realToCanvasMat;
9784
- drawer.drawElements(nonHighlightedElements, { layers });
9804
+ drawer.drawElements(nonHighlightedElements, {
9805
+ layers,
9806
+ clipContextElements
9807
+ });
9785
9808
  }
9786
9809
  if (highlightedElements.length > 0) {
9787
9810
  const highlightDrawer = new CircuitToCanvasDrawer11(canvas);
9788
9811
  highlightDrawer.configure({ colorOverrides: HOVER_COLOR_MAP2 });
9789
9812
  highlightDrawer.realToCanvasMat = realToCanvasMat;
9790
- highlightDrawer.drawElements(highlightedElements, { layers });
9813
+ highlightDrawer.drawElements(highlightedElements, {
9814
+ layers,
9815
+ clipContextElements
9816
+ });
9791
9817
  }
9792
9818
  }
9793
9819
 
@@ -10490,6 +10516,7 @@ var CanvasPrimitiveRenderer = ({
10490
10516
  }) => {
10491
10517
  const canvasRefs = useRef3({});
10492
10518
  const selectedLayer = useGlobalStore((s) => s.selected_layer);
10519
+ const isShowingCopperPours = useGlobalStore((s) => s.is_showing_copper_pours);
10493
10520
  const isShowingSolderMask = useGlobalStore((s) => s.is_showing_solder_mask);
10494
10521
  const isShowingFabricationNotes = useGlobalStore(
10495
10522
  (s) => s.is_showing_fabrication_notes
@@ -10529,7 +10556,8 @@ var CanvasPrimitiveRenderer = ({
10529
10556
  elements,
10530
10557
  layers: [copperLayer],
10531
10558
  realToCanvasMat: transform,
10532
- primitives
10559
+ primitives,
10560
+ showCopperPours: isShowingCopperPours
10533
10561
  });
10534
10562
  }
10535
10563
  for (const { canvas, copperLayer } of copperLayers) {
@@ -10745,6 +10773,7 @@ var CanvasPrimitiveRenderer = ({
10745
10773
  elements,
10746
10774
  transform,
10747
10775
  selectedLayer,
10776
+ isShowingCopperPours,
10748
10777
  isShowingSolderMask,
10749
10778
  isShowingFabricationNotes,
10750
10779
  isShowingCourtyards,
@@ -14950,7 +14979,7 @@ import { css as css3 } from "@emotion/css";
14950
14979
  // package.json
14951
14980
  var package_default = {
14952
14981
  name: "@tscircuit/pcb-viewer",
14953
- version: "1.11.378",
14982
+ version: "1.11.380",
14954
14983
  main: "dist/index.js",
14955
14984
  type: "module",
14956
14985
  repository: "tscircuit/pcb-viewer",
@@ -15005,7 +15034,7 @@ var package_default = {
15005
15034
  "@tscircuit/math-utils": "^0.0.36",
15006
15035
  "@vitejs/plugin-react": "^5.0.2",
15007
15036
  "circuit-json": "^0.0.450",
15008
- "circuit-to-canvas": "^0.0.115",
15037
+ "circuit-to-canvas": "^0.0.118",
15009
15038
  color: "^4.2.3",
15010
15039
  "react-supergrid": "^1.0.10",
15011
15040
  "react-toastify": "^10.0.5",