forked from 1b-agent/opencadstudio-upstream
feat: complete freehand sketch workflow
Co-authored-by: ramox81 <184937705+ramox81@users.noreply.github.com>
This commit is contained in:
commit
464971969c
32 files changed
+926
-113
No files matched your search
@@ -642,6 +642,26 @@ impl OpenCADStudio {
|
||||
/// Pure-selection commands (SELECTALL, QSELECT, …) run without an active
|
||||
/// command, so `was_active` is false and their selection is preserved.
|
||||
pub(super) fn apply_cmd_result(&mut self, result: CmdResult) -> Task<Message> {
|
||||
let settings = self.tabs[self.active_tab]
|
||||
.active_cmd
|
||||
.as_ref()
|
||||
.and_then(|command| command.sketch_settings());
|
||||
if let Some((sketch_type, increment, tolerance)) = settings {
|
||||
let tab = &mut self.tabs[self.active_tab];
|
||||
let changed = tab.scene.document.header.sketch_type != sketch_type
|
||||
|| (tab.scene.document.header.sketch_increment - increment).abs() > f64::EPSILON
|
||||
|| (tab.scene.document.header.sketch_tolerance - tolerance).abs()
|
||||
> f64::EPSILON;
|
||||
if changed {
|
||||
crate::io::set_sketch_settings(
|
||||
&mut tab.scene.document,
|
||||
sketch_type,
|
||||
increment,
|
||||
tolerance,
|
||||
);
|
||||
tab.dirty = true;
|
||||
}
|
||||
}
|
||||
let was_active = self.tabs[self.active_tab].active_cmd.is_some();
|
||||
let preserve_selection =
|
||||
matches!(result, CmdResult::Relaunch(..) | CmdResult::Dispatch(..));
|
||||
@@ -785,6 +805,7 @@ impl OpenCADStudio {
|
||||
self.commit_entity(entity);
|
||||
}
|
||||
self.tabs[i].dirty = true;
|
||||
self.tabs[i].scene.clear_preview_wire();
|
||||
let prompt = self.tabs[i].active_cmd.as_ref().map(|c| c.prompt());
|
||||
if let Some(p) = prompt {
|
||||
self.command_line.push_info(&p);
|
||||
|
||||
Reference in new issue
Block a user