Improved text size in list of credits options.

This commit is contained in:
23rd 2024-08-05 20:26:47 +03:00 committed by John Preston
parent c4f45c4b7c
commit efc8417ab1
2 changed files with 8 additions and 8 deletions

View file

@ -39,6 +39,7 @@ void GiftCreditsBox(
not_null<Ui::GenericBox*> box,
not_null<PeerData*> peer,
Fn<void()> gifted) {
box->setWidth(st::boxWideWidth);
box->setStyle(st::creditsGiftBox);
box->setNoContentMargin(true);
box->addButton(tr::lng_create_group_back(), [=] { box->closeBox(); });

View file

@ -256,7 +256,7 @@ void FillCreditOptions(
const auto &st = st::creditsTopupButton;
const auto diffBetweenTextAndStar = st.padding.left()
- st.iconLeft
- singleStarWidth;
- int(singleStarWidth * 1.5);
const auto buttonHeight = st.height + rect::m::sum::v(st.padding);
const auto minCredits = (!options.empty()
&& (minimumCredits > options.back().credits))
@ -283,26 +283,25 @@ void FillCreditOptions(
st::creditsTopupPrice);
const auto inner = Ui::CreateChild<Ui::RpWidget>(button);
const auto stars = Ui::GenerateStars(st.height, (i + 1));
const auto textLeft = diffBetweenTextAndStar
+ stars.width() / style::DevicePixelRatio();
inner->paintRequest(
) | rpl::start_with_next([=](const QRect &rect) {
auto p = QPainter(inner);
p.drawImage(0, 0, stars);
const auto textLeft = diffBetweenTextAndStar
+ stars.width() / style::DevicePixelRatio();
p.setPen(st.textFg);
text->draw(p, {
.position = QPoint(textLeft, 0),
.availableWidth = inner->width() - textLeft,
.elisionLines = 1,
});
}, inner->lifetime());
button->sizeValue(
) | rpl::start_with_next([=](const QSize &size) {
button->widthValue(
) | rpl::start_with_next([=](int width) {
price->moveToRight(st.padding.right(), st.padding.top());
inner->moveToLeft(st.iconLeft, st.padding.top());
inner->resize(
size.width()
- rect::m::sum::h(st.padding)
- price->width(),
width - price->width() - st.padding.left(),
buttonHeight);
}, button->lifetime());
button->setClickedCallback([=] {