From 2ebc4905fc7c7effe0cd65cb4d2046f67d622565 Mon Sep 17 00:00:00 2001 From: Michael Alexsander Date: Sat, 4 Jun 2022 02:51:22 -0300 Subject: [PATCH] Fix hover being drawn twice inside `PopupMenu`s --- scene/gui/popup_menu.cpp | 1 - scene/resources/default_theme/default_theme.cpp | 7 ++++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index a1c3fe791..7a424a9a2 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -571,7 +571,6 @@ void PopupMenu::_notification(int p_what) { } if (i == mouse_over) { - hover->draw(ci, Rect2(item_ofs + Point2(-hseparation, -vseparation / 2), Size2(get_size().width - style->get_minimum_size().width + hseparation * 2, h + vseparation))); hover->draw(ci, Rect2(item_ofs + Point2(0, -vseparation / 2), Size2(size.width - style->get_minimum_size().width, h + vseparation))); } diff --git a/scene/resources/default_theme/default_theme.cpp b/scene/resources/default_theme/default_theme.cpp index 161696822..8a0fa2b69 100644 --- a/scene/resources/default_theme/default_theme.cpp +++ b/scene/resources/default_theme/default_theme.cpp @@ -569,9 +569,10 @@ void fill_default_theme(Ref &theme, const Ref &default_font, const Ref style_pp = sb_expand(make_stylebox(popup_bg_png, 5, 5, 5, 5, 4, 4, 4, 4), 2, 2, 2, 2); Ref selected = make_stylebox(selection_png, 6, 6, 6, 6); - for (int i = 0; i < 4; i++) { - selected->set_expand_margin_size(Margin(i), 2 * scale); - } + selected->set_expand_margin_size(MARGIN_TOP, 2 * scale); + selected->set_expand_margin_size(MARGIN_BOTTOM, 2 * scale); + selected->set_expand_margin_size(MARGIN_LEFT, 6 * scale); + selected->set_expand_margin_size(MARGIN_RIGHT, 6 * scale); theme->set_stylebox("panel", "PopupPanel", style_pp);