1
0
forked from mirrors/0ad
Files
0ad/source/gui/Scripting
trompetin17 19e82ebceb Add getPreferredTextSize to calculate unconstrained text width
Introduces (CButton|CText).getPreferredTextSize, a new method for estimating
the natural width of a caption if the object had no width constraints.

Unlike .getTextSize, which reports the size after applying current
layout constraints (e.g., fixed width or anchors), getPreferredTextSize
answers the question: "How wide would this object need to be to display
the caption on a single line?"

This is particularly useful for modders and layout logic that wants to
dynamically size elements *before* assigning a fixed width or anchoring.
2025-06-26 16:58:32 -05:00
..
2025-06-26 17:25:05 +02:00
2025-06-26 17:25:05 +02:00