Merge pull request #64960 from YeldhamDev/more_hl_stuff
This commit is contained in:
@ -216,9 +216,14 @@ void PopupMenu::_activate_submenu(int p_over, bool p_by_keyboard) {
|
||||
|
||||
submenu_pum->activated_by_keyboard = p_by_keyboard;
|
||||
|
||||
// If not triggered by the mouse, start the popup with its first item selected.
|
||||
if (submenu_pum->get_item_count() > 0 && p_by_keyboard) {
|
||||
submenu_pum->set_current_index(0);
|
||||
// If not triggered by the mouse, start the popup with its first enabled item focused.
|
||||
if (p_by_keyboard) {
|
||||
for (int i = 0; i < submenu_pum->get_item_count(); i++) {
|
||||
if (!submenu_pum->is_item_disabled(i)) {
|
||||
submenu_pum->set_current_index(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
submenu_pum->popup();
|
||||
@ -1534,14 +1539,19 @@ bool PopupMenu::is_item_shortcut_disabled(int p_idx) const {
|
||||
}
|
||||
|
||||
void PopupMenu::set_current_index(int p_idx) {
|
||||
ERR_FAIL_INDEX(p_idx, items.size());
|
||||
if (p_idx != -1) {
|
||||
ERR_FAIL_INDEX(p_idx, items.size());
|
||||
}
|
||||
|
||||
if (mouse_over == p_idx) {
|
||||
return;
|
||||
}
|
||||
|
||||
mouse_over = p_idx;
|
||||
scroll_to_item(mouse_over);
|
||||
if (mouse_over != -1) {
|
||||
scroll_to_item(mouse_over);
|
||||
}
|
||||
|
||||
control->update();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user