From 8228d647a9a5a3dd36bad508ebb3746432d3d1fc Mon Sep 17 00:00:00 2001 From: kleonc <9283098+kleonc@users.noreply.github.com> Date: Thu, 6 Jun 2024 16:46:13 +0200 Subject: [PATCH] Fix MenuBar popup placement assuming it's in viewport default canvas --- scene/gui/menu_bar.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/scene/gui/menu_bar.cpp b/scene/gui/menu_bar.cpp index 2ce12794a78..c8b022d622d 100644 --- a/scene/gui/menu_bar.cpp +++ b/scene/gui/menu_bar.cpp @@ -121,8 +121,9 @@ void MenuBar::_open_popup(int p_index, bool p_focus_item) { } Rect2 item_rect = _get_menu_item_rect(p_index); - Point2 screen_pos = get_screen_position() + item_rect.position * get_viewport()->get_canvas_transform().get_scale(); - Size2 screen_size = item_rect.size * get_viewport()->get_canvas_transform().get_scale(); + Size2 canvas_scale = get_canvas_transform().get_scale(); + Point2 screen_pos = get_screen_position() + item_rect.position * canvas_scale; + Size2 screen_size = item_rect.size * canvas_scale; active_menu = p_index;