mirror of
https://github.com/geode-sdk/geode.git
synced 2025-02-17 00:30:26 -05:00
add CCNode::removeChildByID
This commit is contained in:
parent
72ee7755d2
commit
5f3c6587b3
2 changed files with 12 additions and 0 deletions
|
@ -699,6 +699,12 @@ public:
|
|||
* @param cleanup true if all running actions and callbacks on the child node will be cleanup, false otherwise.
|
||||
*/
|
||||
virtual void removeChildByTag(int tag, bool cleanup);
|
||||
/**
|
||||
* Removes a child from the container by its ID.
|
||||
* @param id The ID of the node
|
||||
* @note Geode addition
|
||||
*/
|
||||
void removeChildByID(std::string const& id);
|
||||
/**
|
||||
* Removes all children from the container with a cleanup.
|
||||
*
|
||||
|
|
|
@ -122,6 +122,12 @@ CCNode* CCNode::getChildByIDRecursive(std::string const& id) {
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void CCNode::removeChildByID(std::string const& id) {
|
||||
if (auto child = this->getChildByID(id)) {
|
||||
this->removeChild(child);
|
||||
}
|
||||
}
|
||||
|
||||
void CCNode::setLayout(Layout* layout, bool apply, bool respectAnchor) {
|
||||
if (respectAnchor && this->isIgnoreAnchorPointForPosition()) {
|
||||
for (auto child : CCArrayExt<CCNode>(m_pChildren)) {
|
||||
|
|
Loading…
Reference in a new issue