forked from 1b-agent/opencadstudio-upstream
ULAYERS opens in a drawing without underlays; the ribbon runs ULAYERS
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
b1d4c9bd9b
commit
15c70b16d1
4 files changed
+12
-9
No files matched your search
@@ -2051,7 +2051,7 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
"UNDERLAYLAYERS" | "ULAYERS" => self.open_underlay_layers_dialog(i),
|
||||
"ULAYERS" => self.open_underlay_layers_dialog(i),
|
||||
"RECAP" | "SYNCPVIEWPORTS" => {
|
||||
self.command_line
|
||||
.push_info(crate::tf!("{cmd}: not yet implemented.").as_ref());
|
||||
|
||||
@@ -289,7 +289,8 @@ impl OpenCADStudio {
|
||||
}
|
||||
}
|
||||
|
||||
/// ULAYERS: every underlay of the drawing, the selected one first shown.
|
||||
/// ULAYERS: every underlay of the drawing, the selected one first shown
|
||||
/// (none: an empty dialog).
|
||||
pub(in crate::app) fn open_underlay_layers_dialog(&mut self, i: usize) {
|
||||
let document = &self.tabs[i].scene.document;
|
||||
let selected: Vec<codec::Handle> = self.tabs[i]
|
||||
@@ -329,10 +330,6 @@ impl OpenCADStudio {
|
||||
hidden: crate::scene::model::pdf_layers::hidden_layers(u),
|
||||
});
|
||||
}
|
||||
if targets.is_empty() {
|
||||
self.command_line.push_error("No underlays found.");
|
||||
return;
|
||||
}
|
||||
let current = targets
|
||||
.iter()
|
||||
.position(|t| selected.contains(&t.handle))
|
||||
|
||||
@@ -6,6 +6,6 @@ pub fn tool() -> ToolDef {
|
||||
id: "UNDERLAYLAYERS",
|
||||
label: "Underlay\nLayers",
|
||||
icon: ICON,
|
||||
event: ModuleEvent::Command("UNDERLAYLAYERS".to_string()),
|
||||
event: ModuleEvent::Command("ULAYERS".to_string()),
|
||||
}
|
||||
}
|
||||
@@ -1037,10 +1037,16 @@ pub fn view_layers<'a>(
|
||||
) -> Element<'a, Message> {
|
||||
let names: Vec<String> = state.targets.iter().map(|t| t.name.clone()).collect();
|
||||
let target = state.targets.get(state.current);
|
||||
let has_underlays = !names.is_empty();
|
||||
let underlay = pick_list(target.map(|t| t.name.clone()), names, |n: &String| {
|
||||
n.clone()
|
||||
})
|
||||
.on_select(|n| msg(PdfDialogMsg::LayersUnderlay(n)))
|
||||
});
|
||||
// No underlays: the list stays empty and disabled.
|
||||
let underlay = if has_underlays {
|
||||
underlay.on_select(|n| msg(PdfDialogMsg::LayersUnderlay(n)))
|
||||
} else {
|
||||
underlay
|
||||
}
|
||||
.text_size(12)
|
||||
.padding([5, 8])
|
||||
.width(Fill);
|
||||
|
||||
Reference in new issue
Block a user