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

@@ -242,9 +242,8 @@ public:
for (auto object_class_id : this->object_classes) {
ObjectClass *objclass = ObjectClass::Get(object_class_id);
if (objclass->GetUISpecCount() == 0) continue;
size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width);
size->width = std::max(size->width, GetStringBoundingBox(objclass->name).width + padding.width);
}
size->width += padding.width;
this->line_height = FONT_HEIGHT_NORMAL + padding.height;
resize->height = this->line_height;
size->height = 5 * this->line_height;