1
0
Fork 0

Fix: Build industry window did not take width of count into account.

pull/12476/head
Peter Nelson 2024-04-10 15:44:33 +01:00
parent 442daf58da
commit 93c9b31635
No known key found for this signature in database
GPG Key ID: 8EF8F0A467DF75ED
1 changed files with 5 additions and 3 deletions

View File

@ -429,12 +429,14 @@ public:
{ {
switch (widget) { switch (widget) {
case WID_DPI_MATRIX_WIDGET: { case WID_DPI_MATRIX_WIDGET: {
Dimension d = GetStringBoundingBox(STR_FUND_INDUSTRY_MANY_RANDOM_INDUSTRIES); SetDParamMaxDigits(0, 4);
Dimension count = GetStringBoundingBox(STR_JUST_COMMA, FS_SMALL);
Dimension d{};
for (const auto &indtype : this->list) { for (const auto &indtype : this->list) {
d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(indtype)->name)); d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(indtype)->name));
} }
resize.height = std::max<uint>(this->legend.height, GetCharacterHeight(FS_NORMAL)) + padding.height; resize.height = std::max<uint>({this->legend.height, d.height, count.height}) + padding.height;
d.width += this->legend.width + WidgetDimensions::scaled.hsep_wide + padding.width; d.width += this->legend.width + WidgetDimensions::scaled.hsep_wide + WidgetDimensions::scaled.hsep_normal + count.width + padding.width;
d.height = 5 * resize.height; d.height = 5 * resize.height;
size = maxdim(size, d); size = maxdim(size, d);
break; break;