diff options
Diffstat (limited to 'scene/gui/menu_button.cpp')
-rw-r--r-- | scene/gui/menu_button.cpp | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index 737ba84617..ceb2092e3a 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -87,15 +87,17 @@ void MenuButton::_popup_visibility_changed(bool p_visible) { void MenuButton::pressed() { emit_signal(SNAME("about_to_popup")); - Size2 size = get_size(); + Size2 size = get_size() * get_viewport()->get_canvas_transform().get_scale(); + popup->set_size(Size2(size.width, 0)); Point2 gp = get_screen_position(); - gp.y += get_size().y; - + gp.y += size.y; + if (is_layout_rtl()) { + gp.x += size.width - popup->get_size().width; + } popup->set_position(gp); + popup->set_parent_rect(Rect2(Point2(gp - popup->get_position()), size)); - popup->set_size(Size2(size.width, 0)); - popup->set_parent_rect(Rect2(Point2(gp - popup->get_position()), get_size())); popup->take_mouse_focus(); popup->popup(); } |