feat(draw): add fluid tangent arc, circle, and line construction with ellipse support

This commit is contained in:
yztink committed 2026-09-28 01:56:03 -07:00
1 parent 7c0af700e8
commit 92fa661065
11 files changed
+2750 -212

No files matched your search

+18 -1
View File
@@ -255,12 +255,19 @@ pub enum EntityTransform {
// ── Tangent object ─────────────────────────────────────────────────────────
/// Geometric representation of a tangent-snap target.
#[derive(Clone, Copy, Debug)]
#[derive(Clone, Copy, Debug, PartialEq)]
pub enum TangentObject {
/// Infinite line through two world-space XZ-plane points.
Line { p1: DVec3, p2: DVec3 },
/// Circle in the world XY plane.
Circle { center: DVec3, radius: f64 },
/// Planar ellipse in world space.
Ellipse {
center: DVec3,
major_axis: DVec3,
normal: DVec3,
minor_axis_ratio: f64,
},
}
/// One unit of input to the active command's step machine.
@@ -2728,6 +2735,16 @@ pub trait CadCommand: Send {
self.on_mouse_move(pt).into_iter().collect()
}
/// Called on every mouse-move with optional live tangent snap target under the cursor.
/// Default: forwards to `on_preview_wires(pt)`.
fn on_preview_wires_with_tangent(
&mut self,
pt: DVec3,
_tangent: Option<TangentObject>,
) -> Vec<WireModel> {
self.on_preview_wires(pt)
}
/// Source entities replaced by the current live preview. The host removes
/// these from the resident render until the command commits or cancels.
/// Commands such as COPY keep their sources visible and use the default.