refactor(shape): unify circle into ellipse with lockAspect#73
Merged
Conversation
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)
There was a problem hiding this comment.
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.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.