Skip to content

fix: manualEdits position double-counts parent group's anchor (#2281)#2402

Closed
sagarmaurya64-ai wants to merge 1 commit into
tscircuit:mainfrom
sagarmaurya64-ai:fix/manual-placement-double-counting-2281
Closed

fix: manualEdits position double-counts parent group's anchor (#2281)#2402
sagarmaurya64-ai wants to merge 1 commit into
tscircuit:mainfrom
sagarmaurya64-ai:fix/manual-placement-double-counting-2281

Conversation

@sagarmaurya64-ai

Copy link
Copy Markdown

This PR resolves #2281 where manual placement coordinates inside a positioned group or translated subcircuit were double-counting the parent group's/subcircuit's translation.

Cause

In PrimitiveComponent.ts, manualPlacement coordinates (retrieved via getSubcircuit()._getPcbManualPlacementForComponent(this)) are already subcircuit-absolute (meaning the subcircuit's global transform has already been pre-multiplied).
However, _computePcbGlobalTransformBeforeLayout() composed this with this.parent?._computePcbGlobalTransformBeforeLayout(), adding the parent's translation offset a second time.

Fix

Composed the manual placement coordinate with only the parent's global rotation (extracted using decomposeTSR on the parent global transform), rather than the entire parent global transform.

Testing

  • Created a standard unit test file tests/repro-2281.test.tsx verifying the positioning offset behaves correctly both in plain positioned groups and in rotated parent groups.

@vercel

vercel Bot commented Jun 7, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
tscircuit-core-benchmarks Ready Ready Preview, Comment Jun 7, 2026 9:54am

Request Review

@github-actions

Copy link
Copy Markdown

This PR has been automatically marked as stale because it has had no recent activity. It will be closed if no further activity occurs.

@github-actions

Copy link
Copy Markdown

This PR was closed because it has been inactive for 1 day since being marked as stale.

@github-actions github-actions Bot closed this Jun 11, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

manualEdits position double-counts the parent group's anchor for components inside positioned regions

1 participant