File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -85,6 +85,16 @@ void MenuButton::show_popup() {
8585 Transform2D xform = get_viewport ()->get_popup_base_transform_native ();
8686 rect = xform.xform (rect);
8787 }
88+ Rect2i scr_usable = DisplayServer::get_singleton ()->screen_get_usable_rect (get_window ()->get_current_screen ());
89+ Size2i max_size;
90+ if (scr_usable.has_area ()) {
91+ real_t max_h = scr_usable.get_end ().y - rect.position .y ;
92+ real_t max_w = scr_usable.get_end ().x - rect.position .x ;
93+ if (max_h >= 4 * rect.size .height && max_w >= rect.size .width ) {
94+ max_size = Size2i (max_w, max_h);
95+ }
96+ }
97+ popup->set_max_size (max_size);
8898 rect.size .height = 0 ;
8999 popup->set_size (rect.size );
90100 if (is_layout_rtl ()) {
Original file line number Diff line number Diff line change @@ -3230,6 +3230,10 @@ void PopupMenu::_pre_popup() {
32303230 set_content_scale_factor (popup_scale);
32313231 Size2 minsize = get_contents_minimum_size () * popup_scale;
32323232 minsize.height = Math::ceil (minsize.height ); // Ensures enough height at fractional content scales to prevent the v_scroll_bar from showing.
3233+ real_t max_h = get_max_size ().height ;
3234+ if (max_h > 0 ) {
3235+ minsize.height = MIN (minsize.height , max_h);
3236+ }
32333237 set_min_size (minsize); // `height` is truncated here by the cast to Size2i for Window.min_size.
32343238 reset_size (); // Shrinkwraps to min size.
32353239}
You can’t perform that action at this time.
0 commit comments