From 10a130a91344a43a3f9655fd615dad8ccc8f5d0b Mon Sep 17 00:00:00 2001 From: bleeptrack Date: Tue, 27 Oct 2020 12:15:45 +0100 Subject: [PATCH] Open only one file browser for commits --- scenes/node.gd | 4 +++- scenes/repository.gd | 8 ++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/scenes/node.gd b/scenes/node.gd index 6882414..7fba280 100644 --- a/scenes/node.gd +++ b/scenes/node.gd @@ -121,6 +121,8 @@ func _input(event): var dist = get_viewport().get_mouse_position() - start_pos print(dist.length()) if dist.length() < 3: - file_browser.visible = not file_browser.visible + var state = file_browser.visible + repository.close_all_file_browsers() + file_browser.visible = not state start_pos = null diff --git a/scenes/repository.gd b/scenes/repository.gd index 4180213..4972f17 100644 --- a/scenes/repository.gd +++ b/scenes/repository.gd @@ -342,3 +342,11 @@ func set_file_browser_active(active): file_browser_active = active if file_browser: file_browser.visible = active + +func close_all_file_browsers(): + var all = all_objects() + + for o in objects.values(): + if o.type == "commit": + o.file_browser.visible = false +