forked from 1b-agent/opencadstudio-upstream
feat(input): scalar entry via dynamic input
Text-input steps (OFFSET distance, POLYGON sides, radii, counts) were swallowed by the dynamic-input overlay: typed digits landed in the field buffer and Enter committed a point pick, so the value never reached on_text_input (issue #61). Now each text step shows one scalar box whose value routes to on_text_input on commit; non-numeric prompts (names, keywords) keep going to the command line so mixed text like "Bolt12" isn't split. OFFSET reworked: object first, then through-mode by default — the offset follows the cursor at the perpendicular distance to the object. Typing a number locks the magnitude (cursor then only picks the side); a value typed and clicked without Enter is applied before the point pick. The dynamic-input overlay and the command line now show the active step's prompt and hold it until the step completes. Co-Authored-By: Claude Opus 4.8 <[email protected]>
This commit is contained in:
1 parent
c9c6e45793
commit
4b878b88c4
15 files changed
+405
-70
No files matched your search
@@ -232,6 +232,10 @@ pub enum DynField {
|
||||
Distance,
|
||||
/// An angle, shown in degrees, measured from the last point.
|
||||
Angle,
|
||||
/// A typed scalar with no geometric meaning at the cursor — a count
|
||||
/// (number of sides / segments) or any value the command reads purely
|
||||
/// from the keyboard. Shown as a single typed box.
|
||||
Scalar,
|
||||
}
|
||||
|
||||
// ── Trait ─────────────────────────────────────────────────────────────────
|
||||
@@ -379,6 +383,17 @@ pub trait CadCommand: Send {
|
||||
fn dyn_field(&self) -> DynField {
|
||||
DynField::Point
|
||||
}
|
||||
|
||||
/// Live value for the dynamic-input scalar box, derived from the cursor
|
||||
/// world position. Lets a command drive a typed prompt by mouse — e.g.
|
||||
/// OFFSET returns the perpendicular distance from the cursor to the
|
||||
/// object being offset, so moving the cursor fills in the distance.
|
||||
/// Returns `None` when the value can only be typed (a count, or a
|
||||
/// distance with no reference yet). The string the host commits is this
|
||||
/// value formatted; the command's own `on_text_input` parses it back.
|
||||
fn dyn_live_value(&self, _cursor: Vec3) -> Option<f64> {
|
||||
None
|
||||
}
|
||||
}
|
||||
|
||||
// ── Autocomplete registry ─────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user