diff options
author | Harley Acheson <harley> | 2019-01-14 17:02:21 +0300 |
---|---|---|
committer | Brecht Van Lommel <brechtvanlommel@gmail.com> | 2019-01-14 17:28:01 +0300 |
commit | 06f7b6827d0d74e1ee870b30ddae4f3afb3067ce (patch) | |
tree | 5399e00ae0f100089df9c687d64e833bf019dbd5 /source/blender/editors/interface | |
parent | ed843774a8b71c426ce8d800abaa4705df0ea28f (diff) |
UI: fix panel header contents alignment.
The contents is now properly centered at all zoom levels.
Differential Revision: https://developer.blender.org/D4176
Diffstat (limited to 'source/blender/editors/interface')
-rw-r--r-- | source/blender/editors/interface/interface_intern.h | 2 | ||||
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 15 |
2 files changed, 8 insertions, 9 deletions
diff --git a/source/blender/editors/interface/interface_intern.h b/source/blender/editors/interface/interface_intern.h index b0136feaa30..0a69ff6e38b 100644 --- a/source/blender/editors/interface/interface_intern.h +++ b/source/blender/editors/interface/interface_intern.h @@ -163,7 +163,7 @@ extern const short ui_radial_dir_to_angle[8]; /* internal panel drawing defines */ #define PNL_GRID (UI_UNIT_Y / 5) /* 4 default */ -#define PNL_HEADER (UI_UNIT_Y + 4) /* 24 default */ +#define PNL_HEADER (UI_UNIT_Y * 1.2) /* 24 default */ /* bit button defines */ /* Bit operations */ diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 469720c2d30..7fec94b15f7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -621,11 +621,10 @@ static void ui_draw_panel_dragwidget(uint pos, uint col, const rctf *rect) void UI_panel_label_offset(uiBlock *block, int *x, int *y) { Panel *panel = block->panel; - uiStyle *style = UI_style_get_dpi(); const bool is_subpanel = (panel->type && panel->type->parent); - *x = UI_UNIT_X * 1.1f; - *y = (UI_UNIT_Y * 1.1f) + style->panelspace; + *x = UI_UNIT_X * 1.0f; + *y = UI_UNIT_Y * 1.5f; if (is_subpanel) { *x += 5.0f / block->aspect; @@ -646,9 +645,9 @@ static void ui_draw_aligned_panel_header( /* + 0.001f to avoid flirting with float inaccuracy */ if (panel->control & UI_PNL_CLOSE) - pnl_icons = (panel->labelofs + 2 * PNL_ICON + 5) / block->aspect + 0.001f; + pnl_icons = (panel->labelofs + (2.0f * PNL_ICON)) / block->aspect + 0.001f; else - pnl_icons = (panel->labelofs + PNL_ICON + 5) / block->aspect + 0.001f; + pnl_icons = (panel->labelofs + (1.1f * PNL_ICON)) / block->aspect + 0.001f; /* draw text label */ panel_title_color_get(show_background, col_title); @@ -657,7 +656,7 @@ static void ui_draw_aligned_panel_header( hrect = *rect; if (dir == 'h') { hrect.xmin = rect->xmin + pnl_icons; - hrect.ymin += 2.0f / block->aspect; + hrect.ymin -= 2.0f / block->aspect; UI_fontstyle_draw( fontstyle, &hrect, activename, col_title, &(struct uiFontStyleDraw_Params) { .align = UI_STYLE_TEXT_LEFT, }); @@ -763,7 +762,7 @@ void ui_draw_aligned_panel( col = GPU_vertformat_attr_add(format, "color", GPU_COMP_F32, 4, GPU_FETCH_FLOAT); /* itemrect smaller */ - itemrect.xmax = headrect.xmax - 5.0f / block->aspect; + itemrect.xmax = headrect.xmax - (0.2f * UI_UNIT_X); itemrect.xmin = itemrect.xmax - BLI_rcti_size_y(&headrect); itemrect.ymin = headrect.ymin; itemrect.ymax = headrect.ymax; @@ -835,7 +834,7 @@ void ui_draw_aligned_panel( /* draw collapse icon */ /* itemrect smaller */ - itemrect.xmin = titlerect.xmin + 3.0f / block->aspect; + itemrect.xmin = titlerect.xmin; itemrect.xmax = itemrect.xmin + BLI_rcti_size_y(&titlerect); itemrect.ymin = titlerect.ymin; itemrect.ymax = titlerect.ymax; |