mirror of https://github.com/procxx/kepka.git
Added scroll animation in dialogs list when it scrolls to top.
This commit is contained in:
parent
c2ad765424
commit
32bc723745
|
@ -333,7 +333,25 @@ void DialogsWidget::dialogsToUp() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (_filter->getLastText().trimmed().isEmpty() && !_searchInChat) {
|
if (_filter->getLastText().trimmed().isEmpty() && !_searchInChat) {
|
||||||
_scroll->scrollToY(0);
|
_scrollToAnimation.finish();
|
||||||
|
auto scrollTop = _scroll->scrollTop();
|
||||||
|
const auto scrollTo = 0;
|
||||||
|
const auto maxAnimatedDelta = _scroll->height();
|
||||||
|
if (scrollTo + maxAnimatedDelta < scrollTop) {
|
||||||
|
scrollTop = scrollTo + maxAnimatedDelta;
|
||||||
|
_scroll->scrollToY(scrollTop);
|
||||||
|
}
|
||||||
|
|
||||||
|
const auto scroll = [&] {
|
||||||
|
_scroll->scrollToY(qRound(_scrollToAnimation.current()));
|
||||||
|
};
|
||||||
|
|
||||||
|
_scrollToAnimation.start(
|
||||||
|
scroll,
|
||||||
|
scrollTop,
|
||||||
|
scrollTo,
|
||||||
|
st::slideDuration,
|
||||||
|
anim::sineInOut);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -199,6 +199,7 @@ private:
|
||||||
object_ptr<BottomButton> _loadMoreChats = { nullptr };
|
object_ptr<BottomButton> _loadMoreChats = { nullptr };
|
||||||
std::unique_ptr<Window::ConnectionState> _connecting;
|
std::unique_ptr<Window::ConnectionState> _connecting;
|
||||||
|
|
||||||
|
Animation _scrollToAnimation;
|
||||||
Animation _a_show;
|
Animation _a_show;
|
||||||
Window::SlideDirection _showDirection;
|
Window::SlideDirection _showDirection;
|
||||||
QPixmap _cacheUnder, _cacheOver;
|
QPixmap _cacheUnder, _cacheOver;
|
||||||
|
|
Loading…
Reference in New Issue