add hover color highlighting for schematic traces#174
Open
lyfher wants to merge 1 commit intotscircuit:mainfrom
Open
add hover color highlighting for schematic traces#174lyfher wants to merge 1 commit intotscircuit:mainfrom
lyfher wants to merge 1 commit intotscircuit:mainfrom
Conversation
When the pointer enters a schematic trace the matching <g> elements (base layer and overlay layer) receive the `trace-hover` CSS class, which changes the stroke to #3399ff and updates junction fill to match. A MutationObserver re-attaches listeners after every SVG re-render (e.g. triggered by window resize) so highlighting stays functional across layout changes. Closes tscircuit/tscircuit#1130 Co-Authored-By: Claude Sonnet 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.
Fixes tscircuit/tscircuit#1130
Hovering over a schematic trace now changes its stroke color to
#3399ffand highlights junction dots to match.How it works
useTraceHoverHighlightingattachesmouseenter/mouseleavelisteners to everyg[data-schematic-trace-id]element in the SVGtrace-hoverCSS class to both the base and overlay<g>groups that share the samedata-schematic-trace-id.trace-hoverrule changes the stroke color and junction fill to#3399ffMutationObserverre-attaches listeners after every SVG re-render (e.g. window resize)Changes
lib/hooks/useTraceHoverHighlighting.ts— new hook (80 lines)lib/components/SchematicViewer.tsx— import hook + add CSS style tag