Skip to content

Feature/circle shape#24

Merged
u8array merged 3 commits intomainfrom
feature/circle-shape
May 7, 2026
Merged

Feature/circle shape#24
u8array merged 3 commits intomainfrom
feature/circle-shape

Conversation

@u8array
Copy link
Copy Markdown
Owner

@u8array u8array commented May 7, 2026

No description provided.

u8array added 2 commits May 7, 2026 19:41
A circle is structurally an ellipse with width=height, but enforcing
that constraint manually in the existing ellipse panel is error-prone.
Adds a Circle type with a single diameter prop, a commitTransform that
clamps to the smaller scale axis (so the resized circle stays inside
the user's drag box), and ZPL output that emits ^GE with the diameter
on both axes. Locale keys added in all 32 languages via the existing
add_locale_key.local.py script. Parser is unchanged: imported ^GE
remains an ellipse since ZPL has no separate circle command.
Adds an optional uniformScale flag on ObjectTypeDefinition. When set, the
transformer restricts to corner anchors and forceSquareBox clamps the
resize bbox to the larger of the two axes while pinning the inferred
anchor corner. Visual feedback during drag now matches the uniform
commitTransform applied on release; circle is the first consumer.
forceSquareBox lives in transformerGeometry next to its sibling helpers
and has unit coverage for all four corner anchors.
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 introduces a new 'circle' object type, featuring Konva-based rendering, ZPL generation, and comprehensive localization. It also implements a 'uniformScale' mechanism within the transformer to maintain a 1:1 aspect ratio for specific shapes. The review feedback suggests enhancing the properties panel by clamping diameter and thickness inputs to a minimum of 1 to prevent invalid or invisible object states.

Comment thread src/registry/circle.tsx Outdated
Comment thread src/registry/circle.tsx Outdated
Adds src/lib/inputParse.ts with clampMin and parseIntOrUndef. clampMin
replaces the bare `Number(e.target.value)` pattern in the shape
PropertiesPanels (box, ellipse, circle, line) so an empty or sub-floor
input no longer collapses dimensions to 0. parseIntOrUndef moves out of
PropertiesPanel.tsx into the shared module since it has the same
sanitisation purpose.

Other registries keep their unclamped pattern for now; pulling them
in is independent and can happen organically as files get touched.
@u8array u8array merged commit b8eb2a8 into main May 7, 2026
2 checks passed
@u8array u8array deleted the feature/circle-shape branch May 7, 2026 21:24
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