PopupMenu: Update margins on visibility change

Fixes #96149.

Co-authored-by: Haoyu Qiu <timothyqiu32@gmail.com>
This commit is contained in:
Rémi Verschelde 2024-09-04 11:35:41 +02:00
parent 67d4b7346f
commit c84cf04e95
No known key found for this signature in database
GPG Key ID: C3336907360768E1

View File

@ -646,6 +646,8 @@ void PopupMenu::_notification(int p_what) {
case NOTIFICATION_POST_POPUP: {
initial_button_mask = Input::get_singleton()->get_mouse_button_mask();
during_grabbed_click = (bool)initial_button_mask;
} break;
case NOTIFICATION_VISIBILITY_CHANGED: {
// Set margin on the margin container
Ref<StyleBox> panel_style = get_stylebox("panel");
margin_container->add_constant_override("margin_top", panel_style->get_margin(Margin::MARGIN_TOP));