From 46d09182bbd874e0fd2e316916f3a54332bb9a16 Mon Sep 17 00:00:00 2001 From: rustbasic <127506429+rustbasic@users.noreply.github.com> Date: Thu, 20 Jun 2024 16:15:05 +0900 Subject: [PATCH] Update scroll_area.rs --- crates/egui/src/containers/scroll_area.rs | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/crates/egui/src/containers/scroll_area.rs b/crates/egui/src/containers/scroll_area.rs index a526bc649cd..3b05e2795db 100644 --- a/crates/egui/src/containers/scroll_area.rs +++ b/crates/egui/src/containers/scroll_area.rs @@ -960,6 +960,10 @@ impl Prepared { let main_range = Rangef::new(inner_rect.min[d], inner_rect.max[d]); // Margin on either side of the scroll bar: + let inner_margin = match scroll_style.floating { + true => 0.0, + false => show_factor * scroll_style.bar_inner_margin, + }; let outer_margin = show_factor * scroll_style.bar_outer_margin; let mut max_cross = outer_rect.max[1 - d] - outer_margin; @@ -1005,12 +1009,12 @@ impl Prepared { let outer_scroll_rect = if d == 0 { Rect::from_min_max( - pos2(inner_rect.left(), cross.min), + pos2(inner_rect.left(), cross.min - inner_margin), pos2(inner_rect.right(), cross.max), ) } else { Rect::from_min_max( - pos2(cross.min, inner_rect.top()), + pos2(cross.min - inner_margin, inner_rect.top()), pos2(cross.max, inner_rect.bottom()), ) };