@tscircuit/pcb-viewer 1.11.283 → 1.11.285

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
@@ -12696,7 +12696,7 @@ var isPcbGroup = (element) => element?.type === "pcb_group";
12696
12696
  var isPcbBoard = (element) => element?.type === "pcb_board";
12697
12697
 
12698
12698
  // src/components/AnchorOffsetOverlay/Board/index.tsx
12699
- import { jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
12699
+ import { Fragment as Fragment5, jsx as jsx12, jsxs as jsxs9 } from "react/jsx-runtime";
12700
12700
  var BoardAnchorOffsetOverlay = ({
12701
12701
  elements,
12702
12702
  highlightedPrimitives,
@@ -12857,7 +12857,7 @@ var BoardAnchorOffsetOverlay = ({
12857
12857
  strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
12858
12858
  }
12859
12859
  ),
12860
- /* @__PURE__ */ jsx12(
12860
+ target.type === "component" ? /* @__PURE__ */ jsx12(
12861
12861
  "circle",
12862
12862
  {
12863
12863
  cx: targetScreen.x,
@@ -12867,7 +12867,30 @@ var BoardAnchorOffsetOverlay = ({
12867
12867
  stroke: COLORS.COMPONENT_MARKER_STROKE,
12868
12868
  strokeWidth: 1
12869
12869
  }
12870
- ),
12870
+ ) : /* @__PURE__ */ jsxs9(Fragment5, { children: [
12871
+ /* @__PURE__ */ jsx12(
12872
+ "line",
12873
+ {
12874
+ x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12875
+ y1: targetScreen.y,
12876
+ x2: targetScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12877
+ y2: targetScreen.y,
12878
+ stroke: COLORS.OFFSET_LINE,
12879
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12880
+ }
12881
+ ),
12882
+ /* @__PURE__ */ jsx12(
12883
+ "line",
12884
+ {
12885
+ x1: targetScreen.x,
12886
+ y1: targetScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12887
+ x2: targetScreen.x,
12888
+ y2: targetScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
12889
+ stroke: COLORS.OFFSET_LINE,
12890
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
12891
+ }
12892
+ )
12893
+ ] }),
12871
12894
  shouldShowXLabel && /* @__PURE__ */ jsx12(
12872
12895
  "foreignObject",
12873
12896
  {
@@ -12938,7 +12961,7 @@ var BoardAnchorOffsetOverlay = ({
12938
12961
 
12939
12962
  // src/components/AnchorOffsetOverlay/Group/index.tsx
12940
12963
  import { applyToPoint as applyToPoint13 } from "transformation-matrix";
12941
- import { jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
12964
+ import { Fragment as Fragment6, jsx as jsx13, jsxs as jsxs10 } from "react/jsx-runtime";
12942
12965
  var GroupAnchorOffsetOverlay = ({
12943
12966
  elements,
12944
12967
  highlightedPrimitives,
@@ -12959,14 +12982,26 @@ var GroupAnchorOffsetOverlay = ({
12959
12982
  }
12960
12983
  return null;
12961
12984
  }).filter((id) => Boolean(id));
12985
+ const collectParentGroups = (groupId, collected) => {
12986
+ if (collected.has(groupId)) return;
12987
+ collected.add(groupId);
12988
+ const group = groups.find((g) => g.pcb_group_id === groupId);
12989
+ if (group?.position_mode === "relative_to_group_anchor" && group.positioned_relative_to_pcb_group_id) {
12990
+ collectParentGroups(group.positioned_relative_to_pcb_group_id, collected);
12991
+ }
12992
+ };
12962
12993
  const hoveredGroupIds = /* @__PURE__ */ new Set();
12963
12994
  hoveredComponentIds.forEach((componentId) => {
12964
12995
  const component = components.find((c) => c.pcb_component_id === componentId);
12965
- if (component?.pcb_group_id) {
12966
- hoveredGroupIds.add(component.pcb_group_id);
12996
+ if (!component) return;
12997
+ if (component.position_mode === "relative_to_group_anchor" && component.positioned_relative_to_pcb_group_id) {
12998
+ collectParentGroups(
12999
+ component.positioned_relative_to_pcb_group_id,
13000
+ hoveredGroupIds
13001
+ );
12967
13002
  }
12968
- if (component?.position_mode === "relative_to_group_anchor" && component.positioned_relative_to_pcb_group_id) {
12969
- hoveredGroupIds.add(component.positioned_relative_to_pcb_group_id);
13003
+ if (component.pcb_group_id) {
13004
+ collectParentGroups(component.pcb_group_id, hoveredGroupIds);
12970
13005
  }
12971
13006
  });
12972
13007
  const isShowingAnchorOffsets = useGlobalStore(
@@ -13128,7 +13163,7 @@ var GroupAnchorOffsetOverlay = ({
13128
13163
  strokeDasharray: VISUAL_CONFIG.LINE_DASH_PATTERN
13129
13164
  }
13130
13165
  ),
13131
- /* @__PURE__ */ jsx13(
13166
+ target.type === "component" ? /* @__PURE__ */ jsx13(
13132
13167
  "circle",
13133
13168
  {
13134
13169
  cx: targetScreen.x,
@@ -13138,7 +13173,30 @@ var GroupAnchorOffsetOverlay = ({
13138
13173
  stroke: COLORS.COMPONENT_MARKER_STROKE,
13139
13174
  strokeWidth: 1
13140
13175
  }
13141
- ),
13176
+ ) : /* @__PURE__ */ jsxs10(Fragment6, { children: [
13177
+ /* @__PURE__ */ jsx13(
13178
+ "line",
13179
+ {
13180
+ x1: targetScreen.x - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13181
+ y1: targetScreen.y,
13182
+ x2: targetScreen.x + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13183
+ y2: targetScreen.y,
13184
+ stroke: COLORS.OFFSET_LINE,
13185
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13186
+ }
13187
+ ),
13188
+ /* @__PURE__ */ jsx13(
13189
+ "line",
13190
+ {
13191
+ x1: targetScreen.x,
13192
+ y1: targetScreen.y - VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13193
+ x2: targetScreen.x,
13194
+ y2: targetScreen.y + VISUAL_CONFIG.ANCHOR_MARKER_SIZE,
13195
+ stroke: COLORS.OFFSET_LINE,
13196
+ strokeWidth: VISUAL_CONFIG.ANCHOR_MARKER_STROKE_WIDTH
13197
+ }
13198
+ )
13199
+ ] }),
13142
13200
  shouldShowXLabel && /* @__PURE__ */ jsx13(
13143
13201
  "foreignObject",
13144
13202
  {
@@ -13211,7 +13269,7 @@ var GroupAnchorOffsetOverlay = ({
13211
13269
  };
13212
13270
 
13213
13271
  // src/components/MouseElementTracker.tsx
13214
- import { Fragment as Fragment5, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
13272
+ import { Fragment as Fragment7, jsx as jsx14, jsxs as jsxs11 } from "react/jsx-runtime";
13215
13273
  var getPolygonBoundingBox = (points) => {
13216
13274
  if (points.length === 0) return null;
13217
13275
  let minX = points[0].x;
@@ -13429,7 +13487,7 @@ var MouseElementTracker = ({
13429
13487
  highlightedPrimitives
13430
13488
  }
13431
13489
  ),
13432
- transform && /* @__PURE__ */ jsxs11(Fragment5, { children: [
13490
+ transform && /* @__PURE__ */ jsxs11(Fragment7, { children: [
13433
13491
  /* @__PURE__ */ jsx14(
13434
13492
  BoardAnchorOffsetOverlay,
13435
13493
  {
@@ -13815,7 +13873,7 @@ import { css as css3 } from "@emotion/css";
13815
13873
  // package.json
13816
13874
  var package_default = {
13817
13875
  name: "@tscircuit/pcb-viewer",
13818
- version: "1.11.282",
13876
+ version: "1.11.284",
13819
13877
  main: "dist/index.js",
13820
13878
  type: "module",
13821
13879
  repository: "tscircuit/pcb-viewer",