diff options
author | Campbell Barton <ideasman42@gmail.com> | 2014-01-09 19:23:55 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2014-01-09 19:25:49 +0400 |
commit | 1914d804cf1eb8cce1f6e7390b94b702c2e3006b (patch) | |
tree | bb6c54c565d4a7b3f657dfdce76cd9c671927214 /source/blender/editors/interface | |
parent | 0445454f1e9409058c465b80c180ca8c25b45772 (diff) |
Fix T38083: submenu arrow is overlayed by menu hotkey
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index b7d7c093284..0f0ce394403 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -844,7 +844,8 @@ static int ui_but_draw_menu_icon(const uiBut *but) /* icons have been standardized... and this call draws in untransformed coordinates */ -static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, const rcti *rect) +static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, const rcti *rect, + const bool show_menu_icon) { float xs = 0.0f, ys = 0.0f; float aspect, height; @@ -908,7 +909,7 @@ static void widget_draw_icon(const uiBut *but, BIFIconID icon, float alpha, cons UI_icon_draw_aspect(xs, ys, icon, aspect, alpha); } - if (ui_but_draw_menu_icon(but)) { + if (show_menu_icon) { xs = rect->xmax - UI_DPI_ICON_SIZE - aspect; ys = (rect->ymin + rect->ymax - height) / 2.0f; @@ -1349,15 +1350,23 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB if (but->type == MENU && (but->flag & UI_BUT_NODE_LINK)) { rcti temp = *rect; temp.xmin = rect->xmax - BLI_rcti_size_y(rect) - 1; - widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp); + widget_draw_icon(but, ICON_LAYER_USED, alpha, &temp, false); } /* If there's an icon too (made with uiDefIconTextBut) then draw the icon * and offset the text label to accommodate it */ if (but->flag & UI_HAS_ICON) { - widget_draw_icon(but, but->icon + but->iconadd, alpha, rect); - rect->xmin += ICON_SIZE_FROM_BUTRECT(rect); + const bool show_menu_icon = ui_but_draw_menu_icon(but); + const float icon_size = ICON_SIZE_FROM_BUTRECT(rect); + + widget_draw_icon(but, but->icon + but->iconadd, alpha, rect, show_menu_icon); + + rect->xmin += icon_size; + /* without this menu keybindings will overlap the arrow icon [#38083] */ + if (show_menu_icon) { + rect->xmax -= icon_size / 2.0f; + } } if (but->editstr || (but->drawflag & UI_BUT_TEXT_LEFT)) { @@ -1372,7 +1381,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB rcti temp = *rect; temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f); - widget_draw_icon(but, ICON_X, alpha, &temp); + widget_draw_icon(but, ICON_X, alpha, &temp, false); rect->xmax -= ICON_SIZE_FROM_BUTRECT(rect); } |