mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Prevent undoing/redoing while drawing
Prevents errors (and potentially unwanted behavior) if attempting to undo while in the middle of drawing with the Pencil, Eraser of Shading tools. Needs more testing in case I broke something else.
This commit is contained in:
parent
cc332c6cbf
commit
af2b1feb1f
|
@ -8,6 +8,7 @@ var size: Vector2 setget _size_changed
|
|||
var undo_redo := UndoRedo.new()
|
||||
var tiles: Tiles
|
||||
var undos := 0 # The number of times we added undo properties
|
||||
var can_undo = true
|
||||
var fill_color := Color(0)
|
||||
var has_changed := false setget _has_changed_changed
|
||||
# frames and layers Arrays should generally only be modified directly when
|
||||
|
@ -95,6 +96,8 @@ func remove() -> void:
|
|||
|
||||
|
||||
func commit_undo() -> void:
|
||||
if not can_undo:
|
||||
return
|
||||
if Global.canvas.selection.is_moving_content:
|
||||
Global.canvas.selection.transform_content_cancel()
|
||||
else:
|
||||
|
@ -102,6 +105,8 @@ func commit_undo() -> void:
|
|||
|
||||
|
||||
func commit_redo() -> void:
|
||||
if not can_undo:
|
||||
return
|
||||
Global.control.redone = true
|
||||
undo_redo.redo()
|
||||
Global.control.redone = false
|
||||
|
|
|
@ -50,6 +50,7 @@ func update_config() -> void:
|
|||
func draw_start(_position: Vector2) -> void:
|
||||
_draw_cache = []
|
||||
is_moving = true
|
||||
Global.current_project.can_undo = false
|
||||
|
||||
|
||||
func draw_move(position: Vector2) -> void:
|
||||
|
@ -62,6 +63,7 @@ func draw_move(position: Vector2) -> void:
|
|||
func draw_end(_position: Vector2) -> void:
|
||||
is_moving = false
|
||||
_draw_cache = []
|
||||
Global.current_project.can_undo = true
|
||||
|
||||
|
||||
func cursor_move(position: Vector2) -> void:
|
||||
|
|
Loading…
Reference in a new issue