1
0
Fork 0

Fix: League table window ignored the minimal size in its widget description.

pull/13630/head
Peter Nelson 2025-02-20 21:26:26 +00:00 committed by Peter Nelson
parent 9b65786055
commit 17a4fcefde
1 changed files with 6 additions and 2 deletions

View File

@ -384,8 +384,12 @@ public:
if (!show_icon_column) this->icon_size.width = 0;
else this->icon_size.width += WidgetDimensions::scaled.hsep_wide;
size.width = this->rank_width + this->icon_size.width + this->text_width + this->score_width + WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.hsep_wide * 2;
size.height = this->line_height * std::max<uint>(3u, (unsigned)this->rows.size()) + WidgetDimensions::scaled.framerect.Vertical();
uint non_text_width = this->rank_width + this->icon_size.width + this->score_width + WidgetDimensions::scaled.framerect.Horizontal() + WidgetDimensions::scaled.hsep_wide * 2;
size.width = std::max(size.width, non_text_width + this->text_width);
size.height = std::max(size.height, this->line_height * std::max<uint>(3u, (unsigned)this->rows.size()) + WidgetDimensions::scaled.framerect.Vertical());
/* Adjust text_width to fill any space left over if the preset minimal width is larger than our calculated width. */
this->text_width = size.width - non_text_width;
if (!lt->header.empty()) {
SetDParamStr(0, lt->header);