Support controller input on popup/dialogs
This commit is contained in:
parent
7ba79d68bd
commit
f0927250ca
|
@ -38,8 +38,7 @@
|
||||||
// AcceptDialog
|
// AcceptDialog
|
||||||
|
|
||||||
void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) {
|
void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventKey> key = p_event;
|
if (close_on_escape && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
|
||||||
if (close_on_escape && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) {
|
|
||||||
_cancel_pressed();
|
_cancel_pressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -35,8 +35,7 @@
|
||||||
#include "scene/gui/panel.h"
|
#include "scene/gui/panel.h"
|
||||||
|
|
||||||
void Popup::_input_from_window(const Ref<InputEvent> &p_event) {
|
void Popup::_input_from_window(const Ref<InputEvent> &p_event) {
|
||||||
Ref<InputEventKey> key = p_event;
|
if (get_flag(FLAG_POPUP) && p_event->is_action_pressed(SNAME("ui_cancel"), false, true)) {
|
||||||
if (get_flag(FLAG_POPUP) && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) {
|
|
||||||
_close_pressed();
|
_close_pressed();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue