From 59bb4ca1b08b3b174d91f69f3ed6af43bad66138 Mon Sep 17 00:00:00 2001 From: raa Date: Tue, 28 Mar 2017 13:44:02 +0300 Subject: Fix: Icon offset for pie buttons --- .../blender/editors/interface/interface_widgets.c | 22 ++++++++-------------- 1 file changed, 8 insertions(+), 14 deletions(-) diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 5ec0c49a8cd..f7f2b422724 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -874,24 +874,18 @@ static void widget_draw_icon( float ofs = 1.0f / aspect; if (but->drawflag & UI_BUT_ICON_LEFT) { - if (but->block->flag & UI_BLOCK_LOOP) { - if (but->type == UI_BTYPE_SEARCH_MENU) - xs = rect->xmin + 4.0f * ofs; - else - xs = rect->xmin + ofs; - } - else { - if (but->dt == UI_EMBOSS_NONE || but->type == UI_BTYPE_LABEL) - xs = rect->xmin + 2.0f * ofs; - else - xs = rect->xmin + 4.0f * ofs; - } - ys = (rect->ymin + rect->ymax - height) / 2.0f; + /* special case - icon_only pie buttons */ + if (ui_block_is_pie_menu(but->block) && but->type != UI_BTYPE_MENU && but->str && but->str[0] == '\0') + xs = rect->xmin + 2.0f * ofs; + else if (but->dt == UI_EMBOSS_NONE || but->type == UI_BTYPE_LABEL) + xs = rect->xmin + 2.0f * ofs; + else + xs = rect->xmin + 4.0f * ofs; } else { xs = (rect->xmin + rect->xmax - height) / 2.0f; - ys = (rect->ymin + rect->ymax - height) / 2.0f; } + ys = (rect->ymin + rect->ymax - height) / 2.0f; /* force positions to integers, for zoom levels near 1. draws icons crisp. */ if (aspect > 0.95f && aspect < 1.05f) { -- cgit v1.2.3