Fix generic box size with pinned top content.
This commit is contained in:
parent
3cce0655d1
commit
96279cc04d
1 changed files with 13 additions and 6 deletions
|
|
@ -17,15 +17,22 @@ void GenericBox::prepare() {
|
||||||
_init(this);
|
_init(this);
|
||||||
|
|
||||||
const auto currentWidth = width();
|
const auto currentWidth = width();
|
||||||
if (_pinnedToTopContent) {
|
const auto pinned = _pinnedToTopContent.data();
|
||||||
_pinnedToTopContent->resizeToWidth(currentWidth);
|
if (pinned) {
|
||||||
|
pinned->resizeToWidth(currentWidth);
|
||||||
}
|
}
|
||||||
|
|
||||||
auto wrap = object_ptr<Ui::OverrideMargins>(this, std::move(_owned));
|
auto wrap = object_ptr<Ui::OverrideMargins>(this, std::move(_owned));
|
||||||
setDimensionsToContent(currentWidth, wrap.data());
|
wrap->resizeToWidth(currentWidth);
|
||||||
setInnerWidget(
|
rpl::combine(
|
||||||
std::move(wrap),
|
pinned ? pinned->heightValue() : rpl::single(0),
|
||||||
_pinnedToTopContent ? _pinnedToTopContent->height() : 0);
|
wrap->heightValue()
|
||||||
|
) | rpl::start_with_next([=](int top, int height) {
|
||||||
|
setInnerTopSkip(top);
|
||||||
|
setDimensions(currentWidth, top + height);
|
||||||
|
}, wrap->lifetime());
|
||||||
|
|
||||||
|
setInnerWidget(std::move(wrap), pinned ? pinned->height() : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
void GenericBox::addSkip(int height) {
|
void GenericBox::addSkip(int height) {
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue