Docking: a Properties panel link keeps that panel's open flyout

This commit is contained in:
aiongg
2026-10-24 20:46:59 +00:00
parent 753f3ba04a
commit aa442c9495
+15 -2
View File
@@ -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()
}