Skip to content

Commit

Permalink
Update scroll_area.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
rustbasic authored Jun 20, 2024
1 parent 2913cdb commit 46d0918
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions crates/egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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()),
)
};
Expand Down

0 comments on commit 46d0918

Please sign in to comment.