Fix: Don't double-pad existing size when adding widget padding.

UpdateWidgetSize's size parameter already includes padding.
This commit is contained in:
Peter Nelson
2023-04-11 18:45:42 +01:00
committed by PeterN
parent d93f96a442
commit 06b78a7299
3 changed files with 27 additions and 23 deletions

View File

@@ -2413,12 +2413,14 @@ struct VehicleDetailsWindow : Window {
break;
case WID_VD_SERVICE_INTERVAL_DROPDOWN: {
Dimension d{0, 0};
StringID *strs = _service_interval_dropdown;
while (*strs != INVALID_STRING_ID) {
*size = maxdim(*size, GetStringBoundingBox(*strs++));
d = maxdim(d, GetStringBoundingBox(*strs++));
}
size->width += padding.width;
size->height = FONT_HEIGHT_NORMAL + padding.height;
d.width += padding.width;
d.height += padding.height;
*size = maxdim(*size, d);
break;
}