@@ -228,7 +228,12 @@ void FlexibleScrollHelper::setupScrollHandlingWithFilter() {
228228 if (std::abs (delta) != 120 ) {
229229 return base::EventFilterResult::Continue;
230230 }
231- const auto top = _scroll->scrollTop ();
231+ const auto actualTop = _scroll->scrollTop ();
232+ const auto animationActive = _scrollAnimation.animating ()
233+ && (_lastScrollApplied != _scrollTopTo);
234+ const auto top = animationActive
235+ ? (_lastScrollApplied ? _lastScrollApplied : actualTop)
236+ : actualTop;
232237 const auto diff = (delta > 0 ) ? -singleStep : singleStep;
233238 const auto previousValue = top;
234239 const auto targetTop = top + diff;
@@ -243,7 +248,7 @@ void FlexibleScrollHelper::setupScrollHandlingWithFilter() {
243248 : (targetTop < step2)
244249 ? step1
245250 : -1 );
246- if (_scrollAnimation. animating ()
251+ if (animationActive
247252 && ((_scrollTopTo > _scrollTopFrom) != (diff > 0 ))) {
248253 auto overriddenDirection = true ;
249254 if (_scrollTopTo > _scrollTopFrom) {
@@ -277,8 +282,8 @@ void FlexibleScrollHelper::setupScrollHandlingWithFilter() {
277282 _lastScrollApplied = 0 ;
278283 }
279284 }
280- _scrollTopFrom = _lastScrollApplied ? _lastScrollApplied : top;
281- if (!_scrollAnimation. animating () ) {
285+ _scrollTopFrom = top;
286+ if (!animationActive ) {
282287 _scrollTopTo = (nextStep != -1 ) ? nextStep : targetTop;
283288 _scrollAnimation.start ();
284289 } else {
0 commit comments