feat(grip): complete standard grip-shape vocabulary

Existing entity grip definitions already followed the conventional
CAD layout: square at vertices / endpoints, diamond at curve
centres / midpoints, triangle for directional control. Round out
the supported shape vocabulary with the two missing standards so
future entities (polyline straight-segment stretch grips, dimension
parameter grips, …) can pick the right marker without inventing
ad-hoc visuals:

- `GripShape::Rectangle` — direction-aware mid-segment stretch
  handle (wider-than-tall box).
- `GripShape::Circle` — parametric control (radius / dimension
  value).

New `rectangle_grip` / `circle_grip` helpers in `entities::common`
mirror the existing `square_grip` / `diamond_grip` / `triangle_grip`
constructors. `SelectionCanvas::draw` renders the two new variants;
the previously-used Square / Diamond / Triangle paths are
unchanged. Both new variants carry `#[allow(dead_code)]` until an
entity adopts them.
This commit is contained in:
Hakan Seven committed 2026-05-29 01:46:33 +03:00
1 parent 0ec6d77cb1
commit 1e33a9049c
3 files changed
+43 -1

No files matched your search

+11
View File
@@ -423,6 +423,16 @@ impl canvas::Program<Message> for SelectionCanvas {
Point::new(sp.x - h, sp.y - h),
Size::new(h * 2.0, h * 2.0),
),
GripShape::Rectangle => {
// Wider-than-tall box — direction-aware mid-segment
// stretch handle.
let w = h * 1.4;
let t = h * 0.7;
canvas::Path::rectangle(
Point::new(sp.x - w, sp.y - t),
Size::new(w * 2.0, t * 2.0),
)
}
GripShape::Diamond => canvas::Path::new(|b| {
b.move_to(Point::new(sp.x, sp.y - h));
b.line_to(Point::new(sp.x + h, sp.y));
@@ -436,6 +446,7 @@ impl canvas::Program<Message> for SelectionCanvas {
b.line_to(Point::new(sp.x - h, sp.y + h));
b.close();
}),
GripShape::Circle => canvas::Path::circle(sp, h),
};
if grip.is_hot {