From e4ba665c2af6923fad57bc99e454e2527c77cca1 Mon Sep 17 00:00:00 2001 From: Manolis Papadeas <35376950+OverloadedOrama@users.noreply.github.com> Date: Wed, 1 Sep 2021 18:07:36 +0300 Subject: [PATCH] Always display the close button in tabs and let users close projects other than the current --- CHANGELOG.md | 1 + src/UI/Tabs.gd | 13 +++++++------ src/UI/UI.tscn | 2 +- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 65d398723..4bfcba1c5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -39,6 +39,7 @@ Kawan Weege ([@DragonOfWar](https://github.com/DragonOfWar)), Martin Novák ([@n - The frame delay minimum value is now 0.01 instead of 0. - Cloning frames now create linked cels on layers where the cel linking button is enabled. - Window transparency has been temporarily disabled in macOS due to [#491](https://github.com/Orama-Interactive/Pixelorama/issues/491). +- The close button on tabs is always being displayed, which lets the user close projects other than the current one. ### Fixed - Issues such as not being able to create guides at random times, which are a result of PoolVectorArray locking issues, may have finally been solved. [#331](https://github.com/Orama-Interactive/Pixelorama/issues/331) diff --git a/src/UI/Tabs.gd b/src/UI/Tabs.gd index 1c09223ba..37f86ef8e 100644 --- a/src/UI/Tabs.gd +++ b/src/UI/Tabs.gd @@ -6,10 +6,10 @@ func _on_Tabs_tab_changed(tab : int) -> void: func _on_Tabs_tab_close(tab : int) -> void: - if Global.projects.size() == 1 or Global.current_project_index != tab: + if Global.projects.size() == 1: return - if Global.current_project.has_changed: + if Global.projects[tab].has_changed: if !Global.unsaved_changes_dialog.is_connected("confirmed", self, "delete_tab"): Global.unsaved_changes_dialog.connect("confirmed", self, "delete_tab", [tab]) Global.unsaved_changes_dialog.popup_centered() @@ -39,9 +39,10 @@ func delete_tab(tab : int) -> void: OpenSave.current_save_paths.remove(tab) OpenSave.backup_save_paths.remove(tab) Global.projects.remove(tab) - if tab > 0: - Global.current_project_index -= 1 - else: - Global.current_project_index = 0 + if Global.current_project_index == tab: + if tab > 0: + Global.current_project_index -= 1 + else: + Global.current_project_index = 0 if Global.unsaved_changes_dialog.is_connected("confirmed", self, "delete_tab"): Global.unsaved_changes_dialog.disconnect("confirmed", self, "delete_tab") diff --git a/src/UI/UI.tscn b/src/UI/UI.tscn index 04dce715d..ad40cf9e4 100644 --- a/src/UI/UI.tscn +++ b/src/UI/UI.tscn @@ -1076,7 +1076,7 @@ margin_top = 7.0 margin_right = 889.0 margin_bottom = 31.0 tab_align = 0 -tab_close_display_policy = 1 +tab_close_display_policy = 2 drag_to_rearrange_enabled = true script = ExtResource( 3 )