mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 07:07:08 +02:00
Don't stick to bottom while loading down.
This commit is contained in:
parent
f223ae7eee
commit
0f524ac67d
2 changed files with 6 additions and 2 deletions
Telegram/SourceFiles/history/view
|
@ -589,6 +589,7 @@ void ListWidget::refreshRows(const Data::MessagesSlice &old) {
|
|||
|
||||
auto destroyingBarElement = _bar.element;
|
||||
auto clearingOverElement = _overElement;
|
||||
_itemsKnownTillEnd = (_slice.skippedAfter == 0);
|
||||
_resizePending = true;
|
||||
_items.clear();
|
||||
_items.reserve(_slice.ids.size());
|
||||
|
@ -1107,7 +1108,7 @@ void ListWidget::applyUpdatedScrollState() {
|
|||
}
|
||||
|
||||
void ListWidget::updateVisibleTopItem() {
|
||||
if (_visibleBottom == height()) {
|
||||
if (_itemsKnownTillEnd && _visibleBottom == height()) {
|
||||
_visibleTopItem = nullptr;
|
||||
} else if (_items.empty()) {
|
||||
_visibleTopItem = nullptr;
|
||||
|
@ -2558,7 +2559,8 @@ Element *ListWidget::strictFindItemByY(int y) const {
|
|||
}
|
||||
|
||||
auto ListWidget::countScrollState() const -> ScrollTopState {
|
||||
if (_items.empty() || _visibleBottom == height()) {
|
||||
if (_items.empty()
|
||||
|| (_itemsKnownTillEnd && _visibleBottom == height())) {
|
||||
return { Data::MessagePosition(), 0 };
|
||||
}
|
||||
const auto topItem = findItemByY(_visibleTop);
|
||||
|
|
|
@ -727,6 +727,8 @@ private:
|
|||
int _aroundIndex = -1;
|
||||
int _idsLimit = kMinimalIdsLimit;
|
||||
Data::MessagesSlice _slice;
|
||||
bool _itemsKnownTillEnd = false;
|
||||
|
||||
std::vector<not_null<Element*>> _items;
|
||||
ViewsMap _views, _viewsCapacity;
|
||||
int _itemsTop = 0;
|
||||
|
|
Loading…
Add table
Reference in a new issue