diary/user_interface/topic_panel/topic_feed.gd

68 lines
1.3 KiB
GDScript3
Raw Normal View History

extends VBoxContainer
# warning-ignore:unused_signal
signal topic_node_added(topic_node)
var currently_grabbed_topic = null
var selected_topics = []
# For multi-selection.
var _shift_hold = false
var _toggle_selection_result
func _ready():
# warning-ignore:return_value_discarded
Data.topics.connect("topic_added", self, "_on_data_topic_added")
func _input(event):
if event is InputEventKey:
if event.scancode == KEY_DELETE and !event.is_pressed():
_delete_selected_topics()
func set_all_previous_positions():
for topic in get_children():
if topic != currently_grabbed_topic:
topic.set_previous_position()
func check_all_passings():
if currently_grabbed_topic == null:
return
var did_passing_occur = false
for topic in get_children():
if topic != currently_grabbed_topic:
if topic.check_for_passing():
did_passing_occur = true
if did_passing_occur:
yield(get_tree(), "idle_frame")
setup_all_tweens()
func setup_all_tweens():
for topic in get_children():
if topic != currently_grabbed_topic:
topic.setup_tween()
func update_all_colors():
for topic in get_children():
topic.editable._update_color()
func _delete_selected_topics():
for topic in selected_topics:
topic.editable._delete()
selected_topics.clear()
func _on_data_topic_added(topic):
var topic_node = topic.create_node()
add_child(topic_node)