UI: Fix icon width and padding in search menus

Previously the padding size and the width saved for the icon were
constant regardless of the zoom level. This resulted in overlapping
icons and text, and ugly padding with more extreme zoom levels.
We can retrieve the size of the row from the `rect` argument.
This commit is contained in:
Hans Goudey 2021-02-25 10:28:39 -06:00
parent f908ff1ccd
commit 6daff9a08e
1 changed files with 3 additions and 2 deletions

View File

@ -5237,8 +5237,9 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
{
uiWidgetType *wt = widget_type(UI_WTYPE_MENU_ITEM);
const rcti _rect = *rect;
const int row_height = BLI_rcti_size_y(rect);
int max_hint_width = INT_MAX;
int padding = 0.25f * UI_UNIT_X;
int padding = 0.25f * row_height;
char *cpoin = NULL;
wt->state(wt, state, 0, UI_EMBOSS_UNDEFINED);
@ -5249,7 +5250,7 @@ void ui_draw_menu_item(const uiFontStyle *fstyle,
/* text location offset */
rect->xmin += padding;
if (iconid) {
rect->xmin += UI_DPI_ICON_SIZE;
rect->xmin += row_height; /* Use square area for icon. */
}
/* cut string in 2 parts? */