Fix initial stories collapsing in chats list.

This commit is contained in:
John Preston 2023-05-26 19:51:56 +04:00
parent 0edbb91b72
commit cdd4774bb8
2 changed files with 9 additions and 3 deletions

View file

@ -328,6 +328,7 @@ InnerWidget::InnerWidget(
) | rpl::filter([=] { ) | rpl::filter([=] {
return (_viewportHeight > 0) && (defaultScrollTop() > _visibleTop); return (_viewportHeight > 0) && (defaultScrollTop() > _visibleTop);
}) | rpl::start_with_next([=] { }) | rpl::start_with_next([=] {
refreshForDefaultScroll();
jumpToTop(); jumpToTop();
}, lifetime()); }, lifetime());
@ -1735,9 +1736,7 @@ void InnerWidget::mousePressReleased(
void InnerWidget::setViewportHeight(int viewportHeight) { void InnerWidget::setViewportHeight(int viewportHeight) {
if (_viewportHeight != viewportHeight) { if (_viewportHeight != viewportHeight) {
_viewportHeight = viewportHeight; _viewportHeight = viewportHeight;
if (height() < defaultScrollTop() + viewportHeight) { refreshForDefaultScroll();
refresh();
}
} }
} }
@ -2766,6 +2765,12 @@ void InnerWidget::editOpenedFilter() {
} }
} }
void InnerWidget::refreshForDefaultScroll() {
if (height() < defaultScrollTop() + _viewportHeight) {
refresh();
}
}
void InnerWidget::refresh(bool toTop) { void InnerWidget::refresh(bool toTop) {
if (!_geometryInited) { if (!_geometryInited) {
return; return;

View file

@ -122,6 +122,7 @@ public:
void clearFilter(); void clearFilter();
void refresh(bool toTop = false); void refresh(bool toTop = false);
void refreshForDefaultScroll();
void refreshEmptyLabel(); void refreshEmptyLabel();
void resizeEmptyLabel(); void resizeEmptyLabel();