1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 09:52:44 +01:00

Fix 8f14894024: Badge widths were not updated on interface scale change. (#13630)

Prepare GUI badge class lists in OnInit() method of Windows, so that they handle scaling changes.
This commit is contained in:
Peter Nelson
2025-02-22 13:29:52 +00:00
committed by GitHub
parent 8566030c53
commit bb4ac915ff
5 changed files with 17 additions and 12 deletions

View File

@@ -311,7 +311,7 @@ class BuildIndustryWindow : public Window {
bool enabled; ///< Availability state of the selected industry.
Scrollbar *vscroll;
Dimension legend; ///< Dimension of the legend 'blob'.
GUIBadgeClasses badge_classes{GSF_INDUSTRIES};
GUIBadgeClasses badge_classes;
/** The largest allowed minimum-width of the window, given in line heights */
static const int MAX_MINWIDTH_LINEHEIGHTS = 20;
@@ -419,6 +419,8 @@ public:
void OnInit() override
{
this->badge_classes = GUIBadgeClasses{GSF_INDUSTRIES};
/* Width of the legend blob -- slightly larger than the smallmap legend blob. */
this->legend.height = GetCharacterHeight(FS_SMALL);
this->legend.width = this->legend.height * 9 / 6;