Apply scroll_max after uniform list autoscrolls

This commit is contained in:
Max Brunsfeld 2022-01-14 11:56:28 -08:00
parent dd8e5ee543
commit f3239fe1d5

View File

@ -14,6 +14,7 @@ use std::{cmp, ops::Range, sync::Arc};
#[derive(Clone, Default)]
pub struct UniformListState(Arc<Mutex<StateInner>>);
#[derive(Debug)]
pub enum ScrollTarget {
Show(usize),
Center(usize),
@ -98,10 +99,6 @@ where
fn autoscroll(&mut self, scroll_max: f32, list_height: f32, item_height: f32) {
let mut state = self.state.0.lock();
if state.scroll_top > scroll_max {
state.scroll_top = scroll_max;
}
if let Some(scroll_to) = state.scroll_to.take() {
let item_ix;
let center;
@ -130,6 +127,10 @@ where
}
}
}
if state.scroll_top > scroll_max {
state.scroll_top = scroll_max;
}
}
fn scroll_top(&self) -> f32 {