X Tutup
Skip to content

Fix MenuButton's PopupMenu is clipped#112239

Merged
Repiteo merged 1 commit intogodotengine:masterfrom
scgm0:Fix-`PopupMenu`-is-clipped
Oct 31, 2025
Merged

Fix MenuButton's PopupMenu is clipped#112239
Repiteo merged 1 commit intogodotengine:masterfrom
scgm0:Fix-`PopupMenu`-is-clipped

Conversation

@scgm0
Copy link
Contributor

@scgm0 scgm0 commented Oct 31, 2025

Fix #112218

@scgm0 scgm0 requested a review from a team as a code owner October 31, 2025 10:21
@scgm0 scgm0 changed the title Fix PopupMenu is clipped Fix MenuButton's PopupMenu is clipped Oct 31, 2025
@AThousandShips AThousandShips added this to the 4.6 milestone Oct 31, 2025
@KoBeWi
Copy link
Member

KoBeWi commented Oct 31, 2025

This just reverts #109981
It's not a correct fix.

@bruvzg
Copy link
Member

bruvzg commented Oct 31, 2025

Ah, I completely forgot about this change, probably should just remove unneeded x part of it.

diff --git a/scene/gui/menu_button.cpp b/scene/gui/menu_button.cpp
index eb2e30ad0d..a8bb6dc250 100644
--- a/scene/gui/menu_button.cpp
+++ b/scene/gui/menu_button.cpp
@@ -89,9 +89,8 @@ 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 = Size2i(RS::get_singleton()->get_maximum_viewport_size().x, max_h);
                }
        }
        popup->set_max_size(max_size);

@bruvzg
Copy link
Member

bruvzg commented Oct 31, 2025

Note: edited last comment, since 0 is not working in max_size, so width should be set to real max size. Both scrolling and size seems to be working.

@scgm0 scgm0 force-pushed the Fix-`PopupMenu`-is-clipped branch from 91605f7 to a99fdbd Compare October 31, 2025 11:15
@Repiteo Repiteo merged commit 35928c5 into godotengine:master Oct 31, 2025
20 checks passed
@Repiteo
Copy link
Contributor

Repiteo commented Oct 31, 2025

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PopupMenu is clipped

5 participants

X Tutup