Polish the commit file browser node

This commit is contained in:
Sebastian Morr 2020-10-23 16:52:03 +02:00
parent 0670a8ebdf
commit 251aef245c
4 changed files with 18 additions and 10 deletions

View file

@ -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.

10
node.gd
View file

@ -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

View file

@ -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"]

View file

@ -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