mirror of
https://github.com/telegramdesktop/tdesktop
synced 2024-12-24 23:42:58 +00:00
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;
|
||||
}
|
||||
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 };
|
||||
std::unique_ptr<Window::ConnectionState> _connecting;
|
||||
|
||||
Animation _scrollToAnimation;
|
||||
Animation _a_show;
|
||||
Window::SlideDirection _showDirection;
|
||||
QPixmap _cacheUnder, _cacheOver;
|
||||
|
Loading…
Reference in New Issue
Block a user