-
Notifications
You must be signed in to change notification settings - Fork 25
implement highlight for connected trace when hovering over trace with mouse #118
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
implement highlight for connected trace when hovering over trace with mouse #118
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
lib/hooks/useSubTraceHover.ts
Outdated
| /** | ||
| * Optimized trace highlighting using CSS classes and circuit-to-svg metadata | ||
| */ | ||
| export const useSubTraceHover = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| export const useSubTraceHover = ({ | |
| export const useConnectedTracesHoverHighlighting = ({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good, only minor comments
Thanks ! Modifications done |
|
@JrmyDev seems now there's a formatting issue (should be caught in CI, but that's a different issue) |
|
Hmm seems my vscode auto applied on save... will rollback and apply modification only |
|
@seveibar this implementation doesn't work, I'm diving into the connectivity issue which has to be fixed first |
dbf2264 to
70b8eb8
Compare
|
@ShiboSoftwareDev it seems he's just using subcircuit_connectivity_key to determine if traces are connected. AFAIK that is a stable approach, even as we fix other bugs. It could even help fix other bugs
|
|
@seveibar check the deployment |
Kapture.2025-09-03.at.13.08.29.mp4ahh yea you're right, this doesn't work, must be a flaw in the logic |
renaming file and const
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some kind of flaw in the logic, see video in comment
correct, might be an hovering issue... will dive |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
its completed in circuit-to-svg

This PR implements the trace hover highlighting feature that allows users to visualize electrical connectivity in schematic diagrams. When hovering over any trace, all electrically connected traces in the same net are highlighted, making it easier to understand circuit topology and debug routing issues.
✨ Features Implemented
Core Functionality
✅ Hover Detection: Automatically detects when user hovers over schematic traces
✅ Connectivity Analysis: Uses circuit JSON metadata to find electrically connected traces
✅ Visual Highlighting: Applies CSS-based highlighting with filter: invert(1) to match existing hover behavior
✅ Performance Optimized: CSS-only approach with no SVG manipulation
✅ Clean Integration: Minimal changes to existing codebase
Technical Highlights
✅ MutationObserver: Reliable detection of SVG loading for proper timing
✅ Electrical Accuracy: Uses
subcircuit_connectivity_map_keyfor precise connectivity detection✅ Graceful Fallbacks: Handles edge cases and ID mismatches robustly
✅ Memory Management: Proper cleanup of event listeners and timeouts
New Files Created:
useSubTraceHover.tsMain React hook for trace hover functionalitytrace-connectivity.tsElectrical connectivity detection logictrace-highlighting-styles.tsCSS injection for highlighting stylesexample13-trace-hover-highlighting-demo.fixture.tsxDemo circuit showcasing the featureFiles Modified
Minimal Changes Made:
SchematicViewer.tsxAdded 2 lines:import { useSubTraceHover } from "lib/hooks/useSubTraceHover"[useSubTraceHover({ svgDivRef, circuitJson, enabled: true })]🏗️ Architecture
Clean Separation of Concerns:
Key Design Decisions:
/claim #117
Enregistrement.de.l.ecran.2025-09-03.a.14.58.13.mov