Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans Goudey <h.goudey@me.com>2021-02-25 19:28:39 +0300
committerHans Goudey <h.goudey@me.com>2021-02-25 19:28:39 +0300
commit6daff9a08e79546a28a24a6306d9f067e7f7fa59 (patch)
tree164a5b2ba4017d9354eb635b7a650a761cad4229
parentf908ff1ccdfb0133e1797877363f063b9daa696c (diff)
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.
-rw-r--r--source/blender/editors/interface/interface_widgets.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c
index 5c59d0edeb5..0fa5999976b 100644
--- a/source/blender/editors/interface/interface_widgets.c
+++ b/source/blender/editors/interface/interface_widgets.c
@@ -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? */