reset child z order when applying layouts

This commit is contained in:
HJfod 2023-02-11 12:05:25 +02:00
parent 9c9706b456
commit 3fb8c2be83

View file

@ -37,6 +37,7 @@ static void switchToMenu(CCNode* node, CCMenu* menu) {
node->retain(); node->retain();
node->removeFromParent(); node->removeFromParent();
node->setZOrder(0);
menu->addChild(node); menu->addChild(node);
node->setPosition(menu->convertToNodeSpace(worldPos)); node->setPosition(menu->convertToNodeSpace(worldPos));
@ -67,6 +68,7 @@ static CCMenu* detachAndCreateMenu(CCNode* parent, const char* menuID, Layout* l
parent->addChild(newMenu); parent->addChild(newMenu);
first->setPosition(0, 0); first->setPosition(0, 0);
first->setZOrder(0);
newMenu->addChild(first); newMenu->addChild(first);
first->release(); first->release();