mirror of https://github.com/axmolengine/axmol.git
Add items as protected children.
This commit is contained in:
parent
57943b41b1
commit
b92733c402
|
@ -178,7 +178,7 @@ void RichText::formatText()
|
||||||
{
|
{
|
||||||
if (_formatTextDirty)
|
if (_formatTextDirty)
|
||||||
{
|
{
|
||||||
this->removeAllChildren();
|
this->removeAllProtectedChildren();
|
||||||
_elementRenders.clear();
|
_elementRenders.clear();
|
||||||
if (_ignoreSize)
|
if (_ignoreSize)
|
||||||
{
|
{
|
||||||
|
@ -353,7 +353,7 @@ void RichText::formarRenderers()
|
||||||
Node* l = row->at(j);
|
Node* l = row->at(j);
|
||||||
l->setAnchorPoint(Vec2::ZERO);
|
l->setAnchorPoint(Vec2::ZERO);
|
||||||
l->setPosition(nextPosX, 0.0f);
|
l->setPosition(nextPosX, 0.0f);
|
||||||
this->addChild(l, 1);
|
this->addProtectedChild(l, 1);
|
||||||
Size iSize = l->getContentSize();
|
Size iSize = l->getContentSize();
|
||||||
newContentSizeWidth += iSize.width;
|
newContentSizeWidth += iSize.width;
|
||||||
newContentSizeHeight = MAX(newContentSizeHeight, iSize.height);
|
newContentSizeHeight = MAX(newContentSizeHeight, iSize.height);
|
||||||
|
@ -391,7 +391,7 @@ void RichText::formarRenderers()
|
||||||
Node* l = row->at(j);
|
Node* l = row->at(j);
|
||||||
l->setAnchorPoint(Vec2::ZERO);
|
l->setAnchorPoint(Vec2::ZERO);
|
||||||
l->setPosition(nextPosX, nextPosY);
|
l->setPosition(nextPosX, nextPosY);
|
||||||
this->addChild(l, 1);
|
this->addProtectedChild(l, 1);
|
||||||
nextPosX += l->getContentSize().width;
|
nextPosX += l->getContentSize().width;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,9 @@ bool UIRichTextTest::init()
|
||||||
|
|
||||||
_widget->addChild(_richText);
|
_widget->addChild(_richText);
|
||||||
|
|
||||||
|
// test remove all children, this call won't effect the test
|
||||||
|
_richText->removeAllChildren();
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue