Skip to content

Commit

Permalink
replace setColor with setTextColor for RichElementText (cocos2d#18985)
Browse files Browse the repository at this point in the history
  • Loading branch information
summerinsects authored and huangwei1024 committed Jun 20, 2019
1 parent 9424dc0 commit 3b63680
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions cocos/ui/UIRichText.cpp 100644 → 100755
Expand Up @@ -1400,6 +1400,7 @@ void RichText::formatText()
if (elmtText->_flags & RichElementText::GLOW_FLAG) {
label->enableGlow(Color4B(elmtText->_glowColor));
}
label->setTextColor(Color4B(elmtText->_color));
elementRenderer = label;
break;
}
Expand All @@ -1423,13 +1424,15 @@ void RichText::formatText()
elementRenderer->addComponent(ListenerComponent::create(elementRenderer,
elmtImage->_url,
std::bind(&RichText::openUrl, this, std::placeholders::_1)));
elementRenderer->setColor(element->_color);
}
break;
}
case RichElement::Type::CUSTOM:
{
RichElementCustomNode* elmtCustom = static_cast<RichElementCustomNode*>(element);
elementRenderer = elmtCustom->_customNode;
elementRenderer->setColor(element->_color);
break;
}
case RichElement::Type::NEWLINE:
Expand All @@ -1443,7 +1446,6 @@ void RichText::formatText()

if (elementRenderer)
{
elementRenderer->setColor(element->_color);
elementRenderer->setOpacity(element->_opacity);
pushToContainer(elementRenderer);
}
Expand Down Expand Up @@ -1692,7 +1694,7 @@ void RichText::handleTextRenderer(const std::string& text, const std::string& fo
if (flags & RichElementText::GLOW_FLAG)
textRenderer->enableGlow(Color4B(glowColor));

textRenderer->setColor(color);
textRenderer->setTextColor(Color4B(color));
textRenderer->setOpacity(opacity);

// textRendererWidth will get 0.0f, when we've got glError: 0x0501 in Label::getContentSize
Expand Down

0 comments on commit 3b63680

Please sign in to comment.