egui: fix scroll not sticking when scrollbar is hidden (#3434)
Before: https://github.com/emilk/egui/assets/4723091/4b42842c-4f34-45d1-9538-29cd0bfd614e https://github.com/emilk/egui/assets/4723091/7544e300-5b9a-4b2b-aaa4-9acade69fa75 After: https://github.com/emilk/egui/assets/4723091/d720286f-a166-4891-874a-350b15683587
This commit is contained in:
parent
cd46691423
commit
fb8fa67afd
|
|
@ -812,6 +812,11 @@ impl Prepared {
|
|||
|
||||
// Paint the bars:
|
||||
for d in 0..2 {
|
||||
// maybe force increase in offset to keep scroll stuck to end position
|
||||
if stick_to_end[d] && state.scroll_stuck_to_end[d] {
|
||||
state.offset[d] = content_size[d] - inner_rect.size()[d];
|
||||
}
|
||||
|
||||
let show_factor = show_bars_factor[d];
|
||||
if show_factor == 0.0 {
|
||||
state.scroll_bar_interaction[d] = false;
|
||||
|
|
@ -882,11 +887,6 @@ impl Prepared {
|
|||
)
|
||||
};
|
||||
|
||||
// maybe force increase in offset to keep scroll stuck to end position
|
||||
if stick_to_end[d] && state.scroll_stuck_to_end[d] {
|
||||
state.offset[d] = content_size[d] - inner_rect.size()[d];
|
||||
}
|
||||
|
||||
let from_content = |content| remap_clamp(content, 0.0..=content_size[d], main_range);
|
||||
|
||||
let handle_rect = if d == 0 {
|
||||
|
|
|
|||
Loading…
Reference in New Issue