diff --git a/crates/ui-panels/src/docking/commands/dock.rs b/crates/ui-panels/src/docking/commands/dock.rs
index 81fef5765..1287eb3da 100644
--- a/crates/ui-panels/src/docking/commands/dock.rs
+++ b/crates/ui-panels/src/docking/commands/dock.rs
@@ -1,6 +1,6 @@
//! The panel commands of a docked or floating panel and the dock actions they turn into.
-use crate::docking::drop::{beside, members, moving_panels, to_target};
+use crate::docking::drop::{beside, members, moving_panels, takes, to_target};
use crate::docking::{DockEvent, DragUnit, FloatSpace};
use crate::runtime::commands::CommandState;
use craft_behavior::DockSide;
@@ -20,7 +20,7 @@ pub enum DockCommands {
/// Float the panel's tab group into its own frame.
#[command(label = "Float Tab Group")]
FloatGroup,
- /// Dock the floating panel: back where it was docked, else as a tab of the first docked panel.
+ /// Dock the floating panel: back where it was docked, else as a tab of the first docked group that takes it.
#[command(label = "Dock Panel")]
DockPanel,
/// Ask for a group to move the panel to; the host lists [`Layout::move_targets`] and calls [`move_actions`].
@@ -146,7 +146,9 @@ pub enum DockTo
{
Edge(DockSide),
/// As a new last column of the dock on this window edge, or in a new dock there.
Dock(DockEdge),
- /// Back to the docked layout: a tab of the first docked panel outside the unit. Nothing for a docked unit.
+ /// Back to the docked layout: tabs of the first group outside the unit that takes them, as its rights and the
+ /// unit's allow ([`Permissions::accepts_tabs`], [`Permissions::shares_column`]); dock columns come before the
+ /// docked tree. Nothing for a docked unit.
Docked,
}
@@ -260,10 +262,14 @@ pub fn move_actions(scene: &DockScene<'_, P>, unit: &DragU
}
let panels = layout.panels();
let free = || panels.iter().copied().filter(|p| !moved.contains(p));
- let docked = free().find(|p| matches!(layout.place(p), Some(PanelPlace::Dock { .. })));
- let framed = || free().find(|p| matches!(layout.place(p), Some(PanelPlace::Node(_))));
- let anchor = docked.or_else(framed).cloned().ok_or(DockError::MissingTarget)?;
- one(beside(unit, anchor, DockPlacement::tab(None)))
+ let docked = free().filter(|p| matches!(layout.place(p), Some(PanelPlace::Dock { .. })));
+ let framed = free().filter(|p| matches!(layout.place(p), Some(PanelPlace::Node(_))));
+ let mut joins = docked.chain(framed).map(|anchor| beside(unit, anchor.clone(), DockPlacement::tab(None))).peekable();
+ if joins.peek().is_none() {
+ return Err(DockError::MissingTarget);
+ }
+ let permissions = |p: &P| scene.policy(p);
+ joins.find(|action| takes(layout, action, &permissions)).map_or(Err(DockError::NotAllowed), one)
}
}
}
diff --git a/crates/ui-panels/src/docking/dock_column.rs b/crates/ui-panels/src/docking/dock_column.rs
index ad747f9a6..7ac1e5752 100644
--- a/crates/ui-panels/src/docking/dock_column.rs
+++ b/crates/ui-panels/src/docking/dock_column.rs
@@ -166,7 +166,7 @@ pub struct DockColumnStyle {
/// them by pointer or with the arrow keys.
///
/// The column registers the drop bands of its two edges (`DockSpot::column`) and of the seams between its groups
-/// (`DockSpot::seam`) with the dock `dock` every pass. A dock hidden by the shell shows nothing.
+/// (`DockSpot::seam`) with the dock `dock` every pass.
///
/// In a floating window ([`ColumnBar::Window`]) the window's title row is the column's bar and the window's edges
/// size it: the column shows its groups and their dividers only, and registers its seams.
@@ -248,10 +248,6 @@ impl<'a, P: Value + Hash + 'static> DockColumn<'a, P> {
let mut bar = BarRecord::default();
let shown = &mut bar;
let body = move |ui: &mut Ui, body: &mut BodyCx<'_>| {
- // A floating window shows where the area shows it; the shell hides docks only.
- if own == ColumnBar::Own && body.shell().is_some_and(|shell| !shell.dock_visible()) {
- return;
- }
let Some(sizes) = body.style::>().map(|style| style.sizes) else { return };
// The bar and the groups at the heights this pass's drag leaves them, in the measuring run and the real
// run alike: the same plan `parts` lays out, so the dividers sit at the seams.
diff --git a/crates/ui-panels/src/docking/drop.rs b/crates/ui-panels/src/docking/drop.rs
index 4bd9beafb..abfa15fcb 100644
--- a/crates/ui-panels/src/docking/drop.rs
+++ b/crates/ui-panels/src/docking/drop.rs
@@ -147,7 +147,7 @@ pub(crate) fn to_target(unit: &DragUnit, target: Target
) -> Acti
/// Whether the model takes `action` and changes the arrangement by it: a dry run on a copy, so no mark shows for a
/// drop that `Layout::apply_with_permissions` would refuse or that moves nothing.
-fn takes(layout: &Layout, action: &Action
, permissions: &dyn Fn(&P) -> Permissions) -> bool {
+pub(crate) fn takes(layout: &Layout, action: &Action
, permissions: &dyn Fn(&P) -> Permissions) -> bool {
let mut copy = layout.clone();
copy.apply_with_permissions(action.clone(), permissions).is_ok() && !copy.same_arrangement(layout)
}
diff --git a/crates/ui-panels/src/docking/event.rs b/crates/ui-panels/src/docking/event.rs
index 88c3ce351..367fff306 100644
--- a/crates/ui-panels/src/docking/event.rs
+++ b/crates/ui-panels/src/docking/event.rs
@@ -39,7 +39,9 @@ pub enum DockEvent
{
},
}
-/// Which panels the host hides. Protected panels always stay.
+/// Which panels the host hides. Protected panels always stay. While the shell hides the panels and keeps the tools
+/// (Shift+Tab), the panels `Except` names stay and every other panel hides; while it hides the dock (Tab), every panel
+/// hides.
#[non_exhaustive]
pub enum HidePanels<'a, P> {
/// Hides none.
@@ -67,7 +69,7 @@ pub struct FloatSpace
{
pub area: Rect,
/// Room between the area's top-left corner and a unit a command floats.
pub inset: f32,
- /// The height of a floating window's title row (`DockSizes::bar`), which a drop keeps under the pointer.
+ /// The height of a floating window's title row (`DockSizes::title_row`), which a drop keeps under the pointer.
pub title_row: f32,
/// The size a unit floats at when neither its panel nor where it came from gives one. Its height is also the
/// most a panel, group or column floats at.
@@ -85,7 +87,7 @@ impl FloatSpace {
FloatSpace {
area,
inset: sizes.cascade_inset,
- title_row: sizes.bar,
+ title_row: sizes.title_row,
default_size: sizes.float_size,
panels: Vec::new(),
side_edge_zones: false,
diff --git a/crates/ui-panels/src/docking/floating.rs b/crates/ui-panels/src/docking/floating.rs
index 38a7c7fe2..815f84358 100644
--- a/crates/ui-panels/src/docking/floating.rs
+++ b/crates/ui-panels/src/docking/floating.rs
@@ -22,7 +22,7 @@ use crate::runtime::env::{Env, Label};
use crate::runtime::overlay::CloseReason;
use crate::runtime::windows::WindowSpec;
use crate::sections::{HeaderAction, HeaderStrength, MenuRows, TitleRow};
-use crate::style::{ComponentStyle, StyleCx, SurfaceKind};
+use crate::style::{ComponentStyle, StyleCx, SurfaceKind, UiTokens};
use craft_behavior::dock::DockEdge;
use craft_behavior::{GesturePhase, Metrics, Sense};
use craft_ui_widgets::popover::WholeWindow;
@@ -33,6 +33,11 @@ use std::hash::Hash;
#[cfg(feature = "testing")]
mod stories;
+/// The height of a floating group's title row: a strong `TitleRow`, which is as tall as a panel header.
+pub(crate) fn title_row(tokens: &UiTokens) -> f32 {
+ tokens.size.panel_header
+}
+
/// The actions a floating group's title row shows unless `actions` says otherwise.
const ACTIONS: [HeaderAction; 3] = [HeaderAction::Menu, HeaderAction::Float, HeaderAction::Close];
@@ -304,7 +309,7 @@ impl<'a> FloatingGroup<'a> {
/// Shows the group; `body` fills the area under the title row unless the group is minimized.
pub fn show_group(mut self, ui: &mut Ui, mut body: impl FnMut(&mut Ui, &mut BodyCx<'_>) -> R) -> Inner {
let env = Env::of(ui);
- let header = env.tokens.size.panel_header;
+ let header = title_row(&env.tokens);
(self.header, self.rtl) = (header, env.direction.is_rtl());
let mount = self.mount(header);
self.props = self.props.mount(mount);
diff --git a/crates/ui-panels/src/docking/iconic.rs b/crates/ui-panels/src/docking/iconic.rs
index 8e375d9d3..70b9f5cd4 100644
--- a/crates/ui-panels/src/docking/iconic.rs
+++ b/crates/ui-panels/src/docking/iconic.rs
@@ -695,7 +695,7 @@ impl Container for IconicColumn<'_, P> {
/// The column bar, over the icons. What the user did on it is read in `finish`.
fn header(&mut self, ui: &mut Ui, cx: &mut BodyCx<'_>) {
- if self.bar == ColumnBar::Window || cx.shell().is_some_and(|shell| !shell.dock_visible()) {
+ if self.bar == ColumnBar::Window {
return;
}
if let Some(grip) = column_grip(self.column, self.spec, cx) {
diff --git a/crates/ui-panels/src/docking/targets.rs b/crates/ui-panels/src/docking/targets.rs
index 0e17258d2..44a86f34f 100644
--- a/crates/ui-panels/src/docking/targets.rs
+++ b/crates/ui-panels/src/docking/targets.rs
@@ -47,6 +47,9 @@ pub struct DockSizes {
pub strip: f32,
/// The height of a column bar (a small control).
pub bar: f32,
+ /// The height of a floating window's title row, which is the bar of the column the window holds: every height of
+ /// a window's body or content is the window's height less this.
+ pub title_row: f32,
/// The least body size of a column's group and the least width of an expanded column (the panel header height).
pub least: f32,
/// How thick a divider is across its boundary (the least hit size).
@@ -84,6 +87,7 @@ impl DockSizes {
least_pane: size.pane.least,
strip: size.panel_header,
bar: size.control.sm,
+ title_row: super::floating::title_row(cx.tokens),
least: size.panel_header,
reach: size.hit.target,
step: cx.control().gap,
diff --git a/crates/ui-patterns/src/patterns/dock/area.rs b/crates/ui-patterns/src/patterns/dock/area.rs
index 6858d28e1..d975f6f37 100644
--- a/crates/ui-patterns/src/patterns/dock/area.rs
+++ b/crates/ui-patterns/src/patterns/dock/area.rs
@@ -1191,7 +1191,7 @@ impl Pass<'_, P> {
_ => (change.rect.width() - fitted.x).abs() <= 0.5,
};
let to = if by_height {
- let room = change.rect.height() - scene.sizes.strip;
+ let room = change.rect.height() - scene.sizes.title_row;
grid.steps_for_height(room, |width| self.stepped_height(ui, body, column, width, true).unwrap_or(0.0))
} else {
grid.steps_within(change.rect.width())
@@ -1208,7 +1208,7 @@ impl Pass<'_, P> {
let top = match change.kind {
PlacementKind::Size(ResizeEdge::Top | ResizeEdge::TopLeft | ResizeEdge::TopRight) => {
let content = self.stepped_height(ui, body, column, grid.width(to), true).unwrap_or(0.0);
- change.rect.bottom() - scene.sizes.strip - content
+ change.rect.bottom() - scene.sizes.title_row - content
}
_ => change.rect.top(),
};
@@ -1236,7 +1236,7 @@ impl Pass<'_, P> {
self.pick(&active, item);
}
// The window's commands run from its body, below the title row.
- let body = opening.rect.size() - Vec2::new(0.0, scene.sizes.bar);
+ let body = opening.rect.size() - Vec2::new(0.0, scene.sizes.title_row);
for command in commands {
self.run(&active, command, Some(body));
}
diff --git a/crates/ui-patterns/src/patterns/dock/hide.rs b/crates/ui-patterns/src/patterns/dock/hide.rs
index f518e3d7d..e6ca0e421 100644
--- a/crates/ui-patterns/src/patterns/dock/hide.rs
+++ b/crates/ui-patterns/src/patterns/dock/hide.rs
@@ -11,13 +11,15 @@ use std::hash::Hash;
pub(super) struct Shown<'a, P: Clone> {
/// The pruned layout with its write-back map.
pub(super) view: FrameView<'a, P>,
- /// Floating windows show: the shell shows them and the panels are not hidden.
+ /// Floating windows show: the shell shows them, or it hides the panels and the view keeps what the host names.
pub(super) floating: bool,
}
/// `layout` with the host's `hide`, the shell's panel visibility and the frame of `maximized` applied. Protected
-/// panels always stay, so a canvas shows while the dock is hidden. Size edits made on the view go back through
-/// `FrameView::write_back`.
+/// panels always stay, so a canvas shows while the dock is hidden. While the shell hides the panels and keeps the
+/// tools (Shift+Tab), the panels the host's `HidePanels::Except` names stay, docked or floating, and every other panel
+/// hides; while the shell hides the dock (Tab, body-only mode), every panel hides. Size edits made on the view go back
+/// through `FrameView::write_back`.
pub(super) fn shown<'a, P: Clone + Eq + Hash>(
layout: &'a Layout,
maximized: Option<&P>,
@@ -25,8 +27,10 @@ pub(super) fn shown<'a, P: Clone + Eq + Hash>(
shell: Option<&ShellCx>,
protected: &dyn Fn(&P) -> bool,
) -> Shown<'a, P> {
- let dock_hidden = shell.is_some_and(|shell| !shell.dock_visible());
- let hide = if dock_hidden { HidePanels::All } else { hide };
- let floating = shell.is_none_or(|shell| shell.floating_visible());
+ let (hide, floating) = match shell {
+ None => (hide, true),
+ Some(shell) if shell.panels_hidden() => (if let HidePanels::Except(keep) = hide { HidePanels::Except(keep) } else { HidePanels::All }, true),
+ Some(shell) => (if shell.dock_visible() { hide } else { HidePanels::All }, shell.floating_visible()),
+ };
Shown { view: maximize(layout, maximized, hide, protected), floating }
}
diff --git a/crates/ui-patterns/tests/it/docking/dock_back.rs b/crates/ui-patterns/tests/it/docking/dock_back.rs
new file mode 100644
index 000000000..cad0462e1
--- /dev/null
+++ b/crates/ui-patterns/tests/it/docking/dock_back.rs
@@ -0,0 +1,44 @@
+//! Dock Panel with no docked place recorded: the floating unit joins the first docked group that takes it.
+
+use craft_behavior::Axis;
+use craft_behavior::dock::{Column, DockEdge, Floating, Group, Layout, Node, Permissions, SplitSize};
+use craft_ui::docking::{DockScene, DockTo, DragUnit, FloatSpace, move_actions};
+use craft_ui::testing::trial;
+use egui::{Pos2, Rect};
+
+const CANVAS: usize = 1;
+const TOOLBAR: usize = 2;
+const LAYERS: usize = 3;
+const FLOATED: usize = 4;
+
+fn rights(panel: &usize) -> Permissions {
+ match *panel {
+ CANVAS => Permissions::PROTECTED,
+ TOOLBAR => Permissions::ALL.accepts_tabs(false).accepts_splits(false).collapses(false).shares_column(false),
+ _ => Permissions::ALL,
+ }
+}
+
+/// The toolbar alone in the start dock's only column, the canvas, Layers in the end dock, and a floating panel.
+fn layout() -> Layout {
+ let start = Node::dock(DockEdge::Start, vec![Column::new(vec![Group::new(vec![TOOLBAR], 0)])]);
+ let end = Node::dock(DockEdge::End, vec![Column::new(vec![Group::new(vec![LAYERS], 0)])]);
+ let root = Node::split(Axis::X, SplitSize::Ratio(0.2), start, Node::split(Axis::X, SplitSize::Ratio(0.7), Node::tabs(vec![CANVAS], 0), end));
+ let window = Rect::from_min_size(Pos2::new(100.0, 100.0), egui::vec2(200.0, 150.0));
+ Layout::new(Some(root), vec![Floating::single(vec![FLOATED], 0, window)])
+}
+
+#[trial]
+fn a_floating_panel_docks_into_the_first_group_that_takes_tabs_and_shares_its_column() {
+ let mut layout = layout();
+ let space = FloatSpace::new(Rect::from_min_size(Pos2::ZERO, egui::vec2(800.0, 600.0)), &super::sizes(4.0, 60.0, 20.0));
+ let actions = {
+ let scene = DockScene::new(&layout, &space, false, &rights);
+ move_actions(&scene, &DragUnit::Panel(FLOATED), DockTo::Docked).expect("a docked group takes the panel")
+ };
+ layout.apply_all(actions, rights).expect("the model takes the move");
+ let group_of = |panel: usize| layout.place(&panel).and_then(|place| layout.group(&place)).map(|group| group.panels.clone());
+ assert!(group_of(FLOATED).is_some_and(|panels| panels.contains(&LAYERS)), "the panel joins Layers' tabs, past the toolbar's group");
+ assert_eq!(group_of(TOOLBAR), Some(vec![TOOLBAR]), "the toolbar keeps its group to itself");
+ assert!(layout.floating.is_empty(), "the window closes with its only panel");
+}
diff --git a/crates/ui-patterns/tests/it/docking/floating_area.rs b/crates/ui-patterns/tests/it/docking/floating_area.rs
index 0e4fde61a..0781a0708 100644
--- a/crates/ui-patterns/tests/it/docking/floating_area.rs
+++ b/crates/ui-patterns/tests/it/docking/floating_area.rs
@@ -67,6 +67,8 @@ struct Bed {
second: Rc>,
/// The tallest a floated panel opens (`FloatSpace::default_size`), as the area reported it.
float_height: Rc>,
+ /// The height of a floating window's title row (`FloatSpace::title_row`), as the area reported it.
+ title_row: Rc| >,
}
fn bed(layout: Layout, rights: fn(&usize) -> Permissions) -> Bed {
@@ -74,7 +76,9 @@ fn bed(layout: Layout, rights: fn(&usize) -> Permissions) -> Bed {
let actions: Rc>>> = Rc::default();
let second = Rc::new(Cell::new(false));
let float_height = Rc::new(Cell::new(0.0));
+ let title_row = Rc::new(Cell::new(0.0));
let (held, seen_actions, shows_second, seen_height) = (Rc::clone(&workspace), Rc::clone(&actions), Rc::clone(&second), Rc::clone(&float_height));
+ let seen_title_row = Rc::clone(&title_row);
let mut other = Workspace::new(Layout::new(Some(Node::tabs(vec![SECOND], 0)), Vec::new()));
let mut fixture = Fixture::new(move |ui| {
let mut workspace = held.borrow().clone();
@@ -84,13 +88,14 @@ fn bed(layout: Layout, rights: fn(&usize) -> Permissions) -> Bed {
seen_actions.borrow_mut().extend(out.actions);
if let Some(space) = out.float_space {
seen_height.set(space.default_size.y);
+ seen_title_row.set(space.title_row);
}
if shows_second.get() {
DockArea::new("Second dock", Bind::bound(&mut other), &mut panels, DockConfig::default()).show(ui);
}
});
fixture.settle();
- Bed { fixture, workspace, actions, second, float_height }
+ Bed { fixture, workspace, actions, second, float_height, title_row }
}
/// A point on the floating window's title row.
@@ -230,6 +235,28 @@ fn a_floating_windows_drag_bar_shows_no_title() {
assert_eq!(named, 1, "only the tab names the panel: {:?}", bed.fixture.texts());
}
+/// The title row the area keeps a dropped window's under the pointer and adds to a floated unit's height is the
+/// one the window draws: the window's group starts right under it.
+#[trial]
+fn a_floating_windows_group_starts_under_the_title_row_the_area_sizes_windows_by() {
+ let bed = bed(with_window(Some(Node::tabs(vec![DOCKED], 0))), |_| Permissions::ALL);
+ let group = bed
+ .fixture
+ .by_role(Role::TAB_PANEL)
+ .into_iter()
+ .find(|group| WINDOW_AT.expand(SLACK).contains_rect(group.rect))
+ .expect("the window shows its group")
+ .rect;
+ let title_row = bed.title_row.get();
+ assert!(title_row > 0.0, "the area reported its float space");
+ assert!(
+ (group.top() - WINDOW_AT.top() - title_row).abs() <= SLACK,
+ "the group starts at {} in a window from {} with a title row of {title_row}",
+ group.top(),
+ WINDOW_AT.top()
+ );
+}
+
/// A tab dragged out of the window floats at the width its group had where it was docked, not a default size.
#[trial]
fn a_floated_panel_fits_its_content_up_to_the_float_height() {
diff --git a/crates/ui-patterns/tests/it/docking/hidden.rs b/crates/ui-patterns/tests/it/docking/hidden.rs
new file mode 100644
index 000000000..dcc2cfc09
--- /dev/null
+++ b/crates/ui-patterns/tests/it/docking/hidden.rs
@@ -0,0 +1,85 @@
+//! What a dock area shows while the shell hides the panels and keeps the tools (Shift+Tab) or hides the dock (Tab).
+
+use craft_behavior::Axis;
+use craft_behavior::dock::{Column, DockEdge, Floating, Group, Layout, Node, Permissions, SplitSize, Workspace};
+use craft_ui::contract::{Bind, BodyCx};
+use craft_ui::docking::{DockConfig, DockPanels, HidePanels, PanelSpec};
+use craft_ui::patterns::dock::DockArea;
+use craft_ui::runtime::env::{BodyMode, ShellCx, ShellEntry, WindowKey};
+use craft_ui::testing::{Fixture, trial};
+use egui::{Pos2, Rect, Ui, Vec2};
+use std::cell::RefCell;
+use std::collections::BTreeSet;
+use std::rc::Rc;
+
+const CANVAS: usize = 1;
+/// Docked, and named by the host's `HidePanels::Except`.
+const TOOLBAR: usize = 2;
+const LAYERS: usize = 3;
+/// Floating, and named by the host's `HidePanels::Except`.
+const PALETTE: usize = 4;
+const NAVIGATOR: usize = 5;
+
+/// Records the panels whose bodies ran.
+struct Panels {
+ shown: Rc>>,
+}
+
+impl DockPanels for Panels {
+ fn spec(&self, panel: &usize) -> PanelSpec {
+ PanelSpec::new(format!("Panel {panel}"))
+ }
+
+ fn permissions(&self, panel: &usize) -> Permissions {
+ if *panel == CANVAS { Permissions::PROTECTED } else { Permissions::ALL }
+ }
+
+ fn body(&mut self, panel: &usize, _: &mut Ui, _: &mut BodyCx<'_>) {
+ self.shown.borrow_mut().insert(*panel);
+ }
+}
+
+/// The toolbar in a start dock, the canvas, Layers in an end dock, and two floating windows.
+fn layout() -> Layout {
+ let start = Node::dock(DockEdge::Start, vec![Column::new(vec![Group::new(vec![TOOLBAR], 0)])]);
+ let end = Node::dock(DockEdge::End, vec![Column::new(vec![Group::new(vec![LAYERS], 0)])]);
+ let root = Node::split(Axis::X, SplitSize::Ratio(0.2), start, Node::split(Axis::X, SplitSize::Ratio(0.7), Node::tabs(vec![CANVAS], 0), end));
+ let window = |panel: usize, x: f32| Floating::single(vec![panel], 0, Rect::from_min_size(Pos2::new(x, 60.0), Vec2::new(120.0, 120.0)));
+ Layout::new(Some(root), vec![window(PALETTE, 90.0), window(NAVIGATOR, 220.0)])
+}
+
+/// The panels the area shows under `shell`, with the host keeping the toolbar and the palette when `keeps`.
+fn shown_under(shell: ShellCx, keeps: bool) -> BTreeSet {
+ let shown: Rc>> = Rc::default();
+ let seen = Rc::clone(&shown);
+ let mut fixture = Fixture::new(move |ui| {
+ seen.borrow_mut().clear();
+ let mut workspace = Workspace::new(layout());
+ let mut panels = Panels { shown: Rc::clone(&seen) };
+ let keep = |panel: &usize| *panel == TOOLBAR || *panel == PALETTE;
+ let mut area = DockArea::new("Hidden dock", Bind::bound(&mut workspace), &mut panels, DockConfig::default());
+ if keeps {
+ area = area.hide(HidePanels::Except(&keep));
+ }
+ area.show(ui);
+ });
+ fixture.root_value(ShellEntry(Some(shell))).settle();
+ shown.take()
+}
+
+#[trial]
+fn shift_tab_keeps_the_panels_the_host_names_docked_and_floating_and_tab_hides_them_all() {
+ let room = Rect::from_min_size(Pos2::ZERO, Vec2::new(400.0, 300.0));
+ let normal = ShellCx::detached(WindowKey::main(), BodyMode::Normal, room);
+ let all = BTreeSet::from([CANVAS, TOOLBAR, LAYERS, PALETTE, NAVIGATOR]);
+ assert_eq!(shown_under(normal.clone(), false), all, "every panel shows while nothing hides them");
+ let shift_tab = normal.with_panels_hidden(true);
+ assert_eq!(
+ shown_under(shift_tab.clone(), true),
+ BTreeSet::from([CANVAS, TOOLBAR, PALETTE]),
+ "Shift+Tab keeps the canvas and what the host names, docked and floating"
+ );
+ assert_eq!(shown_under(shift_tab, false), BTreeSet::from([CANVAS]), "Shift+Tab with nothing named keeps the canvas only");
+ let tab = ShellCx::detached(WindowKey::main(), BodyMode::Only, room);
+ assert_eq!(shown_under(tab, true), BTreeSet::from([CANVAS]), "Tab keeps the canvas only, whatever the host names");
+}
diff --git a/crates/ui-patterns/tests/it/docking/mod.rs b/crates/ui-patterns/tests/it/docking/mod.rs
index 9c195ac25..61631da3e 100644
--- a/crates/ui-patterns/tests/it/docking/mod.rs
+++ b/crates/ui-patterns/tests/it/docking/mod.rs
@@ -16,8 +16,10 @@ mod drop_session;
mod floating;
mod floating_area;
+mod hidden;
mod columns;
+mod dock_back;
mod group_view;
mod workspace_dialogs;
diff --git a/docs/ui-docking.md b/docs/ui-docking.md
index c4b63328e..c0fb12b27 100644
--- a/docs/ui-docking.md
+++ b/docs/ui-docking.md
@@ -65,7 +65,7 @@ The binding decides who applies the edits. With `Bind::bound` the area writes ev
A panel body, or code a body calls, changes the workspace during the pass with `docking::request_actions(ctx, actions)`, never by writing the workspace the area shows. The running area takes them unapplied and returns them in `DockAreaOutput::requested`, in order, for the host to apply after `actions` in the same frame. With no area over that panel type running, `request_actions` hands the actions back for the caller to apply.
-Props: `hide` (`HidePanels::None`, `All` or `Except`), `maximized`, `auto_collapse`, `locked`, and `flyout`, which binds the open flyout to the host's value (the area keeps it otherwise). A hidden panel keeps its place for restore.
+Props: `hide` (`HidePanels::None`, `All` or `Except`), `maximized`, `auto_collapse`, `locked`, and `flyout`, which binds the open flyout to the host's value (the area keeps it otherwise). A hidden panel keeps its place for restore. Inside an `AppShell`, the shell's hiding wins over `hide`: while it hides the panels and keeps the tools (Shift+Tab, `ShellCx::panels_hidden`), only the panels an `Except` names stay, docked or floating (a toolbar); while it hides the dock (Tab), no panel shows. Protected panels always show.
A panel in a column collapsed to icons shows in its flyout (`Layout::opens_in_flyout`). The host opens and closes it by writing the `flyout` binding, not the layout: `WindowMenuRows` checks such a panel's row while its flyout is open (`WindowMenuRows::flyout`) and reports a pick in `WindowMenuRowsOutput::flyout`.
| | |