From a99fdbd21014dd57a4f8f7448f6ab8f19b6af737 Mon Sep 17 00:00:00 2001 From: scgm0 <2682963017@qq.com> Date: Fri, 31 Oct 2025 18:20:58 +0800 Subject: [PATCH] Fix `PopupMenu` is clipped --- scene/gui/menu_button.cpp | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp index eb2e30ad0de..0b292dfe5f0 100644 --- a/scene/gui/menu_button.cpp +++ b/scene/gui/menu_button.cpp @@ -89,14 +89,11 @@ void MenuButton::show_popup() { Size2i max_size; if (scr_usable.has_area()) { real_t max_h = scr_usable.get_end().y - rect.position.y; - real_t max_w = scr_usable.get_end().x - rect.position.x; - if (max_h >= 4 * rect.size.height && max_w >= rect.size.width) { - max_size = Size2i(max_w, max_h); + if (max_h >= 4 * rect.size.height) { + max_size = Size2(RS::get_singleton()->get_maximum_viewport_size().width, max_h); } } popup->set_max_size(max_size); - rect.size.height = 0; - popup->set_size(rect.size); if (is_layout_rtl()) { rect.position.x += rect.size.width - popup->get_size().width; }