summaryrefslogtreecommitdiff
path: root/scene/gui/option_button.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/gui/option_button.cpp')
-rw-r--r--scene/gui/option_button.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/scene/gui/option_button.cpp b/scene/gui/option_button.cpp
index 931dffe3bb..881acdbf3a 100644
--- a/scene/gui/option_button.cpp
+++ b/scene/gui/option_button.cpp
@@ -198,6 +198,11 @@ void OptionButton::_selected(int p_which) {
}
void OptionButton::pressed() {
+ if (popup->is_visible()) {
+ popup->hide();
+ return;
+ }
+
Size2 size = get_size() * get_viewport()->get_canvas_transform().get_scale();
popup->set_position(get_screen_position() + Size2(0, size.height * get_global_transform().get_scale().y));
popup->set_size(Size2(size.width, 0));