UI: center align number buttons w/o text
authorCampbell Barton <ideasman42@gmail.com>
Sun, 27 May 2018 19:06:38 +0000 (21:06 +0200)
committerCampbell Barton <ideasman42@gmail.com>
Sun, 27 May 2018 19:08:50 +0000 (21:08 +0200)
This makes supporting split properties and text possible, see T54951

source/blender/editors/interface/interface.c
source/blender/editors/interface/interface_widgets.c

index 1d798c7baad6b55fcfc53d040ae1f366f3a6f775..20ad6f00c5b2cccc96d260fc09cb4e3cad7236f4 100644 (file)
@@ -3238,7 +3238,9 @@ static uiBut *ui_def_but(
        }
 #ifdef USE_NUMBUTS_LR_ALIGN
        else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) {
-               but->drawflag |= UI_BUT_TEXT_LEFT;
+               if (slen != 0) {
+                       but->drawflag |= UI_BUT_TEXT_LEFT;
+               }
        }
 #endif
 
index c476c12ce2b1fb680f6e6d0110f3ff24247445d1..e3230d39ae2899a8924e2aa9dba1e740f84b3257 100644 (file)
@@ -1475,7 +1475,9 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
        }
 
 #ifdef USE_NUMBUTS_LR_ALIGN
-       if (!drawstr_right && ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) &&
+       if (!drawstr_right &&
+           (but->drawflag & UI_BUT_TEXT_LEFT) &&
+           ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER) &&
            /* if we're editing or multi-drag (fake editing), then use left alignment */
            (but->editstr == NULL) && (drawstr == but->drawstr))
        {