More changes to PopupMenu's submenu keyboard handling.
This commit is contained in:
parent
1e2a8132f3
commit
7e38db631f
1 changed files with 25 additions and 10 deletions
|
@ -211,11 +211,6 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
mouse_over = i;
|
||||
update();
|
||||
|
||||
if (items[i].submenu != "" && submenu_over != i) {
|
||||
submenu_over = i;
|
||||
submenu_timer->start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -231,20 +226,40 @@ void PopupMenu::_gui_input(const Ref<InputEvent> &p_event) {
|
|||
|
||||
mouse_over = i;
|
||||
update();
|
||||
|
||||
if (items[i].submenu != "" && submenu_over != i) {
|
||||
submenu_over = i;
|
||||
submenu_timer->start();
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
} break;
|
||||
|
||||
case KEY_LEFT: {
|
||||
|
||||
Node *n = get_parent();
|
||||
if (!n)
|
||||
break;
|
||||
|
||||
PopupMenu *pm = Object::cast_to<PopupMenu>(n);
|
||||
if (!pm)
|
||||
break;
|
||||
|
||||
hide();
|
||||
} break;
|
||||
|
||||
case KEY_RIGHT: {
|
||||
|
||||
if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator && items[mouse_over].submenu != "" && submenu_over != mouse_over)
|
||||
_activate_submenu(mouse_over);
|
||||
} break;
|
||||
|
||||
case KEY_ENTER:
|
||||
case KEY_KP_ENTER: {
|
||||
|
||||
if (mouse_over >= 0 && mouse_over < items.size() && !items[mouse_over].separator) {
|
||||
|
||||
if (items[mouse_over].submenu != "" && submenu_over != mouse_over) {
|
||||
_activate_submenu(mouse_over);
|
||||
break;
|
||||
}
|
||||
|
||||
activate_item(mouse_over);
|
||||
}
|
||||
} break;
|
||||
|
|
Loading…
Reference in a new issue