Ensure label underline node has the same global Z value as the label node to fix visibility issue when global Z is not 0. (#373)

This commit is contained in:
RH 2021-06-09 14:09:01 +10:00 committed by GitHub
parent fe4f151b1f
commit 429215ee85
1 changed files with 6 additions and 0 deletions

View File

@ -1444,6 +1444,7 @@ void Label::enableUnderline()
if (!_underlineNode) if (!_underlineNode)
{ {
_underlineNode = DrawNode::create(); _underlineNode = DrawNode::create();
_underlineNode->setGlobalZOrder(getGlobalZOrder());
addChild(_underlineNode, 100000); addChild(_underlineNode, 100000);
_contentDirty = true; _contentDirty = true;
} }
@ -2435,6 +2436,11 @@ void Label::setGlobalZOrder(float globalZOrder)
_shadowNode->setGlobalZOrder(globalZOrder); _shadowNode->setGlobalZOrder(globalZOrder);
} }
} }
if (_underlineNode)
{
_underlineNode->setGlobalZOrder(globalZOrder);
}
} }
float Label::getRenderingFontSize()const float Label::getRenderingFontSize()const