mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-31 07:29:49 +00:00
Compress mirror image in undo/redo
This commit is contained in:
parent
4f5f37a522
commit
e22794e611
|
@ -51,37 +51,34 @@ func _commit_undo(action: String, undo_data: Dictionary, project: Project) -> vo
|
||||||
var redo_data := _get_undo_data(project)
|
var redo_data := _get_undo_data(project)
|
||||||
project.undos += 1
|
project.undos += 1
|
||||||
project.undo_redo.create_action(action)
|
project.undo_redo.create_action(action)
|
||||||
project.undo_redo.add_do_property(project, "selection_map", redo_data["selection_map"])
|
if redo_data.has("selection_map"):
|
||||||
project.undo_redo.add_do_property(project, "selection_offset", redo_data["outline_offset"])
|
project.undo_redo.add_do_property(project, "selection_map", redo_data["selection_map"])
|
||||||
project.undo_redo.add_undo_property(project, "selection_map", undo_data["selection_map"])
|
project.undo_redo.add_do_property(project, "selection_offset", redo_data["outline_offset"])
|
||||||
project.undo_redo.add_undo_property(project, "selection_offset", undo_data["outline_offset"])
|
project.undo_redo.add_undo_property(project, "selection_map", undo_data["selection_map"])
|
||||||
|
project.undo_redo.add_undo_property(
|
||||||
|
project, "selection_offset", undo_data["outline_offset"]
|
||||||
|
)
|
||||||
|
project.undo_redo.add_do_method(project.selection_map_changed)
|
||||||
|
project.undo_redo.add_undo_method(project.selection_map_changed)
|
||||||
|
|
||||||
for image in redo_data:
|
Global.undo_redo_compress_images(redo_data, undo_data, project)
|
||||||
if not image is Image:
|
|
||||||
continue
|
|
||||||
project.undo_redo.add_do_property(image, "data", redo_data[image])
|
|
||||||
for image in undo_data:
|
|
||||||
if not image is Image:
|
|
||||||
continue
|
|
||||||
project.undo_redo.add_undo_property(image, "data", undo_data[image])
|
|
||||||
project.undo_redo.add_do_method(Global.undo_or_redo.bind(false, -1, -1, project))
|
project.undo_redo.add_do_method(Global.undo_or_redo.bind(false, -1, -1, project))
|
||||||
project.undo_redo.add_do_method(project.selection_map_changed)
|
|
||||||
project.undo_redo.add_undo_method(Global.undo_or_redo.bind(true, -1, -1, project))
|
project.undo_redo.add_undo_method(Global.undo_or_redo.bind(true, -1, -1, project))
|
||||||
project.undo_redo.add_undo_method(project.selection_map_changed)
|
|
||||||
project.undo_redo.commit_action()
|
project.undo_redo.commit_action()
|
||||||
|
|
||||||
|
|
||||||
func _get_undo_data(project: Project) -> Dictionary:
|
func _get_undo_data(project: Project) -> Dictionary:
|
||||||
var bitmap_image := SelectionMap.new()
|
var affect_selection := selection_checkbox.button_pressed and project.has_selection
|
||||||
bitmap_image.copy_from(project.selection_map)
|
|
||||||
var data := {}
|
var data := {}
|
||||||
data["selection_map"] = bitmap_image
|
if affect_selection:
|
||||||
data["outline_offset"] = project.selection_offset
|
var bitmap_image := SelectionMap.new()
|
||||||
|
bitmap_image.copy_from(project.selection_map)
|
||||||
|
data["selection_map"] = bitmap_image
|
||||||
|
data["outline_offset"] = project.selection_offset
|
||||||
|
|
||||||
var images := _get_selected_draw_images(project)
|
var images := _get_selected_draw_images(project)
|
||||||
for image in images:
|
for image in images:
|
||||||
data[image] = image.data
|
data[image] = image.data
|
||||||
|
|
||||||
return data
|
return data
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue