mirror of https://github.com/axmolengine/axmol.git
fix RichText visit issue
This commit is contained in:
parent
03299cb76a
commit
a9a16b3ee5
|
@ -461,6 +461,11 @@ void RichText::formarRenderers()
|
||||||
_elementRenderersContainer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
|
_elementRenderersContainer->setPosition(_contentSize.width / 2.0f, _contentSize.height / 2.0f);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void RichText::adaptRenderers()
|
||||||
|
{
|
||||||
|
this->formatText();
|
||||||
|
}
|
||||||
|
|
||||||
void RichText::pushToContainer(cocos2d::Node *renderer)
|
void RichText::pushToContainer(cocos2d::Node *renderer)
|
||||||
{
|
{
|
||||||
if (_elementRenders.size() <= 0)
|
if (_elementRenders.size() <= 0)
|
||||||
|
@ -470,15 +475,6 @@ void RichText::pushToContainer(cocos2d::Node *renderer)
|
||||||
_elementRenders[_elementRenders.size()-1]->pushBack(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)
|
void RichText::setVerticalSpace(float space)
|
||||||
{
|
{
|
||||||
_verticalSpace = space;
|
_verticalSpace = space;
|
||||||
|
|
|
@ -103,7 +103,7 @@ public:
|
||||||
void pushBackElement(RichElement* element);
|
void pushBackElement(RichElement* element);
|
||||||
void removeElement(int index);
|
void removeElement(int index);
|
||||||
void removeElement(RichElement* element);
|
void removeElement(RichElement* element);
|
||||||
virtual void visit(cocos2d::Renderer *renderer, const Mat4 &parentTransform, uint32_t parentFlags) override;
|
|
||||||
void setVerticalSpace(float space);
|
void setVerticalSpace(float space);
|
||||||
virtual void setAnchorPoint(const Vec2 &pt);
|
virtual void setAnchorPoint(const Vec2 &pt);
|
||||||
virtual const Size& getVirtualRendererSize() const override;
|
virtual const Size& getVirtualRendererSize() const override;
|
||||||
|
@ -115,6 +115,8 @@ CC_CONSTRUCTOR_ACCESS:
|
||||||
virtual bool init() override;
|
virtual bool init() override;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
virtual void adaptRenderers();
|
||||||
|
|
||||||
virtual void initRenderer();
|
virtual void initRenderer();
|
||||||
void pushToContainer(Node* renderer);
|
void pushToContainer(Node* renderer);
|
||||||
void handleTextRenderer(const std::string& text, const std::string& fontName, float fontSize, const Color3B& color, GLubyte opacity);
|
void handleTextRenderer(const std::string& text, const std::string& fontName, float fontSize, const Color3B& color, GLubyte opacity);
|
||||||
|
|
Loading…
Reference in New Issue