2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Change layer widget height with animation.

This commit is contained in:
John Preston
2022-04-12 16:07:25 +04:00
parent 9933d1ff3a
commit f6f39d1560
5 changed files with 79 additions and 13 deletions

View File

@@ -645,10 +645,10 @@ rpl::producer<bool> WrapWidget::topShadowToggledValue() const {
rpl::producer<int> WrapWidget::desiredHeightForContent() const {
using namespace rpl::mappers;
return rpl::combine(
return rpl::single(0) | rpl::then(rpl::combine(
_content->desiredHeightValue(),
topWidget()->heightValue(),
_1 + _2);
_1 + _2));
}
rpl::producer<SelectedItems> WrapWidget::selectedListValue() const {
@@ -738,7 +738,14 @@ QPixmap WrapWidget::grabForShowAnimation(
//if (params.withTabs && _topTabs) {
// _topTabs->hide();
//}
const auto expanding = _expanding;
if (expanding) {
_grabbingForExpanding = true;
}
auto result = Ui::GrabWidget(this);
if (expanding) {
_grabbingForExpanding = false;
}
if (params.withTopBarShadow) {
_topShadow->setVisible(true);
}
@@ -1007,11 +1014,15 @@ object_ptr<Ui::RpWidget> WrapWidget::createTopBarSurrogate(
return nullptr;
}
void WrapWidget::updateGeometry(QRect newGeometry, int additionalScroll) {
void WrapWidget::updateGeometry(
QRect newGeometry,
bool expanding,
int additionalScroll) {
auto scrollChanged = (_additionalScroll != additionalScroll);
auto geometryChanged = (geometry() != newGeometry);
auto shrinkingContent = (additionalScroll < _additionalScroll);
_additionalScroll = additionalScroll;
_expanding = expanding;
if (geometryChanged) {
if (shrinkingContent) {
@@ -1038,6 +1049,10 @@ rpl::producer<int> WrapWidget::scrollTillBottomChanges() const {
) | rpl::flatten_latest();
}
rpl::producer<bool> WrapWidget::grabbingForExpanding() const {
return _grabbingForExpanding.value();
}
WrapWidget::~WrapWidget() = default;
} // namespace Info