Use defined key mapping for closing popups and dialogs

As opposed to hardcoding the escape key. Also removed such hardcoding in a few other places as well as a hardcoded enter key in one of the affected input fields.

(cherry picked from commit 8ab2cf3d2d)
This commit is contained in:
Arman Elgudzhyan
2023-06-29 16:03:22 +02:00
committed by Yuri Sizov
parent fcafb674af
commit 88475cfba9
7 changed files with 26 additions and 66 deletions

View File

@@ -39,7 +39,7 @@
void AcceptDialog::_input_from_window(const Ref<InputEvent> &p_event) {
Ref<InputEventKey> key = p_event;
if (close_on_escape && key.is_valid() && key->is_pressed() && key->get_keycode() == Key::ESCAPE) {
if (close_on_escape && key.is_valid() && key->is_action_pressed(SNAME("ui_cancel"), false, true)) {
_cancel_pressed();
}
}