Skip to content

Commit 46d0918

Browse files
authored
Update scroll_area.rs
1 parent 2913cdb commit 46d0918

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

crates/egui/src/containers/scroll_area.rs

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,10 @@ impl Prepared {
960960
let main_range = Rangef::new(inner_rect.min[d], inner_rect.max[d]);
961961

962962
// Margin on either side of the scroll bar:
963+
let inner_margin = match scroll_style.floating {
964+
true => 0.0,
965+
false => show_factor * scroll_style.bar_inner_margin,
966+
};
963967
let outer_margin = show_factor * scroll_style.bar_outer_margin;
964968

965969
let mut max_cross = outer_rect.max[1 - d] - outer_margin;
@@ -1005,12 +1009,12 @@ impl Prepared {
10051009

10061010
let outer_scroll_rect = if d == 0 {
10071011
Rect::from_min_max(
1008-
pos2(inner_rect.left(), cross.min),
1012+
pos2(inner_rect.left(), cross.min - inner_margin),
10091013
pos2(inner_rect.right(), cross.max),
10101014
)
10111015
} else {
10121016
Rect::from_min_max(
1013-
pos2(cross.min, inner_rect.top()),
1017+
pos2(cross.min - inner_margin, inner_rect.top()),
10141018
pos2(cross.max, inner_rect.bottom()),
10151019
)
10161020
};

0 commit comments

Comments
 (0)