From a480fc9d7ccf019604f1e5b66a3a2af6d8f23ec8 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 15 Jun 2022 15:21:29 +0400 Subject: [PATCH] Put "View" in the middle of the toast. --- .../history/view/history_view_sticker_toast.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp b/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp index 5ae255fd4..6b4b0cf21 100644 --- a/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp +++ b/Telegram/SourceFiles/history/view/history_view_sticker_toast.cpp @@ -84,9 +84,14 @@ void StickerToast::showFor(not_null document) { st::historyPremiumViewSet); button->setTextTransform(Ui::RoundButton::TextTransform::NoTransform); button->show(); - widget->widthValue( - ) | rpl::start_with_next([=](int width) { - button->moveToRight(0, 0, width); + rpl::combine( + widget->sizeValue(), + button->sizeValue() + ) | rpl::start_with_next([=](QSize outer, QSize inner) { + button->moveToRight( + 0, + (outer.height() - inner.height()) / 2, + outer.width()); }, widget->lifetime()); const auto preview = Ui::CreateChild(widget.get()); preview->moveToLeft(skip, skip);