Merge pull request #30926 from NilsIrl/if_to_switch
Change if to switch in OptionButton
This commit is contained in:
commit
a19c15d105
1 changed files with 31 additions and 28 deletions
|
@ -43,7 +43,8 @@ Size2 OptionButton::get_minimum_size() const {
|
|||
|
||||
void OptionButton::_notification(int p_what) {
|
||||
|
||||
if (p_what == NOTIFICATION_DRAW) {
|
||||
switch (p_what) {
|
||||
case NOTIFICATION_DRAW: {
|
||||
|
||||
if (!has_icon("arrow"))
|
||||
return;
|
||||
|
@ -72,11 +73,13 @@ 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) {
|
||||
} break;
|
||||
case NOTIFICATION_VISIBILITY_CHANGED: {
|
||||
|
||||
if (!is_visible_in_tree()) {
|
||||
popup->hide();
|
||||
}
|
||||
} break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue