mirror of https://github.com/axmolengine/axmol.git
Merge branch 'v3-label-pos' of https://github.com/WenhaiLin/cocos2d-x into v3.7
This commit is contained in:
commit
03a1167902
|
@ -621,7 +621,7 @@ void Label::alignText()
|
||||||
int tag = child->getTag();
|
int tag = child->getTag();
|
||||||
if (tag >= strLen)
|
if (tag >= strLen)
|
||||||
{
|
{
|
||||||
SpriteBatchNode::removeChild(child, true);
|
child->removeFromParentAndCleanup(true);
|
||||||
}
|
}
|
||||||
else if (tag >= 0)
|
else if (tag >= 0)
|
||||||
{
|
{
|
||||||
|
@ -634,9 +634,10 @@ void Label::alignText()
|
||||||
uvRect.origin.x = letterDef.U;
|
uvRect.origin.x = letterDef.U;
|
||||||
uvRect.origin.y = letterDef.V;
|
uvRect.origin.y = letterDef.V;
|
||||||
|
|
||||||
letterSprite->setTexture(textures.at(letterDef.textureID));
|
letterSprite->setBatchNode(_batchNodes[letterDef.textureID]);
|
||||||
letterSprite->setTextureRect(uvRect);
|
letterSprite->setTextureRect(uvRect, false, uvRect.size);
|
||||||
letterSprite->setPosition(_lettersInfo[tag].position);
|
letterSprite->setPosition(_lettersInfo[tag].position.x + letterDef.width/2,
|
||||||
|
_lettersInfo[tag].position.y - letterDef.height/2);
|
||||||
}
|
}
|
||||||
++index;
|
++index;
|
||||||
}
|
}
|
||||||
|
@ -966,7 +967,6 @@ void Label::onDraw(const Mat4& transform, bool transformUpdated)
|
||||||
|
|
||||||
for(const auto &child: _children)
|
for(const auto &child: _children)
|
||||||
{
|
{
|
||||||
if(child->getTag() >= 0)
|
|
||||||
child->updateTransform();
|
child->updateTransform();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue