Skip to content

Keep inline label attachment points on routed traces - #1339

Merged
MustafaMulla29 merged 14 commits into
repro/inline-label-wire-anchorsfrom
fix/inline-label-wire-anchors
Oct 21, 2026
Merged

MustafaMulla29 merged 14 commits into
repro/inline-label-wire-anchorsfrom
fix/inline-label-wire-anchors

Conversation

@MustafaMulla29

@MustafaMulla29 MustafaMulla29 commented Oct 21, 2026 •

Copy link
Copy Markdown
Contributor

Inline labels spanning a short bend can have an anchorPoint outside their routed wire. Keep the collision-checked text box, test center/left/right attachment positions against the same trace using the existing tracePathContainsPoint helper, and return the matching textAnchor. Continue the existing placement search if none fit.

This supports cleaning up the inline-label converter PR #658. Together with the core change, it supplies an exact wire attachment and alignment so the converter can remove nearest-wire detection and attachment-point guessing.

Stacked on the repro PR #1344. In Files changed, open repro-core-tb67s579ftg-inline-label-attachments-detail.snap.svg: the blue points move onto the wires while the dashed text boxes and routed paths stay unchanged. Both OUT_A_P and OUT_B_P were 0.1 mm off-wire before this fix. The fixture is core's existing TB67 breakout with only J4 moved through normal layout props.

The existing bent-route snapshots use the same guide rendering before and after. This PR adds on-wire and alignment assertions and updates those snapshots. A separate straight-wire close-up uses the same captured input to check that ordinary vertical connections keep their centered attachment.

Vertical coverage: open repro-core-tb67s579ftg-vertical-inline-label-attachments-detail.snap.svg in Files changed. It comes from a vertical layout of core's existing TB67 circuit using normal schematic props, with the same components and connections. OUT_A_P attaches at the lower end of its text and OUT_B_P at the upper end. The solver's dashed text boxes and routes stay unchanged; both blue dots move onto their wires. left/right are alignments in the text's reading direction, so they become lower/upper ends for vertical text.

Straight vertical wire coverage: repro-core-tb67s579ftg-vertical-inline-label-attachments-straight-detail.snap.svg is added directly in this PR's Files changed. It shows STOP_DET_VTH and NFHYS from the same TB67 input, with dashed text bounds and blue attachment points on the straight wires. The test checks two-point vertical paths and centered, on-wire attachments.

Validation:

  • Local follow-up: bun run format:check (installed Biome 2.5.15), both TB67 attachment tests, the updated-base gimbal test (63 assertions total), and bunx tsc --noEmit pass. The repository's original ^2.2.2 Biome dependency range is unchanged.
  • Full bun test: 721 passed, 4 skipped, 0 failed.
  • bunx tsc --noEmit and bun run build passed.
  • Restoring the original implementation makes the new on-wire assertion fail at 0.1 mm; restoring the fix passes.
  • Snapshot geometry comparison confirms identical wire paths and text positions in the close-up; only attachment points move.

Merge the repro first, then this fix. Core PR tscircuit/core#4811 consumes the attachment/alignment after the solver is released. No Circuit JSON schema change is needed.

Straight vertical stub coverage: repro-core-tb67s579ftg-vertical-inline-label-attachments-straight-stub.snap.svg shows the real AGC_OUT terminal from the same TB67 input. The test checks its two-point vertical path and on-wire attachment. This solver anchor was already correct before the fix, so its before/after stub snapshots are intentionally identical.

Main-branch cross-check: the same input was run against solver main b4dbf4f. All inline text centers and dimensions match the fix; the bent-route attachment points change. Core main f0a5872 produces an identical SVG with either solver version. The OUT_B_P overlap seen in core's PNG rendering also exists with both main versions; it is not introduced by this solver fix. Vertical examples remain in this solver stack.

@vercel

vercel Bot commented Oct 21, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
schematic-trace-solver Ready Ready Preview Oct 21, 2026 10:34am UTC

Request Review

@MustafaMulla29
MustafaMulla29 force-pushed the fix/inline-label-wire-anchors branch from 9f0a69c to 0245a47 Compare October 21, 2026 07:01
@MustafaMulla29
MustafaMulla29 changed the base branch from main to repro/inline-label-wire-anchors October 21, 2026 07:01
@MustafaMulla29
MustafaMulla29 added this pull request to stack #1346 October 21, 2026 07:04

@imrishabh18 imrishabh18 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No vertical anchorPoints?

@MustafaMulla29
MustafaMulla29 merged commit d1cd837 into main Oct 21, 2026
8 of 11 checks passed
@tscircuitbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution! 🎉

PR Rating: ⭐⭐⭐
Impact: Major

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


This branch was successfully deployed

1 active deployment
Preview — d0ddee6a Deployed Oct 21, 2026 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants