summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordP <dp@dpointer.org>2020-08-02 17:26:53 +0300
committerMichael Lutz <michi@icosahedron.de>2020-08-13 20:50:11 +0200
commit3db7cf54fdd85b51981887f948a867bc214ec895 (patch)
tree71c5de8ebdd1af445470e97fe1dac4a621f6e9b8 /src
parent2693a901f9882589d95330a4546e781c2e71becb (diff)
downloadopenttd-3db7cf54fdd85b51981887f948a867bc214ec895.tar.xz
Fix: sprite preview in sprite aligner is too small with scaled UI
Diffstat (limited to 'src')
-rw-r--r--src/newgrf_debug_gui.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp
index 19757646d..511436b27 100644
--- a/src/newgrf_debug_gui.cpp
+++ b/src/newgrf_debug_gui.cpp
@@ -856,13 +856,17 @@ struct SpriteAlignerWindow : Window {
void UpdateWidgetSize(int widget, Dimension *size, const Dimension &padding, Dimension *fill, Dimension *resize) override
{
- if (widget != WID_SA_LIST) return;
-
- resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
- resize->width = 1;
-
- /* Resize to about 200 pixels (for the preview) */
- size->height = (1 + 200 / resize->height) * resize->height;
+ switch (widget) {
+ case WID_SA_SPRITE:
+ size->height = ScaleGUITrad(200);
+ break;
+ case WID_SA_LIST:
+ resize->height = max(11, FONT_HEIGHT_NORMAL + 1);
+ resize->width = 1;
+ break;
+ default:
+ break;
+ }
}
void DrawWidget(const Rect &r, int widget) const override