From db8d381f7159aefa3fe076f66a61caac1a1ea476 Mon Sep 17 00:00:00 2001 From: Jacques Lucke Date: Fri, 22 Dec 2023 22:14:06 +0100 Subject: [PATCH] Fix: layout panels headers don't take block width into account Found while working on #116472. --- source/blender/editors/interface/interface_layout.cc | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/interface/interface_layout.cc b/source/blender/editors/interface/interface_layout.cc index 53ea6eaad01..cf2e9a58a22 100644 --- a/source/blender/editors/interface/interface_layout.cc +++ b/source/blender/editors/interface/interface_layout.cc @@ -4206,7 +4206,7 @@ static void ui_litem_layout_panel_header(uiLayout *litem) int w, h; ui_item_size(item, &w, &h); litem->y -= h; - ui_item_position(item, litem->x, litem->y, w, h); + ui_item_position(item, litem->x, litem->y, litem->w, h); panel->runtime->layout_panels.headers.append({float(litem->y), float(litem->y + litem->h), @@ -4993,14 +4993,16 @@ uiLayout *uiLayoutPanel(const bContext *C, UI_block_layout_set_current(layout->root->block, litem); uiBlock *block = uiLayoutGetBlock(layout); + const int icon = is_open ? ICON_DOWNARROW_HLT : ICON_RIGHTARROW; + const int width = ui_text_icon_width(layout, name, icon, false); uiDefIconTextBut(block, UI_BTYPE_LABEL, 0, - is_open ? ICON_DOWNARROW_HLT : ICON_RIGHTARROW, - IFACE_(name), + icon, + name, 0, 0, - UI_UNIT_X * 4, + width, UI_UNIT_Y * 1.2f, nullptr, 0.0,