mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-06 03:42:56 +00:00
Fix community layer bottom edge case.
This commit is contained in:
@@ -2376,6 +2376,7 @@ void Suggestions::updateControlsGeometry() {
|
||||
}
|
||||
|
||||
const auto expanding = false;
|
||||
const auto contentTillBottom = true;
|
||||
for (const auto &[key, list] : _mediaLists) {
|
||||
const auto full = !list.wrap->scrollBottomSkip();
|
||||
const auto additionalScroll = (full ? st::boxRadius : 0);
|
||||
@@ -2384,6 +2385,7 @@ void Suggestions::updateControlsGeometry() {
|
||||
list.wrap->updateGeometry(
|
||||
wrapGeometry,
|
||||
expanding,
|
||||
contentTillBottom,
|
||||
additionalScroll,
|
||||
content.height());
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||
#include "ui/rp_widget.h"
|
||||
#include "ui/ui_utility.h"
|
||||
#include "styles/style_info.h"
|
||||
#include "styles/style_layers.h"
|
||||
|
||||
namespace Info::Community {
|
||||
|
||||
@@ -241,19 +242,22 @@ std::unique_ptr<Ui::RpWidget> Widget::setupAddChatButton() {
|
||||
Dialogs::PaintBottomFade(p, wrap->width(), fadeHeight, st::boxBg);
|
||||
});
|
||||
|
||||
scroll()->setVerticalBarBottomSkip(st::communityAddChatButtonMargin.top()
|
||||
+ st::communityAddChatButton.height
|
||||
+ st::communityAddChatButtonMargin.bottom());
|
||||
|
||||
widthValue() | rpl::on_next([=](int width) {
|
||||
wrap->resizeToWidth(width);
|
||||
}, wrap->lifetime());
|
||||
|
||||
rpl::combine(
|
||||
wrap->heightValue(),
|
||||
heightValue()
|
||||
) | rpl::on_next([=](int height, int fullHeight) {
|
||||
wrap->move(0, fullHeight - height);
|
||||
heightValue(),
|
||||
this->controller()->contentTillBottomValue()
|
||||
) | rpl::on_next([=](int height, int fullHeight, bool tillBottom) {
|
||||
const auto shift = tillBottom ? 0 : st::boxRadius;
|
||||
wrap->move(0, fullHeight - height + shift);
|
||||
|
||||
const auto scrollSkip = st::communityAddChatButtonMargin.top()
|
||||
+ st::communityAddChatButton.height
|
||||
+ st::communityAddChatButtonMargin.bottom();
|
||||
scroll()->setVerticalBarBottomSkip(scrollSkip - shift);
|
||||
}, wrap->lifetime());
|
||||
|
||||
return result;
|
||||
|
||||
@@ -393,6 +393,10 @@ rpl::producer<Wrap> Controller::wrapValue() const {
|
||||
return _widget->wrapValue();
|
||||
}
|
||||
|
||||
rpl::producer<bool> Controller::contentTillBottomValue() const {
|
||||
return _widget->contentTillBottomValue();
|
||||
}
|
||||
|
||||
not_null<Ui::RpWidget*> Controller::wrapWidget() const {
|
||||
return _widget;
|
||||
}
|
||||
|
||||
@@ -326,6 +326,7 @@ public:
|
||||
[[nodiscard]] Wrap wrap() const;
|
||||
[[nodiscard]] rpl::producer<Wrap> wrapValue() const;
|
||||
[[nodiscard]] not_null<Ui::RpWidget*> wrapWidget() const;
|
||||
[[nodiscard]] rpl::producer<bool> contentTillBottomValue() const;
|
||||
void setSection(not_null<ContentMemento*> memento);
|
||||
[[nodiscard]] bool hasBackButton() const;
|
||||
|
||||
|
||||
@@ -331,7 +331,7 @@ QRect LayerWidget::countGeometry(int newWidth) {
|
||||
contentTop,
|
||||
contentWidth,
|
||||
contentHeight,
|
||||
}, expanding, additionalScroll, maxVisibleHeight);
|
||||
}, expanding, _contentTillBottom, additionalScroll, maxVisibleHeight);
|
||||
|
||||
return QRect(newLeft, newTop, newWidth, desiredHeight);
|
||||
}
|
||||
|
||||
@@ -50,6 +50,7 @@ void SectionWidget::init() {
|
||||
return (_content != nullptr);
|
||||
}) | rpl::on_next([=](QSize size, int) {
|
||||
const auto expanding = false;
|
||||
const auto contentTillBottom = true;
|
||||
const auto full = !_content->scrollBottomSkip();
|
||||
const auto additionalScroll = (full ? st::boxRadius : 0);
|
||||
const auto height = size.height() - (full ? 0 : st::boxRadius);
|
||||
@@ -57,6 +58,7 @@ void SectionWidget::init() {
|
||||
_content->updateGeometry(
|
||||
wrapGeometry,
|
||||
expanding,
|
||||
contentTillBottom,
|
||||
additionalScroll,
|
||||
size.height());
|
||||
}, lifetime());
|
||||
|
||||
@@ -772,6 +772,10 @@ void WrapWidget::setWrap(Wrap wrap) {
|
||||
_wrap = wrap;
|
||||
}
|
||||
|
||||
rpl::producer<bool> WrapWidget::contentTillBottomValue() const {
|
||||
return _contentTillBottom.value();
|
||||
}
|
||||
|
||||
rpl::producer<> WrapWidget::contentChanged() const {
|
||||
return _contentChanges.events();
|
||||
}
|
||||
@@ -1107,6 +1111,7 @@ object_ptr<Ui::RpWidget> WrapWidget::createTopBarSurrogate(
|
||||
void WrapWidget::updateGeometry(
|
||||
QRect newGeometry,
|
||||
bool expanding,
|
||||
bool contentTillBottom,
|
||||
int additionalScroll,
|
||||
int maxVisibleHeight) {
|
||||
auto scrollChanged = (_additionalScroll != additionalScroll);
|
||||
@@ -1115,6 +1120,7 @@ void WrapWidget::updateGeometry(
|
||||
_additionalScroll = additionalScroll;
|
||||
_maxVisibleHeight = maxVisibleHeight;
|
||||
_expanding = expanding;
|
||||
_contentTillBottom = contentTillBottom;
|
||||
|
||||
_content->applyMaxVisibleHeight(maxVisibleHeight);
|
||||
|
||||
|
||||
@@ -93,17 +93,18 @@ public:
|
||||
Wrap wrap,
|
||||
not_null<Memento*> memento);
|
||||
|
||||
Key key() const;
|
||||
[[nodiscard]] Key key() const;
|
||||
Dialogs::RowDescriptor activeChat() const override;
|
||||
Wrap wrap() const {
|
||||
[[nodiscard]] Wrap wrap() const {
|
||||
return _wrap.current();
|
||||
}
|
||||
rpl::producer<Wrap> wrapValue() const;
|
||||
[[nodiscard]] rpl::producer<Wrap> wrapValue() const;
|
||||
void setWrap(Wrap wrap);
|
||||
|
||||
rpl::producer<> contentChanged() const;
|
||||
[[nodiscard]] rpl::producer<bool> contentTillBottomValue() const;
|
||||
[[nodiscard]] rpl::producer<> contentChanged() const;
|
||||
|
||||
not_null<Controller*> controller() {
|
||||
[[nodiscard]] not_null<Controller*> controller() {
|
||||
return _controller.get();
|
||||
}
|
||||
|
||||
@@ -137,6 +138,7 @@ public:
|
||||
void updateGeometry(
|
||||
QRect newGeometry,
|
||||
bool expanding,
|
||||
bool contentTillBottom,
|
||||
int additionalScroll,
|
||||
int maxVisibleHeight);
|
||||
[[nodiscard]] int scrollBottomSkip() const;
|
||||
@@ -229,6 +231,7 @@ private:
|
||||
int _maxVisibleHeight = 0;
|
||||
bool _expanding = false;
|
||||
rpl::variable<bool> _grabbingForExpanding = false;
|
||||
rpl::variable<bool> _contentTillBottom = false;
|
||||
object_ptr<TopBar> _topBar = { nullptr };
|
||||
object_ptr<Ui::RpWidget> _topBarSurrogate = { nullptr };
|
||||
Ui::Animations::Simple _topBarOverrideAnimation;
|
||||
|
||||
Reference in New Issue
Block a user