From ad852f0f4ab271de4db799d01fa8b7032eb33b11 Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 24 Jul 2023 10:43:45 +0400 Subject: [PATCH] Fix incorrect state of ElasticScroll. --- ui/widgets/elastic_scroll.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/ui/widgets/elastic_scroll.cpp b/ui/widgets/elastic_scroll.cpp index 221d790..4406c43 100644 --- a/ui/widgets/elastic_scroll.cpp +++ b/ui/widgets/elastic_scroll.cpp @@ -734,13 +734,13 @@ bool ElasticScroll::eventFilter(QObject *obj, QEvent *e) { if (obj == _widget.data()) { if (filterOutTouchEvent(e)) { return true; - } else if (e->type() == QEvent::Resize) { + } else if (e->type() == QEvent::Resize) { const auto weak = Ui::MakeWeak(this); updateState(); if (weak) { _innerResizes.fire({}); } - } else if (e->type() == QEvent::Move) { + } else if (e->type() == QEvent::Move) { updateState(); } return result; @@ -903,8 +903,10 @@ void ElasticScroll::updateState() { const auto delta = std::max( std::min(nowOverscroll - wasOverscroll, from), 0); - from -= delta; - till -= delta; + if (delta) { + applyScrollTo(from - delta); + return; + } } setState({ .visibleFrom = from,