Apply scroll_max after uniform list autoscrolls
This commit is contained in:
parent
dd8e5ee543
commit
f3239fe1d5
1 changed files with 5 additions and 4 deletions
|
@ -14,6 +14,7 @@ use std::{cmp, ops::Range, sync::Arc};
|
||||||
#[derive(Clone, Default)]
|
#[derive(Clone, Default)]
|
||||||
pub struct UniformListState(Arc<Mutex<StateInner>>);
|
pub struct UniformListState(Arc<Mutex<StateInner>>);
|
||||||
|
|
||||||
|
#[derive(Debug)]
|
||||||
pub enum ScrollTarget {
|
pub enum ScrollTarget {
|
||||||
Show(usize),
|
Show(usize),
|
||||||
Center(usize),
|
Center(usize),
|
||||||
|
@ -98,10 +99,6 @@ where
|
||||||
fn autoscroll(&mut self, scroll_max: f32, list_height: f32, item_height: f32) {
|
fn autoscroll(&mut self, scroll_max: f32, list_height: f32, item_height: f32) {
|
||||||
let mut state = self.state.0.lock();
|
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() {
|
if let Some(scroll_to) = state.scroll_to.take() {
|
||||||
let item_ix;
|
let item_ix;
|
||||||
let center;
|
let center;
|
||||||
|
@ -130,6 +127,10 @@ where
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if state.scroll_top > scroll_max {
|
||||||
|
state.scroll_top = scroll_max;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn scroll_top(&self) -> f32 {
|
fn scroll_top(&self) -> f32 {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue