Skip to content

refactor(shape): unify circle into ellipse with lockAspect#73

Merged
u8array merged 2 commits into
mainfrom
refactor/unify-ellipse-circle
May 18, 2026
Merged

refactor(shape): unify circle into ellipse with lockAspect#73
u8array merged 2 commits into
mainfrom
refactor/unify-ellipse-circle

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 18, 2026

No description provided.

Circle is no longer a registry type. The unified ellipse carries an
optional lockAspect flag; the parser sets it for ^GC, the transformer
honors it via the registry's uniformScale predicate, and a virtual
palette entry surfaces 'Circle' as sugar for ellipse + lockAspect.

- EllipseProps.lockAspect drives commitTransform and isUniformScale
- ObjectTypeDefinition.uniformScale accepts a per-instance predicate
- ellipse.toZPL collapses to ^GC when width === height
- Parser ^GC handler emits ellipse with lockAspect:true
- Virtual palette entry (Palette/virtualEntries.ts) maps to ellipse
- Store v2->v3 migration rewrites type:'circle' to type:'ellipse'
- Removed circle.tsx, CircleProps, and circle branches in renderers
- Dropped dead circle.* locale keys (kept diameter)
Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request refactors the shape system by consolidating the circle object type into the ellipse type, utilizing a new lockAspect property and a virtual palette entry system to maintain the 'Circle' UI tool. It includes comprehensive updates to the ZPL parser, renderer, and registry, along with a migration path for legacy data. Feedback suggests improving the ZPL parser's ^GC handler to preserve original thickness values when importing filled circles, ensuring consistency with other shape implementations.

Comment thread src/lib/zplParser.ts Outdated
Both handlers reset thickness to a magic 3 when filled, which is
inconsistent with ^GB (which preserves the source value for lossless
round-trips). UI sets sensible defaults when the user toggles filled
off; the parser stays faithful to the source.

Spotted by Gemini on PR #73 (GC only); GE shared the same anti-pattern,
so both are fixed here for consistency with GB.
@u8array u8array merged commit eba48db into main May 18, 2026
2 checks passed
@u8array u8array deleted the refactor/unify-ellipse-circle branch May 18, 2026 16:45
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