UI: Improved alignment of labels and buttons
Improved alignment of labels with other buttons. Differential Revision: https://developer.blender.org/D9058 Reviewed by Julian Eisel
This commit is contained in:
parent
d32188b85b
commit
6bf043ac94
|
@ -282,10 +282,10 @@ def draw(layout, context, context_member, property_type, use_edit=True):
|
|||
|
||||
if use_edit:
|
||||
split = box.split(factor=0.75)
|
||||
row = split.row(align=True)
|
||||
row = split.row()
|
||||
else:
|
||||
split = box.split(factor=1.00)
|
||||
row = split.row(align=True)
|
||||
row = split.row()
|
||||
|
||||
row.alignment = 'RIGHT'
|
||||
|
||||
|
|
|
@ -2148,7 +2148,6 @@ void uiItemFullR(uiLayout *layout,
|
|||
uiLayout *layout_split = uiLayoutSplit(
|
||||
layout_row ? layout_row : layout, UI_ITEM_PROP_SEP_DIVIDE, true);
|
||||
bool label_added = false;
|
||||
layout_split->space = 0;
|
||||
uiLayout *layout_sub = uiLayoutColumn(layout_split, true);
|
||||
layout_sub->space = 0;
|
||||
|
||||
|
@ -3186,7 +3185,6 @@ uiPropertySplitWrapper uiItemPropertySplitWrapperCreate(uiLayout *parent_layout)
|
|||
uiLayout *layout_row = uiLayoutRow(parent_layout, true);
|
||||
uiLayout *layout_split = uiLayoutSplit(layout_row, UI_ITEM_PROP_SEP_DIVIDE, true);
|
||||
|
||||
layout_split->space = 0;
|
||||
split_wrapper.label_column = uiLayoutColumn(layout_split, true);
|
||||
split_wrapper.label_column->alignment = UI_LAYOUT_ALIGN_RIGHT;
|
||||
split_wrapper.property_row = ui_item_prop_split_layout_hack(parent_layout, layout_split);
|
||||
|
|
|
@ -2426,19 +2426,23 @@ static void widget_draw_text_icon(const uiFontStyle *fstyle,
|
|||
}
|
||||
}
|
||||
else if (but->drawflag & UI_BUT_TEXT_LEFT) {
|
||||
|
||||
/* Reduce the left padding for labels without an icon. */
|
||||
if ((but->type == UI_BTYPE_LABEL) && !(but->flag & UI_HAS_ICON) &&
|
||||
!ui_block_is_menu(but->block)) {
|
||||
text_padding /= 2;
|
||||
}
|
||||
|
||||
rect->xmin += text_padding;
|
||||
}
|
||||
else if (but->drawflag & UI_BUT_TEXT_RIGHT) {
|
||||
rect->xmax -= text_padding;
|
||||
}
|
||||
}
|
||||
else {
|
||||
/* In case a separate text label and some other button are placed under each other,
|
||||
and the outline of the button does not contrast with the background.
|
||||
Add an offset (thickness of the outline) so that the text does not stick out visually. */
|
||||
if (but->drawflag & UI_BUT_TEXT_LEFT) {
|
||||
rect->xmin += U.pixelsize;
|
||||
}
|
||||
else if (but->drawflag & UI_BUT_TEXT_RIGHT) {
|
||||
rect->xmax -= U.pixelsize;
|
||||
}
|
||||
}
|
||||
|
||||
/* Menu contains sub-menu items with triangle icon on their right. Shortcut
|
||||
* strings should be drawn with some padding to the right then. */
|
||||
|
@ -4575,6 +4579,9 @@ void ui_draw_but(const bContext *C, struct ARegion *region, uiStyle *style, uiBu
|
|||
wt->wcol_theme = &tui->wcol_menu_back;
|
||||
wt->state = widget_state;
|
||||
}
|
||||
if (!(but->flag & UI_HAS_ICON)) {
|
||||
but->drawflag |= UI_BUT_NO_TEXT_PADDING;
|
||||
}
|
||||
break;
|
||||
|
||||
case UI_BTYPE_SEPR:
|
||||
|
|
|
@ -266,7 +266,7 @@ extern const char *node_context_dir[];
|
|||
#define NODE_SOCKDY (0.08f * U.widget_unit)
|
||||
#define NODE_WIDTH(node) (node->width * UI_DPI_FAC)
|
||||
#define NODE_HEIGHT(node) (node->height * UI_DPI_FAC)
|
||||
#define NODE_MARGIN_X (0.95f * U.widget_unit)
|
||||
#define NODE_MARGIN_X (1.10f * U.widget_unit)
|
||||
#define NODE_SOCKSIZE (0.25f * U.widget_unit)
|
||||
#define NODE_RESIZE_MARGIN (0.20f * U.widget_unit)
|
||||
#define NODE_LINK_RESOL 12
|
||||
|
|
Loading…
Reference in New Issue