Fix scroll bar position (#392)
* Fix scroll bar position * Always position scroll bar on the right side of the ScrollArea inner rect * Fix the clipping rect
This commit is contained in:
parent
6468b2b84e
commit
2932ff0e53
1 changed files with 4 additions and 4 deletions
|
@ -137,9 +137,9 @@ impl ScrollArea {
|
||||||
),
|
),
|
||||||
*ui.layout(),
|
*ui.layout(),
|
||||||
);
|
);
|
||||||
let mut content_clip_rect = inner_rect.expand(ui.visuals().clip_rect_margin);
|
let content_clip_rect = inner_rect
|
||||||
content_clip_rect = content_clip_rect.intersect(ui.clip_rect());
|
.expand(ui.visuals().clip_rect_margin)
|
||||||
content_clip_rect.max.x = ui.clip_rect().max.x - current_scroll_bar_width; // Nice handling of forced resizing beyond the possible
|
.intersect(ui.clip_rect());
|
||||||
content_ui.set_clip_rect(content_clip_rect);
|
content_ui.set_clip_rect(content_clip_rect);
|
||||||
|
|
||||||
let viewport = Rect::from_min_size(Pos2::ZERO + state.offset, inner_size);
|
let viewport = Rect::from_min_size(Pos2::ZERO + state.offset, inner_size);
|
||||||
|
@ -251,7 +251,7 @@ impl Prepared {
|
||||||
}
|
}
|
||||||
|
|
||||||
let width = if inner_rect.width().is_finite() {
|
let width = if inner_rect.width().is_finite() {
|
||||||
inner_rect.width().max(content_size.x) // Expand width to fit content
|
inner_rect.width() // Position scroll bar correctly
|
||||||
} else {
|
} else {
|
||||||
// ScrollArea is in an infinitely wide parent
|
// ScrollArea is in an infinitely wide parent
|
||||||
content_size.x
|
content_size.x
|
||||||
|
|
Loading…
Reference in a new issue