diff options
author | Max <maksloboda123@gmail.com> | 2018-07-27 14:02:30 +0300 |
---|---|---|
committer | Max <maksloboda123@gmail.com> | 2018-07-27 15:09:41 +0300 |
commit | c2be1a75a0b93c2a0f8ec7c4df7f125d1a53eca4 (patch) | |
tree | 7325aadebcad4c1502e91bb6c837df2449ee6469 | |
parent | 25f1833890a643e07d31f5160917c46ec5665e9e (diff) |
Fixed shortcuts not working with InputEventActions
-rw-r--r-- | core/os/input_event.cpp | 8 | ||||
-rw-r--r-- | core/os/input_event.h | 1 |
2 files changed, 9 insertions, 0 deletions
diff --git a/core/os/input_event.cpp b/core/os/input_event.cpp index 4ebb821a2f..206938f393 100644 --- a/core/os/input_event.cpp +++ b/core/os/input_event.cpp @@ -937,6 +937,14 @@ bool InputEventAction::is_pressed() const { return pressed; } +bool InputEventAction::shortcut_match(const Ref<InputEvent> &p_event) const { + Ref<InputEventKey> event = p_event; + if (event.is_null()) + return false; + + return event->is_action(action); +} + bool InputEventAction::is_action(const StringName &p_action) const { return action == p_action; diff --git a/core/os/input_event.h b/core/os/input_event.h index 037649ed60..df89dd518c 100644 --- a/core/os/input_event.h +++ b/core/os/input_event.h @@ -467,6 +467,7 @@ public: virtual bool is_action(const StringName &p_action) const; + virtual bool shortcut_match(const Ref<InputEvent> &p_event) const; virtual bool is_action_type() const { return true; } virtual String as_text() const; |