Fix: DropDownListColourItem didn't provide width nor scale vertical padding.

This commit is contained in:
Peter Nelson 2023-04-12 12:20:07 +01:00 committed by PeterN
parent bb988f940e
commit 701092003d
1 changed files with 6 additions and 1 deletions

View File

@ -592,9 +592,14 @@ public:
return this->result >= COLOUR_END ? STR_COLOUR_DEFAULT : _colour_dropdown[this->result];
}
uint Width() const override
{
return ScaleGUITrad(28) + WidgetDimensions::scaled.hsep_normal + GetStringBoundingBox(this->String()).width + WidgetDimensions::scaled.dropdowntext.Horizontal();
}
uint Height(uint width) const override
{
return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + 2);
return std::max(FONT_HEIGHT_NORMAL, ScaleGUITrad(12) + WidgetDimensions::scaled.vsep_normal);
}
bool Selectable() const override