Fix #35281: search menu buttons (with an X on the right side to clear) had text

overlapping the X icon if the text was long.
This commit is contained in:
2013-05-10 20:34:35 +00:00
parent 50b270ca36
commit 38391d9a7d

View File

@@ -968,8 +968,14 @@ static void ui_text_clip_give_next_off(uiBut *but)
static void ui_text_clip_left(uiFontStyle *fstyle, uiBut *but, const rcti *rect)
{
int border = (but->flag & UI_BUT_ALIGN_RIGHT) ? 8 : 10;
int okwidth = max_ii(BLI_rcti_size_x(rect) - border, 0);
if (but->flag & UI_HAS_ICON) okwidth -= UI_DPI_ICON_SIZE;
int okwidth = BLI_rcti_size_x(rect) - border;
if (but->flag & UI_HAS_ICON)
okwidth -= UI_DPI_ICON_SIZE;
if (but->type == SEARCH_MENU_UNLINK && !but->editstr)
okwidth -= BLI_rcti_size_y(rect);
okwidth = max_ii(okwidth, 0);
/* need to set this first */
uiStyleFontSet(fstyle);
@@ -1347,7 +1353,7 @@ static void widget_draw_text_icon(uiFontStyle *fstyle, uiWidgetColors *wcol, uiB
}
/* unlink icon for this button type */
if (but->type == SEARCH_MENU_UNLINK && but->drawstr[0]) {
if (but->type == SEARCH_MENU_UNLINK && !but->editstr && but->drawstr[0]) {
rcti temp = *rect;
temp.xmin = temp.xmax - (BLI_rcti_size_y(rect) * 1.08f);