Release pressed action if event is removed
(cherry picked from commit b7c612bd54
)
This commit is contained in:
parent
3b10458a5d
commit
00c631b13c
1 changed files with 6 additions and 1 deletions
|
@ -30,6 +30,7 @@
|
||||||
|
|
||||||
#include "input_map.h"
|
#include "input_map.h"
|
||||||
|
|
||||||
|
#include "core/os/input.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
#include "core/project_settings.h"
|
#include "core/project_settings.h"
|
||||||
|
|
||||||
|
@ -153,8 +154,12 @@ void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEve
|
||||||
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
ERR_FAIL_COND_MSG(!input_map.has(p_action), "Request for nonexistent InputMap action '" + String(p_action) + "'.");
|
||||||
|
|
||||||
List<Ref<InputEvent> >::Element *E = _find_event(input_map[p_action], p_event);
|
List<Ref<InputEvent> >::Element *E = _find_event(input_map[p_action], p_event);
|
||||||
if (E)
|
if (E) {
|
||||||
input_map[p_action].inputs.erase(E);
|
input_map[p_action].inputs.erase(E);
|
||||||
|
if (Input::get_singleton()->is_action_pressed(p_action)) {
|
||||||
|
Input::get_singleton()->action_release(p_action);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void InputMap::action_erase_events(const StringName &p_action) {
|
void InputMap::action_erase_events(const StringName &p_action) {
|
||||||
|
|
Loading…
Reference in a new issue