Created
December 1, 2022 00:29
-
-
Save PeterN/cc2c2bbbda727554a2fc57e3ddb2bfd9 to your computer and use it in GitHub Desktop.
multiline label
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/widget.cpp b/src/widget.cpp | |
index 9c9868988c..0c79f67f1b 100644 | |
--- a/src/widget.cpp | |
+++ b/src/widget.cpp | |
@@ -490,10 +490,8 @@ static inline void DrawLabel(const Rect &r, WidgetType type, bool clicked, TextC | |
{ | |
if (str == STR_NULL) return; | |
if ((type & WWT_MASK) == WWT_TEXTBTN_2 && clicked) str++; | |
- Dimension d = GetStringBoundingBox(str); | |
- Point p = GetAlignedPosition(r, d, align); | |
int o = clicked ? WidgetDimensions::scaled.pressed : 0; | |
- DrawString(r.left + o, r.right + o, p.y + o, str, colour, align); | |
+ DrawStringMultiLine(r.Translate(o, o), str, colour, align); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment