diff options
author | Julian Eisel <julian@blender.org> | 2021-11-25 18:53:44 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-25 19:09:45 +0300 |
commit | 5514ca58a4d4e03d9062bc479488faca7e577677 (patch) | |
tree | 7d3996161a38020c78d2f2bd198d42d8c1c976a9 /source/blender/editors/screen | |
parent | 94e8db1e869d8209599f1a40b0e1a25c056d077a (diff) |
Fix T92313: Heading of redo panel is not aligned properly
This corrects some alignments issues through new margins introduced in
93544b641bd6. Basic idea of this fix is to only add the new margins when
drawing a panel with background. These margins were added specifically
for the background boxes, so that makes sense.
Alternative fix to D13199.
This also fixes some margings added unintentionally in mentioned commit.
There is a little jump of the toolbar and the tabs in the Properties
when comparing the UI without this fix to 2.93:
{F12158085} {F12158039}
The jump is gone with this fix applied (compare to the 2.93 screenshot):
{F12158064}
While not a serious issue, this confirms that this fix actually tackles
the root of the issue.
Diffstat (limited to 'source/blender/editors/screen')
-rw-r--r-- | source/blender/editors/screen/area.c | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/source/blender/editors/screen/area.c b/source/blender/editors/screen/area.c index 80c14371c16..fc839d5cd63 100644 --- a/source/blender/editors/screen/area.c +++ b/source/blender/editors/screen/area.c @@ -2934,6 +2934,16 @@ static const char *region_panels_collect_categories(ARegion *region, return NULL; } +static int panel_draw_width_from_max_width_get(const ARegion *region, + const PanelType *panel_type, + const int max_width) +{ + /* With a background, we want some extra padding. */ + return UI_panel_should_show_background(region, panel_type) ? + max_width - UI_PANEL_MARGIN_X * 2.0f : + max_width; +} + /** * \param contexts: A NULL terminated array of context strings to match against. * Matching against any of these strings will draw the panel. @@ -2982,7 +2992,6 @@ void ED_region_panels_layout_ex(const bContext *C, } const int width_no_header = BLI_rctf_size_x(&v2d->cur) - margin_x; - const int width = width_no_header - UI_PANEL_MARGIN_X * 2.0f; /* Works out to 10 * UI_UNIT_X or 20 * UI_UNIT_X. */ const int em = (region->type->prefsizex) ? 10 : 20; @@ -3010,6 +3019,7 @@ void ED_region_panels_layout_ex(const bContext *C, continue; } } + const int width = panel_draw_width_from_max_width_get(region, pt, width_no_header); if (panel && UI_panel_is_dragging(panel)) { /* Prevent View2d.tot rectangle size changes while dragging panels. */ @@ -3040,6 +3050,7 @@ void ED_region_panels_layout_ex(const bContext *C, !STREQ(category, panel->type->category)) { continue; } + const int width = panel_draw_width_from_max_width_get(region, panel->type, width_no_header); if (panel && UI_panel_is_dragging(panel)) { /* Prevent View2d.tot rectangle size changes while dragging panels. */ |