mbrlabs / Lorien

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

Refactor event processing in Lorien #161

Closed MrApplejuice closed 2 years ago

MrApplejuice commented 2 years ago

Why is this needed?

Pretty much what was discussed in here: https://github.com/mbrlabs/Lorien/discussions/144#discussioncomment-2966218

I had to extend it a bit further however. Problem is that all tools and the Viewport itself also tried to process events in various ways that would not be compatible with stopping event processing through the standard _input/_gui_input/_unhandled_input functions. I tried to push everything to _unhandled_input, but was not able to, because of the way the ViewportContainer is structured at the moment.

To limit the extent of the PR, I pushed everything to use at least _gui_input which is enough to be intercepted in the _input method in case the keybinding-dialog wants to listen for key events in the future.

More explanations in the code comments...

What changed

MrApplejuice commented 2 years ago

Converted to a Draft temporarily, because I think I found a problem with deleting strokes... need to investigate this tomorrow. No time tonight :-/

MrApplejuice commented 2 years ago

Key inputs fixed. Stuff can be deleted/copied/pasted again... Sorry for (almost) breaking this :P

mbrlabs commented 2 years ago

Not a problem, thanks for doing this. This is much cleaner than the previous input handling.