Make purchased media badge better looking.

This commit is contained in:
John Preston 2024-06-27 10:24:32 +04:00
parent b58c03f0de
commit c833b8a1b0
3 changed files with 10 additions and 8 deletions

View file

@ -243,22 +243,23 @@ void Media::drawPurchasedTag(
const auto st = context.st;
const auto sti = context.imageStyle();
const auto &padding = st::purchasedTagPadding;
auto right = outer.x() + outer.width();
auto top = outer.y();
right -= st::msgDateImgDelta + st::msgDateImgPadding.x();
top += st::msgDateImgDelta + st::msgDateImgPadding.y();
right -= st::msgDateImgDelta + padding.right();
top += st::msgDateImgDelta + padding.top();
const auto size = QSize(
purchased->text.maxWidth(),
st::normalFont->height);
const auto tagX = right - size.width();
const auto tagY = top;
const auto tagW = size.width() + 2 * st::msgDateImgPadding.x();
const auto tagH = size.height() + 2 * st::msgDateImgPadding.y();
const auto tagW = padding.left() + size.width() + padding.right();
const auto tagH = padding.top() + size.height() + padding.bottom();
Ui::FillRoundRect(
p,
tagX - st::msgDateImgPadding.x(),
tagY - st::msgDateImgPadding.y(),
tagX - padding.left(),
tagY - padding.top(),
tagW,
tagH,
sti->msgDateImgBg,
@ -268,7 +269,7 @@ void Media::drawPurchasedTag(
purchased->text.draw(p, {
.position = { tagX, tagY },
.outerWidth = width(),
.availableWidth = tagW - 2 * st::msgDateImgPadding.x(),
.availableWidth = size.width(),
.palette = &st->priceTagTextPalette(),
});
}

View file

@ -1144,3 +1144,4 @@ factcheckField: InputField(defaultInputField) {
style: defaultTextStyle;
}
purchasedTagPadding: margins(3px, 2px, 6px, 2px);

View file

@ -46,4 +46,4 @@ creditsBoxButtonLabel: FlatLabel(defaultFlatLabel) {
}
starIconSmall: icon{{ "payments/small_star", windowFg }};
starIconSmallPadding: margins(0px, -3px, 0px, 0px);
starIconSmallPadding: margins(0px, -2px, 0px, 0px);