Improve first reaction animation in group.

This commit is contained in:
John Preston 2022-01-11 19:35:59 +03:00
parent 928d8feb21
commit 2c599e60c3

View file

@ -198,12 +198,17 @@ void InlineList::paint(
} }
p.setFont(st::semiboldFont); p.setFont(st::semiboldFont);
for (const auto &button : _buttons) { for (const auto &button : _buttons) {
const auto mine = (_data.chosenReaction == button.emoji);
const auto withoutMine = button.count - (mine ? 1 : 0);
const auto animating = (animated == button.emoji); const auto animating = (animated == button.emoji);
const auto skipImage = animating
&& (withoutMine < 1 || !_animation->flying());
const auto skipBubble = skipImage && _animation->flying();
const auto &geometry = button.geometry; const auto &geometry = button.geometry;
const auto inner = geometry.marginsRemoved(padding); const auto inner = geometry.marginsRemoved(padding);
const auto chosen = (_data.chosenReaction == button.emoji) const auto chosen = mine
&& (!animating || !_animation->flying()); && (!animating || !_animation->flying());
{ if (!skipBubble) {
auto hq = PainterHighQualityEnabler(p); auto hq = PainterHighQualityEnabler(p);
p.setPen(Qt::NoPen); p.setPen(Qt::NoPen);
if (inbubble) { if (inbubble) {
@ -230,8 +235,6 @@ void InlineList::paint(
const auto image = QRect( const auto image = QRect(
inner.topLeft() + QPoint(skip, skip), inner.topLeft() + QPoint(skip, skip),
QSize(st::reactionBottomImage, st::reactionBottomImage)); QSize(st::reactionBottomImage, st::reactionBottomImage));
const auto skipImage = animating
&& (button.count < 2 || !_animation->flying());
if (!button.image.isNull() && !skipImage) { if (!button.image.isNull() && !skipImage) {
p.drawImage(image.topLeft(), button.image); p.drawImage(image.topLeft(), button.image);
} }
@ -240,6 +243,7 @@ void InlineList::paint(
return _animation->paintGetArea(p, QPoint(), image); return _animation->paintGetArea(p, QPoint(), image);
}; };
} }
if (!skipBubble) {
p.setPen(!inbubble p.setPen(!inbubble
? (chosen ? (chosen
? QPen(AdaptChosenServiceFg(st->msgServiceBg()->c)) ? QPen(AdaptChosenServiceFg(st->msgServiceBg()->c))
@ -261,6 +265,7 @@ void InlineList::paint(
button.countText); button.countText);
} }
} }
}
bool InlineList::getState( bool InlineList::getState(
QPoint point, QPoint point,