Skip to content

EffectCraft: An open-source motion graphics and compositing tool written by scratch in pure Rust

D2a: dock tabs carry their drawn titles as automation labels; group top borders get panel.border ids

aiongge89aff1e99f0
diff --git a/crates/ui-egui/src/dock.rs b/crates/ui-egui/src/dock.rs
index 78519bf7b..d2fb9a9e1 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<PanelKind> {
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<f32>)]) -> Node<PanelKind> {
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 3281ef66c..f8fffd84c 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>`, `panel.drag.<Panel>`
- /// (the group's drag bar), `panel.tabs.more.<Panel>`, `panel.header.<Panel>` (a stacked
- /// panel's open/close button), `panel.float.<n>.move`, `.close`, `.resize` (bottom-right
+ /// (the group's drag bar), `panel.border.<Panel>` (the top border above its tabs),
+ /// `panel.tabs.more.<Panel>`, `panel.header.<Panel>` (a stacked panel's open/close button),
+ /// `panel.float.<n>.move`, `.close`, `.resize` (bottom-right
/// corner) and `.resize.<Edge>`, `dock.gutter.<path>` (`a`/`b` per split level; a stack's gap
/// below entry `i` adds `s<i>`), `dock.corner.<outer>.<inner>` where two dividers meet, and
/// the same inside floating window `n` as `panel.float.<n>.gutter.…` and `.corner.…`.
fn register_dock_hits(&mut self, hits: &[(Hit<PanelKind>, 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,