You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-23 15:16:17 +00:00
Make Menu/OptionButton item auto-highlight behave better
(cherry picked from commit 50506e19a6)
This commit is contained in:
committed by
Rémi Verschelde
parent
5c9ced191b
commit
4744a8a1a9
@@ -29,7 +29,6 @@
|
||||
/*************************************************************************/
|
||||
|
||||
#include "menu_button.h"
|
||||
#include "core/os/input.h"
|
||||
#include "core/os/keyboard.h"
|
||||
#include "scene/main/viewport.h"
|
||||
|
||||
@@ -64,9 +63,7 @@ void MenuButton::pressed() {
|
||||
popup->set_parent_rect(Rect2(Point2(gp - popup->get_global_position()), get_size()));
|
||||
|
||||
// If not triggered by the mouse, start the popup with its first item selected.
|
||||
if (popup->get_item_count() > 0 &&
|
||||
((get_action_mode() == ActionMode::ACTION_MODE_BUTTON_PRESS && Input::get_singleton()->is_action_just_pressed("ui_accept")) ||
|
||||
(get_action_mode() == ActionMode::ACTION_MODE_BUTTON_RELEASE && Input::get_singleton()->is_action_just_released("ui_accept")))) {
|
||||
if (popup->get_item_count() > 0 && !_was_pressed_by_mouse()) {
|
||||
popup->set_current_index(0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user