From 429215ee85e86a1c68c6a25cc8e4186382129980 Mon Sep 17 00:00:00 2001 From: RH Date: Wed, 9 Jun 2021 14:09:01 +1000 Subject: [PATCH] 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) --- cocos/2d/CCLabel.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/cocos/2d/CCLabel.cpp b/cocos/2d/CCLabel.cpp index b2bed1122c..b2753ea359 100644 --- a/cocos/2d/CCLabel.cpp +++ b/cocos/2d/CCLabel.cpp @@ -1444,6 +1444,7 @@ void Label::enableUnderline() if (!_underlineNode) { _underlineNode = DrawNode::create(); + _underlineNode->setGlobalZOrder(getGlobalZOrder()); addChild(_underlineNode, 100000); _contentDirty = true; } @@ -2435,6 +2436,11 @@ void Label::setGlobalZOrder(float globalZOrder) _shadowNode->setGlobalZOrder(globalZOrder); } } + + if (_underlineNode) + { + _underlineNode->setGlobalZOrder(globalZOrder); + } } float Label::getRenderingFontSize()const