From 15c70b16d15ea0e52e73eb505df4c6e3e862fb1c Mon Sep 17 00:00:00 2001 From: ramox81 <184937705+ramox81@users.noreply.github.com> Date: Tue, 13 Oct 2026 15:28:06 +0300 Subject: [PATCH] ULAYERS opens in a drawing without underlays; the ribbon runs ULAYERS Co-Authored-By: Claude Opus 5.5 --- src/app/commands/display.rs | 2 +- src/app/commands/pdf_dialogs.rs | 7 ++----- src/modules/insert/underlay_layers.rs | 2 +- src/ui/window/pdf_dialogs.rs | 10 ++++++++-- 4 files changed, 12 insertions(+), 9 deletions(-) diff --git a/src/app/commands/display.rs b/src/app/commands/display.rs index c48af2cbf..c13ce0a9c 100644 --- a/src/app/commands/display.rs +++ b/src/app/commands/display.rs @@ -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()); diff --git a/src/app/commands/pdf_dialogs.rs b/src/app/commands/pdf_dialogs.rs index 1449afbea..4d7669a30 100644 --- a/src/app/commands/pdf_dialogs.rs +++ b/src/app/commands/pdf_dialogs.rs @@ -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 = 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)) diff --git a/src/modules/insert/underlay_layers.rs b/src/modules/insert/underlay_layers.rs index 59d039ad8..d0b52b061 100644 --- a/src/modules/insert/underlay_layers.rs +++ b/src/modules/insert/underlay_layers.rs @@ -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()), } } diff --git a/src/ui/window/pdf_dialogs.rs b/src/ui/window/pdf_dialogs.rs index a9d83eeff..cc11a8f44 100644 --- a/src/ui/window/pdf_dialogs.rs +++ b/src/ui/window/pdf_dialogs.rs @@ -1037,10 +1037,16 @@ pub fn view_layers<'a>( ) -> Element<'a, Message> { let names: Vec = 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);