forked from mirrors/0ad
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:
@@ -27,6 +27,7 @@
|
|||||||
#include "maths/Rect.h"
|
#include "maths/Rect.h"
|
||||||
#include "maths/Size2D.h"
|
#include "maths/Size2D.h"
|
||||||
|
|
||||||
|
#include <limits>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <utility>
|
#include <utility>
|
||||||
@@ -120,7 +121,7 @@ CSize2D CText::GetTextSize()
|
|||||||
|
|
||||||
CSize2D CText::GetPreferredTextSize()
|
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
|
const CStrW& CText::GetTooltipText() const
|
||||||
|
|||||||
Reference in New Issue
Block a user