From 25fd1159571f808826523fb7f38c092bb49fe9bf Mon Sep 17 00:00:00 2001 From: scgm0 <2682963017@qq.com> Date: Tue, 21 Jan 2025 21:37:19 +0800 Subject: [PATCH] Fix OptionButton::show_popup --- scene/gui/option_button.cpp | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp index a3e30f54139..272e02d7ba2 100644 --- a/scene/gui/option_button.cpp +++ b/scene/gui/option_button.cpp @@ -468,12 +468,6 @@ void OptionButton::show_popup() { return; } - Rect2 rect = get_screen_rect(); - rect.position.y += rect.size.height; - rect.size.height = 0; - popup->set_position(rect.position); - popup->set_size(rect.size); - // If not triggered by the mouse, start the popup with the checked item (or the first enabled one) focused. if (current != NONE_SELECTED && !popup->is_item_disabled(current)) { if (!_was_pressed_by_mouse()) { @@ -495,7 +489,10 @@ void OptionButton::show_popup() { } } - popup->popup(); + Rect2 rect = get_screen_rect(); + rect.position.y += rect.size.height; + rect.size.height = 0; + popup->popup(rect); } void OptionButton::_validate_property(PropertyInfo &p_property) const {