forked from 1b-agent/opencadstudio-upstream
feat(dynamic-input): per-step specs for rectangle, polygon and ellipse
Extend the DynSpec coverage and add the guides those commands need: - Rectangle: two-corner enters width/height as unsigned magnitudes (the sign follows the cursor side, like the angle entry), drawn with the rectangle as the guide; rotated rectangle's height is a single distance measured square to the base edge (dimension line offset off the edge with extension lines); centre rectangle shows half-width/half-height. - Polygon: inscribed/circumscribed vertex step shows radius + rotation. - Ellipse: minor-axis step (all three modes) measures the half-length perpendicular to the major axis and draws that semi-axis from the centre; angle steps anchor their arc at the centre. Adds DynGuide::Perp / PerpDim (perpendicular measure to a reference line) and DynSpec::ref_point, plus Width/Height role handling (unsigned display, cursor-signed commit) and diameter value scaling. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
b0ee1c39bd
commit
e31dbcb5c4
8 files changed
+296
-10
No files matched your search
+15
-2
@@ -278,7 +278,8 @@ pub enum DynRole {
|
||||
Height,
|
||||
/// Typed-only scale factor.
|
||||
Factor,
|
||||
/// Typed-only integer count.
|
||||
/// Typed-only integer count. Reserved for upcoming command migrations.
|
||||
#[allow(dead_code)]
|
||||
Count,
|
||||
}
|
||||
|
||||
@@ -321,12 +322,21 @@ pub enum DynGuide {
|
||||
Radius,
|
||||
/// The two rectangle sides (width × height) from the anchor corner.
|
||||
RectSides,
|
||||
/// A line from the anchor, perpendicular to the reference line (anchor →
|
||||
/// `DynSpec::ref_point`), reaching the cursor's perpendicular offset — the
|
||||
/// measured semi-axis (ellipse minor). The value is that offset.
|
||||
Perp,
|
||||
/// Like `Perp` but drawn as a dimension: the measured segment is offset off
|
||||
/// the edge with extension lines back to its endpoints (rectangle height).
|
||||
PerpDim,
|
||||
}
|
||||
|
||||
/// Where a step's values are measured from.
|
||||
#[derive(Clone, Copy, PartialEq, Debug)]
|
||||
pub enum DynAnchor {
|
||||
/// The previous committed point (`App::last_point`).
|
||||
/// The previous committed point (`App::last_point`). Reserved — current
|
||||
/// specs pass the anchor explicitly via `Point`.
|
||||
#[allow(dead_code)]
|
||||
LastPoint,
|
||||
/// An explicit world point.
|
||||
Point(Vec3),
|
||||
@@ -352,6 +362,9 @@ pub struct DynSpec {
|
||||
pub anchor: DynAnchor,
|
||||
pub fields: Vec<DynFieldSpec>,
|
||||
pub guide: DynGuide,
|
||||
/// Far end of a reference line through `anchor` (only used by
|
||||
/// [`DynGuide::Perp`]); `None` otherwise.
|
||||
pub ref_point: Option<Vec3>,
|
||||
}
|
||||
|
||||
// ── Trait ─────────────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user