Lift window width constraint of .getPreferredTextSize

The method's point is to calculate a text's height and width if it was written
in a single line -- no matter how long the caption, even if it's wider
than the window.
This commit is contained in:
Vantha 2025-08-21 19:26:13 +02:00 committed by Ralph Sennhauser
parent 835f59a604
commit 83f4d8789b

View file

@ -27,6 +27,7 @@
#include "maths/Rect.h"
#include "maths/Size2D.h"
#include <limits>
#include <memory>
#include <string>
#include <utility>
@ -120,7 +121,7 @@ CSize2D CText::GetTextSize()
CSize2D CText::GetPreferredTextSize()
{
return CGUIText{m_pGUI, m_Caption, m_Font, m_pGUI.GetWindowSize().Width, m_BufferZone, m_TextAlign, this}.GetSize();
return CGUIText{m_pGUI, m_Caption, m_Font, std::numeric_limits<float>::max(), m_BufferZone, m_TextAlign, this}.GetSize();
}
const CStrW& CText::GetTooltipText() const