From fb036529a222126da3f119da4d94d17776460421 Mon Sep 17 00:00:00 2001 From: Cory Forsstrom Date: Mon, 17 Oct 2022 14:56:06 -0700 Subject: [PATCH] Render picked pane last --- native/src/widget/pane_grid.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/native/src/widget/pane_grid.rs b/native/src/widget/pane_grid.rs index 8eadac48cd..3ef578bfea 100644 --- a/native/src/widget/pane_grid.rs +++ b/native/src/widget/pane_grid.rs @@ -757,7 +757,12 @@ pub fn draw( cursor_position }; - for ((id, pane), layout) in elements.zip(layout.children()) { + // Render picked pane last + let mut elements = elements.zip(layout.children()).collect::>(); + elements + .sort_by_key(|((id, _), _)| picked_pane.map(|(id, _)| id) == Some(*id)); + + for ((id, pane), layout) in elements { match picked_pane { Some((dragging, origin)) if id == dragging => { let bounds = layout.bounds();