mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-15 21:57:10 +02:00
Fix non-shown group thumb in media viewer.
This commit is contained in:
parent
cad8a85497
commit
df8176d671
1 changed files with 23 additions and 12 deletions
|
@ -190,18 +190,19 @@ public:
|
|||
Data::FileOrigin origin,
|
||||
Fn<void()> handler);
|
||||
|
||||
int leftToUpdate() const;
|
||||
int rightToUpdate() const;
|
||||
[[nodiscard]] int leftToUpdate() const;
|
||||
[[nodiscard]] int rightToUpdate() const;
|
||||
|
||||
void animateToLeft(not_null<Thumb*> next);
|
||||
void animateToRight(not_null<Thumb*> prev);
|
||||
|
||||
void setState(State state);
|
||||
State state() const;
|
||||
bool removed() const;
|
||||
[[nodiscard]] State state() const;
|
||||
[[nodiscard]] bool inited() const;
|
||||
[[nodiscard]] bool removed() const;
|
||||
|
||||
void paint(QPainter &p, int x, int y, int outerWidth, float64 progress);
|
||||
ClickHandlerPtr getState(QPoint point) const;
|
||||
[[nodiscard]] ClickHandlerPtr getState(QPoint point) const;
|
||||
|
||||
private:
|
||||
QSize wantedPixSize() const;
|
||||
|
@ -400,6 +401,10 @@ auto GroupThumbs::Thumb::state() const -> State {
|
|||
return _state;
|
||||
}
|
||||
|
||||
bool GroupThumbs::Thumb::inited() const {
|
||||
return _fullWidth != 0;
|
||||
}
|
||||
|
||||
bool GroupThumbs::Thumb::removed() const {
|
||||
return (_state == State::Dying) && _hiding && !_opacity.current();
|
||||
}
|
||||
|
@ -819,21 +824,27 @@ void GroupThumbs::paint(QPainter &p, int x, int y, int outerWidth) {
|
|||
: _animation.value(1.);
|
||||
x += (_width / 2);
|
||||
y += st::mediaviewGroupPadding.top();
|
||||
auto initedCurrentIndex = int(_items.size());
|
||||
for (auto i = _cache.begin(); i != _cache.end();) {
|
||||
const auto &thumb = i->second;
|
||||
const auto thumb = not_null{ i->second.get() };
|
||||
const auto inited = thumb->inited();
|
||||
thumb->paint(p, x, y, outerWidth, progress);
|
||||
if (thumb->removed()) {
|
||||
_dying.erase(
|
||||
ranges::remove(
|
||||
_dying,
|
||||
thumb.get(),
|
||||
[](not_null<Thumb*> thumb) { return thumb.get(); }),
|
||||
_dying.end());
|
||||
_dying.erase(ranges::remove(_dying, thumb), _dying.end());
|
||||
i = _cache.erase(i);
|
||||
} else {
|
||||
if (!inited
|
||||
&& thumb->inited()
|
||||
&& thumb->state() == Thumb::State::Current) {
|
||||
initedCurrentIndex = ranges::find(_items, thumb)
|
||||
- begin(_items);
|
||||
}
|
||||
++i;
|
||||
}
|
||||
}
|
||||
if (initedCurrentIndex < _items.size()) {
|
||||
animateAliveItems(initedCurrentIndex);
|
||||
}
|
||||
}
|
||||
|
||||
ClickHandlerPtr GroupThumbs::getState(QPoint point) const {
|
||||
|
|
Loading…
Add table
Reference in a new issue