Codechange: Replace Rect CentreTo with CentreToHeight. (#14675)

So far all callers only need to centre vertically, so not having to provide the existing width simplifies calls.
This commit is contained in:
Peter Nelson
2025-09-28 14:09:36 +01:00
committed by dP
parent fcd3d29be7
commit aaa337592c
7 changed files with 16 additions and 19 deletions

View File

@@ -754,7 +754,7 @@ static inline void DrawButtonDropdown(const Rect &r, Colours colour, bool clicke
Rect text = r.Indent(NWidgetLeaf::dropdown_dimension.width, !rtl);
DrawFrameRect(text, colour, clicked_button ? FrameFlag::Lowered : FrameFlags{});
if (!str.empty()) {
text = text.CentreTo(text.Width(), GetCharacterHeight(FS_NORMAL)).Shrink(WidgetDimensions::scaled.dropdowntext, RectPadding::zero);
text = text.CentreToHeight(GetCharacterHeight(FS_NORMAL)).Shrink(WidgetDimensions::scaled.dropdowntext, RectPadding::zero);
DrawString(text, str, TC_BLACK, align);
}