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

[0.x] Fix undo/redo history not working when the tool changes (#916)

* remove_undo_redo_draw_op from Draw.gd

* shifted undo_redo_draw_op to Global.gd
This commit is contained in:
Variable 2023-10-09 14:55:17 +05:00 committed by GitHub
parent b2c157fa07
commit be093f3490
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 6 deletions

View file

@ -617,3 +617,7 @@ func convert_dictionary_values(dict: Dictionary) -> void:
dict[key] = str2var("Vector2" + dict[key])
elif "size" in key or "center_offset" in key: # Convert a String to a Vector3
dict[key] = str2var("Vector3" + dict[key])
func undo_redo_draw_op(image: Object, compressed_image_data: Dictionary, buffer_size: int) -> void:
image["data"]["data"] = compressed_image_data["data"].decompress(buffer_size)

View file

@ -213,7 +213,7 @@ func commit_undo() -> void:
var buffer_size = compressed_data["data"].size()
compressed_data["data"] = compressed_data["data"].compress()
project.undo_redo.add_do_method(
self, "undo_redo_draw_op", image, compressed_data, buffer_size
Global, "undo_redo_draw_op", image, compressed_data, buffer_size
)
image.unlock()
for image in _undo_data:
@ -221,7 +221,7 @@ func commit_undo() -> void:
var buffer_size = compressed_data["data"].size()
compressed_data["data"] = compressed_data["data"].compress()
project.undo_redo.add_undo_method(
self, "undo_redo_draw_op", image, compressed_data, buffer_size
Global, "undo_redo_draw_op", image, compressed_data, buffer_size
)
project.undo_redo.add_do_method(Global, "undo_or_redo", false, frame, layer)
project.undo_redo.add_undo_method(Global, "undo_or_redo", true, frame, layer)
@ -230,10 +230,6 @@ func commit_undo() -> void:
_undo_data.clear()
func undo_redo_draw_op(image: Object, compressed_image_data: Dictionary, buffer_size: int) -> void:
image["data"]["data"] = compressed_image_data["data"].decompress(buffer_size)
func draw_tool(position: Vector2) -> void:
if Global.mirror_view:
# Even brushes are not perfectly centred and are offsetted by 1 px so we add it