feat(select): PICKADD/PICKDRAG command-line toggles (#226)
PICKADD 0 = click/box/lasso replaces the selection (Shift toggles), empty click clears; PICKADD 1 (default) keeps today's accumulate. PICKDRAG 1 = press-drag spans a rectangle marquee through the box machinery; PICKDRAG 0 (default) keeps the freeform lasso. Both persist in settings.json. Also re-points the start-page gate test at the start_allowed fn it moved into (#388/389 refactor left it broken). Closes #226 Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
parent
90fd69df06
commit
0c578b03f3
7 changed files with 250 additions and 17 deletions
|
|
@ -290,6 +290,8 @@ inventory::submit!(crate::command::CommandRegistration {
|
|||
// Restore the last-erased objects.
|
||||
"OOPS",
|
||||
// Plan (top) view.
|
||||
"PICKADD",
|
||||
"PICKDRAG",
|
||||
"PLAN",
|
||||
// Current object colour (CECOLOR).
|
||||
"COLOR",
|
||||
|
|
|
|||
|
|
@ -652,6 +652,70 @@ impl OpenCADStudio {
|
|||
}
|
||||
}
|
||||
|
||||
// ── PICKADD / PICKDRAG — selection UX (#226, app settings) ───
|
||||
// Bare form reports; `<name> 0|1` sets and persists. Defaults keep
|
||||
// today's behaviour (PICKADD 1, PICKDRAG 0).
|
||||
"PICKADD" | "PICKDRAG" => {
|
||||
use crate::command::ValuePromptCommand;
|
||||
let (name, prompt) = if cmd == "PICKADD" {
|
||||
("PICKADD", "PICKADD 1 = click adds to selection (default), 0 = click replaces <Enter reports>:")
|
||||
} else {
|
||||
("PICKDRAG", "PICKDRAG 0 = press-drag lassoes (default), 1 = press-drag draws a rectangle <Enter reports>:")
|
||||
};
|
||||
let c = ValuePromptCommand::new(name, prompt);
|
||||
self.command_line.push_info(&c.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(c));
|
||||
}
|
||||
cmd if cmd.starts_with("PICKADD ") || cmd.starts_with("PICKDRAG ") => {
|
||||
let is_add = cmd.starts_with("PICKADD");
|
||||
let arg = cmd.splitn(2, ' ').nth(1).unwrap_or("").trim();
|
||||
if arg.is_empty() {
|
||||
let v = if is_add {
|
||||
u8::from(self.pick_add)
|
||||
} else {
|
||||
u8::from(self.pick_drag_rect)
|
||||
};
|
||||
self.command_line.push_output(&format!(
|
||||
"{} = {v}",
|
||||
if is_add { "PICKADD" } else { "PICKDRAG" }
|
||||
));
|
||||
} else {
|
||||
match arg {
|
||||
"0" | "1" => {
|
||||
let on = arg == "1";
|
||||
if is_add {
|
||||
self.pick_add = on;
|
||||
self.command_line.push_output(&format!(
|
||||
"PICKADD = {} ({})",
|
||||
arg,
|
||||
if on {
|
||||
"click adds to selection"
|
||||
} else {
|
||||
"click replaces selection, Shift toggles"
|
||||
}
|
||||
));
|
||||
} else {
|
||||
self.pick_drag_rect = on;
|
||||
self.command_line.push_output(&format!(
|
||||
"PICKDRAG = {} ({})",
|
||||
arg,
|
||||
if on {
|
||||
"press-drag draws a rectangle"
|
||||
} else {
|
||||
"press-drag lassoes"
|
||||
}
|
||||
));
|
||||
}
|
||||
self.persist_settings_if_changed();
|
||||
}
|
||||
_ => self.command_line.push_error(&format!(
|
||||
"{}: expected 0 or 1.",
|
||||
if is_add { "PICKADD" } else { "PICKDRAG" }
|
||||
)),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// ── SETVAR — read / write system variables ───────────────────
|
||||
// SETVAR <name> → report the value
|
||||
// SETVAR <name> <value> → set it
|
||||
|
|
|
|||
Loading…
Reference in a new issue