diff options
author | Yevgeny Makarov <jenkm> | 2020-10-29 02:01:51 +0300 |
---|---|---|
committer | Harley Acheson <harley.acheson@gmail.com> | 2020-10-29 02:01:51 +0300 |
commit | 6bf043ac946f39f2ac3063feb7e7cfe7b7a6ba18 (patch) | |
tree | 827e540e7dffb14aa471fbd2f6da5183e680e19a /source/blender | |
parent | d32188b85bf031f316bf0ae284805c5934fdee9c (diff) |
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
Diffstat (limited to 'source/blender')
-rw-r--r-- | source/blender/editors/interface/interface_layout.c | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 21 | ||||
-rw-r--r-- | source/blender/editors/space_node/node_intern.h | 2 |
3 files changed, 15 insertions, 10 deletions
diff --git a/source/blender/editors/interface/interface_layout.c b/source/blender/editors/interface/interface_layout.c index ad260274e78..cf589e43858 100644 --- a/source/blender/editors/interface/interface_layout.c +++ b/source/blender/editors/interface/interface_layout.c @@ -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); diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index 415a0440be6..e2250c764b1 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -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: diff --git a/source/blender/editors/space_node/node_intern.h b/source/blender/editors/space_node/node_intern.h index 04e452d5270..aa59b7293a3 100644 --- a/source/blender/editors/space_node/node_intern.h +++ b/source/blender/editors/space_node/node_intern.h @@ -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 |