docking: split divider hits name the layout path while panels are hidden

A split's handle id and its Hit::Divider use the layout path that
ResizeSplit takes, also when hiding panels collapses a split in the drawn
tree.
This commit is contained in:
aiongg committed 2026-10-20 03:45:18 +00:00
1 parent ae0c19b49b
commit 815d648016
3 files changed
+9 -4

No files matched your search

+4 -1
View File
@@ -586,7 +586,10 @@ fn hidden_panels_leave_their_split_and_resizing_names_the_layout_path() {
d.step(vec![]);
d.step(vec![]);
assert_eq!(d.tab(1).map(|r| r.left()), Some(0.0), "the hidden frame's space goes to the others");
let divider = d.response(Id::new(AREA).with(("split", &Vec::<bool>::new()))).unwrap().center();
// Hits and widget ids name the split by its layout path, as `ResizeSplit` does.
let hit = Hit::Divider(Divider::Split(vec![true]));
assert!(DockArea::<u32>::hit_rects(&d.ctx, Id::new(AREA)).iter().any(|(h, _)| *h == hit), "the hits name the layout path");
let divider = d.response(DockArea::<u32>::hit_id(Id::new(AREA), &hit)).unwrap().center();
let out = d.hold(divider, divider + vec2(0.0, 60.0));
assert!(out.actions.iter().any(|a| matches!(a, Action::ResizeSplit { path, .. } if path == &vec![true])), "{:?}", out.actions);
let Some(Node::Split { size: SplitSize::FixedFirst(200.0), second, .. }) = &d.layout.root else { panic!("{:?}", d.layout) };
+4 -2
View File
@@ -95,8 +95,10 @@ impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> Renderer<'_, P> {
path.pop();
// The divider's inner-edge hit margin must win over child scrollbars, just
// as accordion dividers win over the adjacent panel's content.
// Named by its layout path, which `ResizeSplit` takes and hits report.
let layout_path = self.original_path(path);
let response = ResizeHandle::new(
self.id.with(("split", &*path)),
self.id.with(("split", &layout_path)),
*axis,
split.divider,
&self.style.resize_label,
@@ -108,7 +110,7 @@ impl<P: Clone + Eq + Hash + Debug + Send + Sync + 'static> Renderer<'_, P> {
if response.delta != 0.0
&& let Some(size) = split.resized(*size, (split.first_size() + response.delta).clamp(lo, hi) - split.first_size(), 0.0)
{
self.output.actions.push(Action::ResizeSplit { path: self.original_path(path), size });
self.output.actions.push(Action::ResizeSplit { path: layout_path, size });
}
}
Node::Tabs { panels, active } => self.group(ui, panels, *active, false, rect, GroupKind::Frame),
+1 -1
View File
@@ -863,7 +863,7 @@ impl<'a, P: Clone + Eq + Hash + Debug + Send + Sync + 'static> DockArea<'a, P> {
renderer.finish_group_drag(ui);
renderer.finish_drag(ui.ctx());
renderer.report_flyout(ui.ctx());
super::hits::record(ui.ctx(), self.id, &view, &renderer.owned_interactions);
super::hits::record(ui.ctx(), self.id, layout, &renderer.owned_interactions);
record_tab_focus(ui.ctx(), self.id, layout, !renderer.output.actions.is_empty());
ui.ctx().data_mut(|d| d.insert_temp(float_space_key(self.id), renderer.float_space));
ui.ctx().data_mut(|d| d.insert_temp(self.id.with("owned-interactions"), renderer.owned_interactions));