From 5438ed12d39bf44e5925a6f6ac6b5c2ccaa28526 Mon Sep 17 00:00:00 2001 From: bflatastic Date: Thu, 29 Oct 2026 19:00:25 +0700 Subject: [PATCH] =?UTF-8?q?Fix=20#4542:=20Edit=20=E2=80=BA=20Color=20Setti?= =?UTF-8?q?ngs=E2=80=A6=20and=20Assign=20Profile=E2=80=A6=20show=20the=20S?= =?UTF-8?q?eparations=20Preview=20panel?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The commands opened the panel as an icon column's flyout, but Separations Preview isn't in an icon column, so the dock dropped the request on the next frame and nothing showed. They now show it the way Window › Separations Preview does (in its group, its remembered place, or floating), and leave it showing when it already does. --- crates/ui-egui/src/menus/run.rs | 8 ++++---- crates/ui-egui/src/menus/tests.rs | 14 ++++++++++++++ crates/ui-egui/src/panel_docking.rs | 10 ++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/crates/ui-egui/src/menus/run.rs b/crates/ui-egui/src/menus/run.rs index 206242768..53a5a6ad6 100644 --- a/crates/ui-egui/src/menus/run.rs +++ b/crates/ui-egui/src/menus/run.rs @@ -175,11 +175,11 @@ fn run_ui_part2(app: &mut VectorcraftApp, id: &str, p: &Value) -> Option { - app.ui.open_panel = Some("separations".into()); - app.ui.dock = true; - app.session.execute(id, p).map_err(|e| e.to_string()) + crate::panel_docking::reveal_panel(app, "separations").and_then(|_| app.session.execute(id, p).map_err(|e| e.to_string())) } "view.outline" => flag(&mut app.ui.view.outline), _ => return None, diff --git a/crates/ui-egui/src/menus/tests.rs b/crates/ui-egui/src/menus/tests.rs index 35f711c39..7a23026d2 100644 --- a/crates/ui-egui/src/menus/tests.rs +++ b/crates/ui-egui/src/menus/tests.rs @@ -283,6 +283,20 @@ fn panel_ids_are_case_insensitive_and_labels_work() { app.ui.dock_collapsed = false; } +/// #4542: Edit › Color Settings… and Assign Profile… show the Separations Preview panel, which +/// isn't in an icon column, and leave it showing when it already does. +#[test] +fn color_settings_and_assign_profile_show_the_separations_panel() { + let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); + app.run("file.new", json!({})).unwrap(); + let shown = |app: &VectorcraftApp| checked(app, "window.panel", &json!({"panel": "separations"})).unwrap(); + assert!(!shown(&app)); + for id in ["edit.colorSettings", "edit.colorSettings", "edit.assignProfile"] { + app.run(id, json!({})).unwrap(); + assert!(shown(&app), "{id} shows the panel"); + } +} + #[test] fn saved_views_store_and_restore_the_view() { let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), crate::Services::default()); diff --git a/crates/ui-egui/src/panel_docking.rs b/crates/ui-egui/src/panel_docking.rs index eba97d88f..dfedad31d 100644 --- a/crates/ui-egui/src/panel_docking.rs +++ b/crates/ui-egui/src/panel_docking.rs @@ -345,6 +345,16 @@ fn show_panel(app: &mut VectorcraftApp, params: &Value) -> Result }) } +/// Show `panel` as `window.panel` does, but leave it be when it already shows ([`showing`]): a +/// command that opens a panel to work in (Edit › Color Settings…) never puts it away. +pub(crate) fn reveal_panel(app: &mut VectorcraftApp, panel: &str) -> Result { + if showing(&app.ui, panel) { + app.ui.dock = true; + return Ok(json!({"open": panel})); + } + show_panel(app, &json!({ "panel": panel })) +} + /// `window.collapseDock {collapsed?}`: collapse every dock column to icons, or expand the outer /// one; without `collapsed` it toggles the outer column. pub(crate) fn collapse_dock(app: &mut VectorcraftApp, collapsed: Option) -> Result {