Fix: Build industry window did not take width of count into account. (#12476)

This commit is contained in:
Peter Nelson 2024-04-12 23:07:31 +01:00 committed by GitHub
parent 12125bad82
commit e83e2df023
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 5 additions and 3 deletions

View File

@ -429,12 +429,14 @@ public:
{
switch (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) {
d = maxdim(d, GetStringBoundingBox(GetIndustrySpec(indtype)->name));
}
resize.height = std::max<uint>(this->legend.height, GetCharacterHeight(FS_NORMAL)) + padding.height;
d.width += this->legend.width + WidgetDimensions::scaled.hsep_wide + padding.width;
resize.height = std::max<uint>({this->legend.height, d.height, count.height}) + padding.height;
d.width += this->legend.width + WidgetDimensions::scaled.hsep_wide + WidgetDimensions::scaled.hsep_normal + count.width + padding.width;
d.height = 5 * resize.height;
size = maxdim(size, d);
break;