Make SolveApp::start honour a command's enabled flag, and disable solid.move inside a sketch (#740)
`SolveApp::start` now honours a command's enabled flag, so shortcuts, the command palette and the control channel can't start a disabled command, and Move is disabled while a sketch is open.
This commit is contained in:
1 parent
62a7f903f2
commit
ff609bc320
8 files changed
+132
-4
No files matched your search
@@ -186,6 +186,12 @@ pub fn in_sketch(s: &Session) -> std::result::Result<(), String> {
|
||||
if s.active_sketch.is_some() { Ok(()) } else { Err("no sketch is being edited (Create Sketch or Edit Sketch first)".into()) }
|
||||
}
|
||||
|
||||
/// The mirror of [`in_sketch`], for a command that acts on bodies and has nothing to offer the
|
||||
/// geometry under the cursor while a sketch is open.
|
||||
pub fn not_in_sketch(s: &Session) -> std::result::Result<(), String> {
|
||||
if s.active_sketch.is_none() { Ok(()) } else { Err("a sketch is being edited (this works on bodies: Finish Sketch first)".into()) }
|
||||
}
|
||||
|
||||
/// Every command, in toolbar order.
|
||||
pub fn command_specs() -> Vec<&'static CommandSpec> {
|
||||
let mut v: Vec<&'static CommandSpec> = Vec::new();
|
||||
|
||||
Reference in new issue
Block a user