mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 07:23:02 +02:00
Fix glitching userpics in monoforum.
This commit is contained in:
parent
7dadaa1b28
commit
ee3d70f879
1 changed files with 13 additions and 1 deletions
|
@ -283,6 +283,12 @@ void SubsectionTabs::setupSlider(
|
||||||
}
|
}
|
||||||
}, scroll->lifetime());
|
}, scroll->lifetime());
|
||||||
|
|
||||||
|
using ImagePointer = std::shared_ptr<Ui::DynamicImage>;
|
||||||
|
struct Cache {
|
||||||
|
base::flat_map<not_null<PeerData*>, ImagePointer> userpics;
|
||||||
|
};
|
||||||
|
const auto cache = std::make_shared<Cache>();
|
||||||
|
|
||||||
_refreshed.events_starting_with_copy(
|
_refreshed.events_starting_with_copy(
|
||||||
rpl::empty
|
rpl::empty
|
||||||
) | rpl::start_with_next([=] {
|
) | rpl::start_with_next([=] {
|
||||||
|
@ -291,6 +297,7 @@ void SubsectionTabs::setupSlider(
|
||||||
return _controller->isGifPausedAtLeastFor(
|
return _controller->isGifPausedAtLeastFor(
|
||||||
Window::GifPauseReason::Any);
|
Window::GifPauseReason::Any);
|
||||||
};
|
};
|
||||||
|
auto updated = Cache();
|
||||||
auto sections = std::vector<Ui::SubsectionTab>();
|
auto sections = std::vector<Ui::SubsectionTab>();
|
||||||
auto activeIndex = -1;
|
auto activeIndex = -1;
|
||||||
for (const auto &item : _slice) {
|
for (const auto &item : _slice) {
|
||||||
|
@ -337,9 +344,13 @@ void SubsectionTabs::setupSlider(
|
||||||
} else if (const auto sublist = item.thread->asSublist()) {
|
} else if (const auto sublist = item.thread->asSublist()) {
|
||||||
const auto peer = sublist->sublistPeer();
|
const auto peer = sublist->sublistPeer();
|
||||||
if (vertical) {
|
if (vertical) {
|
||||||
|
auto was = cache->userpics[peer];
|
||||||
|
auto userpic = updated.userpics[peer] = was
|
||||||
|
? was
|
||||||
|
: Ui::MakeUserpicThumbnail(peer);
|
||||||
sections.push_back({
|
sections.push_back({
|
||||||
.text = peer->shortName(),
|
.text = peer->shortName(),
|
||||||
.userpic = Ui::MakeUserpicThumbnail(peer),
|
.userpic = std::move(userpic),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
sections.push_back({
|
sections.push_back({
|
||||||
|
@ -359,6 +370,7 @@ void SubsectionTabs::setupSlider(
|
||||||
auto §ion = sections.back();
|
auto §ion = sections.back();
|
||||||
section.badges = item.badges;
|
section.badges = item.badges;
|
||||||
}
|
}
|
||||||
|
*cache = std::move(updated);
|
||||||
|
|
||||||
auto scrollSavingThread = (Data::Thread*)nullptr;
|
auto scrollSavingThread = (Data::Thread*)nullptr;
|
||||||
auto scrollSavingShift = 0;
|
auto scrollSavingShift = 0;
|
||||||
|
|
Loading…
Add table
Reference in a new issue