diff options
author | Leon Leno <lone_noel> | 2021-11-24 23:04:29 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2021-11-24 23:06:32 +0300 |
commit | a9642f8d613078b285db4b04efb8bf8e5a234fbb (patch) | |
tree | 424f5c6901aa58592369ceb8d00f28aa413c0339 /source/blender/editors/interface/interface_panel.c | |
parent | 752c6d668bcb9a6b357734f7e124a6b605ac9d9b (diff) |
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
Diffstat (limited to 'source/blender/editors/interface/interface_panel.c')
-rw-r--r-- | source/blender/editors/interface/interface_panel.c | 6 |
1 files changed, 4 insertions, 2 deletions
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); |