mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-18 23:27:09 +02:00
Scale premium reaction lock.
This commit is contained in:
parent
1745ccf0bf
commit
1a2a65ff19
2 changed files with 29 additions and 6 deletions
|
@ -991,7 +991,9 @@ void Manager::paintButton(
|
|||
? QPoint(0, expanded - expandedSkip)
|
||||
: QPoint(0, expandedSkip);
|
||||
const auto source = validateEmoji(frameIndex, scale);
|
||||
if (expanded || (current && !onlyMainEmojiVisible())) {
|
||||
if (expanded
|
||||
|| (current && !onlyMainEmojiVisible())
|
||||
|| (_icons.size() == 1 && _icons.front()->premiumLock)) {
|
||||
const auto origin = expanded ? QPoint() : position;
|
||||
const auto scroll = button->expandAnimationScroll(expandRatio);
|
||||
const auto opacity = button->expandAnimationOpacity(expandRatio);
|
||||
|
@ -1372,11 +1374,7 @@ void Manager::paintAllEmoji(
|
|||
clearStateForHidden(*icon);
|
||||
}
|
||||
} else if (icon->premiumLock) {
|
||||
st::reactionPremiumLocked.paintInCenter(p, QRect(
|
||||
_inner.x() + (_inner.width() - finalSize) / 2,
|
||||
_inner.y() + (_inner.height() - finalSize) / 2,
|
||||
finalSize,
|
||||
finalSize).translated(emojiPosition - shift));
|
||||
paintPremiumIcon(p, emojiPosition - shift, target);
|
||||
} else {
|
||||
const auto appear = icon->appear.get();
|
||||
if (current
|
||||
|
@ -1398,6 +1396,30 @@ void Manager::paintAllEmoji(
|
|||
}
|
||||
}
|
||||
|
||||
void Manager::paintPremiumIcon(
|
||||
QPainter &p,
|
||||
QPoint position,
|
||||
QRectF target) const {
|
||||
const auto finalSize = CornerImageSize(1.);
|
||||
const auto to = QRect(
|
||||
_inner.x() + (_inner.width() - finalSize) / 2,
|
||||
_inner.y() + (_inner.height() - finalSize) / 2,
|
||||
finalSize,
|
||||
finalSize).translated(position);
|
||||
const auto scale = target.width() / to.width();
|
||||
if (scale != 1.) {
|
||||
p.save();
|
||||
p.translate(target.center());
|
||||
p.scale(scale, scale);
|
||||
p.translate(-target.center());
|
||||
}
|
||||
auto hq = PainterHighQualityEnabler(p);
|
||||
st::reactionPremiumLocked.paintInCenter(p, to);
|
||||
if (scale != 1.) {
|
||||
p.restore();
|
||||
}
|
||||
}
|
||||
|
||||
void Manager::clearStateForHidden(ReactionIcons &icon) {
|
||||
if (const auto appear = icon.appear.get()) {
|
||||
appear->jumpTo(0, nullptr);
|
||||
|
|
|
@ -241,6 +241,7 @@ private:
|
|||
float64 scale,
|
||||
QPoint position,
|
||||
QPoint mainEmojiPosition);
|
||||
void paintPremiumIcon(QPainter &p, QPoint position, QRectF target) const;
|
||||
void paintInnerGradients(
|
||||
Painter &p,
|
||||
const QColor &background,
|
||||
|
|
Loading…
Add table
Reference in a new issue