Merge pull request #91114 from Koyper/fix_popup_menu_incorrect_v_scrollbar
[PopupMenu] Fix incorrect vertical scroll bar visible at fractional content scale
This commit is contained in:
commit
43d7346b5a
1 changed files with 4 additions and 3 deletions
|
@ -276,6 +276,7 @@ Size2 PopupMenu::_get_contents_minimum_size() const {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
minsize.height = Math::ceil(minsize.height); // Ensures enough height at fractional content scales to prevent the v_scroll_bar from showing.
|
||||||
return minsize;
|
return minsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2832,9 +2833,9 @@ void PopupMenu::popup(const Rect2i &p_bounds) {
|
||||||
if (!is_embedded()) {
|
if (!is_embedded()) {
|
||||||
float win_scale = get_parent_visible_window()->get_content_scale_factor();
|
float win_scale = get_parent_visible_window()->get_content_scale_factor();
|
||||||
set_content_scale_factor(win_scale);
|
set_content_scale_factor(win_scale);
|
||||||
Size2 minsize = get_contents_minimum_size();
|
Size2 minsize = get_contents_minimum_size() * win_scale;
|
||||||
minsize.height += 0.5 * win_scale; // Ensures enough height at fractional content scales to prevent the v_scroll_bar from showing.
|
minsize.height = Math::ceil(minsize.height); // Ensures enough height at fractional content scales to prevent the v_scroll_bar from showing.
|
||||||
set_min_size(minsize * win_scale);
|
set_min_size(minsize); // `height` is truncated here by the cast to Size2i for Window.min_size.
|
||||||
set_size(Vector2(0, 0)); // Shrinkwraps to min size.
|
set_size(Vector2(0, 0)); // Shrinkwraps to min size.
|
||||||
}
|
}
|
||||||
Popup::popup(p_bounds);
|
Popup::popup(p_bounds);
|
||||||
|
|
Loading…
Reference in a new issue