Skip to content

fix: support polygon pads when applying footprint origins - #868

Open
gaboxdev wants to merge 1 commit into
tscircuit:mainfrom
gaboxdev:fix/polygon-pad-origins
Open

gaboxdev wants to merge 1 commit into
tscircuit:mainfrom
gaboxdev:fix/polygon-pad-origins

Conversation

@gaboxdev

@gaboxdev gaboxdev commented Sep 8, 2026

Copy link
Copy Markdown

Changing the origin of a footprint containing polygon pads currently corrupts its coordinates: fp.string("sot89_3").origin("bottomleft").circuitJson() produces NaN positions because polygon pads have points instead of x, y, width, and height. With origin("pin1"), a rectangular first pad moves correctly but the polygon stays behind; a polygon first pad also produces invalid offsets.

Include polygon vertices in the copper bounds, use the polygon bounding-box center for a polygon pin1 (consistent with applyPin1Location), and translate polygon points together with the other elements. Replace the point array rather than mutating shared generator constants.

Add four regression tests with SVG snapshots covering SOT89 bottom-left, center and pin1 origins, DFN polygon pin1, alignment with silkscreen, and repeated generation without shared-point contamination.

Validation on Bun 1.4.2, macOS arm64, base d0d2ee19b261781af97d405400eb88402598ac92: the four regression tests fail before the fix; all 568 tests pass after it. ESM/declaration build, formatting and diff whitespace checks pass. Rendered SOT89 and DFN snapshots were visually inspected.

Related: #867 addresses courtyard outline translation. This change addresses polygon copper pads and leaves that separately proposed change to its author.

Implementation and validation were performed with OpenAI Codex.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant