Fix popup visibility for OptionButton, MenuButton and ColorPickerButton

Hide popup when its button or another parent object is hidden

Fixes #26937
This commit is contained in:
Nikolay Neupokoev 2019-04-18 15:50:35 -07:00
parent f46899e922
commit ebe54833a9
4 changed files with 22 additions and 0 deletions

View file

@ -72,6 +72,11 @@ void OptionButton::_notification(int p_what) {
Point2 ofs(size.width - arrow->get_width() - get_constant("arrow_margin"), int(Math::abs((size.height - arrow->get_height()) / 2)));
arrow->draw(ci, ofs, clr);
} else if (p_what == NOTIFICATION_VISIBILITY_CHANGED) {
if (!is_visible_in_tree()) {
popup->hide();
}
}
}