diff --git a/source/gui/CGUI.cpp b/source/gui/CGUI.cpp index 9cfbec2a81..997d6502bf 100644 --- a/source/gui/CGUI.cpp +++ b/source/gui/CGUI.cpp @@ -746,8 +746,6 @@ SGUIText CGUI::GenerateText(const CGUIString& string, const CStrW& FontW, const // Append X value. x += Feedback2.m_Size.cx; - Text.m_Size.cx = std::max(Text.m_Size.cx, x+BufferZone); - // The first word overrides the width limit, what we // do, in those cases, are just drawing that word even // though it'll extend the object. @@ -783,10 +781,11 @@ SGUIText CGUI::GenerateText(const CGUIString& string, const CStrW& FontW, const } // Reset X - x = 0.f; + x = BufferZone; - // Update height of all - Text.m_Size.cy = std::max(Text.m_Size.cy, y+BufferZone); + // Update dimensions + Text.m_Size.cx = std::max(Text.m_Size.cx, line_width + BufferZone); + Text.m_Size.cy = std::max(Text.m_Size.cy, y + BufferZone); FirstLine = false; diff --git a/source/gui/CTooltip.cpp b/source/gui/CTooltip.cpp index 5f6c7f6aff..5c0259e446 100644 --- a/source/gui/CTooltip.cpp +++ b/source/gui/CTooltip.cpp @@ -97,9 +97,7 @@ void CTooltip::SetupText() GUI::GetSetting(this, "offset", offset); GUI::GetSetting(this, "anchor", anchor); - // TODO: Calculate the actual width of the wrapped text and use that. - // (m_Size.cx is >max_width if the text wraps, which is not helpful) - float textwidth = std::min(m_GeneratedTexts[0]->m_Size.cx, (float)max_width); + float textwidth = m_GeneratedTexts[0]->m_Size.cx; float textheight = m_GeneratedTexts[0]->m_Size.cy; CClientArea size;