From 93823087041a5c3e28d133ebaca1979dced11a6f Mon Sep 17 00:00:00 2001 From: guishe Date: Thu, 16 Mar 2023 10:36:39 -0600 Subject: [PATCH] UI: align tab labels towards panels Align the labels on the tabs so that when you read them, your head is tilted towards the content, instead of away. When tabs are drawn to the right of panels in the sidebar, the labels are read from bottom to top, which may suggest that this tab does not belong to the area. This change does it like this: Sidebar on the right: the text is read from top to bottom. Sidebar on the left: the text keeps reading from bottom to top. --- source/blender/editors/interface/interface_panel.cc | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/source/blender/editors/interface/interface_panel.cc b/source/blender/editors/interface/interface_panel.cc index 9c15ad6d98e..fd3ead60ae2 100644 --- a/source/blender/editors/interface/interface_panel.cc +++ b/source/blender/editors/interface/interface_panel.cc @@ -1332,7 +1332,7 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) is_alpha = (region->overlap && (theme_col_back[3] != 255)); BLF_enable(fontid, BLF_ROTATION); - BLF_rotation(fontid, M_PI_2); + BLF_rotation(fontid, is_left ? M_PI_2 : -M_PI_2); ui_fontscale(&fstyle_points, aspect); BLF_size(fontid, fstyle_points * UI_SCALE_FAC); @@ -1467,7 +1467,10 @@ void UI_panel_category_draw_all(ARegion *region, const char *category_id_active) /* Tab titles. */ - BLF_position(fontid, rct->xmax - text_v_ofs, rct->ymin + tab_v_pad_text, 0.0f); + BLF_position(fontid, + is_left ? rct->xmax - text_v_ofs : rct->xmin + text_v_ofs, + is_left ? rct->ymin + tab_v_pad_text : rct->ymax - tab_v_pad_text, + 0.0f); BLF_color3ubv(fontid, is_active ? theme_col_text_hi : theme_col_text); BLF_draw(fontid, category_id_draw, category_draw_len); -- 2.30.2