Merge pull request #11000 from dotCooCoo/fix/flyout-dialog-popups

Panels: a flyout's popover is its child; drop the flyout dialog tracking
This commit is contained in:
.CooCoo authored and GitHub committed 2026-12-05 18:38:38 -08:00
commit 4d402cecb5
2 files changed
+16 -30

No files matched your search

+1 -29
View File
@@ -21,7 +21,6 @@ use std::sync::Arc;
use craft::behavior::{Axis, DockSide, IconId};
use craft::ui::buttons::IconButton;
use craft::ui::contract::{Bind, BodyCx, PlainData, Props as _, Show as _, SizeLimits, Tracked};
use craft::ui::dialog::DialogId;
use craft::ui::docking::{
ColumnCards, DockCommands, DockConfig, DockEvent, DockGrid, DockPanels, DockScene, DockSizes, DockTo, DragUnit, FloatSpace, GroupAt, HidePanels,
PanelKey, PanelSpec, PanelSpecs, actions as command_actions, move_actions, request_actions,
@@ -74,9 +73,6 @@ pub(crate) struct Runtime {
/// A panel just floated out of a tool rail, whose window takes over the held press on the next
/// pass, with the pointer at this point inside it ([`continue_move`]).
hand_over: Option<(String, egui::Vec2)>,
/// The dialogs a panel in the open flyout opened, by id and opening serial: while one is open, Auto-Collapse Iconic
/// Panels leaves the flyout open ([`show`]).
flyout_dialogs: Vec<(DialogId, u64)>,
}
/// `ui.docking`: the layout in use, the hidden panels, the open flyout, the focused panel, the
@@ -1350,16 +1346,6 @@ fn raise(app: &VectorcraftApp, ctx: &egui::Context, panel: &str) {
}
}
/// The open dialogs of the main window, by id and opening serial: a dialog closed and opened again has a new serial.
fn open_dialogs(app: &VectorcraftApp) -> Vec<(DialogId, u64)> {
app.dialogs().map_or_else(Vec::new, |dialogs| {
dialogs.with(|host| {
let host = &*host;
host.stack().ids().filter_map(|id| Some((id, host.open_serial(id)?))).collect()
})
})
}
/// The floating window holding `panel` takes over the held primary press on the next pass, with the
/// pointer at `grab` inside it: a panel floated out of a tool rail mid-drag follows the pointer and
/// docks where the release lands.
@@ -1385,15 +1371,7 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
let presenting = app.ui.screen_mode >= 3;
// Shift+Tab, from its key, a menu or automation, closes a panel popped out of the icon column.
let mut flyout = flyout_before.clone().filter(|_| !keeps_tools);
let dialogs_before = open_dialogs(app);
if flyout_before.is_some() {
app.dock_rt.flyout_dialogs.retain(|dialog| dialogs_before.contains(dialog));
} else {
app.dock_rt.flyout_dialogs.clear();
}
// A dialog a panel of the flyout opened (the Gradient panel's stop popover) is a layer of the window's dialog host,
// outside the flyout's: while one is open, a press in it or the focus moving into it leaves the flyout open.
let auto_collapse = app.session.prefs.auto_collapse_icon_panels && app.dock_rt.flyout_dialogs.is_empty();
let auto_collapse = app.session.prefs.auto_collapse_icon_panels;
// The specs and rails leave the app for the pass, which lends the app to the panel bodies.
let specs = std::mem::take(&mut app.dock_rt.specs);
let rails = std::mem::take(&mut app.dock_rt.rails);
@@ -1439,12 +1417,6 @@ pub(crate) fn show(app: &mut VectorcraftApp, ui: &mut egui::Ui, keeps_tools: boo
if app.ui.open_panel == flyout_before {
app.ui.open_panel = flyout;
}
if app.ui.open_panel.is_some() {
let opened: Vec<_> = open_dialogs(app).into_iter().filter(|dialog| !dialogs_before.contains(dialog)).collect();
app.dock_rt.flyout_dialogs.extend(opened);
} else {
app.dock_rt.flyout_dialogs.clear();
}
if output.error.is_some() {
Arc::make_mut(&mut app.ui.dock_workspace).replace(default_workspace(&[]));
app.status(tl!("Invalid panel layout; restored the default dock").to_string());
+15 -1
View File
@@ -1351,7 +1351,8 @@ fn a_tab_menus_stock_items_start_at_the_panel_items_check_column() {
}
/// With Auto-Collapse Iconic Panels on, the popover the Gradient panel's stop chip opens from the panel's flyout leaves
/// the flyout open while it shows; once it closes, a click away from the flyout still closes it.
/// the flyout open while it shows; once it closes, a click away from the flyout still closes it, and a press away from
/// both closes the popover and the flyout together.
#[test]
fn a_popover_opened_from_an_auto_collapsing_flyout_leaves_the_flyout_open() {
let mut h = Harness::new();
@@ -1385,4 +1386,17 @@ fn a_popover_opened_from_an_auto_collapsing_flyout_leaves_the_flyout_open() {
assert_eq!(h.app.ui.open_panel, flyout, "closing the popover leaves the flyout open");
h.click(h.canvas().center());
assert_eq!(h.app.ui.open_panel, None, "a click away from the flyout still closes it");
// With the popover open again, one press away from both closes the popover and the flyout.
h.app.run("window.panel", json!({"panel": "gradient"})).unwrap();
h.frames(3);
assert_eq!(h.app.ui.open_panel, flyout, "the flyout opens again");
h.click(chip.center());
h.frames(3);
assert!(popover_open(&h), "the chip opens the stop popover again");
assert_eq!(h.app.ui.open_panel, flyout, "the flyout stays open while the popover shows");
h.click(h.canvas().center());
h.frames(2);
assert!(!popover_open(&h), "a press away closes the popover");
assert_eq!(h.app.ui.open_panel, None, "and the flyout with it");
}