From 034e123c1da781fee9533a98aa30d0f202877b4a Mon Sep 17 00:00:00 2001 From: Nathan Franke Date: Tue, 1 Sep 2020 16:17:46 -0500 Subject: [PATCH] Fix PopupMenu unresponsive on right side of menu --- scene/gui/popup_menu.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/scene/gui/popup_menu.cpp b/scene/gui/popup_menu.cpp index 40bcc243d180..c9022e98441c 100644 --- a/scene/gui/popup_menu.cpp +++ b/scene/gui/popup_menu.cpp @@ -282,14 +282,15 @@ void PopupMenu::_gui_input(const Ref &p_event) { } // Make an area which does not include v scrollbar, so that items are not activated when dragging scrollbar. - Rect2 item_clickable_area = control->get_global_rect(); - float scroll_width = scroll_container->get_v_scrollbar()->is_visible_in_tree() ? scroll_container->get_v_scrollbar()->get_size().width : 0; - item_clickable_area.set_size(Size2(item_clickable_area.size.width - scroll_width, item_clickable_area.size.height)); + Rect2 item_clickable_area = scroll_container->get_rect(); + if (scroll_container->get_v_scrollbar()->is_visible_in_tree()) { + item_clickable_area.size.width -= scroll_container->get_v_scrollbar()->get_size().width; + } Ref b = p_event; if (b.is_valid()) { - if (!item_clickable_area.has_point(b->get_global_position())) { + if (!item_clickable_area.has_point(b->get_position())) { return; } @@ -331,7 +332,7 @@ void PopupMenu::_gui_input(const Ref &p_event) { Ref m = p_event; if (m.is_valid()) { - if (!item_clickable_area.has_point(m->get_global_position())) { + if (!item_clickable_area.has_point(m->get_position())) { return; }