File tree Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Expand file tree Collapse file tree 3 files changed +14
-1
lines changed Original file line number Diff line number Diff line change @@ -171,6 +171,7 @@ impl Item for NativeScrollView {
171171 if new_control == SC_ScrollBarSlider {
172172 data. pressed_x = pos as f32 ;
173173 data. pressed_val = -value as f32 ;
174+ data. pressed_max = max as f32 ;
174175 }
175176 data. active_controls = new_control;
176177 InputEventResult :: GrabMouse
@@ -210,6 +211,17 @@ impl Item for NativeScrollView {
210211 MouseEvent :: Moved { .. } => {
211212 if data. pressed != 0 && data. active_controls == SC_ScrollBarSlider {
212213 let max = max as f32 ;
214+
215+ // Update reference points when the size of the viewport changes to
216+ // avoid 'jumping' during scrolling.
217+ // This happens when the height estimate of a ListView changes after
218+ // new items are loaded.
219+ if data. pressed_max != max {
220+ data. pressed_x = pos as f32 ;
221+ data. pressed_val = -value as f32 ;
222+ data. pressed_max = max;
223+ }
224+
213225 let new_val = data. pressed_val
214226 + ( ( pos as f32 ) - data. pressed_x ) * ( max + ( page_size as f32 ) )
215227 / size as f32 ;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ pub(super) struct NativeSliderData {
1717 pub pressed : u8 ,
1818 pub pressed_x : f32 ,
1919 pub pressed_val : f32 ,
20+ pub pressed_max : f32 ,
2021}
2122
2223type FloatArg = ( f32 , ) ;
Original file line number Diff line number Diff line change @@ -442,7 +442,7 @@ impl FlickableData {
442442
443443 // Update reference points when the size of the viewport changes to
444444 // avoid 'jumping' during scrolling.
445- // This happens when height estimate of a ListView changes after
445+ // This happens when the height estimate of a ListView changes after
446446 // new items are loaded.
447447 if current_viewport_size != inner. pressed_viewport_size {
448448 inner. pressed_viewport_size = current_viewport_size;
You can’t perform that action at this time.
0 commit comments