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

Implement undo and redo while holding (#405)

This commit is contained in:
Laurenz Reinthaler 2020-12-22 16:45:17 +01:00 committed by GitHub
parent ab583a7354
commit 425b11d4b2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -55,11 +55,27 @@ func _input(event : InputEvent) -> void:
if get_focus_owner() is LineEdit:
get_focus_owner().release_focus()
if event.is_action_pressed("redo_secondary"): # Shift + Ctrl + Z
# The section of code below is reserved for Undo and Redo! Do not place code for Input below, but above.
if !event.is_echo(): # Checks if the action is pressed down
if event.is_action_pressed("redo_secondary"): # Done, so that "redo_secondary" hasn't
redone = true # a slight delay before it starts. The "redo" and "undo" action don't have a slight delay,
Global.current_project.undo_redo.redo() # The "redo" and "undo" action don't have a slight delay,
redone = false # because they get called as an accelerator once pressed (TopMenuContainer.gd / Line 152).
return
if event.is_action("redo"): # Ctrl + Y
redone = true
Global.current_project.undo_redo.redo()
redone = false
if event.is_action("redo_secondary"): # Shift + Ctrl + Z
redone = true
Global.current_project.undo_redo.redo()
redone = false
if event.is_action("undo") and !event.shift: # Ctrl + Z and check if shift isn't pressed
Global.current_project.undo_redo.undo() # so "undo" isn't accidentaly triggered while using "redo_secondary"
func setup_application_window_size() -> void:
if OS.get_name() == "HTML5":