forked from 1b-agent/opencadstudio-upstream
feat(offset): start from the pre-selected objects
OFFSET now follows the pick-first flow of MOVE / COPY (#422): with offsettable objects already selected it skips the pick step and goes straight to the distance / side step, offsetting every selected object toward the clicked side — each through the cursor point in through mode, all by the typed magnitude once one is locked. Preview covers every target and a multi-object result commits as one undo step; with nothing selected the command gathers a pick exactly as before. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
1 parent
554921c66f
commit
33864bace6
2 files changed
+96
-45
No files matched your search
+15
-2
@@ -943,7 +943,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
|
||||
"OFFSET" => {
|
||||
use crate::modules::draw::modify::offset::OffsetCommand;
|
||||
use crate::modules::draw::modify::offset::{is_offsettable, OffsetCommand};
|
||||
let all_entities: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.entity_wires()
|
||||
@@ -953,7 +953,20 @@ impl OpenCADStudio {
|
||||
self.tabs[i].scene.document.get_entity(h).cloned()
|
||||
})
|
||||
.collect();
|
||||
let new_cmd = OffsetCommand::new(all_entities);
|
||||
// Pick-first (#422): with offsettable objects already selected,
|
||||
// skip the pick step and go straight to distance / side.
|
||||
let preselected: Vec<_> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
.into_iter()
|
||||
.map(|(_, e)| e.clone())
|
||||
.filter(is_offsettable)
|
||||
.collect();
|
||||
let new_cmd = if preselected.is_empty() {
|
||||
OffsetCommand::new(all_entities)
|
||||
} else {
|
||||
OffsetCommand::with_selection(all_entities, preselected)
|
||||
};
|
||||
self.command_line.push_info(&new_cmd.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(new_cmd));
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user