forked from 1b-agent/opencadstudio-upstream
fix(extrude): typed height is ignored on web (#1082)
On wasm the canvas holds focus, so a typed value reaches the dynamic Distance field through CommandAppendChar+CommandFinalize — and try_dyn_commit only commits as text when wants_text() && ! point_step_accepts_keywords(), or dyn_commit_as_text(). EXTRUDE's Height step accepts keywords and never overrode dyn_commit_as_text (unlike PRESSPULL and REVOLVE), so the value resolved as an in-plane point whose height is ~0 and silently re-prompted. Commit the Height step as text, matching its siblings; regression test drives the exact web message sequence.
This commit is contained in:
1 parent
a60b52a462
commit
9e4c3837dd
2 files changed
+101
No files matched your search
@@ -472,6 +472,16 @@ impl CadCommand for ExtrudeCommand {
|
||||
fn dyn_live_value(&self, cursor: DVec3) -> Option<f64> {
|
||||
Some((cursor - self.anchor).dot(self.profile_direction?))
|
||||
}
|
||||
// The Height step's dynamic box is a span along the profile normal, not a
|
||||
// point in the drawing plane. Without this, a typed value committed from
|
||||
// the box (the only route on web, where the canvas — not the command
|
||||
// line — holds keyboard focus) is resolved into an in-plane point whose
|
||||
// height projects to ~0 and is silently dropped. `on_text_input` parses
|
||||
// the same string the command-line path would (keywords and
|
||||
// `parse_typed_length`), so both entry routes behave identically (#1082).
|
||||
fn dyn_commit_as_text(&self) -> bool {
|
||||
self.step == ExtrudeStep::Height
|
||||
}
|
||||
fn is_selection_gathering(&self) -> bool {
|
||||
self.step == ExtrudeStep::Pick
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user