diff options
Diffstat (limited to 'source/blender/editors/screen/area.c')
-rw-r--r-- | source/blender/editors/screen/area.c | 27 |
1 files changed, 17 insertions, 10 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 833c9accf95..f0d5866aa7f 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2669,7 +2669,7 @@ static void ed_panel_draw(const bContext *C, bool open; panel = UI_panel_begin(region, lb, block, pt, panel, &open); - + const bool is_subpanel = (panel->type && panel->type->parent != NULL); const bool search_filter_active = search_filter != NULL && search_filter[0] != '\0'; /* bad fixed values */ @@ -2724,17 +2724,23 @@ static void ed_panel_draw(const bContext *C, UI_block_apply_search_filter(block, search_filter); UI_block_layout_resolve(block, &xco, &yco); - panel->labelofs = xco - labelx; panel->layout = NULL; } - else { - panel->labelofs = 0; - } + + panel->labelofs = UI_PANEL_LABEL_OFFSET; UI_panel_header_buttons_end(panel); if (open || search_filter_active) { short panelContext; + /* Extra offset and panel width adjustment to accomodate sides margin (style->panelouter). */ + const int wofs = (pt->flag & PANEL_TYPE_NO_HEADER) ? style->panelouter : 0; + int xofs = (pt->flag & PANEL_TYPE_NO_HEADER) ? 0 : style->panelouter; + + if (is_subpanel) { + xofs += style->panelouter; + } + /* panel context can either be toolbar region or normal panels region */ if (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) { panelContext = UI_LAYOUT_VERT_BAR; @@ -2750,9 +2756,9 @@ static void ed_panel_draw(const bContext *C, block, UI_LAYOUT_VERTICAL, panelContext, - (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : style->panelspace, + (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : style->panelspace + xofs, 0, - (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : w - 2 * style->panelspace, + (pt->flag & PANEL_TYPE_LAYOUT_VERT_BAR) ? 0 : (w - 2 * style->panelspace + wofs - xofs), em, 0, style); @@ -2782,7 +2788,7 @@ static void ed_panel_draw(const bContext *C, &panel->children, child_pt, child_panel, - w, + w - style->panelouter, em, unique_panel_str, search_filter); @@ -2892,12 +2898,13 @@ void ED_region_panels_layout_ex(const bContext *C, ScrArea *area = CTX_wm_area(C); View2D *v2d = ®ion->v2d; + const uiStyle *style = UI_style_get_dpi(); bool use_category_tabs = (category_override == NULL) && region_uses_category_tabs(area, region); /* offset panels for small vertical tab area */ const char *category = NULL; const int category_tabs_width = UI_PANEL_CATEGORY_MARGIN_WIDTH; - int margin_x = 0; + int margin_x = style->panelouter; const bool region_layout_based = region->flag & RGN_FLAG_DYNAMIC_SIZE; bool update_tot_size = true; @@ -2912,7 +2919,7 @@ void ED_region_panels_layout_ex(const bContext *C, category = region_panels_collect_categories(region, panel_types_stack, &use_category_tabs); } if (use_category_tabs) { - margin_x = category_tabs_width; + margin_x = category_tabs_width + style->panelouter; } const int w = BLI_rctf_size_x(&v2d->cur) - margin_x; |