Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 11 additions & 3 deletions crates/egui/src/containers/scroll_area.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,12 @@ impl ScrollArea {
ctx.animate_bool_responsive(id.with("v"), show_bars[1]),
);

let current_bar_use = show_bars_factor.yx() * ui.spacing().scroll.allocated_width();
let scroll_style = ui.spacing().scroll;
let current_bar_use = if scroll_style.floating {
show_bars.to_vec2().yx() * scroll_style.allocated_width()
} else {
show_bars_factor.yx() * scroll_style.allocated_width()
};

let available_outer = ui.available_rect_before_wrap();

Expand Down Expand Up @@ -1158,9 +1163,12 @@ impl Prepared {

let outer_rect = Rect::from_min_size(inner_rect.min, inner_rect.size() + current_bar_use);

// Epsilon to prevent jitter from floating-point rounding.
let epsilon = 0.5;

let content_is_too_large = Vec2b::new(
direction_enabled[0] && inner_rect.width() < content_size.x,
direction_enabled[1] && inner_rect.height() < content_size.y,
direction_enabled[0] && (inner_rect.width() + epsilon < content_size.x),
direction_enabled[1] && (inner_rect.height() + epsilon < content_size.y),
);

let max_offset = content_size - inner_rect.size();
Expand Down
Loading