summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Locurcio <hugo.locurcio@hugo.pro>2021-11-29 19:59:12 +0100
committerHugo Locurcio <hugo.locurcio@hugo.pro>2022-08-05 11:29:12 +0200
commit3dab891691c4e33588512e54ae2fafd66d574883 (patch)
tree63fe1b5c76f30913ffbc55cc5ef62d8bd7ea99d0
parent44d3c8402ebc0d1e77936dbf909a1ddcb48ab193 (diff)
Tweak PopupMenu item spacing in the editor theme
- Increase spacing between items for easier clicking with the mouse. - Increase lateral margins for better visual appearance. - Decrease margin at the top and bottom to compensate for the increased per-item height.
-rw-r--r--editor/editor_themes.cpp21
1 files changed, 10 insertions, 11 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index d188871f59..a3086a2ccf 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -901,17 +901,16 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_stylebox("panel", "PopupDialog", style_popup);
// PopupMenu
- const int popup_menu_margin_size = default_margin_size * 1.5 * EDSCALE;
Ref<StyleBoxFlat> style_popup_menu = style_popup->duplicate();
// Use 1 pixel for the sides, since if 0 is used, the highlight of hovered items is drawn
// on top of the popup border. This causes a 'gap' in the panel border when an item is highlighted,
// and it looks weird. 1px solves this.
- style_popup_menu->set_default_margin(SIDE_LEFT, 1 * EDSCALE);
- style_popup_menu->set_default_margin(SIDE_TOP, popup_menu_margin_size);
- style_popup_menu->set_default_margin(SIDE_RIGHT, 1 * EDSCALE);
- style_popup_menu->set_default_margin(SIDE_BOTTOM, popup_menu_margin_size);
+ style_popup_menu->set_default_margin(SIDE_LEFT, EDSCALE);
+ style_popup_menu->set_default_margin(SIDE_TOP, 2 * EDSCALE);
+ style_popup_menu->set_default_margin(SIDE_RIGHT, EDSCALE);
+ style_popup_menu->set_default_margin(SIDE_BOTTOM, 2 * EDSCALE);
// Always display a border for PopupMenus so they can be distinguished from their background.
- style_popup_menu->set_border_width_all(1 * EDSCALE);
+ style_popup_menu->set_border_width_all(EDSCALE);
style_popup_menu->set_border_color(dark_color_2);
theme->set_stylebox("panel", "PopupMenu", style_popup_menu);
@@ -945,12 +944,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
// Force the v_separation to be even so that the spacing on top and bottom is even.
// If the vsep is odd and cannot be split into 2 even groups (of pixels), then it will be lopsided.
- // We add 2 to the vsep to give it some extra spacing which looks a bit more modern (see Windows, for example)
- int vsep_base = extra_spacing + default_margin_size + 2;
- int force_even_vsep = vsep_base + (vsep_base % 2);
+ // We add 2 to the vsep to give it some extra spacing which looks a bit more modern (see Windows, for example).
+ const int vsep_base = extra_spacing + default_margin_size + 6;
+ const int force_even_vsep = vsep_base + (vsep_base % 2);
theme->set_constant("v_separation", "PopupMenu", force_even_vsep * EDSCALE);
- theme->set_constant("item_start_padding", "PopupMenu", popup_menu_margin_size * EDSCALE);
- theme->set_constant("item_end_padding", "PopupMenu", popup_menu_margin_size * EDSCALE);
+ theme->set_constant("item_start_padding", "PopupMenu", default_margin_size * 1.5 * EDSCALE);
+ theme->set_constant("item_end_padding", "PopupMenu", default_margin_size * 1.5 * EDSCALE);
// Sub-inspectors
for (int i = 0; i < 16; i++) {