mirror of
https://github.com/tonytins/CozyPixelStudio.git
synced 2025-06-25 21:44:42 -04:00
UndoRedo vol 6 - Scale Image now has undo/redo
This commit is contained in:
parent
4ba2f3280a
commit
18d109f959
2 changed files with 28 additions and 14 deletions
|
@ -162,19 +162,27 @@ func find_node_by_name(root, node_name) -> Node:
|
|||
return found
|
||||
return null
|
||||
|
||||
func undo(canvas : Canvas, layer_index : int) -> void:
|
||||
func undo(canvas : Canvas, layer_index : int = -1) -> void:
|
||||
undos -= 1
|
||||
var action_name : String = undo_redo.get_current_action_name()
|
||||
if action_name == "Draw" || action_name == "Rectangle Select":
|
||||
canvas.update_texture(layer_index)
|
||||
if action_name == "Draw" || action_name == "Rectangle Select" || action_name == "Scale":
|
||||
if layer_index > -1:
|
||||
canvas.update_texture(layer_index)
|
||||
else:
|
||||
for i in canvas.layers.size():
|
||||
canvas.update_texture(i)
|
||||
print("Undo: ", action_name)
|
||||
|
||||
func redo(canvas : Canvas, layer_index : int) -> void:
|
||||
func redo(canvas : Canvas, layer_index : int = -1) -> void:
|
||||
if undos < undo_redo.get_version(): #If we did undo and then redo
|
||||
undos = undo_redo.get_version()
|
||||
var action_name : String = undo_redo.get_current_action_name()
|
||||
if action_name == "Draw" || action_name == "Rectangle Select":
|
||||
canvas.update_texture(layer_index)
|
||||
if action_name == "Draw" || action_name == "Rectangle Select" || action_name == "Scale":
|
||||
if layer_index > -1:
|
||||
canvas.update_texture(layer_index)
|
||||
else:
|
||||
for i in canvas.layers.size():
|
||||
canvas.update_texture(i)
|
||||
print("Redo: ", action_name)
|
||||
|
||||
func change_frame() -> void:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue