reinstate font scale backup in SimpleButton, to fix the bug I introduced recently.
This commit is contained in:
@@ -199,8 +199,11 @@ void SimpleButton::setText( const string& text)
|
|||||||
float SimpleButton::GetWidth()
|
float SimpleButton::GetWidth()
|
||||||
{
|
{
|
||||||
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
|
WFont * mFont = WResourceManager::Instance()->GetWFont(mFontId);
|
||||||
|
float backup = mFont->GetScale();
|
||||||
mFont->SetScale(1.0);
|
mFont->SetScale(1.0);
|
||||||
return mFont->GetStringWidth(mText.c_str());
|
float result = mFont->GetStringWidth(mText.c_str());
|
||||||
|
mFont->SetScale(backup);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
float SimpleButton::GetEnlargedWidth()
|
float SimpleButton::GetEnlargedWidth()
|
||||||
@@ -210,7 +213,9 @@ float SimpleButton::GetEnlargedWidth()
|
|||||||
mFont->SetScale(SCALE_SELECTED);
|
mFont->SetScale(SCALE_SELECTED);
|
||||||
if(mText.size() < 20)
|
if(mText.size() < 20)
|
||||||
mFont->SetScale(SCALE_SELECTED_LARGE);
|
mFont->SetScale(SCALE_SELECTED_LARGE);
|
||||||
return mFont->GetStringWidth(mText.c_str());
|
float result = mFont->GetStringWidth(mText.c_str());
|
||||||
|
mFont->SetScale(backup);
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
ostream& SimpleButton::toString(ostream& out) const
|
ostream& SimpleButton::toString(ostream& out) const
|
||||||
|
|||||||
Reference in New Issue
Block a user