-
Notifications
You must be signed in to change notification settings - Fork 40
feat: Introduce GroupAnchorOffsetOverlay component and example fixture for displaying group anchor hover offsets. #483
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
Conversation
…e for displaying group anchor hover offsets.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
| highlightedPrimitives={highlightedPrimitives} | ||
| /> | ||
| {transform && ( | ||
| <GroupAnchorOffsetOverlay |
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.
why is this inside the MouseElement tracker?
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.
shouldn't it be with the other overlays?
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.
Marking this resolved? Why?
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.
GroupAnchorOffsetOverlay sits inside MouseElementTracker because it needs the tracker’s hover payload (highlighted primitives, mouse coords, container size).
It’s the same pattern one line above with ElementOverlayBox: both overlays rely on that internal hover state, so they live alongside it, while the rest of the overlays, those that only need elements and transform, so they stay in the outer stack. Is this not corrent ??
|
the appearance is good, the overlay code is fine- i think you need to make sure it's toggleable in the view menu, only on by default in "development modes" (similar to group names) and move the overlay component to where the rest of the overlays are to avoid polluting the very important MouseTracker |
| * Finds the anchor marker position at the nearest edge of the group boundary. | ||
| * The anchor marker ("+") is displayed at the group edge closest to the logical anchor point. | ||
| */ | ||
| const findAnchorMarkerPosition = ( |
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.
Make this overlay a directory woth multiple files, put functions into files with their name
| points.push({ x: comp.center.x + halfWidth, y: comp.center.y + halfHeight }) | ||
| } | ||
|
|
||
| return getBoundsFromPoints(points) |
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.
This isnt a good way to calculate a bounding box for a group, try to find a function in circuit JSON util
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.
Or use the group width and height
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.
I couldn't find a function in utils, i will group width and height
seveibar
left a comment
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.
Didnt address my original comments
…; reorganize ToolbarOverlay for better structure
|
Thank you for your contribution! 🎉 PR Rating: ⭐⭐⭐ Track your contributions and see the leaderboard at: tscircuit Contribution Tracker |
This pull request introduces a new overlay feature for PCB group anchor offsets, allowing users to visually measure and display the X and Y distance between a group's anchor point and a hovered component or pad. The overlay is integrated into the mouse tracking system and includes a fixture for demonstration. The main changes are grouped below.
New overlay feature for PCB group anchor offsets:
GroupAnchorOffsetOverlaycomponent, which calculates and renders offset lines and labels from a group's anchor to the hovered component or pad, including visual styling, bounding box calculations, and screen coordinate transformations. (src/components/GroupAnchorOffsetOverlay.tsx)GroupAnchorOffsetOverlayinto the mouse tracking system, passing in highlighted primitives, transformation matrix, and container dimensions. (src/components/MouseElementTracker.tsx) [1] [2] [3] [4]Fixture and demonstration:
group-anchor-hover-offsetfixture to demonstrate the new overlay feature with multiple PCB groups, components, and anchors in different alignments. (src/examples/group-anchor-hover-offset.fixture.tsx)UI and container improvements:
src/components/MouseElementTracker.tsx) [1] [2]These updates provide a clear, interactive way to visualize and measure component offsets relative to group anchors, improving usability for PCB layout tasks.