summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2022-03-10 14:11:14 +0100
committerGitHub <noreply@github.com>2022-03-10 14:11:14 +0100
commit0a8f8b0e0869c70490acc205524d92fc657203d0 (patch)
treea39eac3d94e973987df76e1cb88e7fdd9d226b3a
parent9b597364737cbc04ccb5ee8e5c18bccb4dd31362 (diff)
parent862a88e9060c247ca48dd3c94786bbb8303f0876 (diff)
Merge pull request #58981 from EricEzaM/improvement/popup-menu-even-spacing
-rw-r--r--editor/editor_themes.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/editor/editor_themes.cpp b/editor/editor_themes.cpp
index 01757dd332..7eceebb38b 100644
--- a/editor/editor_themes.cpp
+++ b/editor/editor_themes.cpp
@@ -831,7 +831,12 @@ Ref<Theme> create_editor_theme(const Ref<Theme> p_theme) {
theme->set_icon("visibility_visible", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityVisible"), SNAME("EditorIcons")));
theme->set_icon("visibility_xray", "PopupMenu", theme->get_icon(SNAME("GuiVisibilityXray"), SNAME("EditorIcons")));
- theme->set_constant("vseparation", "PopupMenu", (extra_spacing + default_margin_size + 1) * EDSCALE);
+ // Force the vseparation 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);
+ theme->set_constant("vseparation", "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);