Codechange: Simplify setting minimum width for game options dropdown lists. (#11474)

Height isn't necessary as drop down controls already have sufficient height, so we can use GetDropDownListDimension() to get the width.
This commit is contained in:
Peter Nelson 2023-11-20 00:44:06 +00:00 committed by GitHub
parent f58a7ef673
commit c80fa7d752
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 11 deletions

View File

@ -445,17 +445,8 @@ struct GameOptionsWindow : Window {
default: {
int selected;
DropDownList list = this->BuildDropDownList(widget, &selected);
if (!list.empty()) {
/* Find the biggest item for the default size. */
for (const auto &ddli : list) {
Dimension string_dim;
int width = ddli->Width();
string_dim.width = width + padding.width;
string_dim.height = ddli->Height() + padding.height;
*size = maxdim(*size, string_dim);
}
}
size->width = std::max(size->width, GetDropDownListDimension(this->BuildDropDownList(widget, &selected)).width + padding.width);
break;
}
}
}