Skip to content

Use GraphicsObject shape coordinates and styles in the SVG fallback - #33

Open
ugin-man wants to merge 1 commit into
tscircuit:mainfrom
ugin-man:codex/fix-fallback-shape-geometry
Open

Use GraphicsObject shape coordinates and styles in the SVG fallback#33
ugin-man wants to merge 1 commit into
tscircuit:mainfrom
ugin-man:codex/fix-fallback-shape-geometry

Conversation

@ugin-man

@ugin-man ugin-man commented Sep 7, 2026

Copy link
Copy Markdown

When the interactive renderer falls back to SimpleGraphicsSVG, rectangles and circles are drawn near the origin because the fallback reads top-level x/y fields, while GraphicsObject stores their positions in center. Rectangles also need their half-width and half-height subtracted for SVG's top-left coordinates. The fallback reads different field names for fill and stroke as well.

Use the declared center, fill, and stroke fields, and calculate the viewBox from the same coordinates used to render the shapes.

Validation: all five new rendering regressions fail before the fix. All 27 tests (98 assertions), tsc --noEmit, and bun run build pass after it. Tests cover nonzero centers, rectangles centered at the origin, combined bounds, and shape colors.

Prepared with Codex (Astra) assistance and verified locally.

@vercel

vercel Bot commented Sep 7, 2026

Copy link
Copy Markdown

@ugin-man is attempting to deploy a commit to the tscircuit Team on Vercel.

A member of the Team first needs to authorize it.

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