1
0
mirror of https://github.com/OpenTTD/OpenTTD synced 2026-01-18 18:02:37 +01:00

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 GitHub
parent 81530e2574
commit ff674829f5
7 changed files with 16 additions and 19 deletions

View File

@@ -752,7 +752,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);
}