From 251aef245c59972417452a2f1837d2519fbe71e6 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Fri, 23 Oct 2020 16:52:03 +0200 Subject: [PATCH] Polish the commit file browser node --- arrow.gd | 2 ++ node.gd | 10 ++++++---- node.tscn | 15 +++++++++------ repository.tscn | 1 + 4 files changed, 18 insertions(+), 10 deletions(-) diff --git a/arrow.gd b/arrow.gd index 5ea9353..a4beedb 100644 --- a/arrow.gd +++ b/arrow.gd @@ -29,6 +29,8 @@ func _process(_delta): if $Target.text.substr(0, 5) != "refs/": $Target.text = ""#$Target.text.substr(0,8) $Target.show() + $Line.hide() + $Tip.hide() $Line.points[1] = end - repository.objects[source].position # Move the tip away from the object a bit. diff --git a/node.gd b/node.gd index 14e4877..7dbc8ea 100644 --- a/node.gd +++ b/node.gd @@ -6,6 +6,7 @@ var type setget type_set var repository: Control onready var content_label = $Content/ContentLabel +onready var file_browser = $OnTop/FileBrowser var children = {} setget children_set var id_always_visible = false @@ -16,6 +17,7 @@ var arrow = preload("res://arrow.tscn") func _ready(): content_set(content) + type_set(type) $Pop.pitch_scale = rand_range(0.8, 1.2) $Pop.play() @@ -53,9 +55,9 @@ func content_set(new_content): func type_set(new_type): type = new_type - if type == "commit": - $FileBrowser.commit = self - $FileBrowser.title = "Commit" + if type == "commit" and file_browser: + file_browser.commit = self + file_browser.title = "Commit" if type != "ref": $ID.text = $ID.text.substr(0,8) #elif type == "ref": @@ -115,7 +117,7 @@ func _input(event): if event.is_action_pressed("click"): held = true if type == "commit": - $FileBrowser.visible = not $FileBrowser.visible + file_browser.visible = not file_browser.visible elif event.is_action_pressed("right_click"): var input = get_tree().get_current_scene().find_node("Input") input.text += id diff --git a/node.tscn b/node.tscn index 4a12a7b..e09bc3f 100644 --- a/node.tscn +++ b/node.tscn @@ -70,10 +70,10 @@ z_index = 1 [node name="ContentLabel" type="Label" parent="Content"] visible = false -margin_left = -22.2898 -margin_top = 30.1969 -margin_right = -12.2898 -margin_bottom = 65.1969 +margin_left = 31.3944 +margin_top = -22.8078 +margin_right = 41.3944 +margin_bottom = 12.1922 custom_styles/normal = SubResource( 2 ) custom_fonts/font = ExtResource( 2 ) custom_colors/font_color = Color( 1, 1, 1, 1 ) @@ -81,14 +81,17 @@ __meta__ = { "_edit_use_anchors_": false } -[node name="FileBrowser" parent="." instance=ExtResource( 6 )] +[node name="OnTop" type="Node2D" parent="."] +z_index = 2 + +[node name="FileBrowser" parent="OnTop" instance=ExtResource( 6 )] visible = false anchor_right = 0.0 anchor_bottom = 0.0 margin_left = -460.672 margin_top = -23.6409 margin_right = -32.6716 -margin_bottom = 94.3591 +margin_bottom = 118.359 mouse_filter = 1 mode = 1 [connection signal="mouse_entered" from="Rect" to="." method="_on_hover"] diff --git a/repository.tscn b/repository.tscn index e754cc5..4d8c079 100644 --- a/repository.tscn +++ b/repository.tscn @@ -66,6 +66,7 @@ __meta__ = { } [node name="SimplifyCheckbox" type="CheckBox" parent="Rows/RepoVis"] +visible = false anchor_left = 1.0 anchor_right = 1.0 margin_left = -208.715