Skip to content

Preserve custom symbol proportions with contain fitting and local viewbox (#4698) - #4706

Merged
Abse2001 merged 15 commits into
repro/symbol-containfrom
fix/symbol-contain
Oct 17, 2026
Merged

Abse2001 merged 15 commits into
repro/symbol-containfrom
fix/symbol-contain

Conversation

@Abse2001

@Abse2001 Abse2001 commented Oct 16, 2026 •

Copy link
Copy Markdown
Contributor

Uses published @tscircuit/props@^0.0.704, which includes the symbol props from merged props#942/#943. Both the development dependency and override use the published version.

Stack order: merge repro #4705 first, then retarget this PR to main before merging.

Fixes #4698 with fit="fill" | "contain" | "stretch" and optional viewbox={{ minX, maxX, minY, maxY }} source bounds. Contain scales both axes uniformly; CSS-style fill and explicit stretch use independent scale factors. Existing defaults retain independent scaling and automatic port-inclusive bounds.

Follows Seve’s fit-mode review, min/max viewbox review, and local-symbol-coordinate naming.

The cached bounds property is named schematicSymbolBoundsInSymbolLocalCoordinateSpace in both Symbol.ts and ISymbol.ts, following Seve’s naming review.

The viewbox establishes the local symbol coordinate space (mm, +X right, +Y up). Core translates those min/max bounds into the pre-resize schematic world frame used by child geometry. During width/height sizing the source bounds center maps to the symbol position. Artwork and ports share that transform, including ports outside the source bounds. With no requested width/height, rendering stays unchanged. The sizing transform composes before the rotation in existing PR #4704.

Validation: all five ordinary regressions fail on unchanged core and pass with this fix. The existing all-primitives resize control passes too (6 focused tests total). Full TypeScript checking and the repository dependency guard pass against the installed published props release. Fixtures use round contacts with a cross; the new fit-mode snapshot was rendered and visually inspected. Hosted CI is rerunning for the published dependency update.

Seve’s #2607/#3208 source-geometry and defined-port guidance is followed. Existing merged #4130/#4580 body and routing bounds behavior is preserved. No CI coverage changes.

Stack: repro #4705 → fix #4706. Merge the repro first, then retarget the fix to main.

Fill, stretch, and contain on a round contact

@vercel

vercel Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
tscircuit-core-benchmarks Ready Ready Preview Oct 17, 2026 12:16am UTC

Request Review

@Abse2001 Abse2001 changed the title Preserve custom symbol proportions with opt-in contain sizing (#4698) Preserve custom symbol proportions with contain fitting and local viewbox (#4698) Oct 16, 2026
Comment thread lib/components/primitive-components/Symbol/Symbol.ts Outdated
@Abse2001
Abse2001 marked this pull request as ready for review October 17, 2026 00:15
@Abse2001
Abse2001 merged commit bf79fe5 into repro/symbol-contain Oct 17, 2026
17 checks passed
@Abse2001
Abse2001 deleted the fix/symbol-contain branch October 17, 2026 00:22
Abse2001 added a commit that referenced this pull request Oct 17, 2026
…4705)

* test: reproduce stretched custom symbols with contain sizing

* test: label legacy and uniform sizing in repro snapshots

* test: keep symbol fitting repro on published props

* test: reproduce custom-symbol stretching with a round contact

* test: document round outline and normalize new snapshots

* test: reproduce sizing with a local viewbox instead of a ports flag

* test: remove superseded artwork-bounds fixture

* test: use reviewed viewbox bounds and compare all fit modes

* test: identify fit-mode fixture children

* test: use typed schematic labels for fit modes

* test: assert cached local bounds and the shape bounds preset

* Revert "test: assert cached local bounds and the shape bounds preset"

This reverts commit 8cdffb1.

* Preserve custom symbol proportions with contain fitting and local viewbox (#4698) (#4706)

* fix: preserve custom-symbol proportions with contain fitting

* Keep unreleased props dependency isolated to the draft fix

* test: resolve round-contact snapshot merge conflicts

* test: keep schematic fit-mode labels compatible with JSX props

* refactor: name symbol bounds by their local coordinate space

* refactor: use the requested symbol local coordinate space name

* chore: use published props 0.0.704 for symbol sizing
@tscircuitbot

Copy link
Copy Markdown
Contributor

Thank you for your contribution! 🎉

PR Rating: ⭐
Impact: Tiny

Track your contributions and see the leaderboard at: tscircuit Contribution Tracker


This branch was successfully deployed

1 active deployment
Preview — f6dc0900 Deployed Oct 17, 2026 by vercel[bot]
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.

3 participants