Bugfix for clipping of SEARCH_MENU icon text.

For the preview-icon search menu (used for example in brush
selection), clip the text so that long names don't flow out into the
space between columns.
This commit is contained in:
Nicholas Bishop 2012-02-28 01:55:27 +00:00
parent fa38c3dbac
commit 2a4cd1d203

@ -3292,9 +3292,13 @@ void ui_draw_preview_item(uiFontStyle *fstyle, rcti *rect, const char *name, int
BLF_width_and_height(fstyle->uifont_id, name, &font_dims[0], &font_dims[1]);
/* text rect */
trect.xmin += 0;
trect.xmax = trect.xmin + font_dims[0] + 10;
trect.ymin += 10;
trect.ymax = trect.ymin + font_dims[1];
if(trect.xmax > rect->xmax - PREVIEW_PAD)
trect.xmax = rect->xmax - PREVIEW_PAD;
uiStyleFontDraw(fstyle, &trect, name);
}