diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rs index 78519bf7..d2fb9a9e 100644 --- a/crates/ui-egui/src/dock.rs +++ b/crates/ui-egui/src/dock.rs @@ -180,7 +180,8 @@ pub fn permissions(_panel: &PanelKind) -> Permissions { pub fn tabs(p: &[PanelKind], active: usize) -> Node { Node::Tabs { panels: p.to_vec(), active } } -/// Stacked panels: (panel, open, height). +/// Stacked panels: (panel, open, height). Open entries share the stack's height in proportion to +/// their heights; an entry without one counts as craft-ui's `DockStyle::min_pane` (40). pub fn stack(e: &[(PanelKind, bool, Option)]) -> Node { Node::Stack { entries: e.iter().map(|&(panel, open, height)| StackEntry { panel, open, height }).collect() } } diff --git a/crates/ui-egui/src/dock_ui.rs b/crates/ui-egui/src/dock_ui.rs index 3281ef66..f8fffd84 100644 --- a/crates/ui-egui/src/dock_ui.rs +++ b/crates/ui-egui/src/dock_ui.rs @@ -447,20 +447,25 @@ impl EffectcraftApp { } /// Automation ids for craft-ui's gesture sources: `panel.tab.`, `panel.drag.` - /// (the group's drag bar), `panel.tabs.more.`, `panel.header.` (a stacked - /// panel's open/close button), `panel.float..move`, `.close`, `.resize` (bottom-right + /// (the group's drag bar), `panel.border.` (the top border above its tabs), + /// `panel.tabs.more.`, `panel.header.` (a stacked panel's open/close button), + /// `panel.float..move`, `.close`, `.resize` (bottom-right /// corner) and `.resize.`, `dock.gutter.` (`a`/`b` per split level; a stack's gap /// below entry `i` adds `s`), `dock.corner..` where two dividers meet, and /// the same inside floating window `n` as `panel.float..gutter.…` and `.corner.…`. fn register_dock_hits(&mut self, hits: &[(Hit, Rect)]) { let window = |panel: &PanelKind| self.ui.dock.layout.floating.iter().position(|window| window.contains(panel)); + // Tabs are labelled as drawn: "Composition Intro", not "Composition". + let titles = self.tab_titles(); + let title = |panel: &PanelKind| titles.iter().find(|(p, _)| p == panel).map_or_else(|| panel.title().to_string(), |(_, t)| t.clone()); let mut found = Vec::new(); for (hit, rect) in hits { let entry = match hit { - Hit::Tab(panel) => (format!("panel.tab.{}", panel.id()), panel.title().to_string()), + Hit::Tab(panel) => (format!("panel.tab.{}", panel.id()), title(panel)), Hit::DragBar(panel) => (format!("panel.drag.{}", panel.id()), "Move panel group".into()), + Hit::Border(panel) => (format!("panel.border.{}", panel.id()), "Move panel group".into()), Hit::Overflow(panel) => (format!("panel.tabs.more.{}", panel.id()), "More tabs".into()), - Hit::StackToggle(panel) => (format!("panel.header.{}", panel.id()), panel.title().to_string()), + Hit::StackToggle(panel) => (format!("panel.header.{}", panel.id()), title(panel)), Hit::Title(panel) => match window(panel) { Some(index) => (format!("panel.float.{index}.move"), "Move floating panel".into()), None => continue,