mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
UndoRedo - Should work with multiple layers and frames
- UndoRedo should work with multiple layers and frames - When pressing right click while left click is being pressed, undo/redo logic is being discarded. It is still buggy, however, when the user holds the right click first and then left click, as well as, when the user holds left click, then holds right click, releases left click and then releases right click.
This commit is contained in:
parent
513637605c
commit
0d69e45cab
|
@ -887,8 +887,8 @@ resizable = true
|
|||
mode = 1
|
||||
access = 2
|
||||
filters = PoolStringArray( "*.bmp ; BMP Image", "*.hdr ; Radiance HDR Image", "*.jpg,*.jpeg ; JPEG Image", "*.png ; PNG Image", "*.svg ; SVG Image", "*.tga ; TGA Image", "*.webp ; WebP Image" )
|
||||
current_dir = "/home/danielnaoexiste/Documents/Prog/Pixelorama"
|
||||
current_path = "/home/danielnaoexiste/Documents/Prog/Pixelorama/"
|
||||
current_dir = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama"
|
||||
current_path = "C:/Users/Overloaded/Dropbox/Orama Founding Members/εταιρικα αρχεια/Godot Projects/Pixelorama/"
|
||||
|
||||
[node name="ExportSprites" type="FileDialog" parent="."]
|
||||
anchor_left = 0.5
|
||||
|
|
|
@ -95,15 +95,15 @@ func _process(delta) -> void:
|
|||
|
||||
|
||||
#Handle Undo/Redo
|
||||
if point_in_rectangle(mouse_pos, location, location + size) && Global.can_draw && Global.has_focus:
|
||||
if Input.is_action_just_pressed("left_mouse") || Input.is_action_just_pressed("right_mouse"):
|
||||
if point_in_rectangle(mouse_pos, location, location + size) && Global.can_draw && Global.has_focus && Global.current_frame == frame:
|
||||
if Input.is_action_just_pressed("left_mouse") || (Input.is_action_just_pressed("right_mouse") && !Input.is_action_pressed("left_mouse")):
|
||||
if current_action != "None":
|
||||
if current_action == "RectSelect":
|
||||
handle_undo("Rectangle Select")
|
||||
else:
|
||||
handle_undo("Draw")
|
||||
|
||||
elif Input.is_action_just_released("left_mouse") || Input.is_action_just_released("right_mouse"):
|
||||
elif Input.is_action_just_released("left_mouse") || (Input.is_action_just_released("right_mouse") && !Input.is_action_pressed("left_mouse")):
|
||||
if previous_action != "None" && previous_action != "RectSelect":
|
||||
handle_redo("Draw")
|
||||
|
||||
|
@ -254,7 +254,9 @@ func handle_redo(action : String) -> void:
|
|||
|
||||
func update_texture(layer_index : int) -> void:
|
||||
layers[layer_index][1].create_from_image(layers[layer_index][0], 0)
|
||||
get_layer_container(layer_index).get_child(0).get_child(1).texture = layers[layer_index][1]
|
||||
var layer_container := get_layer_container(layer_index)
|
||||
if layer_container:
|
||||
layer_container.get_child(0).get_child(1).texture = layers[layer_index][1]
|
||||
|
||||
#This code is used to update the texture in the animation timeline frame button
|
||||
#but blend_rect causes major performance issues on large images
|
||||
|
|
Loading…
Reference in a new issue