mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +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) {
|
QSize InlineList::countCurrentSize(int newWidth) {
|
||||||
|
_data.flags &= ~Data::Flag::Flipped;
|
||||||
if (_buttons.empty()) {
|
if (_buttons.empty()) {
|
||||||
return optimalSize();
|
return optimalSize();
|
||||||
}
|
}
|
||||||
|
@ -246,6 +247,7 @@ int InlineList::countNiceWidth() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void InlineList::flipToRight() {
|
void InlineList::flipToRight() {
|
||||||
|
_data.flags |= Data::Flag::Flipped;
|
||||||
for (auto &button : _buttons) {
|
for (auto &button : _buttons) {
|
||||||
button.geometry.moveLeft(
|
button.geometry.moveLeft(
|
||||||
width() - button.geometry.x() - button.geometry.width());
|
width() - button.geometry.x() - button.geometry.width());
|
||||||
|
@ -274,6 +276,7 @@ void InlineList::paint(
|
||||||
const auto animated = (_animation && context.reactionEffects)
|
const auto animated = (_animation && context.reactionEffects)
|
||||||
? _animation->playingAroundEmoji()
|
? _animation->playingAroundEmoji()
|
||||||
: QString();
|
: QString();
|
||||||
|
const auto flipped = (_data.flags & Data::Flag::Flipped);
|
||||||
if (_animation && context.reactionEffects && animated.isEmpty()) {
|
if (_animation && context.reactionEffects && animated.isEmpty()) {
|
||||||
_animation = nullptr;
|
_animation = nullptr;
|
||||||
}
|
}
|
||||||
|
@ -315,7 +318,12 @@ void InlineList::paint(
|
||||||
p.setBrush(chosen ? st->msgServiceFg() : st->msgServiceBg());
|
p.setBrush(chosen ? st->msgServiceFg() : st->msgServiceBg());
|
||||||
}
|
}
|
||||||
const auto radius = geometry.height() / 2.;
|
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);
|
p.drawRoundedRect(fill, radius, radius);
|
||||||
if (inbubble && !chosen) {
|
if (inbubble && !chosen) {
|
||||||
p.setOpacity(bubbleProgress);
|
p.setOpacity(bubbleProgress);
|
||||||
|
@ -341,7 +349,7 @@ void InlineList::paint(
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
resolveUserpicsImage(button);
|
resolveUserpicsImage(button);
|
||||||
const auto left = inner.x() + bubbleSkip;
|
const auto left = inner.x() + (flipped ? 0 : bubbleSkip);
|
||||||
if (button.userpics) {
|
if (button.userpics) {
|
||||||
p.drawImage(
|
p.drawImage(
|
||||||
left + size + st::reactionInlineUserpicsPadding.left(),
|
left + size + st::reactionInlineUserpicsPadding.left(),
|
||||||
|
|
|
@ -34,6 +34,7 @@ struct InlineListData {
|
||||||
enum class Flag : uchar {
|
enum class Flag : uchar {
|
||||||
InBubble = 0x01,
|
InBubble = 0x01,
|
||||||
OutLayout = 0x02,
|
OutLayout = 0x02,
|
||||||
|
Flipped = 0x04,
|
||||||
};
|
};
|
||||||
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
friend inline constexpr bool is_flag_type(Flag) { return true; };
|
||||||
using Flags = base::flags<Flag>;
|
using Flags = base::flags<Flag>;
|
||||||
|
|
Loading…
Add table
Reference in a new issue