feat(command): clickable option buttons in the command line (#304)

Commands now expose their step options as clickable buttons rendered
inline beside the command-line prompt, so options need not be typed.

Adds a CmdOption/options() API to CadCommand: each command returns the
options for its current step; the command line renders them as
uppercase buttons and a click feeds the keyword to the command exactly
as if typed (an empty keyword submits like Enter).

Construction commands become "central" — CIRCLE offers [3P/2P/TTR/TTT/
DIAMETER], ELLIPSE [ARC/AXIS], ARC [SCE/SCA/SEA/SER/CSA/3P], RECTANGLE
[ROTATION/CENTER], POLYGON [CIRCUMSCRIBED/EDGE] — each keyword hands off
to the existing dedicated variant command via CmdResult::Dispatch,
instead of the variants only being reachable as isolated commands.

Migrates the existing bracketed-option prompts (PLINE, PEDIT, SPLINE,
SCALE, FILLET, CHAMFER, HATCH, GRADIENT, SOLID, POINT, RAY, XLINE, TRIM,
EXTEND) to the same button API and strips the option text from the
prompt strings, keeping value/coordinate hints. PEDIT's Width option
now enters a value sub-step so the button acts on click.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Hakan SevenandClaude Opus 4.8 committed 2026-07-08 00:16:59 +03:00
1 parent efa4bdd5e1
commit 31ac5372d6
18 files changed
+457 -28

No files matched your search

+10 -1
View File
@@ -82,7 +82,7 @@ impl CadCommand for ScaleCommand {
self.handles.len()
),
Step::Factor { .. } => format!(
"SCALE Specify scale factor or [Reference] <{:.4}>:",
"SCALE Specify scale factor <{:.4}>:",
self.default_factor
),
Step::RefLen { .. } => {
@@ -95,6 +95,15 @@ impl CadCommand for ScaleCommand {
}
}
fn options(&self) -> Vec<crate::command::CmdOption> {
use crate::command::CmdOption;
match &self.step {
// The reference-scaling keyword is only offered at the factor step.
Step::Factor { .. } => vec![CmdOption::new("Reference", "R")],
_ => vec![],
}
}
fn on_point(&mut self, pt: DVec3) -> CmdResult {
match &self.step {
Step::Base => {