fix RichText visit issue

This commit is contained in:
andyque 2014-07-24 11:51:47 +08:00
parent 03299cb76a
commit a9a16b3ee5
2 changed files with 8 additions and 10 deletions

View File

@ -461,6 +461,11 @@ void RichText::formarRenderers()
_elementRenderersContainer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
}
void RichText::adaptRenderers()
{
this->formatText();
}
void RichText::pushToContainer(cocos2d::Node *renderer)
{
if (_elementRenders.size() <= 0)
@ -469,15 +474,6 @@ void RichText::pushToContainer(cocos2d::Node *renderer)
}
_elementRenders[_elementRenders.size()-1]->pushBack(renderer);
}
void RichText::visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags)
{
if (_enabled)
{
formatText();
Widget::visit(renderer, parentTransform, parentFlags);
}
}
void RichText::setVerticalSpace(float space)
{

View File

@ -103,7 +103,7 @@ public:
void pushBackElement(RichElement* element);
void removeElement(int index);
void removeElement(RichElement* element);
virtual void visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
void setVerticalSpace(float space);
virtual void setAnchorPoint(const Vec2 &pt);
virtual const Size& getVirtualRendererSize() const override;
@ -115,6 +115,8 @@ CC_CONSTRUCTOR_ACCESS:
virtual bool init() override;
protected:
virtual void adaptRenderers();
virtual void initRenderer();
void pushToContainer(Node* renderer);
void handleTextRenderer(const std::string& text, const std::string& fontName, float fontSize, const Color3B& color, GLubyte opacity);