From a9642f8d613078b285db4b04efb8bf8e5a234fbb Mon Sep 17 00:00:00 2001 From: Leon Leno Date: Wed, 24 Nov 2021 21:04:29 +0100 Subject: UI: Improve scaling of widgets when zooming This commit improves the scaling of some ui widgets when zooming by making the radius of the rounded corners dependent on the element's zoom level. Needed to fix T92278 without padding issues, see D13125. Reviewed By: Hans Goudey, Julian Eisel Differential Revision: https://developer.blender.org/D12842 --- source/blender/editors/interface/interface_panel.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'source/blender/editors/interface/interface_panel.c') diff --git a/source/blender/editors/interface/interface_panel.c b/source/blender/editors/interface/interface_panel.c index 3a8e06a3e49..6aa4c5bb4a7 100644 --- a/source/blender/editors/interface/interface_panel.c +++ b/source/blender/editors/interface/interface_panel.c @@ -1122,7 +1122,8 @@ static void panel_draw_highlight_border(const Panel *panel, } const bTheme *btheme = UI_GetTheme(); - const float radius = btheme->tui.panel_roundness * U.widget_unit * 0.5f; + const float aspect = panel->runtime.block->aspect; + const float radius = (btheme->tui.panel_roundness * U.widget_unit * 0.5f) / aspect; UI_draw_roundbox_corner_set(UI_CNR_ALL); float color[4]; @@ -1245,7 +1246,8 @@ static void panel_draw_aligned_backdrop(const Panel *panel, } const bTheme *btheme = UI_GetTheme(); - const float radius = btheme->tui.panel_roundness * U.widget_unit * 0.5f; + const float aspect = panel->runtime.block->aspect; + const float radius = btheme->tui.panel_roundness * U.widget_unit * 0.5f / aspect; immBindBuiltinProgram(GPU_SHADER_2D_UNIFORM_COLOR); GPU_blend(GPU_BLEND_ALPHA); -- cgit v1.2.3