Skip to content

feat: highlight all same-net traces on hover#173

Open
LuSrodri wants to merge 3 commits intotscircuit:mainfrom
LuSrodri:feat/trace-hover-highlight-1130
Open

feat: highlight all same-net traces on hover#173
LuSrodri wants to merge 3 commits intotscircuit:mainfrom
LuSrodri:feat/trace-hover-highlight-1130

Conversation

@LuSrodri
Copy link
Copy Markdown

@LuSrodri LuSrodri commented Apr 15, 2026

Summary

When hovering over any schematic trace, all traces that belong to the same electrical net are now highlighted in orange (#f5a623).

Implementation

New file: lib/hooks/useSchematicTraceHoverHighlight.ts

  • Builds a net-group map from circuitJson using union-find over source_trace.connected_source_port_ids
  • Attaches mouseover/mouseout event listeners to the SVG div
  • On hover over [data-schematic-trace-id], looks up the hovered trace's net group and paints all group members with the highlight color
  • Restores original stroke values on mouseout
  • Falls back to highlighting only the hovered trace if net grouping is unavailable
  • Fully cleaned up on unmount / circuitJsonKey change

Modified: lib/components/SchematicViewer.tsx

  • Import and call useSchematicTraceHoverHighlight({ svgDivRef, circuitJson, circuitJsonKey })
  • Placed alongside the other SVG-mutation hooks (useChangeSchematicTracesForMovedComponents, useSchematicGroupsOverlay)

How it works

The hook uses the same DOM query pattern as useChangeSchematicTracesForMovedComponents ([data-schematic-trace-id] selectors), so it is compatible with any circuit-to-svg output version that emits those attributes.

/claim #1130

@vercel
Copy link
Copy Markdown

vercel Bot commented Apr 15, 2026

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

Project Deployment Actions Updated (UTC)
schematic-viewer Ready Ready Preview, Comment Apr 15, 2026 1:30am

Request Review

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.

1 participant