@tscircuit/pcb-viewer 1.11.286 → 1.11.288

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
@@ -12673,7 +12673,8 @@ var VISUAL_CONFIG = {
12673
12673
  LABEL_OFFSET_ABOVE: 2,
12674
12674
  LABEL_OFFSET_BELOW: -18,
12675
12675
  LABEL_OFFSET_RIGHT: 8,
12676
- LABEL_OFFSET_LEFT: -80,
12676
+ LABEL_OFFSET_LEFT: -120,
12677
+ Y_LABEL_MIN_WIDTH: 110,
12677
12678
  LINE_STROKE_WIDTH: 1.5,
12678
12679
  LINE_DASH_PATTERN: "4,4",
12679
12680
  COMPONENT_MARKER_RADIUS: 3,
@@ -12805,8 +12806,8 @@ var BoardAnchorOffsetOverlay = ({
12805
12806
  } else {
12806
12807
  if (!target.group.center) return null;
12807
12808
  targetCenter = {
12808
- x: target.group.center.x,
12809
- y: target.group.center.y
12809
+ x: target.group.anchor_position?.x ?? target.group.center.x,
12810
+ y: target.group.anchor_position?.y ?? target.group.center.y
12810
12811
  };
12811
12812
  targetId = target.group.pcb_group_id;
12812
12813
  displayOffsetX = target.group.display_offset_x;
@@ -12828,8 +12829,8 @@ var BoardAnchorOffsetOverlay = ({
12828
12829
  const yLabelOffset = isTargetRightOfAnchor ? VISUAL_CONFIG.LABEL_OFFSET_RIGHT : VISUAL_CONFIG.LABEL_OFFSET_LEFT;
12829
12830
  const shouldShowXLabel = xLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
12830
12831
  const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
12831
- const xLabelText = displayOffsetX ?? `Board \u0394x: ${offsetX.toFixed(2)}mm`;
12832
- const yLabelText = displayOffsetY ?? `Board \u0394y: ${offsetY.toFixed(2)}mm`;
12832
+ const xLabelText = `Board \u0394x: ${displayOffsetX ? displayOffsetX : offsetX.toFixed(2)}mm`;
12833
+ const yLabelText = `Board \u0394y: ${displayOffsetX ? displayOffsetX : offsetY.toFixed(2)}mm`;
12833
12834
  return /* @__PURE__ */ jsxs9("g", { children: [
12834
12835
  /* @__PURE__ */ jsx12(
12835
12836
  "line",
@@ -12905,7 +12906,7 @@ var BoardAnchorOffsetOverlay = ({
12905
12906
  {
12906
12907
  x: targetScreen.x + yLabelOffset,
12907
12908
  y: Math.min(anchorMarkerScreen.y, targetScreen.y),
12908
- width: 20,
12909
+ width: VISUAL_CONFIG.Y_LABEL_MIN_WIDTH,
12909
12910
  height: Math.abs(targetScreen.y - anchorMarkerScreen.y),
12910
12911
  style: { overflow: "visible" },
12911
12912
  children: /* @__PURE__ */ jsx12(
@@ -12915,6 +12916,9 @@ var BoardAnchorOffsetOverlay = ({
12915
12916
  ...labelStyle,
12916
12917
  display: "flex",
12917
12918
  alignItems: "center",
12919
+ justifyContent: isTargetRightOfAnchor ? "flex-start" : "flex-end",
12920
+ whiteSpace: "nowrap",
12921
+ padding: "0 4px",
12918
12922
  height: "100%"
12919
12923
  },
12920
12924
  children: yLabelText
@@ -13131,8 +13135,8 @@ var GroupAnchorOffsetOverlay = ({
13131
13135
  const yLabelOffset = isTargetRightOfAnchor ? VISUAL_CONFIG.LABEL_OFFSET_RIGHT : VISUAL_CONFIG.LABEL_OFFSET_LEFT;
13132
13136
  const shouldShowXLabel = xLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13133
13137
  const shouldShowYLabel = yLineLength > VISUAL_CONFIG.MIN_LINE_LENGTH_FOR_LABEL;
13134
- const xLabelText = displayOffsetX ?? `\u0394x: ${offsetX.toFixed(2)}mm`;
13135
- const yLabelText = displayOffsetY ?? `\u0394y: ${offsetY.toFixed(2)}mm`;
13138
+ const xLabelText = `\u0394x: ${displayOffsetX ? displayOffsetX : offsetX.toFixed(2)}mm`;
13139
+ const yLabelText = `\u0394y: ${displayOffsetY ? displayOffsetY : offsetY.toFixed(2)}mm`;
13136
13140
  return /* @__PURE__ */ jsxs10(
13137
13141
  "g",
13138
13142
  {
@@ -13630,33 +13634,47 @@ var PcbGroupOverlay = ({
13630
13634
  groupComponents = [...groupComponents, ...childComponents];
13631
13635
  }
13632
13636
  }
13633
- if (groupComponents.length === 0) return;
13634
- let minX = Infinity;
13635
- let minY = Infinity;
13636
- let maxX = -Infinity;
13637
- let maxY = -Infinity;
13638
- groupComponents.forEach((comp) => {
13639
- if (comp.center && typeof comp.width === "number" && typeof comp.height === "number") {
13640
- const left = comp.center.x - comp.width / 2;
13641
- const right = comp.center.x + comp.width / 2;
13642
- const top = comp.center.y + comp.height / 2;
13643
- const bottom = comp.center.y - comp.height / 2;
13644
- minX = Math.min(minX, left);
13645
- maxX = Math.max(maxX, right);
13646
- minY = Math.min(minY, bottom);
13647
- maxY = Math.max(maxY, top);
13648
- }
13649
- });
13650
- if (minX === Infinity || maxX === -Infinity) return;
13637
+ let minX, minY, maxX, maxY;
13638
+ let isExplicitlySized = false;
13639
+ if (group.center && group.width && group.height) {
13640
+ isExplicitlySized = true;
13641
+ const halfWidth = group.width / 2;
13642
+ const halfHeight = group.height / 2;
13643
+ minX = group.center.x - halfWidth;
13644
+ maxX = group.center.x + halfWidth;
13645
+ minY = group.center.y - halfHeight;
13646
+ maxY = group.center.y + halfHeight;
13647
+ } else {
13648
+ if (groupComponents.length === 0) return;
13649
+ minX = Infinity;
13650
+ minY = Infinity;
13651
+ maxX = -Infinity;
13652
+ maxY = -Infinity;
13653
+ groupComponents.forEach((comp) => {
13654
+ if (comp.center && typeof comp.width === "number" && typeof comp.height === "number") {
13655
+ const left = comp.center.x - comp.width / 2;
13656
+ const right = comp.center.x + comp.width / 2;
13657
+ const top = comp.center.y + comp.height / 2;
13658
+ const bottom = comp.center.y - comp.height / 2;
13659
+ minX = Math.min(minX, left);
13660
+ maxX = Math.max(maxX, right);
13661
+ minY = Math.min(minY, bottom);
13662
+ maxY = Math.max(maxY, top);
13663
+ }
13664
+ });
13665
+ if (minX === Infinity || maxX === -Infinity) return;
13666
+ }
13651
13667
  const depthLevel = group.source_group_id ? getGroupDepthLevel(group.source_group_id) : 0;
13652
13668
  const hasChildren = group.source_group_id ? getAllDescendantSourceGroups(group.source_group_id).length > 0 : false;
13653
- const basePadding = 1;
13654
- const hierarchyPadding = hasChildren ? 0.5 : 0;
13655
- const totalPadding = basePadding + hierarchyPadding;
13656
- minX -= totalPadding;
13657
- maxX += totalPadding;
13658
- minY -= totalPadding;
13659
- maxY += totalPadding;
13669
+ if (!isExplicitlySized) {
13670
+ const basePadding = 1;
13671
+ const hierarchyPadding = hasChildren ? 0.5 : 0;
13672
+ const totalPadding = basePadding + hierarchyPadding;
13673
+ minX -= totalPadding;
13674
+ maxX += totalPadding;
13675
+ minY -= totalPadding;
13676
+ maxY += totalPadding;
13677
+ }
13660
13678
  const topLeft = applyToPoint15(transform, { x: minX, y: maxY });
13661
13679
  const topRight = applyToPoint15(transform, { x: maxX, y: maxY });
13662
13680
  const bottomLeft = applyToPoint15(transform, { x: minX, y: minY });
@@ -13871,7 +13889,7 @@ import { css as css3 } from "@emotion/css";
13871
13889
  // package.json
13872
13890
  var package_default = {
13873
13891
  name: "@tscircuit/pcb-viewer",
13874
- version: "1.11.285",
13892
+ version: "1.11.287",
13875
13893
  main: "dist/index.js",
13876
13894
  type: "module",
13877
13895
  repository: "tscircuit/pcb-viewer",
@@ -13908,7 +13926,7 @@ var package_default = {
13908
13926
  "react-cosmos-plugin-vite": "7.0.0-beta.0",
13909
13927
  "react-dom": "19.1.0",
13910
13928
  "react-use": "^17.4.0",
13911
- tscircuit: "^0.0.1040",
13929
+ tscircuit: "^0.0.1054",
13912
13930
  tsup: "^8.0.2",
13913
13931
  "type-fest": "^3.0.0",
13914
13932
  typescript: "^5.4.4",