mirror of
https://github.com/edubart/otclient.git
synced 2025-04-29 17:19:20 +02:00
Make UIWidget::resizeToText() respect widget padding and text offset like text-auto-resize does (#1167)
This commit is contained in:
parent
3092b5b2d5
commit
d3e12b5d44
@ -489,7 +489,7 @@ protected:
|
|||||||
BitmapFontPtr m_font;
|
BitmapFontPtr m_font;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void resizeToText() { setSize(getTextSize()); }
|
void resizeToText();
|
||||||
void clearText() { setText(""); }
|
void clearText() { setText(""); }
|
||||||
|
|
||||||
void setText(std::string text, bool dontFireLuaCall = false);
|
void setText(std::string text, bool dontFireLuaCall = false);
|
||||||
|
@ -56,6 +56,15 @@ void UIWidget::updateText()
|
|||||||
m_textMustRecache = true;
|
m_textMustRecache = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void UIWidget::resizeToText()
|
||||||
|
{
|
||||||
|
auto textSize = getTextSize();
|
||||||
|
textSize += Size(m_padding.left + m_padding.right, m_padding.top + m_padding.bottom);
|
||||||
|
textSize += m_textOffset.toSize();
|
||||||
|
|
||||||
|
setSize(textSize);
|
||||||
|
}
|
||||||
|
|
||||||
void UIWidget::parseTextStyle(const OTMLNodePtr& styleNode)
|
void UIWidget::parseTextStyle(const OTMLNodePtr& styleNode)
|
||||||
{
|
{
|
||||||
for(const OTMLNodePtr& node : styleNode->children()) {
|
for(const OTMLNodePtr& node : styleNode->children()) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user