UI: center align number buttons w/o text
This makes supporting split properties and text possible, see T54951
This commit is contained in:
@@ -3238,8 +3238,10 @@ static uiBut *ui_def_but(
|
|||||||
}
|
}
|
||||||
#ifdef USE_NUMBUTS_LR_ALIGN
|
#ifdef USE_NUMBUTS_LR_ALIGN
|
||||||
else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) {
|
else if (ELEM(but->type, UI_BTYPE_NUM, UI_BTYPE_NUM_SLIDER)) {
|
||||||
|
if (slen != 0) {
|
||||||
but->drawflag |= UI_BUT_TEXT_LEFT;
|
but->drawflag |= UI_BUT_TEXT_LEFT;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
but->drawflag |= (block->flag & UI_BUT_ALIGN);
|
but->drawflag |= (block->flag & UI_BUT_ALIGN);
|
||||||
|
@@ -1475,7 +1475,9 @@ static void widget_draw_text(uiFontStyle *fstyle, uiWidgetColors *wcol, uiBut *b
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef USE_NUMBUTS_LR_ALIGN
|
#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 */
|
/* if we're editing or multi-drag (fake editing), then use left alignment */
|
||||||
(but->editstr == NULL) && (drawstr == but->drawstr))
|
(but->editstr == NULL) && (drawstr == but->drawstr))
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user