Hide MenuButton / OptionButton popup on click if it's already visible.

This commit is contained in:
bruvzg
2022-08-23 10:38:51 +03:00
parent b9919fd87d
commit cd095ab64a
3 changed files with 16 additions and 5 deletions

View File

@ -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));