First attempt of rearranging the elements better in horizontal layout

This commit is contained in:
Sebastian Morr 2020-10-27 16:53:19 +01:00
parent 00538ee581
commit ac2062bd5a
7 changed files with 46 additions and 37 deletions

View file

@ -4,7 +4,6 @@
[ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2] [ext_resource path="res://fonts/default.tres" type="DynamicFont" id=2]
[ext_resource path="res://styles/theme.tres" type="Theme" id=3] [ext_resource path="res://styles/theme.tres" type="Theme" id=3]
[node name="FileBrowser" type="Control"] [node name="FileBrowser" type="Control"]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
@ -81,7 +80,6 @@ size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
custom_constants/vseparation = 16 custom_constants/vseparation = 16
custom_constants/hseparation = 16 custom_constants/hseparation = 16
columns = 4
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }

View file

@ -78,6 +78,9 @@ func load_level(level_id):
new_repo.path = repo.path new_repo.path = repo.path
new_repo.label = repo.slug new_repo.label = repo.slug
new_repo.size_flags_horizontal = SIZE_EXPAND_FILL new_repo.size_flags_horizontal = SIZE_EXPAND_FILL
new_repo.size_flags_vertical = SIZE_EXPAND_FILL
if new_repo.label != "yours":
new_repo.file_browser_active = false
repositories_node.add_child(new_repo) repositories_node.add_child(new_repo)
repositories[r] = new_repo repositories[r] = new_repo

View file

@ -60,16 +60,13 @@ margin_bottom = 784.0
mouse_filter = 2 mouse_filter = 2
size_flags_vertical = 3 size_flags_vertical = 3
[node name="Repositories" type="HBoxContainer" parent="Rows/Columns"] [node name="Repositories" type="VBoxContainer" parent="Rows/Columns"]
margin_right = 1266.0 margin_right = 1266.0
margin_bottom = 784.0 margin_bottom = 784.0
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3 size_flags_horizontal = 3
size_flags_stretch_ratio = 2.0 size_flags_stretch_ratio = 2.0
custom_constants/separation = 8 custom_constants/separation = 8
__meta__ = {
"_edit_use_anchors_": false
}
[node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns"] [node name="LevelInfo" type="VBoxContainer" parent="Rows/Columns"]
margin_left = 1271.0 margin_left = 1271.0

View file

@ -100,15 +100,16 @@ func children_set(new_children):
func _on_hover(): func _on_hover():
hovered = true hovered = true
if not id_always_visible: if not id_always_visible and type != "head":
content_label.visible = true if not file_browser.visible:
content_label.visible = true
#$ID.visible = true #$ID.visible = true
func _on_unhover(): func _on_unhover():
hovered = false hovered = false
if not id_always_visible: if not id_always_visible and type != "head":
content_label.visible = false content_label.visible = false
$ID.visible = false #$ID.visible = false
func _input(event): func _input(event):
if hovered: if hovered:
@ -125,9 +126,10 @@ func _input(event):
if start_pos: if start_pos:
var dist = get_viewport().get_mouse_position() - start_pos var dist = get_viewport().get_mouse_position() - start_pos
print(dist.length()) print(dist.length())
if dist.length() < 3: if dist.length() < 3: # <3
var state = file_browser.visible var state = file_browser.visible
repository.close_all_file_browsers() repository.close_all_file_browsers()
file_browser.visible = not state file_browser.visible = not state
content_label.visible = state
start_pos = null start_pos = null

View file

@ -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 = 31.3944 margin_left = -22.057
margin_top = -22.8078 margin_top = 31.1738
margin_right = 41.3944 margin_right = -12.057
margin_bottom = 12.1922 margin_bottom = 66.1738
custom_styles/normal = SubResource( 2 ) custom_styles/normal = SubResource( 2 )
custom_fonts/font = ExtResource( 1 ) custom_fonts/font = ExtResource( 1 )
custom_colors/font_color = Color( 1, 1, 1, 1 ) custom_colors/font_color = Color( 1, 1, 1, 1 )
@ -88,10 +88,10 @@ z_index = 2
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 = -23.2915
margin_top = -23.6409 margin_top = 30.6967
margin_right = -32.6716 margin_right = 404.709
margin_bottom = 118.359 margin_bottom = 172.697
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"]

View file

@ -1,8 +1,8 @@
extends Control extends Control
onready var index = $Rows/Browsers/Index onready var index = $Browsers/Index
onready var nodes = $Rows/RepoVis/Nodes onready var nodes = $Rows/RepoVis/Nodes
onready var file_browser = $Rows/Browsers/FileBrowser onready var file_browser = $Browsers/FileBrowser
onready var label_node = $Rows/RepoVis/Label onready var label_node = $Rows/RepoVis/Label
onready var path_node = $Rows/RepoVis/Path onready var path_node = $Rows/RepoVis/Path
onready var simplify_checkbox = $Rows/RepoVis/SimplifyCheckbox onready var simplify_checkbox = $Rows/RepoVis/SimplifyCheckbox

View file

@ -15,18 +15,16 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Rows" type="VSplitContainer" parent="."] [node name="Rows" type="HSplitContainer" parent="."]
anchor_right = 1.0 anchor_right = 1.0
anchor_bottom = 1.0 anchor_bottom = 1.0
mouse_filter = 2 mouse_filter = 2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="RepoVis" type="Control" parent="Rows"] [node name="RepoVis" type="Control" parent="Rows"]
margin_right = 1920.0 margin_right = 1920.0
margin_bottom = 926.0 margin_bottom = 1080.0
mouse_filter = 2 mouse_filter = 2
size_flags_horizontal = 3
size_flags_vertical = 3 size_flags_vertical = 3
__meta__ = { __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
@ -99,26 +97,37 @@ __meta__ = {
"_edit_use_anchors_": false "_edit_use_anchors_": false
} }
[node name="Browsers" type="VBoxContainer" parent="Rows"] [node name="Browsers" type="VBoxContainer" parent="."]
margin_top = 938.0 anchor_left = 1.0
margin_right = 1920.0 anchor_top = 1.0
margin_bottom = 1080.0 anchor_right = 1.0
anchor_bottom = 1.0
margin_left = 6.0
margin_top = -356.0
margin_right = 635.0
margin_bottom = -5.0
size_flags_horizontal = 3
size_flags_vertical = 3
size_flags_stretch_ratio = 0.2
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Index" parent="Rows/Browsers" instance=ExtResource( 4 )] [node name="Index" parent="Browsers" instance=ExtResource( 4 )]
visible = false
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_right = 1920.0 margin_right = 629.0
margin_bottom = 142.0 margin_bottom = 173.0
size_flags_vertical = 3 size_flags_vertical = 3
title = "Index" title = "Index"
mode = 2 mode = 2
[node name="FileBrowser" parent="Rows/Browsers" instance=ExtResource( 4 )] [node name="FileBrowser" parent="Browsers" instance=ExtResource( 4 )]
anchor_right = 0.0 anchor_right = 0.0
anchor_bottom = 0.0 anchor_bottom = 0.0
margin_right = 1920.0 margin_top = 178.0
margin_bottom = 142.0 margin_right = 629.0
margin_bottom = 351.0
size_flags_vertical = 3 size_flags_vertical = 3
title = "Working directory" title = "Working directory"
[connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"] [connection signal="mouse_entered" from="." to="." method="_on_mouse_entered"]