From 142751fe179e7e1f72a2d9fbd4cfc7dfb77c7271 Mon Sep 17 00:00:00 2001 From: dP Date: Sun, 2 Aug 2020 17:38:21 +0300 Subject: [PATCH] Fix: sprite preview in sprite aligner is too small with scaled UI --- cm_changelog.txt | 3 ++- src/newgrf_debug_gui.cpp | 18 +++++++++++------- 2 files changed, 13 insertions(+), 8 deletions(-) diff --git a/cm_changelog.txt b/cm_changelog.txt index 7fa6ce7e2a..075569b29c 100644 --- a/cm_changelog.txt +++ b/cm_changelog.txt @@ -74,7 +74,7 @@ This is usable for any OpenTTD servers == CHANGELOG == -*** next () *** +*** 1.10.3 () *** - Fix order hotkeys adding extra no load/unload orders. - Allow to use TAB as a hotkey. - Add hotkey to toggle minimap. @@ -93,6 +93,7 @@ This is usable for any OpenTTD servers - Add APM counter to the status bar. - Fix town HR couter. - Allow spectators to open industry funding window from the menu. +- Fix graphical glitches after switching to location with hotkey. *** 1.10.2 (5 Jun 2020) *** - Add new minimap mode showing industries, height and farms at the same time. diff --git a/src/newgrf_debug_gui.cpp b/src/newgrf_debug_gui.cpp index 479cdaf110..c56f667a37 100644 --- a/src/newgrf_debug_gui.cpp +++ b/src/newgrf_debug_gui.cpp @@ -859,13 +859,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