You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-04 12:00:25 +00:00
Ensure minimum modifiers are pressed when matching actions
This commit is contained in:
@@ -424,8 +424,13 @@ bool InputEventKey::action_match(const Ref<InputEvent> &p_event, bool p_exact_ma
|
||||
} else {
|
||||
match = get_physical_keycode() == key->get_physical_keycode();
|
||||
}
|
||||
Key action_mask = get_modifiers_mask();
|
||||
Key key_mask = key->get_modifiers_mask();
|
||||
if (key->is_pressed()) {
|
||||
match &= (action_mask & key_mask) == action_mask;
|
||||
}
|
||||
if (p_exact_match) {
|
||||
match &= get_modifiers_mask() == key->get_modifiers_mask();
|
||||
match &= action_mask == key_mask;
|
||||
}
|
||||
if (match) {
|
||||
bool pressed = key->is_pressed();
|
||||
@@ -589,8 +594,13 @@ bool InputEventMouseButton::action_match(const Ref<InputEvent> &p_event, bool p_
|
||||
}
|
||||
|
||||
bool match = button_index == mb->button_index;
|
||||
Key action_mask = get_modifiers_mask();
|
||||
Key button_mask = mb->get_modifiers_mask();
|
||||
if (mb->is_pressed()) {
|
||||
match &= (action_mask & button_mask) == action_mask;
|
||||
}
|
||||
if (p_exact_match) {
|
||||
match &= get_modifiers_mask() == mb->get_modifiers_mask();
|
||||
match &= action_mask == button_mask;
|
||||
}
|
||||
if (match) {
|
||||
bool pressed = mb->is_pressed();
|
||||
|
||||
Reference in New Issue
Block a user