Skip to content

Fix schematic trace net hover highlighting#219

Open
tonghuaxingdsb wants to merge 5 commits into
tscircuit:mainfrom
tonghuaxingdsb:codex/trace-hover-net-highlighting
Open

Fix schematic trace net hover highlighting#219
tonghuaxingdsb wants to merge 5 commits into
tscircuit:mainfrom
tonghuaxingdsb:codex/trace-hover-net-highlighting

Conversation

@tonghuaxingdsb
Copy link
Copy Markdown

@tonghuaxingdsb tonghuaxingdsb commented Jun 5, 2026

Summary

  • highlight every schematic trace segment connected to the hovered trace's net
  • use source net ids first, with connected source ports as a fallback for older circuit JSON
  • support solver-generated schematic trace ids by resolving solver endpoints back to source ports and connectivity keys
  • keep hover listeners in sync when the generated SVG changes
  • add a dedicated manual verification fixture for same-net trace hover
  • add focused coverage for direct net, port fallback, and solver endpoint grouping

Tests

  • bun test tests/use-highlight-connected-traces-on-hover.test.ts
  • bun x biome check lib/hooks/useHighlightConnectedTracesOnHover.ts tests/use-highlight-connected-traces-on-hover.test.ts
  • bun x biome check examples/example21-connected-trace-hover.fixture.tsx
  • bun x tsc --noEmit
  • bun run build
  • git diff --check

/claim tscircuit/tscircuit#1130
Fixes tscircuit/tscircuit#1130

@vercel
Copy link
Copy Markdown

vercel Bot commented Jun 5, 2026

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

Project Deployment Actions Updated (UTC)
schematic-viewer Ready Ready Preview, Comment Jun 5, 2026 1:17pm

Request Review

@tonghuaxingdsb
Copy link
Copy Markdown
Author

/claim tscircuit/tscircuit#1130

@tonghuaxingdsb
Copy link
Copy Markdown
Author

Added a dedicated manual verification fixture: examples/example21-connected-trace-hover.fixture.tsx.

It creates several independent schematic traces connected to net.GND, so the Vercel preview can be used to hover one GND trace and verify the rest of the same-net trace segments highlight together.

Additional local verification after this update:

  • bun x biome check examples/example21-connected-trace-hover.fixture.tsx
  • bun x tsc --noEmit
  • bun run build

@tonghuaxingdsb
Copy link
Copy Markdown
Author

Added a fallback for schematic traces whose source_trace_id is generated by the schematic solver, e.g. solver_R1.1-U1.4.

In those cases the generated schematic trace id does not directly match a source_trace.source_trace_id, so the hook now resolves the solver endpoints back to source ports and groups traces through subcircuit_connectivity_map_key. This makes the same-net hover behavior work for generated schematic routes as well as direct source trace ids.

Additional local verification:

  • bun x biome check lib/hooks/useHighlightConnectedTracesOnHover.ts
  • bun x tsc --noEmit
  • bun run build

@tonghuaxingdsb
Copy link
Copy Markdown
Author

Added focused unit coverage for the trace grouping logic:

  • direct grouping through connected_source_net_ids
  • fallback grouping through connected_source_port_ids
  • solver-generated schematic trace ids such as solver_R1.1-U1.4, resolved through source port connectivity keys

Additional verification:

  • bun test tests/use-highlight-connected-traces-on-hover.test.ts
  • bun x biome check lib/hooks/useHighlightConnectedTracesOnHover.ts tests/use-highlight-connected-traces-on-hover.test.ts
  • bun x tsc --noEmit
  • bun run build
  • git diff --check

@tonghuaxingdsb
Copy link
Copy Markdown
Author

Added a short demo recording for the connected-trace hover behavior:

The recording uses a real mouse move over the rendered SVG path. In the captured run, hovering schematic_trace_1 marks the connected same-net trace group (schematic_trace_1 and schematic_trace_2) with data-schematic-trace-net-hover=true, making the connected traces switch color together.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Change of color on hover for traces are missing

1 participant