diff --git a/crates/ui/src/docking/floating_tests.rs b/crates/ui/src/docking/floating_tests.rs index da5ae98c..76175b2c 100644 --- a/crates/ui/src/docking/floating_tests.rs +++ b/crates/ui/src/docking/floating_tests.rs @@ -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::::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::::hit_rects(&d.ctx, Id::new(AREA)).iter().any(|(h, _)| *h == hit), "the hits name the layout path"); + let divider = d.response(DockArea::::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) }; diff --git a/crates/ui/src/docking/render/mod.rs b/crates/ui/src/docking/render/mod.rs index 167f68d9..869c8d0c 100644 --- a/crates/ui/src/docking/render/mod.rs +++ b/crates/ui/src/docking/render/mod.rs @@ -95,8 +95,10 @@ impl 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 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), diff --git a/crates/ui/src/docking/surface.rs b/crates/ui/src/docking/surface.rs index 36b037b3..234c7c4a 100644 --- a/crates/ui/src/docking/surface.rs +++ b/crates/ui/src/docking/surface.rs @@ -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));