mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-09 21:23:43 +00:00
Cached peer list rows into opaque images while scrolling.
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
/*
|
||||
This file is part of Telegram Desktop,
|
||||
the official desktop application for the Telegram messaging service.
|
||||
|
||||
For license and copyright information please follow this link:
|
||||
https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
*/
|
||||
#include "boxes/peer_list_scroll_cache.h"
|
||||
|
||||
namespace {
|
||||
|
||||
constexpr auto kStopTimeout = crl::time(120);
|
||||
|
||||
} // namespace
|
||||
|
||||
PeerListRowsScrollCache::PeerListRowsScrollCache(Fn<void()> stopped) {
|
||||
_stopTimer.setCallback([=] {
|
||||
_scrolling = false;
|
||||
_images.clear();
|
||||
stopped();
|
||||
});
|
||||
}
|
||||
|
||||
void PeerListRowsScrollCache::markScrolling() {
|
||||
_scrolling = true;
|
||||
_stopTimer.callOnce(kStopTimeout);
|
||||
}
|
||||
|
||||
void PeerListRowsScrollCache::invalidate(uint64 rowId) {
|
||||
if (const auto i = _images.find(rowId); i != end(_images)) {
|
||||
_images.erase(i);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user