mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Added padding to info layer sections with pinned to bottom content.
This commit is contained in:
parent
10ff236cd2
commit
ef3e139b85
4 changed files with 24 additions and 13 deletions
|
@ -27,6 +27,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
#include "main/main_session.h"
|
#include "main/main_session.h"
|
||||||
#include "styles/style_info.h"
|
#include "styles/style_info.h"
|
||||||
#include "styles/style_profile.h"
|
#include "styles/style_profile.h"
|
||||||
|
#include "styles/style_layers.h"
|
||||||
|
|
||||||
#include <QtCore/QCoreApplication>
|
#include <QtCore/QCoreApplication>
|
||||||
|
|
||||||
|
|
|
@ -270,28 +270,32 @@ int LayerWidget::resizeGetHeight(int newWidth) {
|
||||||
}
|
}
|
||||||
|
|
||||||
QRect LayerWidget::countGeometry(int newWidth) {
|
QRect LayerWidget::countGeometry(int newWidth) {
|
||||||
auto parentSize = parentWidget()->size();
|
const auto &parentSize = parentWidget()->size();
|
||||||
auto windowWidth = parentSize.width();
|
const auto windowWidth = parentSize.width();
|
||||||
auto windowHeight = parentSize.height();
|
const auto windowHeight = parentSize.height();
|
||||||
auto newLeft = (windowWidth - newWidth) / 2;
|
const auto newLeft = (windowWidth - newWidth) / 2;
|
||||||
auto newTop = std::clamp(
|
const auto newTop = std::clamp(
|
||||||
windowHeight / 24,
|
windowHeight / 24,
|
||||||
st::infoLayerTopMinimal,
|
st::infoLayerTopMinimal,
|
||||||
st::infoLayerTopMaximal);
|
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.
|
// Top rounding is included in _contentHeight.
|
||||||
auto desiredHeight = _contentHeight + st::boxRadius;
|
auto desiredHeight = _contentHeight + bottomRadius;
|
||||||
accumulate_min(desiredHeight, windowHeight - newTop - newBottom);
|
accumulate_min(desiredHeight, windowHeight - newTop - newBottom);
|
||||||
|
|
||||||
// First resize content to new width and get the new desired height.
|
// First resize content to new width and get the new desired height.
|
||||||
auto contentLeft = 0;
|
const auto contentLeft = 0;
|
||||||
auto contentTop = 0;
|
const auto contentTop = 0;
|
||||||
auto contentBottom = st::boxRadius;
|
const auto contentBottom = bottomRadius;
|
||||||
auto contentWidth = newWidth;
|
const auto contentWidth = newWidth;
|
||||||
auto contentHeight = desiredHeight - contentTop - contentBottom;
|
auto contentHeight = desiredHeight - contentTop - contentBottom;
|
||||||
auto scrollTillBottom = _content->scrollTillBottom(contentHeight);
|
const auto scrollTillBottom = _content->scrollTillBottom(contentHeight);
|
||||||
auto additionalScroll = std::min(scrollTillBottom, newBottom);
|
auto additionalScroll = hasCustomBottomBar
|
||||||
|
? 0
|
||||||
|
: std::min(scrollTillBottom, newBottom);
|
||||||
|
|
||||||
const auto expanding = (_desiredHeight > _contentHeight);
|
const auto expanding = (_desiredHeight > _contentHeight);
|
||||||
|
|
||||||
|
|
|
@ -799,6 +799,10 @@ QPixmap WrapWidget::grabForShowAnimation(
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool WrapWidget::hasCustomBottomBar() const {
|
||||||
|
return _content->scrollBottomSkip() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
void WrapWidget::showAnimatedHook(
|
void WrapWidget::showAnimatedHook(
|
||||||
const Window::SectionSlideParams ¶ms) {
|
const Window::SectionSlideParams ¶ms) {
|
||||||
//if (params.withTabs && _topTabs) {
|
//if (params.withTabs && _topTabs) {
|
||||||
|
|
|
@ -100,6 +100,8 @@ public:
|
||||||
QPixmap grabForShowAnimation(
|
QPixmap grabForShowAnimation(
|
||||||
const Window::SectionSlideParams ¶ms) override;
|
const Window::SectionSlideParams ¶ms) override;
|
||||||
|
|
||||||
|
[[nodiscard]] bool hasCustomBottomBar() const;
|
||||||
|
|
||||||
void forceContentRepaint();
|
void forceContentRepaint();
|
||||||
|
|
||||||
bool showInternal(
|
bool showInternal(
|
||||||
|
|
Loading…
Add table
Reference in a new issue