feat: highlight all same-net traces on hover#165
Open
makaiachildress-web wants to merge 1 commit intotscircuit:mainfrom
Open
feat: highlight all same-net traces on hover#165makaiachildress-web wants to merge 1 commit intotscircuit:mainfrom
makaiachildress-web wants to merge 1 commit intotscircuit:mainfrom
Conversation
Add useTraceHoverHighlight hook that highlights every trace in the same net when hovering over any trace in the schematic viewer. Net grouping uses two strategies: 1. subcircuit_connectivity_map_key when present on schematic traces 2. BFS over shared source ports as fallback for traces without the key The hook disables the default per-trace :hover CSS from circuit-to-svg to prevent double highlighting, and uses precomputed group keys to avoid flicker when moving between traces in the same net. Fixes tscircuit/tscircuit#1130 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
useTraceHoverHighlighthook that highlights all traces in the same net when hovering over any tracesubcircuit_connectivity_map_key(primary) with BFS over sharedconnected_source_port_idsas fallback:hoverCSS from circuit-to-svg to prevent double highlightingFixes tscircuit/tscircuit#1130
/claim #1130
How it works
buildNetGroups()precomputes net membership for every schematic trace:subcircuit_connectivity_map_keysource_trace->connected_source_port_idsto find all source traces on the same net, then maps back to schematic trace IDspointermove, finds the hovered trace viaElement.closest(), looks up its net group, and setsstroketo#1e90ffon all paths in that grouppointerleave, restores original stroke colors.trace:hover { filter: invert(1) }and the:has()-based net hover rules from circuit-to-svgTest plan
Files changed
lib/hooks/useTraceHoverHighlight.ts- New hook with net grouping and hover logiclib/components/SchematicViewer.tsx- Import and call the hook🤖 Generated with Claude Code