fix: manual edits inside positioned group should use absolute manual center#2565
Open
r-audio wants to merge 1 commit into
Open
fix: manual edits inside positioned group should use absolute manual center#2565r-audio wants to merge 1 commit into
r-audio wants to merge 1 commit into
Conversation
…center _getPcbManualPlacementForComponent() already returns the absolute PCB center, so composing it with the parent group's transform double-counted the parent offset. This caused components placed via manualEdits inside a group with pcbX/pcbY to land at parent_offset + manual_placement instead of the intended absolute position. Fixes tscircuit#2281
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
|
This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs. |
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.
Problem
When a component is placed via
manualEditswithrelative_to: "group_center"inside a<group>that haspcbX/pcbYoffsets, the parent group's transform is applied twice — once inside_getPcbManualPlacementForComponent()(which already returns the absolute PCB center) and again when composing withthis.parent?._computePcbGlobalTransformBeforeLayout().This causes components to land at
parent_offset + manual_placementinstead of the intended absolute position.Reproduction: placing a capacitor at
{ x: 11.4, y: 4.3 }inside a group withpcbX=16yieldsx=27.4instead ofx=11.4.Fix
Remove the parent transform composition from
_computePcbGlobalTransformBeforeLayout()when manual placement is active. The manual placement already returns absolute coordinates, so the parent transform should not be re-applied.Verification
Result: 9 pass, 0 fail (1 snapshot, 22 expect() calls)
New test
manual layout edits inside positioned group use absolute manual centerverifies the fix directly by asserting the capacitor lands at the intended(11.4, 4.3)position.Fixes #2281