fix size of splits not loading properly (#2554)

This commit is contained in:
fourtf
2021-04-17 15:16:14 +02:00
committed by GitHub
parent ed7d1a88d0
commit 58017a7546
4 changed files with 20 additions and 3 deletions
+15
View File
@@ -412,6 +412,11 @@ Split *SplitContainer::getTopRightSplit(Node &node)
void SplitContainer::layout()
{
if (this->disableLayouting_)
{
return;
}
// update top right split
auto topRight = this->getTopRightSplit(this->baseNode_);
if (this->topRight_)
@@ -702,7 +707,10 @@ void SplitContainer::applyFromDescriptor(const NodeDescriptor &rootNode)
{
assert(this->baseNode_.type_ == Node::EmptyRoot);
this->disableLayouting_ = true;
this->applyFromDescriptorRecursively(rootNode, &this->baseNode_);
this->disableLayouting_ = false;
this->layout();
}
void SplitContainer::applyFromDescriptorRecursively(
@@ -769,6 +777,13 @@ void SplitContainer::applyFromDescriptorRecursively(
{
Node *_node = new Node();
_node->parent_ = node;
if (auto *n = std::get_if<ContainerNodeDescriptor>(&item))
{
_node->flexH_ = n->flexH_;
_node->flexV_ = n->flexV_;
}
node->children_.emplace_back(_node);
this->applyFromDescriptorRecursively(item, _node);
}