You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-12-06 17:25:19 +00:00
Merge pull request #43289 from KoBeWi/removelease_action
Release pressed action if event is removed
This commit is contained in:
@@ -31,6 +31,7 @@
|
|||||||
#include "input_map.h"
|
#include "input_map.h"
|
||||||
|
|
||||||
#include "core/config/project_settings.h"
|
#include "core/config/project_settings.h"
|
||||||
|
#include "core/input/input.h"
|
||||||
#include "core/os/keyboard.h"
|
#include "core/os/keyboard.h"
|
||||||
|
|
||||||
InputMap *InputMap::singleton = nullptr;
|
InputMap *InputMap::singleton = nullptr;
|
||||||
@@ -145,6 +146,9 @@ void InputMap::action_erase_event(const StringName &p_action, const Ref<InputEve
|
|||||||
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);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user