mirror of https://github.com/axmolengine/axmol.git
Merge pull request #6044 from Dhilan007/develop_label
fixed getting wrong Rect by LabelTTF(LabelBMFont)::getBoundingBox.
This commit is contained in:
commit
79d1bc5e88
|
@ -1361,7 +1361,7 @@ const Size& Label::getContentSize() const
|
|||
{
|
||||
const_cast<Label*>(this)->updateContent();
|
||||
}
|
||||
return Node::getContentSize();
|
||||
return _contentSize;
|
||||
}
|
||||
|
||||
Rect Label::getBoundingBox() const
|
||||
|
|
|
@ -243,7 +243,7 @@ public:
|
|||
|
||||
virtual const Size& getContentSize() const override;
|
||||
|
||||
virtual Rect getBoundingBox() const;
|
||||
virtual Rect getBoundingBox() const override;
|
||||
|
||||
FontAtlas* getFontAtlas() { return _fontAtlas; }
|
||||
/** Listen "come to background" message
|
||||
|
|
|
@ -191,6 +191,17 @@ void LabelBMFont::setColor(const Color3B& color)
|
|||
_label->setColor(color);
|
||||
}
|
||||
|
||||
const Size& LabelBMFont::getContentSize() const
|
||||
{
|
||||
const_cast<LabelBMFont*>(this)->setContentSize(_label->getContentSize());
|
||||
return _contentSize;
|
||||
}
|
||||
|
||||
Rect LabelBMFont::getBoundingBox() const
|
||||
{
|
||||
return _label->getBoundingBox();
|
||||
}
|
||||
|
||||
//LabelBMFont - Debug draw
|
||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||
void LabelBMFont::draw()
|
||||
|
|
|
@ -116,6 +116,9 @@ public:
|
|||
|
||||
virtual void setColor(const Color3B& color) override;
|
||||
|
||||
virtual const Size& getContentSize() const override;
|
||||
virtual Rect getBoundingBox() const override;
|
||||
|
||||
virtual std::string getDescription() const override;
|
||||
|
||||
#if CC_LABELBMFONT_DEBUG_DRAW
|
||||
|
|
|
@ -278,6 +278,11 @@ const Size& LabelTTF::getContentSize() const
|
|||
return _contentSize;
|
||||
}
|
||||
|
||||
Rect LabelTTF::getBoundingBox() const
|
||||
{
|
||||
return _renderLabel->getBoundingBox();
|
||||
}
|
||||
|
||||
#if defined(__GNUC__) && ((__GNUC__ >= 4) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 1)))
|
||||
#pragma GCC diagnostic warning "-Wdeprecated-declarations"
|
||||
#elif _MSC_VER >= 1400 //vs 2005 or higher
|
||||
|
|
|
@ -143,6 +143,8 @@ public:
|
|||
virtual void setFlippedX(bool flippedX);
|
||||
virtual void setFlippedY(bool flippedY);
|
||||
|
||||
virtual Rect getBoundingBox() const override;
|
||||
|
||||
/**
|
||||
* @js NA
|
||||
* @lua NA
|
||||
|
|
Loading…
Reference in New Issue