@tscircuit/pcb-viewer 1.11.292 → 1.11.294

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
@@ -12373,7 +12373,7 @@ function ifSetsMatchExactly(set1, set2) {
12373
12373
 
12374
12374
  // src/components/MouseElementTracker.tsx
12375
12375
  import { useState as useState7, useMemo as useMemo5 } from "react";
12376
- import { applyToPoint as applyToPoint15, inverse as inverse5 } from "transformation-matrix";
12376
+ import { applyToPoint as applyToPoint14, inverse as inverse5 } from "transformation-matrix";
12377
12377
 
12378
12378
  // src/components/ElementOverlayBox.tsx
12379
12379
  import { useEffect as useEffect11, useState as useState6 } from "react";
@@ -12650,7 +12650,13 @@ var ElementOverlayBox = ({
12650
12650
  )) });
12651
12651
  };
12652
12652
 
12653
- // src/components/AnchorOffsetOverlay/Board/index.tsx
12653
+ // src/components/AnchorOffsetOverlay/common/guards.ts
12654
+ var isPcbComponent = (element) => element?.type === "pcb_component";
12655
+ var isPcbGroup = (element) => element?.type === "pcb_group";
12656
+ var isPcbPanel = (element) => element?.type === "pcb_panel";
12657
+ var isPcbBoard = (element) => element?.type === "pcb_board";
12658
+
12659
+ // src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
12654
12660
  import { applyToPoint as applyToPoint12 } from "transformation-matrix";
12655
12661
 
12656
12662
  // src/components/AnchorOffsetOverlay/common/constants.ts
@@ -12676,67 +12682,15 @@ var COLORS = {
12676
12682
  LABEL_TEXT: "white"
12677
12683
  };
12678
12684
 
12679
- // src/components/AnchorOffsetOverlay/common/guards.ts
12680
- var isPcbComponent = (element) => element?.type === "pcb_component";
12681
- var isPcbGroup = (element) => element?.type === "pcb_group";
12682
- var isPcbPanel = (element) => element?.type === "pcb_panel";
12683
- var isPcbBoard = (element) => element?.type === "pcb_board";
12684
-
12685
- // src/components/AnchorOffsetOverlay/Board/index.tsx
12685
+ // src/components/AnchorOffsetOverlay/AnchorOffsetOverlay.tsx
12686
12686
  import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
12687
- var BoardAnchorOffsetOverlay = ({
12688
- elements,
12689
- highlightedPrimitives,
12687
+ var AnchorOffsetOverlay = ({
12688
+ targets,
12690
12689
  transform,
12691
12690
  containerWidth,
12692
12691
  containerHeight
12693
12692
  }) => {
12694
- const boards = elements.filter((el) => isPcbBoard(el));
12695
- const components = elements.filter(
12696
- (el) => isPcbComponent(el)
12697
- );
12698
- const groups = elements.filter((el) => isPcbGroup(el));
12699
- const hoveredComponentIds = highlightedPrimitives.map((primitive) => {
12700
- if (isPcbComponent(primitive._parent_pcb_component)) {
12701
- return primitive._parent_pcb_component.pcb_component_id;
12702
- }
12703
- if (isPcbComponent(primitive._element)) {
12704
- return primitive._element.pcb_component_id;
12705
- }
12706
- return null;
12707
- }).filter((id) => Boolean(id));
12708
- const hoveredGroupIds = /* @__PURE__ */ new Set();
12709
- hoveredComponentIds.forEach((componentId) => {
12710
- const component = components.find((c) => c.pcb_component_id === componentId);
12711
- if (component?.pcb_group_id) {
12712
- hoveredGroupIds.add(component.pcb_group_id);
12713
- }
12714
- });
12715
- const isShowingAnchorOffsets = useGlobalStore(
12716
- (state) => state.is_showing_group_anchor_offsets
12717
- );
12718
- if (!isShowingAnchorOffsets && hoveredComponentIds.length === 0) {
12719
- return null;
12720
- }
12721
- const componentTargets = components.map((component) => {
12722
- const boardId = component.positioned_relative_to_pcb_board_id;
12723
- if (!boardId) return null;
12724
- const board = boards.find((b) => b.pcb_board_id === boardId);
12725
- return board ? { component, board, type: "component" } : null;
12726
- }).filter(
12727
- (target) => Boolean(target)
12728
- );
12729
- const groupTargets = groups.map((group) => {
12730
- const boardId = group.positioned_relative_to_pcb_board_id;
12731
- if (!boardId || !group.center) return null;
12732
- const board = boards.find((b) => b.pcb_board_id === boardId);
12733
- return board ? { group, board, type: "group" } : null;
12734
- }).filter(
12735
- (target) => Boolean(target)
12736
- );
12737
- const targets = [...componentTargets, ...groupTargets];
12738
12693
  if (targets.length === 0) return null;
12739
- const shouldShowAllTargets = hoveredComponentIds.length === 0;
12740
12694
  const labelStyle = {
12741
12695
  color: COLORS.LABEL_TEXT,
12742
12696
  mixBlendMode: "difference",
@@ -12745,15 +12699,13 @@ var BoardAnchorOffsetOverlay = ({
12745
12699
  fontFamily: "monospace",
12746
12700
  fontWeight: "bold"
12747
12701
  };
12748
- const targetEntries = targets.filter((target) => {
12749
- if (target.type === "component") {
12750
- return shouldShowAllTargets || hoveredComponentIds.includes(target.component.pcb_component_id);
12751
- } else {
12752
- return shouldShowAllTargets || hoveredGroupIds.has(target.group.pcb_group_id);
12702
+ const anchorScreens = /* @__PURE__ */ new Map();
12703
+ targets.forEach((target) => {
12704
+ if (!anchorScreens.has(target.anchor_id)) {
12705
+ const screenPoint = applyToPoint12(transform, target.anchor);
12706
+ anchorScreens.set(target.anchor_id, screenPoint);
12753
12707
  }
12754
12708
  });
12755
- if (targetEntries.length === 0) return null;
12756
- const boardAnchorScreens = /* @__PURE__ */ new Map();
12757
12709
  return /* @__PURE__ */ jsx12(
12758
12710
  "div",
12759
12711
  {
@@ -12779,33 +12731,11 @@ var BoardAnchorOffsetOverlay = ({
12779
12731
  width: containerWidth,
12780
12732
  height: containerHeight,
12781
12733
  children: [
12782
- targetEntries.map((target) => {
12783
- const anchorPosition = target.board.center;
12784
- const anchorKey = target.board.pcb_board_id;
12785
- let targetCenter;
12786
- let targetId;
12787
- let displayOffsetX;
12788
- let displayOffsetY;
12789
- if (target.type === "component") {
12790
- targetCenter = target.component.center;
12791
- targetId = target.component.pcb_component_id;
12792
- displayOffsetX = target.component.display_offset_x;
12793
- displayOffsetY = target.component.display_offset_y;
12794
- } else {
12795
- if (!target.group.center) return null;
12796
- targetCenter = {
12797
- x: target.group.anchor_position?.x ?? target.group.center.x,
12798
- y: target.group.anchor_position?.y ?? target.group.center.y
12799
- };
12800
- targetId = target.group.pcb_group_id;
12801
- displayOffsetX = target.group.display_offset_x;
12802
- displayOffsetY = target.group.display_offset_y;
12803
- }
12804
- if (!boardAnchorScreens.has(anchorKey)) {
12805
- const screenPoint = applyToPoint12(transform, anchorPosition);
12806
- boardAnchorScreens.set(anchorKey, screenPoint);
12807
- }
12808
- const anchorMarkerScreen = boardAnchorScreens.get(anchorKey);
12734
+ targets.map((target) => {
12735
+ const anchorPosition = target.anchor;
12736
+ const anchorKey = target.anchor_id;
12737
+ const targetCenter = target.target;
12738
+ const anchorMarkerScreen = anchorScreens.get(anchorKey);
12809
12739
  const targetScreen = applyToPoint12(transform, targetCenter);
12810
12740
  const offsetX = targetCenter.x - anchorPosition.x;
12811
12741
  const offsetY = targetCenter.y - anchorPosition.y;
@@ -12817,8 +12747,8 @@ var BoardAnchorOffsetOverlay = ({
12817
12747
  const yLabelOffset = isTargetRightOfAnchor ? VISUAL_CONFIG.LABEL_OFFSET_RIGHT : VISUAL_CONFIG.LABEL_OFFSET_LEFT;
12818
12748
  const shouldShowXLabel = xLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
12819
12749
  const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
12820
- const xLabelText = `${displayOffsetX ?? offsetX.toFixed(2)}mm`;
12821
- const yLabelText = `${displayOffsetY ?? offsetY.toFixed(2)}mm`;
12750
+ const xLabelText = `${target.display_offset_x ?? offsetX.toFixed(2)}mm`;
12751
+ const yLabelText = `${target.display_offset_y ?? offsetY.toFixed(2)}mm`;
12822
12752
  return /* @__PURE__ */ jsxs9("g", { children: [
12823
12753
  /* @__PURE__ */ jsx12(
12824
12754
  "line",
@@ -12844,7 +12774,7 @@ var BoardAnchorOffsetOverlay = ({
12844
12774
  strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
12845
12775
  }
12846
12776
  ),
12847
- target.type === "component" ? /* @__PURE__ */ jsx12(
12777
+ target.type === "component" || target.type === "board" ? /* @__PURE__ */ jsx12(
12848
12778
  "circle",
12849
12779
  {
12850
12780
  cx: targetScreen.x,
@@ -12854,30 +12784,33 @@ var BoardAnchorOffsetOverlay = ({
12854
12784
  stroke: COLORS.COMPONENT_MARKER_STROKE,
12855
12785
  strokeWidth: 1
12856
12786
  }
12857
- ) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
12858
- /* @__PURE__ */ jsx12(
12859
- "line",
12860
- {
12861
- x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12862
- y1: targetScreen.y,
12863
- x2: targetScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12864
- y2: targetScreen.y,
12865
- stroke: COLORS.OFFSET_LINE,
12866
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12867
- }
12868
- ),
12869
- /* @__PURE__ */ jsx12(
12870
- "line",
12871
- {
12872
- x1: targetScreen.x,
12873
- y1: targetScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12874
- x2: targetScreen.x,
12875
- y2: targetScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12876
- stroke: COLORS.OFFSET_LINE,
12877
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12878
- }
12879
- )
12880
- ] }),
12787
+ ) : (
12788
+ // assumes "group"
12789
+ /* @__PURE__ */ jsxs9(Fragment5, { children: [
12790
+ /* @__PURE__ */ jsx12(
12791
+ "line",
12792
+ {
12793
+ x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12794
+ y1: targetScreen.y,
12795
+ x2: targetScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12796
+ y2: targetScreen.y,
12797
+ stroke: COLORS.OFFSET_LINE,
12798
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12799
+ }
12800
+ ),
12801
+ /* @__PURE__ */ jsx12(
12802
+ "line",
12803
+ {
12804
+ x1: targetScreen.x,
12805
+ y1: targetScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12806
+ x2: targetScreen.x,
12807
+ y2: targetScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12808
+ stroke: COLORS.OFFSET_LINE,
12809
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12810
+ }
12811
+ )
12812
+ ] })
12813
+ ),
12881
12814
  shouldShowXLabel && /* @__PURE__ */ jsx12(
12882
12815
  "foreignObject",
12883
12816
  {
@@ -12914,34 +12847,32 @@ var BoardAnchorOffsetOverlay = ({
12914
12847
  )
12915
12848
  }
12916
12849
  )
12917
- ] }, `${target.board.pcb_board_id}-${targetId}-${target.type}`);
12850
+ ] }, target.id);
12918
12851
  }),
12919
- Array.from(boardAnchorScreens.entries()).map(
12920
- ([boardId, anchorScreen]) => /* @__PURE__ */ jsxs9("g", { children: [
12921
- /* @__PURE__ */ jsx12(
12922
- "line",
12923
- {
12924
- x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12925
- y1: anchorScreen.y,
12926
- x2: anchorScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12927
- y2: anchorScreen.y,
12928
- stroke: COLORS.OFFSET_LINE,
12929
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12930
- }
12931
- ),
12932
- /* @__PURE__ */ jsx12(
12933
- "line",
12934
- {
12935
- x1: anchorScreen.x,
12936
- y1: anchorScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12937
- x2: anchorScreen.x,
12938
- y2: anchorScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12939
- stroke: COLORS.OFFSET_LINE,
12940
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12941
- }
12942
- )
12943
- ] }, `anchor-${boardId}`)
12944
- )
12852
+ Array.from(anchorScreens.entries()).map(([anchorId, anchorScreen]) => /* @__PURE__ */ jsxs9("g", { children: [
12853
+ /* @__PURE__ */ jsx12(
12854
+ "line",
12855
+ {
12856
+ x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12857
+ y1: anchorScreen.y,
12858
+ x2: anchorScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12859
+ y2: anchorScreen.y,
12860
+ stroke: COLORS.OFFSET_LINE,
12861
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12862
+ }
12863
+ ),
12864
+ /* @__PURE__ */ jsx12(
12865
+ "line",
12866
+ {
12867
+ x1: anchorScreen.x,
12868
+ y1: anchorScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12869
+ x2: anchorScreen.x,
12870
+ y2: anchorScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12871
+ stroke: COLORS.OFFSET_LINE,
12872
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12873
+ }
12874
+ )
12875
+ ] }, `anchor-${anchorId}`))
12945
12876
  ]
12946
12877
  }
12947
12878
  )
@@ -12949,9 +12880,107 @@ var BoardAnchorOffsetOverlay = ({
12949
12880
  );
12950
12881
  };
12951
12882
 
12952
- // src/components/AnchorOffsetOverlay/Group/index.tsx
12953
- import { applyToPoint as applyToPoint13 } from "transformation-matrix";
12954
- import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
12883
+ // src/components/AnchorOffsetOverlay/BoardAnchorOffsetOverlay.tsx
12884
+ import { jsx as jsx13 } from "react/jsx-runtime";
12885
+ var BoardAnchorOffsetOverlay = ({
12886
+ elements,
12887
+ highlightedPrimitives,
12888
+ transform,
12889
+ containerWidth,
12890
+ containerHeight
12891
+ }) => {
12892
+ const boards = elements.filter((el) => isPcbBoard(el));
12893
+ const components = elements.filter(
12894
+ (el) => isPcbComponent(el)
12895
+ );
12896
+ const groups = elements.filter((el) => isPcbGroup(el));
12897
+ const hoveredComponentIds = highlightedPrimitives.map((primitive) => {
12898
+ if (isPcbComponent(primitive._parent_pcb_component)) {
12899
+ return primitive._parent_pcb_component.pcb_component_id;
12900
+ }
12901
+ if (isPcbComponent(primitive._element)) {
12902
+ return primitive._element.pcb_component_id;
12903
+ }
12904
+ return null;
12905
+ }).filter((id) => Boolean(id));
12906
+ const hoveredGroupIds = /* @__PURE__ */ new Set();
12907
+ hoveredComponentIds.forEach((componentId) => {
12908
+ const component = components.find((c) => c.pcb_component_id === componentId);
12909
+ if (component?.pcb_group_id) {
12910
+ hoveredGroupIds.add(component.pcb_group_id);
12911
+ }
12912
+ });
12913
+ const isShowingAnchorOffsets = useGlobalStore(
12914
+ (state) => state.is_showing_group_anchor_offsets
12915
+ );
12916
+ if (!isShowingAnchorOffsets && hoveredComponentIds.length === 0) {
12917
+ return null;
12918
+ }
12919
+ const componentTargets = components.map((component) => {
12920
+ const boardId = component.positioned_relative_to_pcb_board_id;
12921
+ if (!boardId) return null;
12922
+ const board = boards.find((b) => b.pcb_board_id === boardId);
12923
+ return board ? { component, board, type: "component" } : null;
12924
+ }).filter(
12925
+ (target) => Boolean(target)
12926
+ );
12927
+ const groupTargets = groups.map((group) => {
12928
+ const boardId = group.positioned_relative_to_pcb_board_id;
12929
+ if (!boardId || !group.center) return null;
12930
+ const board = boards.find((b) => b.pcb_board_id === boardId);
12931
+ return board ? { group, board, type: "group" } : null;
12932
+ }).filter(
12933
+ (target) => Boolean(target)
12934
+ );
12935
+ const targets = [...componentTargets, ...groupTargets];
12936
+ if (targets.length === 0) return null;
12937
+ const shouldShowAllTargets = hoveredComponentIds.length === 0;
12938
+ const targetEntries = targets.filter((target) => {
12939
+ if (target.type === "component") {
12940
+ return shouldShowAllTargets || hoveredComponentIds.includes(target.component.pcb_component_id);
12941
+ } else {
12942
+ return shouldShowAllTargets || hoveredGroupIds.has(target.group.pcb_group_id);
12943
+ }
12944
+ });
12945
+ if (targetEntries.length === 0) return null;
12946
+ const sharedTargets = targetEntries.map((target) => {
12947
+ if (target.type === "component") {
12948
+ return {
12949
+ id: `${target.board.pcb_board_id}-${target.component.pcb_component_id}-${target.type}`,
12950
+ anchor: target.board.center,
12951
+ anchor_id: target.board.pcb_board_id,
12952
+ target: target.component.center,
12953
+ type: "component",
12954
+ display_offset_x: target.component.display_offset_x,
12955
+ display_offset_y: target.component.display_offset_y
12956
+ };
12957
+ }
12958
+ return {
12959
+ id: `${target.board.pcb_board_id}-${target.group.pcb_group_id}-${target.type}`,
12960
+ anchor: target.board.center,
12961
+ anchor_id: target.board.pcb_board_id,
12962
+ target: {
12963
+ x: target.group.anchor_position?.x ?? target.group.center.x,
12964
+ y: target.group.anchor_position?.y ?? target.group.center.y
12965
+ },
12966
+ type: "group",
12967
+ display_offset_x: target.group.display_offset_x,
12968
+ display_offset_y: target.group.display_offset_y
12969
+ };
12970
+ }).filter((t) => Boolean(t));
12971
+ return /* @__PURE__ */ jsx13(
12972
+ AnchorOffsetOverlay,
12973
+ {
12974
+ targets: sharedTargets,
12975
+ transform,
12976
+ containerWidth,
12977
+ containerHeight
12978
+ }
12979
+ );
12980
+ };
12981
+
12982
+ // src/components/AnchorOffsetOverlay/GroupAnchorOffsetOverlay.tsx
12983
+ import { jsx as jsx14 } from "react/jsx-runtime";
12955
12984
  var GroupAnchorOffsetOverlay = ({
12956
12985
  elements,
12957
12986
  highlightedPrimitives,
@@ -13033,14 +13062,6 @@ var GroupAnchorOffsetOverlay = ({
13033
13062
  const targets = [...componentTargets, ...groupTargets];
13034
13063
  if (targets.length === 0) return null;
13035
13064
  const shouldShowAllTargets = hoveredComponentIds.length === 0;
13036
- const labelStyle = {
13037
- color: COLORS.LABEL_TEXT,
13038
- mixBlendMode: "difference",
13039
- pointerEvents: "none",
13040
- fontSize: VISUAL_CONFIG.LABEL_FONT_SIZE,
13041
- fontFamily: "monospace",
13042
- fontWeight: "bold"
13043
- };
13044
13065
  const targetEntries = targets.filter((target) => {
13045
13066
  if (target.type === "component") {
13046
13067
  return shouldShowAllTargets || hoveredComponentIds.includes(target.component.pcb_component_id);
@@ -13049,16 +13070,89 @@ var GroupAnchorOffsetOverlay = ({
13049
13070
  }
13050
13071
  });
13051
13072
  if (targetEntries.length === 0) return null;
13052
- const groupAnchorScreens = /* @__PURE__ */ new Map();
13053
- targetEntries.forEach((target) => {
13054
- if (!target.parentGroup.anchor_position) return;
13055
- const anchorScreen = applyToPoint13(
13073
+ const sharedTargets = targetEntries.map((target) => {
13074
+ const anchor = target.parentGroup.anchor_position;
13075
+ if (!anchor) return null;
13076
+ if (target.type === "component") {
13077
+ if (!target.component.center) return null;
13078
+ return {
13079
+ id: `${target.parentGroup.pcb_group_id}-${target.component.pcb_component_id}-${target.type}`,
13080
+ anchor,
13081
+ anchor_id: target.parentGroup.pcb_group_id,
13082
+ target: target.component.center,
13083
+ type: "component",
13084
+ display_offset_x: target.component.display_offset_x,
13085
+ display_offset_y: target.component.display_offset_y
13086
+ };
13087
+ }
13088
+ if (!target.group.center) return null;
13089
+ return {
13090
+ id: `${target.parentGroup.pcb_group_id}-${target.group.pcb_group_id}-${target.type}`,
13091
+ anchor,
13092
+ anchor_id: target.parentGroup.pcb_group_id,
13093
+ target: target.group.center,
13094
+ type: "group",
13095
+ display_offset_x: target.group.display_offset_x,
13096
+ display_offset_y: target.group.display_offset_y
13097
+ };
13098
+ }).filter((t) => Boolean(t));
13099
+ return /* @__PURE__ */ jsx14(
13100
+ AnchorOffsetOverlay,
13101
+ {
13102
+ targets: sharedTargets,
13056
13103
  transform,
13057
- target.parentGroup.anchor_position
13058
- );
13059
- groupAnchorScreens.set(target.parentGroup.pcb_group_id, anchorScreen);
13060
- });
13061
- return /* @__PURE__ */ jsx13(
13104
+ containerWidth,
13105
+ containerHeight
13106
+ }
13107
+ );
13108
+ };
13109
+
13110
+ // src/components/AnchorOffsetOverlay/ComponentBoundingBoxOverlay.tsx
13111
+ import { applyToPoint as applyToPoint13 } from "transformation-matrix";
13112
+ import { jsx as jsx15, jsxs as jsxs10 } from "react/jsx-runtime";
13113
+ var calculateComponentBoundingBox = (component, elements) => {
13114
+ const componentId = component.pcb_component_id;
13115
+ const padsAndHoles = elements.filter(
13116
+ (el) => (el.type === "pcb_smtpad" || el.type === "pcb_plated_hole") && el.pcb_component_id === componentId || el.type === "pcb_hole" && el.pcb_component_id === componentId
13117
+ );
13118
+ if (padsAndHoles.length === 0) {
13119
+ return getBoundsOfPcbElements([component]);
13120
+ }
13121
+ return getBoundsOfPcbElements(padsAndHoles);
13122
+ };
13123
+ var ComponentBoundingBoxOverlay = ({
13124
+ elements,
13125
+ highlightedPrimitives,
13126
+ transform,
13127
+ containerWidth,
13128
+ containerHeight
13129
+ }) => {
13130
+ const hoveredComponents = /* @__PURE__ */ new Map();
13131
+ for (const primitive of highlightedPrimitives) {
13132
+ if (isPcbComponent(primitive._parent_pcb_component)) {
13133
+ hoveredComponents.set(
13134
+ primitive._parent_pcb_component.pcb_component_id,
13135
+ primitive._parent_pcb_component
13136
+ );
13137
+ }
13138
+ if (isPcbComponent(primitive._element)) {
13139
+ hoveredComponents.set(
13140
+ primitive._element.pcb_component_id,
13141
+ primitive._element
13142
+ );
13143
+ }
13144
+ }
13145
+ if (hoveredComponents.size === 0) return null;
13146
+ const renderData = [];
13147
+ for (const component of hoveredComponents.values()) {
13148
+ const bbox = calculateComponentBoundingBox(component, elements);
13149
+ if (!bbox) continue;
13150
+ const groupId = component.positioned_relative_to_pcb_group_id ?? component.pcb_group_id;
13151
+ const group = groupId ? su(elements).pcb_group.get(groupId) : null;
13152
+ renderData.push({ component, bbox, group });
13153
+ }
13154
+ if (renderData.length === 0) return null;
13155
+ return /* @__PURE__ */ jsx15(
13062
13156
  "div",
13063
13157
  {
13064
13158
  style: {
@@ -13071,196 +13165,89 @@ var GroupAnchorOffsetOverlay = ({
13071
13165
  pointerEvents: "none",
13072
13166
  zIndex: zIndexMap.dimensionOverlay
13073
13167
  },
13074
- children: /* @__PURE__ */ jsxs10(
13168
+ children: /* @__PURE__ */ jsx15(
13075
13169
  "svg",
13076
13170
  {
13077
- style: {
13078
- position: "absolute",
13079
- left: 0,
13080
- top: 0,
13081
- pointerEvents: "none"
13082
- },
13171
+ style: { position: "absolute", left: 0, top: 0, pointerEvents: "none" },
13083
13172
  width: containerWidth,
13084
13173
  height: containerHeight,
13085
- children: [
13086
- targetEntries.map((target) => {
13087
- const anchor = target.parentGroup.anchor_position;
13088
- if (!anchor) return null;
13089
- const anchorMarkerPosition = { x: anchor.x, y: anchor.y };
13090
- let targetCenter = null;
13091
- let targetId;
13092
- let displayOffsetX;
13093
- let displayOffsetY;
13094
- if (target.type === "component") {
13095
- const center = target.component.center;
13096
- if (!center) return null;
13097
- targetCenter = { x: center.x, y: center.y };
13098
- targetId = target.component.pcb_component_id;
13099
- displayOffsetX = target.component.display_offset_x;
13100
- displayOffsetY = target.component.display_offset_y;
13101
- } else {
13102
- if (!target.group.center) return null;
13103
- targetCenter = {
13104
- x: target.group.center.x,
13105
- y: target.group.center.y
13106
- };
13107
- targetId = target.group.pcb_group_id;
13108
- displayOffsetX = target.group.display_offset_x;
13109
- displayOffsetY = target.group.display_offset_y;
13110
- }
13111
- const offsetX = targetCenter.x - anchorMarkerPosition.x;
13112
- const offsetY = targetCenter.y - anchorMarkerPosition.y;
13113
- const anchorMarkerScreen = applyToPoint13(
13114
- transform,
13115
- anchorMarkerPosition
13116
- );
13117
- const targetScreen = applyToPoint13(transform, targetCenter);
13118
- const xLineLength = Math.abs(targetScreen.x - anchorMarkerScreen.x);
13119
- const yLineLength = Math.abs(targetScreen.y - anchorMarkerScreen.y);
13120
- const isTargetAboveAnchor = targetScreen.y < anchorMarkerScreen.y;
13121
- const isTargetRightOfAnchor = targetScreen.x > anchorMarkerScreen.x;
13122
- const xLabelOffset = isTargetAboveAnchor ? VISUAL_CONFIG.LABEL_OFFSET_ABOVE : VISUAL_CONFIG.LABEL_OFFSET_BELOW;
13123
- const yLabelOffset = isTargetRightOfAnchor ? VISUAL_CONFIG.LABEL_OFFSET_RIGHT : VISUAL_CONFIG.LABEL_OFFSET_LEFT;
13124
- const shouldShowXLabel = xLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13125
- const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13126
- const xLabelText = displayOffsetX ? displayOffsetX : `${offsetX.toFixed(2)}mm`;
13127
- const yLabelText = displayOffsetY ? displayOffsetY : `${offsetY.toFixed(2)}mm`;
13128
- return /* @__PURE__ */ jsxs10(
13129
- "g",
13174
+ children: renderData.map(({ component, bbox, group }) => {
13175
+ const topLeft = applyToPoint13(transform, {
13176
+ x: bbox.minX,
13177
+ y: bbox.maxY
13178
+ });
13179
+ const bottomRight = applyToPoint13(transform, {
13180
+ x: bbox.maxX,
13181
+ y: bbox.minY
13182
+ });
13183
+ const screenBbox = {
13184
+ x: Math.min(topLeft.x, bottomRight.x),
13185
+ y: Math.min(topLeft.y, bottomRight.y),
13186
+ width: Math.abs(bottomRight.x - topLeft.x),
13187
+ height: Math.abs(bottomRight.y - topLeft.y)
13188
+ };
13189
+ const componentCenter = component.center ?? {
13190
+ x: (bbox.minX + bbox.maxX) / 2,
13191
+ y: (bbox.minY + bbox.maxY) / 2
13192
+ };
13193
+ const componentCenterScreen = applyToPoint13(transform, componentCenter);
13194
+ return /* @__PURE__ */ jsxs10("g", { children: [
13195
+ /* @__PURE__ */ jsx15(
13196
+ "rect",
13130
13197
  {
13131
- children: [
13132
- /* @__PURE__ */ jsx13(
13133
- "line",
13134
- {
13135
- x1: anchorMarkerScreen.x,
13136
- y1: anchorMarkerScreen.y,
13137
- x2: targetScreen.x,
13138
- y2: anchorMarkerScreen.y,
13139
- stroke: COLORS.OFFSET_LINE,
13140
- strokeWidth: VISUAL_CONFIG.LINE_STROKE_WIDTH,
13141
- strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13142
- }
13143
- ),
13144
- /* @__PURE__ */ jsx13(
13145
- "line",
13146
- {
13147
- x1: targetScreen.x,
13148
- y1: anchorMarkerScreen.y,
13149
- x2: targetScreen.x,
13150
- y2: targetScreen.y,
13151
- stroke: COLORS.OFFSET_LINE,
13152
- strokeWidth: VISUAL_CONFIG.LINE_STROKE_WIDTH,
13153
- strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13154
- }
13155
- ),
13156
- target.type === "component" ? /* @__PURE__ */ jsx13(
13157
- "circle",
13158
- {
13159
- cx: targetScreen.x,
13160
- cy: targetScreen.y,
13161
- r: VISUAL_CONFIG.COMPONENT_MARKER_RADIUS,
13162
- fill: COLORS.COMPONENT_MARKER_FILL,
13163
- stroke: COLORS.COMPONENT_MARKER_STROKE,
13164
- strokeWidth: 1
13165
- }
13166
- ) : /* @__PURE__ */ jsxs10(Fragment6, { children: [
13167
- /* @__PURE__ */ jsx13(
13168
- "line",
13169
- {
13170
- x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13171
- y1: targetScreen.y,
13172
- x2: targetScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13173
- y2: targetScreen.y,
13174
- stroke: COLORS.OFFSET_LINE,
13175
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13176
- }
13177
- ),
13178
- /* @__PURE__ */ jsx13(
13179
- "line",
13180
- {
13181
- x1: targetScreen.x,
13182
- y1: targetScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13183
- x2: targetScreen.x,
13184
- y2: targetScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13185
- stroke: COLORS.OFFSET_LINE,
13186
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13187
- }
13188
- )
13189
- ] }),
13190
- shouldShowXLabel && /* @__PURE__ */ jsx13(
13191
- "foreignObject",
13192
- {
13193
- x: Math.min(anchorMarkerScreen.x, targetScreen.x),
13194
- y: anchorMarkerScreen.y + xLabelOffset,
13195
- width: Math.abs(targetScreen.x - anchorMarkerScreen.x),
13196
- height: 20,
13197
- style: { overflow: "visible" },
13198
- children: /* @__PURE__ */ jsx13("div", { style: { ...labelStyle, textAlign: "center" }, children: xLabelText })
13199
- }
13200
- ),
13201
- shouldShowYLabel && /* @__PURE__ */ jsx13(
13202
- "foreignObject",
13203
- {
13204
- x: targetScreen.x + yLabelOffset,
13205
- y: Math.min(anchorMarkerScreen.y, targetScreen.y),
13206
- width: 20,
13207
- height: Math.abs(targetScreen.y - anchorMarkerScreen.y),
13208
- style: { overflow: "visible" },
13209
- children: /* @__PURE__ */ jsx13(
13210
- "div",
13211
- {
13212
- style: {
13213
- ...labelStyle,
13214
- display: "flex",
13215
- alignItems: "center",
13216
- height: "100%"
13217
- },
13218
- children: yLabelText
13219
- }
13220
- )
13221
- }
13222
- )
13223
- ]
13224
- },
13225
- `${target.parentGroup.pcb_group_id}-${targetId}-${target.type}`
13226
- );
13227
- }),
13228
- Array.from(groupAnchorScreens.entries()).map(
13229
- ([groupId, anchorScreen]) => /* @__PURE__ */ jsxs10("g", { children: [
13230
- /* @__PURE__ */ jsx13(
13231
- "line",
13232
- {
13233
- x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13234
- y1: anchorScreen.y,
13235
- x2: anchorScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13236
- y2: anchorScreen.y,
13237
- stroke: COLORS.OFFSET_LINE,
13238
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13239
- }
13240
- ),
13241
- /* @__PURE__ */ jsx13(
13242
- "line",
13243
- {
13244
- x1: anchorScreen.x,
13245
- y1: anchorScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13246
- x2: anchorScreen.x,
13247
- y2: anchorScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13248
- stroke: COLORS.OFFSET_LINE,
13249
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13250
- }
13251
- )
13252
- ] }, `anchor-${groupId}`)
13253
- )
13254
- ]
13198
+ x: screenBbox.x,
13199
+ y: screenBbox.y,
13200
+ width: screenBbox.width,
13201
+ height: screenBbox.height,
13202
+ fill: "none",
13203
+ stroke: "white",
13204
+ strokeWidth: 1.5,
13205
+ strokeDasharray: "4,4"
13206
+ }
13207
+ ),
13208
+ /* @__PURE__ */ jsx15(
13209
+ "line",
13210
+ {
13211
+ x1: componentCenterScreen.x - 6,
13212
+ y1: componentCenterScreen.y,
13213
+ x2: componentCenterScreen.x + 6,
13214
+ y2: componentCenterScreen.y,
13215
+ stroke: COLORS.COMPONENT_MARKER_STROKE,
13216
+ strokeWidth: 1.5
13217
+ }
13218
+ ),
13219
+ /* @__PURE__ */ jsx15(
13220
+ "line",
13221
+ {
13222
+ x1: componentCenterScreen.x,
13223
+ y1: componentCenterScreen.y - 6,
13224
+ x2: componentCenterScreen.x,
13225
+ y2: componentCenterScreen.y + 6,
13226
+ stroke: COLORS.COMPONENT_MARKER_STROKE,
13227
+ strokeWidth: 1.5
13228
+ }
13229
+ ),
13230
+ /* @__PURE__ */ jsx15(
13231
+ "circle",
13232
+ {
13233
+ cx: componentCenterScreen.x,
13234
+ cy: componentCenterScreen.y,
13235
+ r: VISUAL_CONFIG.COMPONENT_MARKER_RADIUS,
13236
+ fill: COLORS.COMPONENT_MARKER_FILL,
13237
+ stroke: COLORS.COMPONENT_MARKER_STROKE,
13238
+ strokeWidth: 1
13239
+ }
13240
+ )
13241
+ ] }, component.pcb_component_id);
13242
+ })
13255
13243
  }
13256
13244
  )
13257
13245
  }
13258
13246
  );
13259
13247
  };
13260
13248
 
13261
- // src/components/AnchorOffsetOverlay/Panel/index.tsx
13262
- import { applyToPoint as applyToPoint14 } from "transformation-matrix";
13263
- import { jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
13249
+ // src/components/AnchorOffsetOverlay/PanelAnchorOffsetOverlay.tsx
13250
+ import { jsx as jsx16 } from "react/jsx-runtime";
13264
13251
  var PanelAnchorOffsetOverlay = ({
13265
13252
  elements,
13266
13253
  highlightedPrimitives,
@@ -13293,182 +13280,35 @@ var PanelAnchorOffsetOverlay = ({
13293
13280
  );
13294
13281
  if (boardTargets.length === 0) return null;
13295
13282
  const shouldShowAllTargets = hoveredBoardIds.length === 0;
13296
- const labelStyle = {
13297
- color: COLORS.LABEL_TEXT,
13298
- mixBlendMode: "difference",
13299
- pointerEvents: "none",
13300
- fontSize: VISUAL_CONFIG.LABEL_FONT_SIZE,
13301
- fontFamily: "monospace",
13302
- fontWeight: "bold"
13303
- };
13304
13283
  const targetEntries = boardTargets.filter((target) => {
13305
13284
  return shouldShowAllTargets || hoveredBoardIds.includes(target.board.pcb_board_id);
13306
13285
  });
13307
13286
  if (targetEntries.length === 0) return null;
13308
- const panelAnchorScreens = /* @__PURE__ */ new Map();
13309
- return /* @__PURE__ */ jsx14(
13310
- "div",
13287
+ const sharedTargets = targetEntries.map((target) => {
13288
+ if (!target.board.center) return null;
13289
+ return {
13290
+ id: `${target.panel.pcb_panel_id}-${target.board.pcb_board_id}-${target.type}`,
13291
+ anchor: target.panel.center,
13292
+ anchor_id: target.panel.pcb_panel_id,
13293
+ target: target.board.center,
13294
+ type: "board",
13295
+ display_offset_x: target.board.display_offset_x,
13296
+ display_offset_y: target.board.display_offset_y
13297
+ };
13298
+ }).filter((t) => Boolean(t));
13299
+ return /* @__PURE__ */ jsx16(
13300
+ AnchorOffsetOverlay,
13311
13301
  {
13312
- style: {
13313
- position: "absolute",
13314
- left: 0,
13315
- top: 0,
13316
- width: containerWidth,
13317
- height: containerHeight,
13318
- overflow: "hidden",
13319
- pointerEvents: "none",
13320
- zIndex: zIndexMap.dimensionOverlay
13321
- },
13322
- children: /* @__PURE__ */ jsxs11(
13323
- "svg",
13324
- {
13325
- style: {
13326
- position: "absolute",
13327
- left: 0,
13328
- top: 0,
13329
- pointerEvents: "none"
13330
- },
13331
- width: containerWidth,
13332
- height: containerHeight,
13333
- children: [
13334
- targetEntries.map((target) => {
13335
- const anchorPosition = target.panel.center;
13336
- const anchorKey = target.panel.pcb_panel_id;
13337
- let targetCenter;
13338
- let targetId;
13339
- let displayOffsetX;
13340
- let displayOffsetY;
13341
- targetCenter = target.board.center;
13342
- targetId = target.board.pcb_board_id;
13343
- displayOffsetX = target.board.display_offset_x;
13344
- displayOffsetY = target.board.display_offset_y;
13345
- if (!panelAnchorScreens.has(anchorKey)) {
13346
- const screenPoint = applyToPoint14(transform, anchorPosition);
13347
- panelAnchorScreens.set(anchorKey, screenPoint);
13348
- }
13349
- const anchorMarkerScreen = panelAnchorScreens.get(anchorKey);
13350
- const targetScreen = applyToPoint14(transform, targetCenter);
13351
- const offsetX = targetCenter.x - anchorPosition.x;
13352
- const offsetY = targetCenter.y - anchorPosition.y;
13353
- const xLineLength = Math.abs(targetScreen.x - anchorMarkerScreen.x);
13354
- const yLineLength = Math.abs(targetScreen.y - anchorMarkerScreen.y);
13355
- const isTargetAboveAnchor = targetScreen.y < anchorMarkerScreen.y;
13356
- const isTargetRightOfAnchor = targetScreen.x > anchorMarkerScreen.x;
13357
- const xLabelOffset = isTargetAboveAnchor ? VISUAL_CONFIG.LABEL_OFFSET_ABOVE : VISUAL_CONFIG.LABEL_OFFSET_BELOW;
13358
- const yLabelOffset = isTargetRightOfAnchor ? VISUAL_CONFIG.LABEL_OFFSET_RIGHT : VISUAL_CONFIG.LABEL_OFFSET_LEFT;
13359
- const shouldShowXLabel = xLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13360
- const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13361
- const xLabelText = `${displayOffsetX ?? offsetX.toFixed(2)}mm`;
13362
- const yLabelText = `${displayOffsetY ?? offsetY.toFixed(2)}mm`;
13363
- return /* @__PURE__ */ jsxs11("g", { children: [
13364
- /* @__PURE__ */ jsx14(
13365
- "line",
13366
- {
13367
- x1: anchorMarkerScreen.x,
13368
- y1: anchorMarkerScreen.y,
13369
- x2: targetScreen.x,
13370
- y2: anchorMarkerScreen.y,
13371
- stroke: COLORS.OFFSET_LINE,
13372
- strokeWidth: VISUAL_CONFIG.LINE_STROKE_WIDTH,
13373
- strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13374
- }
13375
- ),
13376
- /* @__PURE__ */ jsx14(
13377
- "line",
13378
- {
13379
- x1: targetScreen.x,
13380
- y1: anchorMarkerScreen.y,
13381
- x2: targetScreen.x,
13382
- y2: targetScreen.y,
13383
- stroke: COLORS.OFFSET_LINE,
13384
- strokeWidth: VISUAL_CONFIG.LINE_STROKE_WIDTH,
13385
- strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13386
- }
13387
- ),
13388
- /* @__PURE__ */ jsx14(
13389
- "circle",
13390
- {
13391
- cx: targetScreen.x,
13392
- cy: targetScreen.y,
13393
- r: VISUAL_CONFIG.COMPONENT_MARKER_RADIUS,
13394
- fill: COLORS.COMPONENT_MARKER_FILL,
13395
- stroke: COLORS.COMPONENT_MARKER_STROKE,
13396
- strokeWidth: 1
13397
- }
13398
- ),
13399
- shouldShowXLabel && /* @__PURE__ */ jsx14(
13400
- "foreignObject",
13401
- {
13402
- x: Math.min(anchorMarkerScreen.x, targetScreen.x),
13403
- y: anchorMarkerScreen.y + xLabelOffset,
13404
- width: Math.abs(targetScreen.x - anchorMarkerScreen.x),
13405
- height: 20,
13406
- style: { overflow: "visible" },
13407
- children: /* @__PURE__ */ jsx14("div", { style: { ...labelStyle, textAlign: "center" }, children: xLabelText })
13408
- }
13409
- ),
13410
- shouldShowYLabel && /* @__PURE__ */ jsx14(
13411
- "foreignObject",
13412
- {
13413
- x: targetScreen.x + yLabelOffset,
13414
- y: Math.min(anchorMarkerScreen.y, targetScreen.y),
13415
- width: VISUAL_CONFIG.Y_LABEL_MIN_WIDTH,
13416
- height: Math.abs(targetScreen.y - anchorMarkerScreen.y),
13417
- style: { overflow: "visible" },
13418
- children: /* @__PURE__ */ jsx14(
13419
- "div",
13420
- {
13421
- style: {
13422
- ...labelStyle,
13423
- display: "flex",
13424
- alignItems: "center",
13425
- justifyContent: isTargetRightOfAnchor ? "flex-start" : "flex-end",
13426
- whiteSpace: "nowrap",
13427
- padding: "0 4px",
13428
- height: "100%"
13429
- },
13430
- children: yLabelText
13431
- }
13432
- )
13433
- }
13434
- )
13435
- ] }, `${target.panel.pcb_panel_id}-${targetId}-${target.type}`);
13436
- }),
13437
- Array.from(panelAnchorScreens.entries()).map(
13438
- ([panelId, anchorScreen]) => /* @__PURE__ */ jsxs11("g", { children: [
13439
- /* @__PURE__ */ jsx14(
13440
- "line",
13441
- {
13442
- x1: anchorScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13443
- y1: anchorScreen.y,
13444
- x2: anchorScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13445
- y2: anchorScreen.y,
13446
- stroke: COLORS.OFFSET_LINE,
13447
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13448
- }
13449
- ),
13450
- /* @__PURE__ */ jsx14(
13451
- "line",
13452
- {
13453
- x1: anchorScreen.x,
13454
- y1: anchorScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13455
- x2: anchorScreen.x,
13456
- y2: anchorScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13457
- stroke: COLORS.OFFSET_LINE,
13458
- strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13459
- }
13460
- )
13461
- ] }, `anchor-${panelId}`)
13462
- )
13463
- ]
13464
- }
13465
- )
13302
+ targets: sharedTargets,
13303
+ transform,
13304
+ containerWidth,
13305
+ containerHeight
13466
13306
  }
13467
13307
  );
13468
13308
  };
13469
13309
 
13470
13310
  // src/components/MouseElementTracker.tsx
13471
- import { Fragment as Fragment7, jsx as jsx15, jsxs as jsxs12 } from "react/jsx-runtime";
13311
+ import { Fragment as Fragment6, jsx as jsx17, jsxs as jsxs11 } from "react/jsx-runtime";
13472
13312
  var getPolygonBoundingBox = (points) => {
13473
13313
  if (points.length === 0) return null;
13474
13314
  let minX = points[0].x;
@@ -13614,7 +13454,7 @@ var MouseElementTracker = ({
13614
13454
  h = "h" in primitive ? primitive.h : "r" in primitive ? primitive.r * 2 : "rX" in primitive && "rY" in primitive ? primitive.rY * 2 : 0;
13615
13455
  }
13616
13456
  if (!basePoint) continue;
13617
- const screenPos = applyToPoint15(transform, basePoint);
13457
+ const screenPos = applyToPoint14(transform, basePoint);
13618
13458
  const screenSize = {
13619
13459
  w: w * transform.a,
13620
13460
  h: h * transform.a
@@ -13639,7 +13479,7 @@ var MouseElementTracker = ({
13639
13479
  }, [mousedPrimitives, transform]);
13640
13480
  const handleInteraction = (x, y, transform2, primitives2) => {
13641
13481
  setMousePos({ x, y });
13642
- const rwPoint = applyToPoint15(inverse5(transform2), { x, y });
13482
+ const rwPoint = applyToPoint14(inverse5(transform2), { x, y });
13643
13483
  const newMousedPrimitives = getPrimitivesUnderPoint(
13644
13484
  primitives2,
13645
13485
  rwPoint,
@@ -13654,7 +13494,7 @@ var MouseElementTracker = ({
13654
13494
  setMousedPrimitives(newMousedPrimitives);
13655
13495
  onMouseHoverOverPrimitives(newMousedPrimitives);
13656
13496
  };
13657
- return /* @__PURE__ */ jsxs12(
13497
+ return /* @__PURE__ */ jsxs11(
13658
13498
  "div",
13659
13499
  {
13660
13500
  ref: containerRef,
@@ -13678,7 +13518,7 @@ var MouseElementTracker = ({
13678
13518
  },
13679
13519
  children: [
13680
13520
  children,
13681
- /* @__PURE__ */ jsx15(
13521
+ /* @__PURE__ */ jsx17(
13682
13522
  ElementOverlayBox,
13683
13523
  {
13684
13524
  elements,
@@ -13686,8 +13526,8 @@ var MouseElementTracker = ({
13686
13526
  highlightedPrimitives
13687
13527
  }
13688
13528
  ),
13689
- transform && /* @__PURE__ */ jsxs12(Fragment7, { children: [
13690
- /* @__PURE__ */ jsx15(
13529
+ transform && /* @__PURE__ */ jsxs11(Fragment6, { children: [
13530
+ /* @__PURE__ */ jsx17(
13691
13531
  BoardAnchorOffsetOverlay,
13692
13532
  {
13693
13533
  elements,
@@ -13697,7 +13537,7 @@ var MouseElementTracker = ({
13697
13537
  containerHeight: height
13698
13538
  }
13699
13539
  ),
13700
- /* @__PURE__ */ jsx15(
13540
+ /* @__PURE__ */ jsx17(
13701
13541
  GroupAnchorOffsetOverlay,
13702
13542
  {
13703
13543
  elements,
@@ -13707,7 +13547,17 @@ var MouseElementTracker = ({
13707
13547
  containerHeight: height
13708
13548
  }
13709
13549
  ),
13710
- /* @__PURE__ */ jsx15(
13550
+ /* @__PURE__ */ jsx17(
13551
+ ComponentBoundingBoxOverlay,
13552
+ {
13553
+ elements,
13554
+ highlightedPrimitives,
13555
+ transform,
13556
+ containerWidth: width,
13557
+ containerHeight: height
13558
+ }
13559
+ ),
13560
+ /* @__PURE__ */ jsx17(
13711
13561
  PanelAnchorOffsetOverlay,
13712
13562
  {
13713
13563
  elements,
@@ -13724,10 +13574,10 @@ var MouseElementTracker = ({
13724
13574
  };
13725
13575
 
13726
13576
  // src/components/PcbGroupOverlay.tsx
13727
- import { applyToPoint as applyToPoint16 } from "transformation-matrix";
13577
+ import { applyToPoint as applyToPoint15 } from "transformation-matrix";
13728
13578
  import { identity as identity8 } from "transformation-matrix";
13729
13579
  import { useRef as useRef9, useEffect as useEffect12 } from "react";
13730
- import { jsx as jsx16, jsxs as jsxs13 } from "react/jsx-runtime";
13580
+ import { jsx as jsx18, jsxs as jsxs12 } from "react/jsx-runtime";
13731
13581
  var GROUP_COLORS = [
13732
13582
  "rgb(255, 100, 100)",
13733
13583
  "rgb(100, 255, 100)",
@@ -13882,10 +13732,10 @@ var PcbGroupOverlay = ({
13882
13732
  minY -= totalPadding;
13883
13733
  maxY += totalPadding;
13884
13734
  }
13885
- const topLeft = applyToPoint16(transform, { x: minX, y: maxY });
13886
- const topRight = applyToPoint16(transform, { x: maxX, y: maxY });
13887
- const bottomLeft = applyToPoint16(transform, { x: minX, y: minY });
13888
- const bottomRight = applyToPoint16(transform, { x: maxX, y: minY });
13735
+ const topLeft = applyToPoint15(transform, { x: minX, y: maxY });
13736
+ const topRight = applyToPoint15(transform, { x: maxX, y: maxY });
13737
+ const bottomLeft = applyToPoint15(transform, { x: minX, y: minY });
13738
+ const bottomRight = applyToPoint15(transform, { x: maxX, y: minY });
13889
13739
  const groupColor = GROUP_COLORS[groupIndex % GROUP_COLORS.length];
13890
13740
  ctx.strokeStyle = groupColor;
13891
13741
  ctx.lineWidth = 2;
@@ -13935,7 +13785,7 @@ var PcbGroupOverlay = ({
13935
13785
  x: group.anchor_position[0] ?? 0,
13936
13786
  y: group.anchor_position[1] ?? 0
13937
13787
  } : { x: group.anchor_position.x, y: group.anchor_position.y };
13938
- const anchorScreenPos = applyToPoint16(transform, anchorPositionValue);
13788
+ const anchorScreenPos = applyToPoint15(transform, anchorPositionValue);
13939
13789
  ctx.strokeStyle = "white";
13940
13790
  ctx.lineWidth = 1.5;
13941
13791
  ctx.setLineDash([]);
@@ -13960,14 +13810,14 @@ var PcbGroupOverlay = ({
13960
13810
  is_showing_group_anchor_offsets,
13961
13811
  hoveredComponentIds
13962
13812
  ]);
13963
- return /* @__PURE__ */ jsxs13(
13813
+ return /* @__PURE__ */ jsxs12(
13964
13814
  "div",
13965
13815
  {
13966
13816
  ref: containerRef,
13967
13817
  style: { position: "relative", width: "100%", height: "100%" },
13968
13818
  children: [
13969
13819
  children,
13970
- /* @__PURE__ */ jsx16(
13820
+ /* @__PURE__ */ jsx18(
13971
13821
  "canvas",
13972
13822
  {
13973
13823
  ref: canvasRef,
@@ -13987,9 +13837,9 @@ var PcbGroupOverlay = ({
13987
13837
  };
13988
13838
 
13989
13839
  // src/components/RatsNestOverlay.tsx
13990
- import { applyToPoint as applyToPoint17, identity as identity9 } from "transformation-matrix";
13840
+ import { applyToPoint as applyToPoint16, identity as identity9 } from "transformation-matrix";
13991
13841
  import { useMemo as useMemo6 } from "react";
13992
- import { jsx as jsx17, jsxs as jsxs14 } from "react/jsx-runtime";
13842
+ import { jsx as jsx19, jsxs as jsxs13 } from "react/jsx-runtime";
13993
13843
  var RatsNestOverlay = ({ transform, soup, children }) => {
13994
13844
  const isShowingRatsNest = useGlobalStore((s) => s.is_showing_rats_nest);
13995
13845
  const { netMap, idToNetMap } = useMemo6(
@@ -14052,9 +13902,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
14052
13902
  }, [soup, netMap, idToNetMap, isShowingRatsNest]);
14053
13903
  if (!soup || !isShowingRatsNest) return children;
14054
13904
  if (!transform) transform = identity9();
14055
- return /* @__PURE__ */ jsxs14("div", { style: { position: "relative" }, children: [
13905
+ return /* @__PURE__ */ jsxs13("div", { style: { position: "relative" }, children: [
14056
13906
  children,
14057
- /* @__PURE__ */ jsx17(
13907
+ /* @__PURE__ */ jsx19(
14058
13908
  "svg",
14059
13909
  {
14060
13910
  style: {
@@ -14068,9 +13918,9 @@ var RatsNestOverlay = ({ transform, soup, children }) => {
14068
13918
  zIndex: zIndexMap.ratsNestOverlay
14069
13919
  },
14070
13920
  children: ratsNestLines.map(({ key, startPoint, endPoint, isInNet }) => {
14071
- const transformedStart = applyToPoint17(transform, startPoint);
14072
- const transformedEnd = applyToPoint17(transform, endPoint);
14073
- return /* @__PURE__ */ jsx17(
13921
+ const transformedStart = applyToPoint16(transform, startPoint);
13922
+ const transformedEnd = applyToPoint16(transform, endPoint);
13923
+ return /* @__PURE__ */ jsx19(
14074
13924
  "line",
14075
13925
  {
14076
13926
  x1: transformedStart.x,
@@ -14096,7 +13946,7 @@ import { css as css3 } from "@emotion/css";
14096
13946
  // package.json
14097
13947
  var package_default = {
14098
13948
  name: "@tscircuit/pcb-viewer",
14099
- version: "1.11.291",
13949
+ version: "1.11.293",
14100
13950
  main: "dist/index.js",
14101
13951
  type: "module",
14102
13952
  repository: "tscircuit/pcb-viewer",
@@ -14202,9 +14052,9 @@ var useIsSmallScreen = () => {
14202
14052
  };
14203
14053
 
14204
14054
  // src/components/ToolbarOverlay.tsx
14205
- import { jsx as jsx18, jsxs as jsxs15 } from "react/jsx-runtime";
14055
+ import { jsx as jsx20, jsxs as jsxs14 } from "react/jsx-runtime";
14206
14056
  var LayerButton = ({ name, selected, onClick }) => {
14207
- return /* @__PURE__ */ jsxs15(
14057
+ return /* @__PURE__ */ jsxs14(
14208
14058
  "div",
14209
14059
  {
14210
14060
  className: css3`
@@ -14220,8 +14070,8 @@ var LayerButton = ({ name, selected, onClick }) => {
14220
14070
  `,
14221
14071
  onClick,
14222
14072
  children: [
14223
- /* @__PURE__ */ jsx18("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
14224
- /* @__PURE__ */ jsx18(
14073
+ /* @__PURE__ */ jsx20("span", { style: { marginRight: 2, opacity: selected ? 1 : 0 }, children: "\u2022" }),
14074
+ /* @__PURE__ */ jsx20(
14225
14075
  "span",
14226
14076
  {
14227
14077
  style: {
@@ -14241,7 +14091,7 @@ var ToolbarButton = ({
14241
14091
  isSmallScreen,
14242
14092
  onClick,
14243
14093
  ...props
14244
- }) => /* @__PURE__ */ jsx18(
14094
+ }) => /* @__PURE__ */ jsx20(
14245
14095
  "div",
14246
14096
  {
14247
14097
  ...props,
@@ -14278,7 +14128,7 @@ var CheckboxMenuItem = ({
14278
14128
  checked,
14279
14129
  onClick
14280
14130
  }) => {
14281
- return /* @__PURE__ */ jsxs15(
14131
+ return /* @__PURE__ */ jsxs14(
14282
14132
  "div",
14283
14133
  {
14284
14134
  className: css3`
@@ -14305,15 +14155,15 @@ var CheckboxMenuItem = ({
14305
14155
  onClick();
14306
14156
  },
14307
14157
  children: [
14308
- /* @__PURE__ */ jsx18("input", { type: "checkbox", checked, onChange: () => {
14158
+ /* @__PURE__ */ jsx20("input", { type: "checkbox", checked, onChange: () => {
14309
14159
  }, readOnly: true }),
14310
- /* @__PURE__ */ jsx18("span", { style: { color: "#eee" }, children: label })
14160
+ /* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
14311
14161
  ]
14312
14162
  }
14313
14163
  );
14314
14164
  };
14315
14165
  var RadioMenuItem = ({ label, checked, onClick }) => {
14316
- return /* @__PURE__ */ jsxs15(
14166
+ return /* @__PURE__ */ jsxs14(
14317
14167
  "div",
14318
14168
  {
14319
14169
  className: css3`
@@ -14340,9 +14190,9 @@ var RadioMenuItem = ({ label, checked, onClick }) => {
14340
14190
  onClick();
14341
14191
  },
14342
14192
  children: [
14343
- /* @__PURE__ */ jsx18("input", { type: "radio", checked, onChange: () => {
14193
+ /* @__PURE__ */ jsx20("input", { type: "radio", checked, onChange: () => {
14344
14194
  }, readOnly: true }),
14345
- /* @__PURE__ */ jsx18("span", { style: { color: "#eee" }, children: label })
14195
+ /* @__PURE__ */ jsx20("span", { style: { color: "#eee" }, children: label })
14346
14196
  ]
14347
14197
  }
14348
14198
  );
@@ -14494,7 +14344,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14494
14344
  setErrorsOpen(false);
14495
14345
  }
14496
14346
  }, [isViewMenuOpen]);
14497
- return /* @__PURE__ */ jsxs15(
14347
+ return /* @__PURE__ */ jsxs14(
14498
14348
  "div",
14499
14349
  {
14500
14350
  style: { position: "relative", zIndex: "999 !important" },
@@ -14502,7 +14352,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14502
14352
  onMouseLeave: handleMouseLeave,
14503
14353
  children: [
14504
14354
  children,
14505
- /* @__PURE__ */ jsxs15(
14355
+ /* @__PURE__ */ jsxs14(
14506
14356
  "div",
14507
14357
  {
14508
14358
  style: {
@@ -14523,7 +14373,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14523
14373
  ]
14524
14374
  }
14525
14375
  ),
14526
- /* @__PURE__ */ jsxs15(
14376
+ /* @__PURE__ */ jsxs14(
14527
14377
  "div",
14528
14378
  {
14529
14379
  "data-toolbar-overlay": true,
@@ -14546,7 +14396,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14546
14396
  fontFamily: "sans-serif"
14547
14397
  },
14548
14398
  children: [
14549
- /* @__PURE__ */ jsxs15(
14399
+ /* @__PURE__ */ jsxs14(
14550
14400
  ToolbarButton,
14551
14401
  {
14552
14402
  isSmallScreen,
@@ -14557,10 +14407,10 @@ var ToolbarOverlay = ({ children, elements }) => {
14557
14407
  }
14558
14408
  },
14559
14409
  children: [
14560
- /* @__PURE__ */ jsxs15("div", { children: [
14410
+ /* @__PURE__ */ jsxs14("div", { children: [
14561
14411
  "layer:",
14562
14412
  " ",
14563
- /* @__PURE__ */ jsx18(
14413
+ /* @__PURE__ */ jsx20(
14564
14414
  "span",
14565
14415
  {
14566
14416
  style: {
@@ -14572,7 +14422,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14572
14422
  }
14573
14423
  )
14574
14424
  ] }),
14575
- isLayerMenuOpen && /* @__PURE__ */ jsx18("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx18(
14425
+ isLayerMenuOpen && /* @__PURE__ */ jsx20("div", { style: { marginTop: 4, minWidth: 120 }, children: processedLayers.map((layer) => /* @__PURE__ */ jsx20(
14576
14426
  LayerButton,
14577
14427
  {
14578
14428
  name: layer,
@@ -14586,7 +14436,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14586
14436
  ]
14587
14437
  }
14588
14438
  ),
14589
- /* @__PURE__ */ jsx18(
14439
+ /* @__PURE__ */ jsx20(
14590
14440
  ToolbarButton,
14591
14441
  {
14592
14442
  isSmallScreen,
@@ -14595,13 +14445,13 @@ var ToolbarOverlay = ({ children, elements }) => {
14595
14445
  ...errorCount > 0 ? { color: "red" } : {}
14596
14446
  },
14597
14447
  onClick: handleErrorsToggle,
14598
- children: /* @__PURE__ */ jsxs15("div", { children: [
14448
+ children: /* @__PURE__ */ jsxs14("div", { children: [
14599
14449
  errorCount,
14600
14450
  " errors"
14601
14451
  ] })
14602
14452
  }
14603
14453
  ),
14604
- isErrorsOpen && errorCount > 0 && /* @__PURE__ */ jsx18(
14454
+ isErrorsOpen && errorCount > 0 && /* @__PURE__ */ jsx20(
14605
14455
  "div",
14606
14456
  {
14607
14457
  style: {
@@ -14621,14 +14471,14 @@ var ToolbarOverlay = ({ children, elements }) => {
14621
14471
  },
14622
14472
  children: errorElements.map((e, i) => {
14623
14473
  const errorId = e.pcb_trace_error_id || `error_${i}_${e.error_type}_${e.message?.slice(0, 20)}`;
14624
- return /* @__PURE__ */ jsxs15(
14474
+ return /* @__PURE__ */ jsxs14(
14625
14475
  "div",
14626
14476
  {
14627
14477
  style: {
14628
14478
  borderBottom: i < errorElements.length - 1 ? "1px solid #444" : "none"
14629
14479
  },
14630
14480
  children: [
14631
- /* @__PURE__ */ jsxs15(
14481
+ /* @__PURE__ */ jsxs14(
14632
14482
  "div",
14633
14483
  {
14634
14484
  style: {
@@ -14679,7 +14529,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14679
14529
  }
14680
14530
  },
14681
14531
  children: [
14682
- /* @__PURE__ */ jsx18(
14532
+ /* @__PURE__ */ jsx20(
14683
14533
  "div",
14684
14534
  {
14685
14535
  style: {
@@ -14693,7 +14543,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14693
14543
  children: e.error_type
14694
14544
  }
14695
14545
  ),
14696
- /* @__PURE__ */ jsx18(
14546
+ /* @__PURE__ */ jsx20(
14697
14547
  "div",
14698
14548
  {
14699
14549
  style: {
@@ -14708,7 +14558,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14708
14558
  children: e.message
14709
14559
  }
14710
14560
  ),
14711
- /* @__PURE__ */ jsx18(
14561
+ /* @__PURE__ */ jsx20(
14712
14562
  "div",
14713
14563
  {
14714
14564
  ref: (el) => {
@@ -14728,7 +14578,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14728
14578
  ]
14729
14579
  }
14730
14580
  ),
14731
- /* @__PURE__ */ jsx18(
14581
+ /* @__PURE__ */ jsx20(
14732
14582
  "div",
14733
14583
  {
14734
14584
  ref: (el) => {
@@ -14741,7 +14591,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14741
14591
  backgroundColor: "#1a1a1a",
14742
14592
  borderTop: "1px solid #444"
14743
14593
  },
14744
- children: /* @__PURE__ */ jsx18(
14594
+ children: /* @__PURE__ */ jsx20(
14745
14595
  "div",
14746
14596
  {
14747
14597
  style: {
@@ -14764,58 +14614,58 @@ var ToolbarOverlay = ({ children, elements }) => {
14764
14614
  })
14765
14615
  }
14766
14616
  ),
14767
- /* @__PURE__ */ jsx18(
14617
+ /* @__PURE__ */ jsx20(
14768
14618
  ToolbarButton,
14769
14619
  {
14770
14620
  isSmallScreen,
14771
14621
  style: {},
14772
14622
  onClick: handleEditTraceToggle,
14773
- children: /* @__PURE__ */ jsxs15("div", { children: [
14623
+ children: /* @__PURE__ */ jsxs14("div", { children: [
14774
14624
  editModes.in_draw_trace_mode ? "\u2716 " : "",
14775
14625
  "Edit Traces"
14776
14626
  ] })
14777
14627
  }
14778
14628
  ),
14779
- /* @__PURE__ */ jsx18(
14629
+ /* @__PURE__ */ jsx20(
14780
14630
  ToolbarButton,
14781
14631
  {
14782
14632
  isSmallScreen,
14783
14633
  style: {},
14784
14634
  onClick: handleMoveComponentToggle,
14785
- children: /* @__PURE__ */ jsxs15("div", { children: [
14635
+ children: /* @__PURE__ */ jsxs14("div", { children: [
14786
14636
  editModes.in_move_footprint_mode ? "\u2716 " : "",
14787
14637
  "Move Components"
14788
14638
  ] })
14789
14639
  }
14790
14640
  ),
14791
- /* @__PURE__ */ jsx18(
14641
+ /* @__PURE__ */ jsx20(
14792
14642
  ToolbarButton,
14793
14643
  {
14794
14644
  isSmallScreen,
14795
14645
  style: {},
14796
14646
  onClick: handleRatsNestToggle,
14797
- children: /* @__PURE__ */ jsxs15("div", { children: [
14647
+ children: /* @__PURE__ */ jsxs14("div", { children: [
14798
14648
  viewSettings.is_showing_rats_nest ? "\u2716 " : "",
14799
14649
  "Rats Nest"
14800
14650
  ] })
14801
14651
  }
14802
14652
  ),
14803
- /* @__PURE__ */ jsx18(
14653
+ /* @__PURE__ */ jsx20(
14804
14654
  ToolbarButton,
14805
14655
  {
14806
14656
  isSmallScreen,
14807
14657
  style: measureToolArmed ? { backgroundColor: "#444" } : {},
14808
14658
  onClick: handleMeasureToolClick,
14809
- children: /* @__PURE__ */ jsx18("div", { children: "\u{1F4CF}" })
14659
+ children: /* @__PURE__ */ jsx20("div", { children: "\u{1F4CF}" })
14810
14660
  }
14811
14661
  ),
14812
- /* @__PURE__ */ jsx18(
14662
+ /* @__PURE__ */ jsx20(
14813
14663
  ToolbarButton,
14814
14664
  {
14815
14665
  isSmallScreen,
14816
14666
  onClick: handleViewMenuToggle,
14817
- children: /* @__PURE__ */ jsxs15("div", { children: [
14818
- /* @__PURE__ */ jsxs15(
14667
+ children: /* @__PURE__ */ jsxs14("div", { children: [
14668
+ /* @__PURE__ */ jsxs14(
14819
14669
  "div",
14820
14670
  {
14821
14671
  style: {
@@ -14825,7 +14675,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14825
14675
  },
14826
14676
  children: [
14827
14677
  "View",
14828
- /* @__PURE__ */ jsx18(
14678
+ /* @__PURE__ */ jsx20(
14829
14679
  "span",
14830
14680
  {
14831
14681
  style: {
@@ -14840,8 +14690,8 @@ var ToolbarOverlay = ({ children, elements }) => {
14840
14690
  ]
14841
14691
  }
14842
14692
  ),
14843
- isViewMenuOpen && /* @__PURE__ */ jsxs15("div", { style: { marginTop: 4, minWidth: 120 }, children: [
14844
- /* @__PURE__ */ jsx18(
14693
+ isViewMenuOpen && /* @__PURE__ */ jsxs14("div", { style: { marginTop: 4, minWidth: 120 }, children: [
14694
+ /* @__PURE__ */ jsx20(
14845
14695
  CheckboxMenuItem,
14846
14696
  {
14847
14697
  label: "Show All Trace Lengths",
@@ -14853,7 +14703,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14853
14703
  }
14854
14704
  }
14855
14705
  ),
14856
- /* @__PURE__ */ jsx18(
14706
+ /* @__PURE__ */ jsx20(
14857
14707
  CheckboxMenuItem,
14858
14708
  {
14859
14709
  label: "Show Autorouting Animation",
@@ -14865,7 +14715,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14865
14715
  }
14866
14716
  }
14867
14717
  ),
14868
- /* @__PURE__ */ jsx18(
14718
+ /* @__PURE__ */ jsx20(
14869
14719
  CheckboxMenuItem,
14870
14720
  {
14871
14721
  label: "Show DRC Errors",
@@ -14875,7 +14725,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14875
14725
  }
14876
14726
  }
14877
14727
  ),
14878
- /* @__PURE__ */ jsx18(
14728
+ /* @__PURE__ */ jsx20(
14879
14729
  CheckboxMenuItem,
14880
14730
  {
14881
14731
  label: "Show Copper Pours",
@@ -14887,7 +14737,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14887
14737
  }
14888
14738
  }
14889
14739
  ),
14890
- /* @__PURE__ */ jsx18(
14740
+ /* @__PURE__ */ jsx20(
14891
14741
  CheckboxMenuItem,
14892
14742
  {
14893
14743
  label: "Show Solder Mask",
@@ -14897,7 +14747,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14897
14747
  }
14898
14748
  }
14899
14749
  ),
14900
- /* @__PURE__ */ jsx18(
14750
+ /* @__PURE__ */ jsx20(
14901
14751
  CheckboxMenuItem,
14902
14752
  {
14903
14753
  label: "Show Group Anchor Offsets",
@@ -14909,7 +14759,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14909
14759
  }
14910
14760
  }
14911
14761
  ),
14912
- /* @__PURE__ */ jsx18(
14762
+ /* @__PURE__ */ jsx20(
14913
14763
  CheckboxMenuItem,
14914
14764
  {
14915
14765
  label: "Show PCB Groups",
@@ -14919,8 +14769,8 @@ var ToolbarOverlay = ({ children, elements }) => {
14919
14769
  }
14920
14770
  }
14921
14771
  ),
14922
- viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs15("div", { style: { marginLeft: 16 }, children: [
14923
- /* @__PURE__ */ jsx18(
14772
+ viewSettings.is_showing_pcb_groups && /* @__PURE__ */ jsxs14("div", { style: { marginLeft: 16 }, children: [
14773
+ /* @__PURE__ */ jsx20(
14924
14774
  RadioMenuItem,
14925
14775
  {
14926
14776
  label: "Show All Groups",
@@ -14930,7 +14780,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14930
14780
  }
14931
14781
  }
14932
14782
  ),
14933
- /* @__PURE__ */ jsx18(
14783
+ /* @__PURE__ */ jsx20(
14934
14784
  RadioMenuItem,
14935
14785
  {
14936
14786
  label: "Show Named Groups",
@@ -14954,7 +14804,7 @@ var ToolbarOverlay = ({ children, elements }) => {
14954
14804
  };
14955
14805
 
14956
14806
  // src/components/CanvasElementsRenderer.tsx
14957
- import { jsx as jsx19 } from "react/jsx-runtime";
14807
+ import { jsx as jsx21 } from "react/jsx-runtime";
14958
14808
  var CanvasElementsRenderer = (props) => {
14959
14809
  const { transform, elements } = props;
14960
14810
  const hoveredErrorId = useGlobalStore((state) => state.hovered_error_id);
@@ -15042,14 +14892,14 @@ var CanvasElementsRenderer = (props) => {
15042
14892
  },
15043
14893
  [connectivityMap]
15044
14894
  );
15045
- return /* @__PURE__ */ jsx19(
14895
+ return /* @__PURE__ */ jsx21(
15046
14896
  MouseElementTracker,
15047
14897
  {
15048
14898
  elements: elementsToRender,
15049
14899
  transform,
15050
14900
  primitives: primitivesWithoutInteractionMetadata,
15051
14901
  onMouseHoverOverPrimitives: onMouseOverPrimitives,
15052
- children: /* @__PURE__ */ jsx19(
14902
+ children: /* @__PURE__ */ jsx21(
15053
14903
  EditPlacementOverlay,
15054
14904
  {
15055
14905
  disabled: !props.allowEditing,
@@ -15058,7 +14908,7 @@ var CanvasElementsRenderer = (props) => {
15058
14908
  cancelPanDrag: props.cancelPanDrag,
15059
14909
  onCreateEditEvent: props.onCreateEditEvent,
15060
14910
  onModifyEditEvent: props.onModifyEditEvent,
15061
- children: /* @__PURE__ */ jsx19(
14911
+ children: /* @__PURE__ */ jsx21(
15062
14912
  EditTraceHintOverlay,
15063
14913
  {
15064
14914
  disabled: !props.allowEditing,
@@ -15067,29 +14917,29 @@ var CanvasElementsRenderer = (props) => {
15067
14917
  cancelPanDrag: props.cancelPanDrag,
15068
14918
  onCreateEditEvent: props.onCreateEditEvent,
15069
14919
  onModifyEditEvent: props.onModifyEditEvent,
15070
- children: /* @__PURE__ */ jsx19(
14920
+ children: /* @__PURE__ */ jsx21(
15071
14921
  DimensionOverlay,
15072
14922
  {
15073
14923
  transform,
15074
14924
  focusOnHover: props.focusOnHover,
15075
14925
  primitives: primitivesWithoutInteractionMetadata,
15076
- children: /* @__PURE__ */ jsx19(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx19(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx19(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx19(
14926
+ children: /* @__PURE__ */ jsx21(ToolbarOverlay, { elements, children: /* @__PURE__ */ jsx21(ErrorOverlay, { transform, elements, children: /* @__PURE__ */ jsx21(RatsNestOverlay, { transform, soup: elements, children: /* @__PURE__ */ jsx21(
15077
14927
  PcbGroupOverlay,
15078
14928
  {
15079
14929
  transform,
15080
14930
  elements,
15081
14931
  hoveredComponentIds,
15082
- children: /* @__PURE__ */ jsx19(
14932
+ children: /* @__PURE__ */ jsx21(
15083
14933
  DebugGraphicsOverlay,
15084
14934
  {
15085
14935
  transform,
15086
14936
  debugGraphics: props.debugGraphics,
15087
- children: /* @__PURE__ */ jsx19(
14937
+ children: /* @__PURE__ */ jsx21(
15088
14938
  WarningGraphicsOverlay,
15089
14939
  {
15090
14940
  transform,
15091
14941
  elements,
15092
- children: /* @__PURE__ */ jsx19(
14942
+ children: /* @__PURE__ */ jsx21(
15093
14943
  CanvasPrimitiveRenderer,
15094
14944
  {
15095
14945
  transform,
@@ -15158,7 +15008,7 @@ var calculateCircuitJsonKey = (circuitJson) => {
15158
15008
  };
15159
15009
 
15160
15010
  // src/PCBViewer.tsx
15161
- import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
15011
+ import { jsx as jsx22, jsxs as jsxs15 } from "react/jsx-runtime";
15162
15012
  var defaultTransform = compose7(translate11(400, 300), scale5(40, -40));
15163
15013
  var PCBViewer = ({
15164
15014
  circuitJson,
@@ -15252,20 +15102,20 @@ var PCBViewer = ({
15252
15102
  }),
15253
15103
  [initialState, disablePcbGroups]
15254
15104
  );
15255
- return /* @__PURE__ */ jsxs16(
15105
+ return /* @__PURE__ */ jsxs15(
15256
15106
  "div",
15257
15107
  {
15258
15108
  ref: transformRef,
15259
15109
  style: { position: "relative" },
15260
15110
  onContextMenu: (event) => event.preventDefault(),
15261
15111
  children: [
15262
- /* @__PURE__ */ jsx20("div", { ref, children: /* @__PURE__ */ jsxs16(
15112
+ /* @__PURE__ */ jsx22("div", { ref, children: /* @__PURE__ */ jsxs15(
15263
15113
  ContextProviders,
15264
15114
  {
15265
15115
  initialState: mergedInitialState,
15266
15116
  disablePcbGroups,
15267
15117
  children: [
15268
- /* @__PURE__ */ jsx20(
15118
+ /* @__PURE__ */ jsx22(
15269
15119
  CanvasElementsRenderer,
15270
15120
  {
15271
15121
  transform,
@@ -15290,11 +15140,11 @@ var PCBViewer = ({
15290
15140
  },
15291
15141
  refDimensions.width
15292
15142
  ),
15293
- /* @__PURE__ */ jsx20(ToastContainer, {})
15143
+ /* @__PURE__ */ jsx22(ToastContainer, {})
15294
15144
  ]
15295
15145
  }
15296
15146
  ) }),
15297
- clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx20(
15147
+ clickToInteractEnabled && !isInteractionEnabled && /* @__PURE__ */ jsx22(
15298
15148
  "div",
15299
15149
  {
15300
15150
  onClick: () => {
@@ -15331,7 +15181,7 @@ var PCBViewer = ({
15331
15181
  justifyContent: "center",
15332
15182
  touchAction: "pan-x pan-y pinch-zoom"
15333
15183
  },
15334
- children: /* @__PURE__ */ jsx20(
15184
+ children: /* @__PURE__ */ jsx22(
15335
15185
  "div",
15336
15186
  {
15337
15187
  style: {