mirror of
https://github.com/Orama-Interactive/Pixelorama.git
synced 2025-01-18 17:19:50 +00:00
Project data no longer remain in memory after the user has removed their tab
This commit is contained in:
parent
057318f659
commit
750fae4713
|
@ -23,8 +23,8 @@ var fps := 6.0
|
|||
|
||||
var x_symmetry_point
|
||||
var y_symmetry_point
|
||||
var x_symmetry_axis: SymmetryGuide
|
||||
var y_symmetry_axis: SymmetryGuide
|
||||
var x_symmetry_axis := SymmetryGuide.new()
|
||||
var y_symmetry_axis := SymmetryGuide.new()
|
||||
|
||||
var selection_bitmap := BitMap.new()
|
||||
# This is useful for when the selection is outside of the canvas boundaries,
|
||||
|
@ -64,21 +64,17 @@ func _init(_frames := [], _name := tr("untitled"), _size := Vector2(64, 64)) ->
|
|||
x_symmetry_point = size.x / 2
|
||||
y_symmetry_point = size.y / 2
|
||||
|
||||
if !x_symmetry_axis:
|
||||
x_symmetry_axis = SymmetryGuide.new()
|
||||
x_symmetry_axis.type = x_symmetry_axis.Types.HORIZONTAL
|
||||
x_symmetry_axis.project = self
|
||||
x_symmetry_axis.add_point(Vector2(-19999, y_symmetry_point))
|
||||
x_symmetry_axis.add_point(Vector2(19999, y_symmetry_point))
|
||||
Global.canvas.add_child(x_symmetry_axis)
|
||||
x_symmetry_axis.type = x_symmetry_axis.Types.HORIZONTAL
|
||||
x_symmetry_axis.project = self
|
||||
x_symmetry_axis.add_point(Vector2(-19999, y_symmetry_point))
|
||||
x_symmetry_axis.add_point(Vector2(19999, y_symmetry_point))
|
||||
Global.canvas.add_child(x_symmetry_axis)
|
||||
|
||||
if !y_symmetry_axis:
|
||||
y_symmetry_axis = SymmetryGuide.new()
|
||||
y_symmetry_axis.type = y_symmetry_axis.Types.VERTICAL
|
||||
y_symmetry_axis.project = self
|
||||
y_symmetry_axis.add_point(Vector2(x_symmetry_point, -19999))
|
||||
y_symmetry_axis.add_point(Vector2(x_symmetry_point, 19999))
|
||||
Global.canvas.add_child(y_symmetry_axis)
|
||||
y_symmetry_axis.type = y_symmetry_axis.Types.VERTICAL
|
||||
y_symmetry_axis.project = self
|
||||
y_symmetry_axis.add_point(Vector2(x_symmetry_point, -19999))
|
||||
y_symmetry_axis.add_point(Vector2(x_symmetry_point, 19999))
|
||||
Global.canvas.add_child(y_symmetry_axis)
|
||||
|
||||
if OS.get_name() == "HTML5":
|
||||
directory_path = "user://"
|
||||
|
@ -88,6 +84,15 @@ func _init(_frames := [], _name := tr("untitled"), _size := Vector2(64, 64)) ->
|
|||
)
|
||||
|
||||
|
||||
func remove() -> void:
|
||||
for layer in layers:
|
||||
layer.frame_container.queue_free()
|
||||
undo_redo.free()
|
||||
for guide in guides:
|
||||
guide.queue_free()
|
||||
Global.projects.erase(self)
|
||||
|
||||
|
||||
func commit_undo() -> void:
|
||||
if Global.canvas.selection.is_moving_content:
|
||||
Global.canvas.selection.transform_content_cancel()
|
||||
|
|
|
@ -513,6 +513,6 @@ func _exit_tree() -> void:
|
|||
|
||||
var i := 0
|
||||
for project in Global.projects:
|
||||
project.undo_redo.free()
|
||||
project.remove()
|
||||
OpenSave.remove_backup(i)
|
||||
i += 1
|
||||
|
|
|
@ -23,7 +23,7 @@ func _on_Tabs_tab_close(tab: int) -> void:
|
|||
|
||||
|
||||
func _on_Tabs_reposition_active_tab_request(idx_to: int) -> void:
|
||||
var temp = Global.projects[Global.current_project_index]
|
||||
var temp: Project = Global.projects[Global.current_project_index]
|
||||
Global.projects.erase(temp)
|
||||
Global.projects.insert(idx_to, temp)
|
||||
|
||||
|
@ -38,11 +38,10 @@ func _on_Tabs_reposition_active_tab_request(idx_to: int) -> void:
|
|||
|
||||
func delete_tab(tab: int) -> void:
|
||||
remove_tab(tab)
|
||||
Global.projects[tab].undo_redo.free()
|
||||
Global.projects[tab].remove()
|
||||
OpenSave.remove_backup(tab)
|
||||
OpenSave.current_save_paths.remove(tab)
|
||||
OpenSave.backup_save_paths.remove(tab)
|
||||
Global.projects.remove(tab)
|
||||
if Global.current_project_index == tab:
|
||||
if tab > 0:
|
||||
Global.current_project_index -= 1
|
||||
|
|
Loading…
Reference in a new issue