1
0
Fork 0
mirror of https://github.com/Orama-Interactive/Pixelorama.git synced 2025-01-18 17:19:50 +00:00

Fix issue where the window regains focus and draws immediatly

The issue occurred when the cursor exited the application window very fast while still on the canvas, thus Global.has_focus was still true, then lost focus. When Pixelorama regained focus, it would draw the tool even if the user clicked outside of the drawing canvas.
This commit is contained in:
Manolis Papadeas 2021-02-25 07:00:50 -08:00 committed by GitHub
parent 59862171e9
commit 35f97ebe6f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -151,6 +151,7 @@ func _notification(what : int) -> void:
MainLoop.NOTIFICATION_WM_QUIT_REQUEST: # Handle exit
show_quit_dialog()
MainLoop.NOTIFICATION_WM_FOCUS_OUT: # Called when the mouse isn't in the window anymore
Global.has_focus = false
if Global.fps_limit_focus:
Engine.set_target_fps(1) # then set the fps to 1 to relieve the cpu
MainLoop.NOTIFICATION_WM_MOUSE_ENTER: # Opposite of the above