mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-07-26 07:23:02 +02:00
Improve first reaction animation in group.
This commit is contained in:
parent
928d8feb21
commit
2c599e60c3
1 changed files with 28 additions and 23 deletions
|
@ -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,25 +243,27 @@ void InlineList::paint(
|
||||||
return _animation->paintGetArea(p, QPoint(), image);
|
return _animation->paintGetArea(p, QPoint(), image);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
p.setPen(!inbubble
|
if (!skipBubble) {
|
||||||
? (chosen
|
p.setPen(!inbubble
|
||||||
? QPen(AdaptChosenServiceFg(st->msgServiceBg()->c))
|
? (chosen
|
||||||
: st->msgServiceFg())
|
? QPen(AdaptChosenServiceFg(st->msgServiceBg()->c))
|
||||||
: !chosen
|
: st->msgServiceFg())
|
||||||
? stm->msgServiceFg
|
: !chosen
|
||||||
: context.outbg
|
? stm->msgServiceFg
|
||||||
? (context.selected()
|
: context.outbg
|
||||||
? st->historyFileOutIconFgSelected()
|
? (context.selected()
|
||||||
: st->historyFileOutIconFg())
|
? st->historyFileOutIconFgSelected()
|
||||||
: (context.selected()
|
: st->historyFileOutIconFg())
|
||||||
? st->historyFileInIconFgSelected()
|
: (context.selected()
|
||||||
: st->historyFileInIconFg()));
|
? st->historyFileInIconFgSelected()
|
||||||
const auto textTop = geometry.y()
|
: st->historyFileInIconFg()));
|
||||||
+ ((geometry.height() - st::semiboldFont->height) / 2);
|
const auto textTop = geometry.y()
|
||||||
p.drawText(
|
+ ((geometry.height() - st::semiboldFont->height) / 2);
|
||||||
inner.x() + size + st::reactionBottomSkip,
|
p.drawText(
|
||||||
textTop + st::semiboldFont->ascent,
|
inner.x() + size + st::reactionBottomSkip,
|
||||||
button.countText);
|
textTop + st::semiboldFont->ascent,
|
||||||
|
button.countText);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue