forked from 1b-agent/opencadstudio-upstream
Expose Draw Order in the Modify extension
This commit is contained in:
1 parent
7d0c059b30
commit
c56ade3f2e
4 files changed
+42
No files matched your search
@@ -0,0 +1 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="#B4B6B9" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="m2 14 10 6 10-6M2 10l10 6 10-6"/><path stroke="#6DB7ED" d="m2 6 10-5 10 5-10 6Z"/></svg>
|
||||
|
After Width: | Height: | Size: 253 B |
@@ -598,6 +598,10 @@ inventory::submit!(crate::command::CommandRegistration {
|
||||
"DIMSTYLE",
|
||||
"DONATE",
|
||||
"DRAWORDER",
|
||||
"DRAWORDER_FRONT",
|
||||
"DRAWORDER_BACK",
|
||||
"DRAWORDER_ABOVE",
|
||||
"DRAWORDER_UNDER",
|
||||
"DWGPROP",
|
||||
"DWGPROPS",
|
||||
"EATTEXT",
|
||||
|
||||
@@ -941,6 +941,37 @@ impl OpenCADStudio {
|
||||
return Some(Task::none());
|
||||
}
|
||||
|
||||
"DRAWORDER_FRONT" | "DRAWORDER_BACK" | "DRAWORDER_ABOVE" | "DRAWORDER_UNDER" => {
|
||||
let selected: Vec<acadrust::Handle> = self.tabs[i]
|
||||
.scene
|
||||
.selected_entities()
|
||||
.iter()
|
||||
.map(|(h, _)| *h)
|
||||
.collect();
|
||||
if selected.is_empty() {
|
||||
use crate::modules::draw::select::SelectObjectsCommand;
|
||||
let selection = SelectObjectsCommand::plain("DRAWORDER", cmd);
|
||||
self.command_line.push_info(&selection.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(selection));
|
||||
} else if matches!(cmd, "DRAWORDER_ABOVE" | "DRAWORDER_UNDER") {
|
||||
let command = DrawOrderCommand::for_reference_pick(
|
||||
selected,
|
||||
cmd == "DRAWORDER_ABOVE",
|
||||
);
|
||||
self.command_line.push_info(&command.prompt());
|
||||
self.tabs[i].active_cmd = Some(Box::new(command));
|
||||
} else {
|
||||
let primitive = if cmd == "DRAWORDER_FRONT" {
|
||||
"DRAWORDER FRONT"
|
||||
} else {
|
||||
"DRAWORDER BACK"
|
||||
};
|
||||
return Some(self.apply_cmd_result(crate::command::CmdResult::Relaunch(
|
||||
primitive.to_string(),
|
||||
selected,
|
||||
)));
|
||||
}
|
||||
}
|
||||
"DRAWORDER" => {
|
||||
let selected: Vec<acadrust::Handle> = self.tabs[i]
|
||||
.scene
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
Tool {
|
||||
command: "DRAWORDER_FRONT",
|
||||
label: "Draw Order",
|
||||
icon: include_bytes!(concat!(env!("CARGO_MANIFEST_DIR"), "/assets/icons/modify_draworder.svg")),
|
||||
options: &[("DRAWORDER_FRONT", "Bring to Front"), ("DRAWORDER_BACK", "Send to Back"), ("DRAWORDER_ABOVE", "Bring Above Objects"), ("DRAWORDER_UNDER", "Send Under Objects")],
|
||||
}
|
||||
Reference in new issue
Block a user