Clean up some rendering.
This commit is contained in:
parent
5ddd54dd6d
commit
77ce58c612
6 changed files with 55 additions and 19 deletions
|
@ -54,6 +54,24 @@ double TextNode::getHeight() const
|
|||
return mHeight;
|
||||
}
|
||||
|
||||
double TextNode::getContentWidth(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (mContentWidth == 1.0)
|
||||
{
|
||||
mContentWidth = sceneInfo->mFontsManager->getFontEngine()->getHorizontalAdvance(mTextData.mFont, mTextData.mContent);
|
||||
}
|
||||
return mContentWidth;
|
||||
}
|
||||
|
||||
double TextNode::getContentHeight(SceneInfo* sceneInfo)
|
||||
{
|
||||
if (mContentHeight == 1.0)
|
||||
{
|
||||
mContentHeight = mTextData.mFont.getSize();
|
||||
}
|
||||
return mContentHeight;
|
||||
}
|
||||
|
||||
void TextNode::setWidth(double width)
|
||||
{
|
||||
if (mWidth != width)
|
||||
|
@ -190,8 +208,8 @@ void TextNode::update(SceneInfo* sceneInfo)
|
|||
mTextItem = std::make_unique<SceneText>();
|
||||
mTextItem->setName(mName + "_SceneText");
|
||||
|
||||
mContentWidth = sceneInfo->mFontsManager->getFontEngine()->getHorizontalAdvance(mTextData.mFont, mTextData.mContent);
|
||||
mContentHeight = mTextData.mFont.getSize();
|
||||
getContentWidth(sceneInfo);
|
||||
getContentHeight(sceneInfo);
|
||||
|
||||
if (mWidth == 1.0 && mHeight == 1.0)
|
||||
{
|
||||
|
|
|
@ -31,6 +31,9 @@ public:
|
|||
double getWidth() const;
|
||||
double getHeight() const;
|
||||
|
||||
double getContentWidth(SceneInfo* sceneInfo);
|
||||
double getContentHeight(SceneInfo* sceneInfo);
|
||||
|
||||
void setWidth(double width);
|
||||
void setHeight(double height);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue