mirror of
https://github.com/git-learning-game/oh-my-git.git
synced 2024-11-20 16:20:18 +01:00
Polish the commit file browser node
This commit is contained in:
parent
0670a8ebdf
commit
251aef245c
4 changed files with 18 additions and 10 deletions
2
arrow.gd
2
arrow.gd
|
@ -29,6 +29,8 @@ func _process(_delta):
|
||||||
if $Target.text.substr(0, 5) != "refs/":
|
if $Target.text.substr(0, 5) != "refs/":
|
||||||
$Target.text = ""#$Target.text.substr(0,8)
|
$Target.text = ""#$Target.text.substr(0,8)
|
||||||
$Target.show()
|
$Target.show()
|
||||||
|
$Line.hide()
|
||||||
|
$Tip.hide()
|
||||||
|
|
||||||
$Line.points[1] = end - repository.objects[source].position
|
$Line.points[1] = end - repository.objects[source].position
|
||||||
# Move the tip away from the object a bit.
|
# Move the tip away from the object a bit.
|
||||||
|
|
10
node.gd
10
node.gd
|
@ -6,6 +6,7 @@ var type setget type_set
|
||||||
var repository: Control
|
var repository: Control
|
||||||
|
|
||||||
onready var content_label = $Content/ContentLabel
|
onready var content_label = $Content/ContentLabel
|
||||||
|
onready var file_browser = $OnTop/FileBrowser
|
||||||
|
|
||||||
var children = {} setget children_set
|
var children = {} setget children_set
|
||||||
var id_always_visible = false
|
var id_always_visible = false
|
||||||
|
@ -16,6 +17,7 @@ var arrow = preload("res://arrow.tscn")
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
content_set(content)
|
content_set(content)
|
||||||
|
type_set(type)
|
||||||
$Pop.pitch_scale = rand_range(0.8, 1.2)
|
$Pop.pitch_scale = rand_range(0.8, 1.2)
|
||||||
$Pop.play()
|
$Pop.play()
|
||||||
|
|
||||||
|
@ -53,9 +55,9 @@ func content_set(new_content):
|
||||||
|
|
||||||
func type_set(new_type):
|
func type_set(new_type):
|
||||||
type = new_type
|
type = new_type
|
||||||
if type == "commit":
|
if type == "commit" and file_browser:
|
||||||
$FileBrowser.commit = self
|
file_browser.commit = self
|
||||||
$FileBrowser.title = "Commit"
|
file_browser.title = "Commit"
|
||||||
if type != "ref":
|
if type != "ref":
|
||||||
$ID.text = $ID.text.substr(0,8)
|
$ID.text = $ID.text.substr(0,8)
|
||||||
#elif type == "ref":
|
#elif type == "ref":
|
||||||
|
@ -115,7 +117,7 @@ func _input(event):
|
||||||
if event.is_action_pressed("click"):
|
if event.is_action_pressed("click"):
|
||||||
held = true
|
held = true
|
||||||
if type == "commit":
|
if type == "commit":
|
||||||
$FileBrowser.visible = not $FileBrowser.visible
|
file_browser.visible = not file_browser.visible
|
||||||
elif event.is_action_pressed("right_click"):
|
elif event.is_action_pressed("right_click"):
|
||||||
var input = get_tree().get_current_scene().find_node("Input")
|
var input = get_tree().get_current_scene().find_node("Input")
|
||||||
input.text += id
|
input.text += id
|
||||||
|
|
15
node.tscn
15
node.tscn
|
@ -70,10 +70,10 @@ z_index = 1
|
||||||
|
|
||||||
[node name="ContentLabel" type="Label" parent="Content"]
|
[node name="ContentLabel" type="Label" parent="Content"]
|
||||||
visible = false
|
visible = false
|
||||||
margin_left = -22.2898
|
margin_left = 31.3944
|
||||||
margin_top = 30.1969
|
margin_top = -22.8078
|
||||||
margin_right = -12.2898
|
margin_right = 41.3944
|
||||||
margin_bottom = 65.1969
|
margin_bottom = 12.1922
|
||||||
custom_styles/normal = SubResource( 2 )
|
custom_styles/normal = SubResource( 2 )
|
||||||
custom_fonts/font = ExtResource( 2 )
|
custom_fonts/font = ExtResource( 2 )
|
||||||
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
custom_colors/font_color = Color( 1, 1, 1, 1 )
|
||||||
|
@ -81,14 +81,17 @@ __meta__ = {
|
||||||
"_edit_use_anchors_": false
|
"_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
|
visible = false
|
||||||
anchor_right = 0.0
|
anchor_right = 0.0
|
||||||
anchor_bottom = 0.0
|
anchor_bottom = 0.0
|
||||||
margin_left = -460.672
|
margin_left = -460.672
|
||||||
margin_top = -23.6409
|
margin_top = -23.6409
|
||||||
margin_right = -32.6716
|
margin_right = -32.6716
|
||||||
margin_bottom = 94.3591
|
margin_bottom = 118.359
|
||||||
mouse_filter = 1
|
mouse_filter = 1
|
||||||
mode = 1
|
mode = 1
|
||||||
[connection signal="mouse_entered" from="Rect" to="." method="_on_hover"]
|
[connection signal="mouse_entered" from="Rect" to="." method="_on_hover"]
|
||||||
|
|
|
@ -66,6 +66,7 @@ __meta__ = {
|
||||||
}
|
}
|
||||||
|
|
||||||
[node name="SimplifyCheckbox" type="CheckBox" parent="Rows/RepoVis"]
|
[node name="SimplifyCheckbox" type="CheckBox" parent="Rows/RepoVis"]
|
||||||
|
visible = false
|
||||||
anchor_left = 1.0
|
anchor_left = 1.0
|
||||||
anchor_right = 1.0
|
anchor_right = 1.0
|
||||||
margin_left = -208.715
|
margin_left = -208.715
|
||||||
|
|
Loading…
Reference in a new issue