feat(grips): improve direct editing

Refit arcs from fixed control points and highlight hovered grips.
Let Lengthen preview from the cursor or accept a typed distance.
This commit is contained in:
Hakan Seven 2026-08-04 16:27:03 +03:00
commit 539d83de47
10 changed files with 421 additions and 59 deletions

View file

@ -57,6 +57,17 @@ pub trait Grippable {
) -> Option<&'static str> {
None
}
/// Convert an interactive cursor point into the numeric value consumed by
/// `apply_grip_menu_value`. Actions without a point-driven form return
/// `None`.
fn grip_menu_point_value(
&self,
_grip_id: usize,
_action: GripMenuAction,
_point: glam::DVec3,
) -> Option<f64> {
None
}
}
pub trait PropertyEditable {
@ -163,6 +174,12 @@ pub trait EntityTypeOps {
grip_id: usize,
action: GripMenuAction,
) -> Option<&'static str>;
fn grip_menu_point_value(
&self,
grip_id: usize,
action: GripMenuAction,
point: glam::DVec3,
) -> Option<f64>;
fn apply_grip_menu_value(
&mut self,
grip_id: usize,
@ -405,6 +422,28 @@ impl EntityTypeOps for EntityType {
)
}
fn grip_menu_point_value(
&self,
grip_id: usize,
action: GripMenuAction,
point: glam::DVec3,
) -> Option<f64> {
dispatch!(self,
|e| Grippable::grip_menu_point_value(e, grip_id, action, point),
[
Line, Circle, Arc, Ellipse, LwPolyline, Polyline, Polyline2D,
Polyline3D, Ray, XLine, RasterImage, Wipeout,
AttributeDefinition, AttributeEntity, MLine, Tolerance,
Solid, Solid3D, Region, Body, Surface, Face3D, PolygonMesh,
PolyfaceMesh, Mesh, Table, Point, Spline, Text, MText,
Viewport, Insert, Leader, MultiLeader, Dimension, Hatch,
Underlay, Shape, Ole2Frame, SectionSymbol, ViewBorder,
Extended,
],
_ => None,
)
}
fn apply_grip_menu_value(
&mut self,
grip_id: usize,