mirror of
https://github.com/telegramdesktop/tdesktop
synced 2025-02-22 08:16:56 +00:00
Added padding to info layer sections with pinned to bottom content.
This commit is contained in:
parent
10ff236cd2
commit
ef3e139b85
@ -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>
|
||||
|
||||
|
@ -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);
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -100,6 +100,8 @@ public:
|
||||
QPixmap grabForShowAnimation(
|
||||
const Window::SectionSlideParams ¶ms) override;
|
||||
|
||||
[[nodiscard]] bool hasCustomBottomBar() const;
|
||||
|
||||
void forceContentRepaint();
|
||||
|
||||
bool showInternal(
|
||||
|
Loading…
Reference in New Issue
Block a user