diff --git a/src/openrct2-ui/windows/Dropdown.cpp b/src/openrct2-ui/windows/Dropdown.cpp index 2c42f47436..475c2c7e51 100644 --- a/src/openrct2-ui/windows/Dropdown.cpp +++ b/src/openrct2-ui/windows/Dropdown.cpp @@ -14,6 +14,7 @@ #include #include #include +#include #include #include #include @@ -27,6 +28,7 @@ namespace OpenRCT2::Ui::Windows constexpr int32_t DROPDOWN_TEXT_MAX_ROWS = 32; constexpr int32_t DROPDOWN_ITEM_HEIGHT = 12; + constexpr int32_t DROPDOWN_ITEM_HEIGHT_TOUCH = 24; static constexpr std::array _appropriateImageDropdownItemsPerRow = { 1, 1, 1, 1, 2, 2, 3, 3, 4, 3, // 10 @@ -86,6 +88,16 @@ namespace OpenRCT2::Ui::Windows InputSetState(InputState::DropdownActive); } + static int32_t GetDefaultRowHeight() + { + return gConfigInterface.EnlargedUi ? DROPDOWN_ITEM_HEIGHT_TOUCH : DROPDOWN_ITEM_HEIGHT; + } + + static int32_t GetAdditionalRowPadding() + { + return gConfigInterface.EnlargedUi ? 6 : 0; + } + void OnDraw(DrawPixelInfo& dpi) override { DrawWidgets(dpi); @@ -154,8 +166,9 @@ namespace OpenRCT2::Ui::Windows colour = NOT_TRANSLUCENT(colours[0]) | COLOUR_FLAG_INSET; // Draw item string + auto yOffset = GetAdditionalRowPadding(); Formatter ft(reinterpret_cast(&gDropdownItems[i].Args)); - DrawTextEllipsised(dpi, screenCoords, width - 5, item, ft, { colour }); + DrawTextEllipsised(dpi, { screenCoords.x, screenCoords.y + yOffset }, width - 5, item, ft, { colour }); } } } @@ -167,7 +180,7 @@ namespace OpenRCT2::Ui::Windows { // Set and calculate num items, rows and columns ItemWidth = itemWidth; - ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : DROPDOWN_ITEM_HEIGHT; + ItemHeight = (txtFlags & Dropdown::Flag::CustomHeight) ? customHeight : GetDefaultRowHeight(); gDropdownNumItems = static_cast(numItems); // There must always be at least one column to prevent dividing by zero if (gDropdownNumItems == 0) @@ -493,9 +506,10 @@ static constexpr colour_t kColoursDropdownOrder[] = { } // Show dropdown + auto squareSize = DropdownWindow::GetDefaultRowHeight(); WindowDropdownShowImage( w->windowPos.x + widget->left, w->windowPos.y + widget->top, widget->height() + 1, dropdownColour, - Dropdown::Flag::StayOpen, numColours, 12, 12, + Dropdown::Flag::StayOpen, numColours, squareSize, squareSize, DropdownGetAppropriateImageDropdownItemsPerRow(static_cast(numColours))); gDropdownIsColour = true;