mbrlabs / Lorien

Infinite canvas drawing/whiteboarding app for Windows, Linux and macOS. Made with Godot.
MIT License
5.54k stars 240 forks source link

Use exact matching of events for action detection to allow "overlapping" shortcuts #168

Closed MrApplejuice closed 2 years ago

MrApplejuice commented 2 years ago

Keybindings editor was delayed by an issue found here: https://github.com/mbrlabs/Lorien/discussions/144#discussioncomment-2976242

In short: A key stroke like Ctrl+Shift+Z would also be detected by the Undo action Ctrl+Z. That spells disaster if people bind these kinds of "overlapping" keystrokes.

The solution is to use exact matches for action-detection, which is why I added a "event.is_action_pressed("...", true)" everywhere, where it was necessary (character movement is not necessary so for keeping the easter-egg intact, I did not change those).

I also took the liberty to change is_action_just_pressed into is_action_pressed in Main.gd. "Just_pressed" is not necessary anymore, because the input-processing is not done in the main game-loop anymore (_process()). This enables key-repetitions driven my key-stroke events emitted by the system, allowing easier chaining of, for example, undo events by just holding down the shortcut.

mbrlabs commented 2 years ago

Thanks!