Added padding to info layer sections with pinned to bottom content.

This commit is contained in:
23rd 2022-05-21 02:30:30 +03:00
parent 10ff236cd2
commit ef3e139b85
4 changed files with 24 additions and 13 deletions

View File

@ -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 <QtCore/QCoreApplication>

View File

@ -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);

View File

@ -799,6 +799,10 @@ QPixmap WrapWidget::grabForShowAnimation(
return result;
}
bool WrapWidget::hasCustomBottomBar() const {
return _content->scrollBottomSkip() > 0;
}
void WrapWidget::showAnimatedHook(
const Window::SectionSlideParams &params) {
//if (params.withTabs && _topTabs) {

View File

@ -100,6 +100,8 @@ public:
QPixmap grabForShowAnimation(
const Window::SectionSlideParams &params) override;
[[nodiscard]] bool hasCustomBottomBar() const;
void forceContentRepaint();
bool showInternal(