diff options
author | Pablo Vazquez <pablovazquez> | 2021-10-13 15:28:55 +0300 |
---|---|---|
committer | Pablo Vazquez <pablo@blender.org> | 2021-10-13 15:31:03 +0300 |
commit | 518365395152e516af235366f4be908a40343b87 (patch) | |
tree | 8f4a6a44c16889b2c11a736e45e0dafcd3c4dd55 /source | |
parent | 72e81a45c4ce3963a5aa929adb00d762db7e07ef (diff) |
UI: Make menu item use theme roundness
Menu items ignore the roundness setting since they spread left to right.
This patch makes it so menu items use the theme preference instead of
hardcoded square corners. Providing more flexibility to themes.
All built-in and included themes already have this set so no need to update them. For the default themes (Dark/Light) roundness is 0.4.
{F10950727, size=full}
The motivations behind this change are:
* To be more consistent with other widgets.
* Improve themes flexibility.
* Match padding with other elements that have like the Search field:
{F10950746, size=full}
Reviewed By: #user_interface, Severin
Differential Revision: https://developer.blender.org/D12813
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/editors/interface/interface_widgets.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/source/blender/editors/interface/interface_widgets.c b/source/blender/editors/interface/interface_widgets.c index a1534ab4b7f..6727d812e1e 100644 --- a/source/blender/editors/interface/interface_widgets.c +++ b/source/blender/editors/interface/interface_widgets.c @@ -4052,9 +4052,15 @@ static void widget_menu_itembut(uiWidgetColors *wcol, uiWidgetBase wtb; widget_init(&wtb); - /* not rounded, no outline */ + /* Padding on the sides. */ + const float padding = 0.125f * BLI_rcti_size_y(rect); + rect->xmin += padding; + rect->xmax -= padding; + + /* No outline. */ wtb.draw_outline = false; - round_box_edges(&wtb, 0, rect, 0.0f); + const float rad = wcol->roundness * BLI_rcti_size_y(rect); + round_box_edges(&wtb, UI_CNR_ALL, rect, rad); widgetbase_draw(&wtb, wcol); } |