diff --git a/Telegram/SourceFiles/info/info_content_widget.cpp b/Telegram/SourceFiles/info/info_content_widget.cpp index ec042ddcb..26417374c 100644 --- a/Telegram/SourceFiles/info/info_content_widget.cpp +++ b/Telegram/SourceFiles/info/info_content_widget.cpp @@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "main/main_session.h" #include "styles/style_info.h" #include "styles/style_profile.h" +#include "styles/style_layers.h" #include diff --git a/Telegram/SourceFiles/info/info_layer_widget.cpp b/Telegram/SourceFiles/info/info_layer_widget.cpp index b2f081cb8..b7ca8edbc 100644 --- a/Telegram/SourceFiles/info/info_layer_widget.cpp +++ b/Telegram/SourceFiles/info/info_layer_widget.cpp @@ -270,28 +270,32 @@ int LayerWidget::resizeGetHeight(int newWidth) { } QRect LayerWidget::countGeometry(int newWidth) { - auto parentSize = parentWidget()->size(); - auto windowWidth = parentSize.width(); - auto windowHeight = parentSize.height(); - auto newLeft = (windowWidth - newWidth) / 2; - auto newTop = std::clamp( + const auto &parentSize = parentWidget()->size(); + const auto windowWidth = parentSize.width(); + const auto windowHeight = parentSize.height(); + const auto newLeft = (windowWidth - newWidth) / 2; + const auto newTop = std::clamp( windowHeight / 24, st::infoLayerTopMinimal, st::infoLayerTopMaximal); - auto newBottom = newTop; + const auto newBottom = newTop; + const auto hasCustomBottomBar = _content->hasCustomBottomBar(); + const auto bottomRadius = st::boxRadius; // Top rounding is included in _contentHeight. - auto desiredHeight = _contentHeight + st::boxRadius; + auto desiredHeight = _contentHeight + bottomRadius; accumulate_min(desiredHeight, windowHeight - newTop - newBottom); // First resize content to new width and get the new desired height. - auto contentLeft = 0; - auto contentTop = 0; - auto contentBottom = st::boxRadius; - auto contentWidth = newWidth; + const auto contentLeft = 0; + const auto contentTop = 0; + const auto contentBottom = bottomRadius; + const auto contentWidth = newWidth; auto contentHeight = desiredHeight - contentTop - contentBottom; - auto scrollTillBottom = _content->scrollTillBottom(contentHeight); - auto additionalScroll = std::min(scrollTillBottom, newBottom); + const auto scrollTillBottom = _content->scrollTillBottom(contentHeight); + auto additionalScroll = hasCustomBottomBar + ? 0 + : std::min(scrollTillBottom, newBottom); const auto expanding = (_desiredHeight > _contentHeight); diff --git a/Telegram/SourceFiles/info/info_wrap_widget.cpp b/Telegram/SourceFiles/info/info_wrap_widget.cpp index 5c0b82bcf..dee5b393f 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.cpp +++ b/Telegram/SourceFiles/info/info_wrap_widget.cpp @@ -799,6 +799,10 @@ QPixmap WrapWidget::grabForShowAnimation( return result; } +bool WrapWidget::hasCustomBottomBar() const { + return _content->scrollBottomSkip() > 0; +} + void WrapWidget::showAnimatedHook( const Window::SectionSlideParams ¶ms) { //if (params.withTabs && _topTabs) { diff --git a/Telegram/SourceFiles/info/info_wrap_widget.h b/Telegram/SourceFiles/info/info_wrap_widget.h index a22568e7a..5f8fe6b20 100644 --- a/Telegram/SourceFiles/info/info_wrap_widget.h +++ b/Telegram/SourceFiles/info/info_wrap_widget.h @@ -100,6 +100,8 @@ public: QPixmap grabForShowAnimation( const Window::SectionSlideParams ¶ms) override; + [[nodiscard]] bool hasCustomBottomBar() const; + void forceContentRepaint(); bool showInternal(