Error fixes

This commit is contained in:
kobewi 2022-07-19 11:36:46 +02:00
parent 2e4ac956da
commit 32c8b35608
2 changed files with 13 additions and 2 deletions

View File

@ -49,7 +49,7 @@ func _process(_delta):
if is_dragging: if is_dragging:
var mouse_position = main.get_local_mouse_position() var mouse_position = main.get_local_mouse_position()
var item_under_mouse = main.column_container.get_column_from_mouse_position() var item_under_mouse = get_column_from_mouse_position()
if item_under_mouse: if item_under_mouse:
if item_under_mouse: if item_under_mouse:
var item_index = item_under_mouse.get_index() var item_index = item_under_mouse.get_index()
@ -165,6 +165,17 @@ func move_column(index):
undo_redo.commit_action() undo_redo.commit_action()
func get_column_from_mouse_position() -> PanelContainer:
var mouse_position = main.column_container.get_local_mouse_position()
for i in main.column_container.get_child_count():
var child = main.column_container.get_child(i)
var rect: Rect2 = child.get_rect()
if rect.has_point(Vector2(mouse_position.x, 0)):
return child
return null
func _on_Items_child_entered_tree(node): func _on_Items_child_entered_tree(node):
update_counter() update_counter()

View File

@ -125,7 +125,7 @@ one_shot = true
[connection signal="text_changed" from="VBoxContainer/Head/Name" to="." method="name_changed"] [connection signal="text_changed" from="VBoxContainer/Head/Name" to="." method="name_changed"]
[connection signal="pressed" from="VBoxContainer/Head/Minimize" to="." method="_on_Minimize_pressed"] [connection signal="pressed" from="VBoxContainer/Head/Minimize" to="." method="_on_Minimize_pressed"]
[connection signal="child_entered_tree" from="VBoxContainer/ScrollContainer/Items" to="." method="_on_Items_child_entered_tree"] [connection signal="child_entered_tree" from="VBoxContainer/ScrollContainer/Items" to="." method="_on_Items_child_entered_tree"]
[connection signal="child_exited_tree" from="VBoxContainer/ScrollContainer/Items" to="." method="_on_Items_child_exited_tree"] [connection signal="child_exiting_tree" from="VBoxContainer/ScrollContainer/Items" to="." method="_on_Items_child_exited_tree"]
[connection signal="pressed" from="VBoxContainer/Actions/AddItem" to="." method="add_item" binds= [ true ]] [connection signal="pressed" from="VBoxContainer/Actions/AddItem" to="." method="add_item" binds= [ true ]]
[connection signal="pressed" from="VBoxContainer/Actions/DeleteColumn" to="." method="delete_column"] [connection signal="pressed" from="VBoxContainer/Actions/DeleteColumn" to="." method="delete_column"]
[connection signal="timeout" from="Timer" to="." method="request_save"] [connection signal="timeout" from="Timer" to="." method="request_save"]