From 5a11c6e558c6581cc07d2a1d67db460241255f09 Mon Sep 17 00:00:00 2001 From: Julian Eisel Date: Thu, 25 Nov 2021 17:15:48 +0100 Subject: Fix missing margin below panels A minor cosmetic fix. When the view was scrolled all the way to the bottom, the lowest panel would end right on the view edge. The scrollable view should get the same margin at the bottom as used at the top. --- source/blender/editors/interface/interface_panel.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index d1daf5b48bf..06edf46fab7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1827,6 +1827,7 @@ static void ui_panels_size(ARegion *region, int *r_x, int *r_y) { int sizex = 0; int sizey = 0; + bool has_panel_with_background = false; /* Compute size taken up by panels, for setting in view2d. */ LISTBASE_FOREACH (Panel *, panel, ®ion->panels) { @@ -1836,6 +1837,9 @@ static void ui_panels_size(ARegion *region, int *r_x, int *r_y) sizex = max_ii(sizex, pa_sizex); sizey = min_ii(sizey, pa_sizey); + if (UI_panel_should_show_background(region, panel->type)) { + has_panel_with_background = true; + } } } @@ -1845,6 +1849,11 @@ static void ui_panels_size(ARegion *region, int *r_x, int *r_y) if (sizey == 0) { sizey = -UI_PANEL_WIDTH; } + /* Extra margin after the list so the view scrolls a few pixels further than the panel border. + * Also makes the bottom match the top margin. */ + if (has_panel_with_background) { + sizey -= UI_PANEL_MARGIN_Y; + } *r_x = sizex; *r_y = sizey; -- cgit v1.2.3