mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-17 06:37:24 +02:00
Better animate sent reaction in flipped context.
This commit is contained in:
parent
ae426a41e0
commit
11f183a79f
2 changed files with 11 additions and 2 deletions
|
@ -201,6 +201,7 @@ QSize InlineList::countOptimalSize() {
|
|||
}
|
||||
|
||||
QSize InlineList::countCurrentSize(int newWidth) {
|
||||
_data.flags &= ~Data::Flag::Flipped;
|
||||
if (_buttons.empty()) {
|
||||
return optimalSize();
|
||||
}
|
||||
|
@ -246,6 +247,7 @@ int InlineList::countNiceWidth() const {
|
|||
}
|
||||
|
||||
void InlineList::flipToRight() {
|
||||
_data.flags |= Data::Flag::Flipped;
|
||||
for (auto &button : _buttons) {
|
||||
button.geometry.moveLeft(
|
||||
width() - button.geometry.x() - button.geometry.width());
|
||||
|
@ -274,6 +276,7 @@ void InlineList::paint(
|
|||
const auto animated = (_animation && context.reactionEffects)
|
||||
? _animation->playingAroundEmoji()
|
||||
: QString();
|
||||
const auto flipped = (_data.flags & Data::Flag::Flipped);
|
||||
if (_animation && context.reactionEffects && animated.isEmpty()) {
|
||||
_animation = nullptr;
|
||||
}
|
||||
|
@ -315,7 +318,12 @@ void InlineList::paint(
|
|||
p.setBrush(chosen ? st->msgServiceFg() : st->msgServiceBg());
|
||||
}
|
||||
const auto radius = geometry.height() / 2.;
|
||||
const auto fill = geometry.marginsAdded({ 0, 0, bubbleSkip, 0 });
|
||||
const auto fill = geometry.marginsAdded({
|
||||
flipped ? bubbleSkip : 0,
|
||||
0,
|
||||
flipped ? 0 : bubbleSkip,
|
||||
0,
|
||||
});
|
||||
p.drawRoundedRect(fill, radius, radius);
|
||||
if (inbubble && !chosen) {
|
||||
p.setOpacity(bubbleProgress);
|
||||
|
@ -341,7 +349,7 @@ void InlineList::paint(
|
|||
continue;
|
||||
}
|
||||
resolveUserpicsImage(button);
|
||||
const auto left = inner.x() + bubbleSkip;
|
||||
const auto left = inner.x() + (flipped ? 0 : bubbleSkip);
|
||||
if (button.userpics) {
|
||||
p.drawImage(
|
||||
left + size + st::reactionInlineUserpicsPadding.left(),
|
||||
|
|
|
@ -34,6 +34,7 @@ struct InlineListData {
|
|||
enum class Flag : uchar {
|
||||
InBubble = 0x01,
|
||||
OutLayout = 0x02,
|
||||
Flipped = 0x04,
|
||||
};
|
||||
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
||||
using Flags = base::flags<Flag>;
|
||||
|
|
Loading…
Add table
Reference in a new issue