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 committed 2026-08-04 16:27:03 +03:00
1 parent b744d4bf2d
commit 539d83de47
10 files changed
+421 -59

No files matched your search

+15
View File
@@ -24,10 +24,18 @@ pub struct GripEdit {
pub origin_world: DVec3,
/// Last world-space cursor position (needed for incremental delta on translate drags).
pub last_world: DVec3,
/// How cursor movement modifies the selected grip.
pub mode: GripEditMode,
/// Every hot grip moved by this edit. A normal grip edit contains one target.
pub targets: Vec<GripTarget>,
}
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub enum GripEditMode {
Stretch,
Lengthen,
}
#[derive(Clone, Debug)]
pub struct GripTarget {
pub handle: Handle,
@@ -48,6 +56,7 @@ impl GripEdit {
grip_id,
origin_world: world,
last_world: world,
mode: GripEditMode::Stretch,
targets: vec![GripTarget {
handle,
grip_id,
@@ -56,6 +65,12 @@ impl GripEdit {
}],
}
}
pub fn lengthen(handle: Handle, grip_id: usize, world: DVec3) -> Self {
let mut edit = Self::single(handle, grip_id, false, world);
edit.mode = GripEditMode::Lengthen;
edit
}
}
// ── Screen-space helpers ───────────────────────────────────────────────────