mirror of https://github.com/axmolengine/axmol.git
Fixed `Label::setGlobalZOrder ` is invalid when label create with system font.
This commit is contained in:
parent
e3c88533fe
commit
827f05c5e1
|
@ -983,6 +983,7 @@ void Label::createSpriteForSystemFont(const FontDefinition& fontDef)
|
|||
_textSprite = Sprite::createWithTexture(texture);
|
||||
//set camera mask using label's camera mask, because _textSprite may be null when setting camera mask to label
|
||||
_textSprite->setCameraMask(getCameraMask());
|
||||
_textSprite->setGlobalZOrder(getGlobalZOrder());
|
||||
_textSprite->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
this->setContentSize(_textSprite->getContentSize());
|
||||
texture->release();
|
||||
|
@ -1027,6 +1028,7 @@ void Label::createShadowSpriteForSystemFont(const FontDefinition& fontDef)
|
|||
_shadowNode->setBlendFunc(_blendFunc);
|
||||
}
|
||||
_shadowNode->setCameraMask(getCameraMask());
|
||||
_shadowNode->setGlobalZOrder(getGlobalZOrder());
|
||||
_shadowNode->setAnchorPoint(Vec2::ANCHOR_BOTTOM_LEFT);
|
||||
_shadowNode->setPosition(_shadowOffset.width, _shadowOffset.height);
|
||||
|
||||
|
@ -1724,4 +1726,17 @@ FontDefinition Label::_getFontDefinition() const
|
|||
return systemFontDef;
|
||||
}
|
||||
|
||||
void Label::setGlobalZOrder(float globalZOrder)
|
||||
{
|
||||
Node::setGlobalZOrder(globalZOrder);
|
||||
if (_textSprite)
|
||||
{
|
||||
_textSprite->setGlobalZOrder(globalZOrder);
|
||||
if (_shadowNode)
|
||||
{
|
||||
_shadowNode->setGlobalZOrder(globalZOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
NS_CC_END
|
||||
|
|
|
@ -453,6 +453,7 @@ public:
|
|||
|
||||
virtual void removeAllChildrenWithCleanup(bool cleanup) override;
|
||||
virtual void removeChild(Node* child, bool cleanup = true) override;
|
||||
virtual void setGlobalZOrder(float globalZOrder) override;
|
||||
|
||||
CC_DEPRECATED_ATTRIBUTE static Label* create(const std::string& text, const std::string& font, float fontSize,
|
||||
const Size& dimensions = Size::ZERO, TextHAlignment hAlignment = TextHAlignment::LEFT,
|
||||
|
|
Loading…
Reference in New Issue