From aa442c9495fcdd62d02f074b352ab8d3da445f45 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 24 Oct 2026 20:46:59 +0000 Subject: [PATCH] Docking: a Properties panel link keeps that panel's open flyout --- crates/ui-egui/src/panels/properties.rs | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/panels/properties.rs b/crates/ui-egui/src/panels/properties.rs index 21d6df50b..40f4f766e 100644 --- a/crates/ui-egui/src/panels/properties.rs +++ b/crates/ui-egui/src/panels/properties.rs @@ -16,9 +16,12 @@ use crate::widgets::{ }; use crate::{DesignApp, icons}; -/// A link to another panel: `window.panel` shows it in the docking layout. +/// A link to another panel: `window.panel` shows it in the docking layout. An open flyout of +/// that panel stays: `window.panel` would close it. fn show_panel(app: &mut DesignApp, panel: &str) { - let _ = app.run("window.panel", json!({"panel": panel})); + if app.ui.docking_flyout.as_deref() != Some(panel) { + let _ = app.run("window.panel", json!({"panel": panel})); + } } fn units(app: &DesignApp) -> Unit { @@ -3169,6 +3172,16 @@ mod tests { use super::*; + /// A link to a panel whose flyout is open leaves the flyout open. + #[test] + fn a_panel_link_keeps_its_open_flyout() { + let mut app = DesignApp::new(designcraft_engine::Session::new(), crate::Services::default()); + show_panel(&mut app, "stroke"); + assert_eq!(app.ui.docking_flyout.as_deref(), Some("stroke")); + show_panel(&mut app, "stroke"); + assert!(crate::panel_docking::showing(&app, "stroke")); + } + fn language(app: &mut DesignApp) -> Value { text_attrs(app).unwrap()["chars"]["language"].clone() }