forked from 1b-agent/opencadstudio-upstream
fix(dynmode): one toggle keeps DYNMODE's sign in step
F12, the drafting dialog and restored settings each re-derived DYNMODE and lost the mode on the way: F12 off set 0, so on came back as 3 even after DYNMODE 1. set_dyn_input now makes off negative (temporarily off) and on restore the stored mode, and the bare query prints the stored value. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
92c00ecbe2
commit
ba8aed4fad
4 files changed
+20
-25
No files matched your search
@@ -1713,14 +1713,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
_ => Err("SETVAR: integer from -3 to 3 required.".into()),
|
||||
},
|
||||
None => {
|
||||
let mode = if self.dyn_input {
|
||||
if self.dyn_mode > 0 { self.dyn_mode } else { 3 }
|
||||
} else {
|
||||
if self.dyn_mode <= 0 { self.dyn_mode } else { 0 }
|
||||
};
|
||||
Ok((format!("DYNMODE = {mode}"), false))
|
||||
}
|
||||
None => Ok((format!("DYNMODE = {}", self.dyn_mode), false)),
|
||||
},
|
||||
"ZOOMWHEEL" => match &value {
|
||||
Some(v) => match parse_bool(v) {
|
||||
@@ -3838,14 +3831,14 @@ mod tests {
|
||||
assert_eq!(app.dyn_mode, 1);
|
||||
assert!(app.dyn_input);
|
||||
|
||||
// F12 / Message::ToggleDynInput synchronization
|
||||
// F12 turns it off temporarily (negative) and restores the mode.
|
||||
let _ = app.update(crate::app::Message::ToggleDynInput);
|
||||
assert!(!app.dyn_input);
|
||||
assert_eq!(app.dyn_mode, 0);
|
||||
assert_eq!(app.dyn_mode, -1);
|
||||
|
||||
let _ = app.update(crate::app::Message::ToggleDynInput);
|
||||
assert!(app.dyn_input);
|
||||
assert_eq!(app.dyn_mode, 3);
|
||||
assert_eq!(app.dyn_mode, 1);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user