Skip to content

feat: highlight all connected traces on hover#157

Open
bimakw wants to merge 1 commit intotscircuit:mainfrom
bimakw:fix/highlight-connected-traces-on-hover
Open

feat: highlight all connected traces on hover#157
bimakw wants to merge 1 commit intotscircuit:mainfrom
bimakw:fix/highlight-connected-traces-on-hover

Conversation

@bimakw
Copy link

@bimakw bimakw commented Jan 16, 2026

/attempt tscircuit/tscircuit#1130

Summary

  • Added useHighlightConnectedTracesOnHover hook that highlights all connected traces in the same net when hovering over any trace
  • When hovering a trace, all traces sharing the same source_trace_id are highlighted together

Implementation

  • New hook listens for mouseover/mouseout events on trace elements
  • Finds connected traces via source_trace_id in CircuitJson
  • Applies highlight color (#ff6b6b) and increased stroke width (7px)
  • Handles edge cases: moving between connected traces, SVG changes

Test plan

  • Hover over a trace - all connected traces should highlight
  • Move mouse between connected traces - highlight should persist
  • Move mouse away - all traces should return to original color

Fixes tscircuit/tscircuit#1130

/claim tscircuit/tscircuit#1130

When hovering over a trace, all traces connected to the same net
(sharing the same source_trace_id) are now highlighted together.

This creates a new useHighlightConnectedTracesOnHover hook that:
- Listens for mouseover/mouseout events on trace elements
- Finds all connected traces via source_trace_id in CircuitJson
- Applies highlight color (#ff6b6b) and increased stroke width
- Properly handles edge cases like moving between connected traces

Fixes tscircuit/tscircuit#1130
@vercel
Copy link

vercel bot commented Jan 16, 2026

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

Project Deployment Review Updated (UTC)
schematic-viewer Ready Ready Preview, Comment Jan 16, 2026 8:11am

Review with Vercel Agent

Copy link
Contributor

@rushabhcodes rushabhcodes left a comment

Choose a reason for hiding this comment

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

Use the repro give https://tscircuit.com/MrPicklePinosaur/tscircuit_demo#schematic to demonstrate your fix

@bimakw
Copy link
Author

bimakw commented Jan 16, 2026

@rushabhcodes Here's the demo:

Before hover (default green):
image

After hover (highlighted red):
image

All connected traces in the same net are highlighted using source_trace_id matching.

Preview: https://schematic-viewer-git-fork-bimakw-fix-highlight-b8a6ec-tscircuit.vercel.app
Fixture: example1-resistor-and-capacitor


Note: I tested on the Vercel preview since the production site
(tscircuit.com/MrPicklePinosaur/tscircuit_demo) uses the current
released version without my fix.

The preview demonstrates the same hover behavior on equivalent circuit components.

Preview: https://schematic-viewer-git-fork-bimakw-fix-highlight-b8a6ec-tscircuit.vercel.app
Fixture: example1-resistor-and-capacitor


@rushabhcodes
Copy link
Contributor

see example 9, it is not working

@bimakw
Copy link
Author

bimakw commented Jan 17, 2026

@rushabhcodes I tested example9 thoroughly - it's working correctly:

Default state (no hover):
Screenshot 2026-01-17 at 2 27 57 PM

Hovering different traces - all highlight correctly:

Screenshot 2026-01-17 at 2 27 48 PM Screenshot 2026-01-17 at 2 27 37 PM Screenshot 2026-01-17 at 2 27 28 PM Screenshot 2026-01-17 at 2 27 19 PM

All traces in example9 respond to hover highlighting. Could you share a screen recording or specify which trace isn't working for you?

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

2 participants