add child order update option to CCNode::updateLayout

This commit is contained in:
HJfod 2023-02-11 12:06:37 +02:00
parent 676b96a34f
commit 8890901af5
2 changed files with 5 additions and 2 deletions

View file

@ -940,7 +940,7 @@ public:
* set, nothing happens
* @note Geode addition
*/
GEODE_DLL void updateLayout();
GEODE_DLL void updateLayout(bool updateChildOrder = true);
/**
* Set the layout options for this node. Layout options can be used to
* control how this node is positioned in its parent's Layout, for example

View file

@ -147,7 +147,10 @@ LayoutOptions* CCNode::getLayoutOptions() {
return GeodeNodeMetadata::set(this)->m_layoutOptions.get();
}
void CCNode::updateLayout() {
void CCNode::updateLayout(bool updateChildOrder) {
if (updateChildOrder) {
this->sortAllChildren();
}
if (auto layout = GeodeNodeMetadata::set(this)->m_layout.get()) {
layout->apply(this);
}