mirror of
https://github.com/Relintai/material-maker.git
synced 2024-11-13 06:27:18 +01:00
Improve filtering in the library
The filter box is now located at the top of the library tree, as most search boxes are placed above the elements they search in. Pressing Ctrl + F will now focus the filter box as well.
This commit is contained in:
parent
d3e34d42cb
commit
d6bfbab92a
@ -4,6 +4,7 @@ extends VBoxContainer
|
|||||||
var libraries = []
|
var libraries = []
|
||||||
|
|
||||||
onready var tree : Tree = $Tree
|
onready var tree : Tree = $Tree
|
||||||
|
onready var filter_line_edit : LineEdit = $HBoxContainer/Filter
|
||||||
|
|
||||||
func _ready():
|
func _ready():
|
||||||
tree.set_column_expand(0, true)
|
tree.set_column_expand(0, true)
|
||||||
@ -15,6 +16,10 @@ func _ready():
|
|||||||
add_library("user://library/user.json")
|
add_library("user://library/user.json")
|
||||||
update_tree()
|
update_tree()
|
||||||
|
|
||||||
|
func _unhandled_input(event : InputEvent) -> void:
|
||||||
|
if event is InputEventKey and event.pressed and event.command and event.scancode == KEY_F:
|
||||||
|
filter_line_edit.grab_focus()
|
||||||
|
|
||||||
func get_selected_item_name():
|
func get_selected_item_name():
|
||||||
var tree_item : TreeItem = tree.get_selected()
|
var tree_item : TreeItem = tree.get_selected()
|
||||||
var rv = ""
|
var rv = ""
|
||||||
|
@ -7,22 +7,13 @@
|
|||||||
margin_right = 352.0
|
margin_right = 352.0
|
||||||
margin_bottom = 423.0
|
margin_bottom = 423.0
|
||||||
script = ExtResource( 1 )
|
script = ExtResource( 1 )
|
||||||
|
__meta__ = {
|
||||||
[node name="Tree" type="Tree" parent="."]
|
"_edit_use_anchors_": false
|
||||||
margin_right = 352.0
|
}
|
||||||
margin_bottom = 395.0
|
|
||||||
rect_min_size = Vector2( 100, 100 )
|
|
||||||
size_flags_horizontal = 3
|
|
||||||
size_flags_vertical = 3
|
|
||||||
columns = 2
|
|
||||||
hide_root = true
|
|
||||||
select_mode = 1
|
|
||||||
script = ExtResource( 2 )
|
|
||||||
|
|
||||||
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
[node name="HBoxContainer" type="HBoxContainer" parent="."]
|
||||||
margin_top = 399.0
|
|
||||||
margin_right = 352.0
|
margin_right = 352.0
|
||||||
margin_bottom = 423.0
|
margin_bottom = 24.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
[node name="FilterLabel" type="Label" parent="HBoxContainer"]
|
[node name="FilterLabel" type="Label" parent="HBoxContainer"]
|
||||||
@ -36,4 +27,16 @@ margin_left = 41.0
|
|||||||
margin_right = 352.0
|
margin_right = 352.0
|
||||||
margin_bottom = 24.0
|
margin_bottom = 24.0
|
||||||
size_flags_horizontal = 3
|
size_flags_horizontal = 3
|
||||||
|
|
||||||
|
[node name="Tree" type="Tree" parent="."]
|
||||||
|
margin_top = 28.0
|
||||||
|
margin_right = 352.0
|
||||||
|
margin_bottom = 423.0
|
||||||
|
rect_min_size = Vector2( 100, 100 )
|
||||||
|
size_flags_horizontal = 3
|
||||||
|
size_flags_vertical = 3
|
||||||
|
columns = 2
|
||||||
|
hide_root = true
|
||||||
|
select_mode = 1
|
||||||
|
script = ExtResource( 2 )
|
||||||
[connection signal="text_changed" from="HBoxContainer/Filter" to="." method="_on_Filter_text_changed"]
|
[connection signal="text_changed" from="HBoxContainer/Filter" to="." method="_on_Filter_text_changed"]
|
||||||
|
Loading…
Reference in New Issue
Block a user