Topic Panel is feature complete now.

This commit is contained in:
mono 2022-05-21 14:56:02 +02:00
parent 7d285bd607
commit 0ad993fcdc
78 changed files with 494 additions and 63 deletions

1
.import/.gdignore Normal file
View File

@ -0,0 +1 @@

View File

@ -0,0 +1,3 @@
source_md5="b0ae9c92bc10ddd8e279278d487e5640"
dest_md5="dbaa22dbba4b13a17ab3a1c0a856c828"

View File

@ -0,0 +1,3 @@
source_md5="646f270783ecf83a085a8b426fb0e9cf"
dest_md5="276e8a115a6e5f0985e7c0e128f64923"

View File

@ -0,0 +1,3 @@
source_md5="b4d0293b5eabe3095cd2ea42f46e4cf9"
dest_md5="9513a4f65d3bb1e798b742c3982bfb60"

View File

@ -0,0 +1,3 @@
source_md5="b3a6590c0e666c8d942e688d308f4fa2"
dest_md5="0990c93510b803afecad3919336da102"

View File

@ -0,0 +1,3 @@
source_md5="879575973d60584e81e21b31f2060110"
dest_md5="e02769059f24e9c5576b7552dc6efb67"

View File

@ -0,0 +1,3 @@
source_md5="99869ec16c048d160a913b764ed0b82c"
dest_md5="3dd0fb4e9c48d36f33fed3c01a70ce10"

View File

@ -0,0 +1,3 @@
source_md5="13b33abcfd7fcdb382be2f8cc5241b90"
dest_md5="d1879bc9fb29bfc2a49b5b453907b1b3"

View File

@ -0,0 +1,3 @@
source_md5="c2f8ee7e4013f01b8975066b1777efc3"
dest_md5="e6cfd3bf61f70ebbea21b68a617a8ea3"

View File

@ -0,0 +1,3 @@
source_md5="986d1626ecf7c000ffc9a56f80b2df64"
dest_md5="62bc505c9ab152918cacabee23655e14"

View File

@ -0,0 +1,3 @@
source_md5="11112eaa7cf69b157d1f7c8f2ce01bab"
dest_md5="8870411b528c6ffb49de9f8db6854cb5"

View File

@ -0,0 +1,3 @@
source_md5="d818096e3b09ea2efe21b8c570a7edad"
dest_md5="f3c4b8f0065b5357b5314ece0a6e1562"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="aace56fdaf060d8ad806d6acffdaf398"
dest_md5="757b165757491783bb3824a9491427aa"

View File

@ -0,0 +1,3 @@
source_md5="cde40aca55b9fdb487c95290baec1db9"
dest_md5="d9eda3d71265b4d019c6347fe1dc2111"

View File

@ -0,0 +1,3 @@
source_md5="88fd1903a3d90118752b89b4e08d2b4a"
dest_md5="160e816cf9c2256e40dac87d5280bf60"

View File

@ -0,0 +1,3 @@
source_md5="83094fe680afb95e3ef547fba8ed20ac"
dest_md5="6b45f6ae8a80e3b55c421dc8af7a5223"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="e5d3288a900b6d4421e9d3937d08ab5e"
dest_md5="cc45eda6d302c77d5e7d876bb1d30a13"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="32a1b014ad4cde8956c2e44802f75c9e"
dest_md5="9fc64f8a0b81ed6bb90eee7e229797e3"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="427888e7a483b00e3a948e8d13c9bb4d"
dest_md5="1228c88a5a6cf8d065d1bbb9b6b7e1ad"

View File

@ -0,0 +1,3 @@
source_md5="8a2523134958f934e46297ea2a697e1e"
dest_md5="b31c9ec7e789f0ce100d338400bc6c38"

View File

@ -0,0 +1,3 @@
source_md5="b891777939b10e39f5b113eef604d834"
dest_md5="12f350577900d444c4a5484671df1ec7"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="7ac917032afeec8a7824e5472cf13638"
dest_md5="6930cf1e3a1ddce048f1fc4dc82e656d"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="6a0879affdd3ff3272b40d2b876c493a"
dest_md5="786aedb5f9921c46dec8adf5d5d80443"

Binary file not shown.

View File

@ -0,0 +1,3 @@
source_md5="56b1c187b72a468cf14cf1a6102bca1b"
dest_md5="77be94894ee06b10d683d853b9b3fa78"

View File

@ -0,0 +1,3 @@
source_md5="3e46c68a686c87959e97519c25a35e46"
dest_md5="c25d3e0fc261f6ed19218d9c837850f4"

View File

@ -0,0 +1,3 @@
source_md5="f87a5b97cfcc8d33ad6da1278fccb2d2"
dest_md5="13089c6bb347888f4b6c33170b30ff82"

View File

@ -0,0 +1,3 @@
source_md5="ceec25b08b0d0ebb65b34989f2ac10b2"
dest_md5="34ea352b537e79967ccf8d818710414f"

View File

@ -0,0 +1,3 @@
source_md5="54e75b5a12f8fa52282f83a1809fce6b"
dest_md5="b16dcd23cf359bc098e0552c775a70c0"

View File

@ -0,0 +1,3 @@
source_md5="da0a840df29fc886de0813fce80b8b97"
dest_md5="53c81ab36d864c34b5e9a4905f2500f1"

View File

@ -15,6 +15,7 @@ others_message_color = Color( 0.294118, 0.168627, 0.34902, 1 )
scroll_bar_color = Color( 0.372549, 0.137255, 0.286275, 1 )
scroll_bar_highlight_color = Color( 0.760784, 0.34902, 0.964706, 1 )
scroll_bar_pressed_color = Color( 1, 0.631373, 0.701961, 1 )
casual_topic_color = Color( 0.380392, 0.152941, 0.27451, 1 )
daily_topic_color = Color( 0.294118, 0.168627, 0.34902, 1 )
casual_topic_color = Color( 0.415686, 0.168627, 0.298039, 1 )
daily_topic_color = Color( 0.341176, 0.168627, 0.337255, 1 )
urgent_topic_color = Color( 0.352941, 0.129412, 0.243137, 1 )
add_topic_button_color = Color( 0.745098, 0.301961, 0.521569, 1 )

View File

@ -18,3 +18,4 @@ scroll_bar_pressed_color = Color( 0.396078, 0.435294, 0.447059, 1 )
casual_topic_color = Color( 0.14902, 0.172549, 0.203922, 1 )
daily_topic_color = Color( 0.0980392, 0.180392, 0.305882, 1 )
urgent_topic_color = Color( 0.290196, 0.152941, 0.203922, 1 )
add_topic_button_color = Color( 0.258824, 0.290196, 0.345098, 1 )

View File

@ -9,7 +9,7 @@ func _ready():
topics = TopicData.new()
var autosave_timer = Timer.new()
autosave_timer.wait_time = 600.0 # Every ten minutes.
autosave_timer.wait_time = 6.0 # Every ten minutes.
autosave_timer.autostart = true
autosave_timer.connect("timeout", self, "_save_data")
add_child(autosave_timer)

View File

@ -10,12 +10,20 @@ const TOPIC_NODE = preload("res://user_interface/topic_panel/topic_node.tscn")
var associated_node: Control
var content: String
var type: int
var type: int = TYPE_CASUAL
func change_type(new_type: int):
type = new_type
associated_node.type = new_type
associated_node._adjust_appearance_to_user()
Data.topics.dirty_flag = true
func delete():
Data.topics.loaded_topics.erase(self)
associated_node.parent.queue_free()
Data.topics.dirty_flag = true
# Used by the TopicFeed, to spawn topic nodes.

View File

@ -2,7 +2,7 @@ extends Node
class_name TopicData
signal topic_added(topic)
signal topic_added(topic, position)
var dirty_flag = false
var loaded_topics = []
@ -10,11 +10,18 @@ var loaded_topics = []
func add_topic(position: int):
var topic = Topic.new()
topic.type = position # Delete this line later.
loaded_topics.append(topic)
dirty_flag = true
# TODO: Make it possible to vary in position in the array!!
emit_signal("topic_added", topic)
emit_signal("topic_added", topic, position)
func sort_topics():
loaded_topics.sort_custom(self, "_compare_topic_index")
func _compare_topic_index(a, b):
return a.associated_node.parent.get_index() < b.associated_node.parent.get_index()
func load_data():
@ -24,6 +31,7 @@ func load_data():
func save_data():
if dirty_flag:
sort_topics() # Important before saving, to remain the order.
# TODO: Save data.
pass

View File

@ -15,6 +15,7 @@ export(Color) var scroll_bar_pressed_color
export(Color) var casual_topic_color
export(Color) var daily_topic_color
export(Color) var urgent_topic_color
export(Color) var add_topic_button_color
var message_box_content: String = ""

View File

@ -44,6 +44,9 @@ margin_bottom = 472.0
rect_min_size = Vector2( 0, 60 )
theme = ExtResource( 1 )
script = ExtResource( 6 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="Margin" type="MarginContainer" parent="."]
margin_right = 328.0
@ -67,17 +70,10 @@ size_flags_vertical = 3
size_flags_stretch_ratio = 4.0
custom_constants/separation = 10
[node name="ProfileImageRect" type="TextureRect" parent="Margin/Structure/Profile" instance=ExtResource( 3 )]
[node name="ProfileImageRect" parent="Margin/Structure/Profile" instance=ExtResource( 3 )]
material = SubResource( 2 )
margin_right = 48.0
margin_bottom = 48.0
rect_min_size = Vector2( 48, 48 )
texture = ExtResource( 2 )
expand = true
stretch_mode = 1
__meta__ = {
"_edit_use_anchors_": false
}
[node name="UserTexts" type="VBoxContainer" parent="Margin/Structure/Profile"]
margin_left = 58.0

View File

@ -0,0 +1,19 @@
extends TextureButton
onready var scroll_container = get_node("../..")
func _ready():
# warning-ignore:return_value_discarded
Users.connect("switched", self, "_on_user_switched")
func _on_user_switched():
self_modulate = Users.get_current().add_topic_button_color
func _on_pressed():
Data.topics.add_topic(get_index())
yield(get_tree(), "idle_frame")
scroll_container.scroll_vertical += 64

View File

@ -0,0 +1,20 @@
[gd_scene load_steps=5 format=2]
[ext_resource path="res://user_interface/topic_panel/add_button_normal.png" type="Texture" id=1]
[ext_resource path="res://user_interface/topic_panel/add_button_hover.png" type="Texture" id=2]
[ext_resource path="res://user_interface/topic_panel/add_button_pressed.png" type="Texture" id=3]
[ext_resource path="res://user_interface/topic_panel/add_button.gd" type="Script" id=4]
[node name="AddButton" type="TextureButton"]
rect_min_size = Vector2( 0, 56 )
size_flags_horizontal = 3
texture_normal = ExtResource( 1 )
texture_pressed = ExtResource( 3 )
texture_hover = ExtResource( 2 )
expand = true
script = ExtResource( 4 )
__meta__ = {
"_edit_use_anchors_": false
}
[connection signal="pressed" from="." to="." method="_on_pressed"]

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/add_button_hover.png-cdbe778a322e171ee118ec3db1548d1c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://user_interface/topic_panel/add_button_hover.png"
dest_files=[ "res://.import/add_button_hover.png-cdbe778a322e171ee118ec3db1548d1c.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.9 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/add_button_normal.png-7610a20d621a1599612f2d10ba19a66e.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://user_interface/topic_panel/add_button_normal.png"
dest_files=[ "res://.import/add_button_normal.png-7610a20d621a1599612f2d10ba19a66e.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

Binary file not shown.

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@ -0,0 +1,35 @@
[remap]
importer="texture"
type="StreamTexture"
path="res://.import/add_button_pressed.png-21b54c26cf6425256cdf8732d7c7e54c.stex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://user_interface/topic_panel/add_button_pressed.png"
dest_files=[ "res://.import/add_button_pressed.png-21b54c26cf6425256cdf8732d7c7e54c.stex" ]
[params]
compress/mode=0
compress/lossy_quality=0.7
compress/hdr_mode=0
compress/bptc_ldr=0
compress/normal_map=0
flags/repeat=0
flags/filter=true
flags/mipmaps=false
flags/anisotropic=false
flags/srgb=2
process/fix_alpha_border=true
process/premult_alpha=false
process/HDR_as_SRGB=false
process/invert_color=false
process/normal_map_invert_y=false
stream=false
size_limit=0
detect_3d=true
svg/scale=1.0

View File

@ -1,6 +1,7 @@
extends Container
class_name TopicDraggable
const SCROLL_SPEED = 25.0
onready var topic_feed: VBoxContainer = get_node("..")
onready var scroll_container: ScrollContainer = get_node("../..")
@ -9,44 +10,67 @@ onready var editable = get_node("TopicEditable")
onready var tween = get_node("Tween")
var global_position setget _set_global_position
var local_position setget _set_local_position
var _in_fit_in_animation = false
var _previous_position
var _previous_global_position
var _previous_scroll
var _offset
var _something_passed = false
func _ready():
pass
func _gui_input(event):
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
if event.is_pressed():
if event.shift:
topic_feed._toggle_selection_result = _set_selection(null)
topic_feed._shift_hold = true
else:
_deselect_all()
if not editable.edit_mode:
if event.doubleclick:
editable._enable_edit_mode()
editable.text_edit.grab_focus()
yield(get_tree(), "idle_frame")
editable.text_edit.select_all()
elif !_in_fit_in_animation:
_set_as_grabbed()
func _input(event):
if event is InputEventMouseButton and event.button_index == BUTTON_LEFT:
if event.is_pressed():
if _is_mouse_on_control():
if event.shift:
topic_feed._toggle_selection_result = _set_selection(null)
topic_feed._shift_hold = true
else:
_deselect_all()
if not editable.edit_mode:
if event.doubleclick:
editable._enable_edit_mode()
editable.text_edit.grab_focus()
editable.text_edit.select_all()
elif !_in_fit_in_animation:
_set_as_grabbed()
elif editable.edit_mode:
if !_is_mouse_on_topic() and editable.edit_mode:
editable.text_edit._confirm()
else:
_fit_in_animation()
if _is_grabbed():
_fit_in_animation()
topic_feed._shift_hold = false
if event is InputEventMouseMotion:
if topic_feed.currently_grabbed_topic == self:
if _is_grabbed():
_move_block(event)
topic_feed.check_all_passings()
if topic_feed._shift_hold and _is_mouse_on_control():
if topic_feed._shift_hold and _is_mouse_on_topic():
# warning-ignore:return_value_discarded
_set_selection(topic_feed._toggle_selection_result)
if event is InputEventMouseButton:
if _is_grabbed():
var scroll_value = 0.0
if event.button_index == BUTTON_WHEEL_UP:
scroll_value = -SCROLL_SPEED
elif event.button_index == BUTTON_WHEEL_DOWN:
scroll_value = SCROLL_SPEED
if scroll_value != 0.0:
scroll_container.scroll_vertical += scroll_value
_previous_scroll = scroll_container.scroll_vertical
topic_feed.check_all_passings()
func _set_selection(to) -> bool:
@ -72,23 +96,52 @@ func _set_as_grabbed():
var rect = editable.get_global_rect()
rect_min_size.y = editable.rect_size.y
editable.set_as_toplevel(true)
editable.mouse_filter = MOUSE_FILTER_IGNORE
editable.rect_position = rect.position
topic_feed.currently_grabbed_topic = self
_previous_position = editable.rect_global_position
_previous_global_position = editable.rect_global_position
_previous_scroll = scroll_container.scroll_vertical
_offset = 0
_move_block(InputEventMouseMotion.new())
func _fit_in_animation():
_in_fit_in_animation = true
topic_feed.currently_grabbed_topic = null
var overhead = _topic_overhead(rect_global_position.y)
var from = editable.rect_global_position
var to
if overhead > 0.0:
var sc_rect = scroll_container.get_global_rect()
to = Vector2(
sc_rect.position.x,
sc_rect.end.y - rect_size.y
)
elif overhead < 0.0:
to = scroll_container.rect_global_position
else:
to = rect_global_position - Vector2(0.0, overhead)
tween.stop_all()
tween.interpolate_property(self, "global_position",
editable.rect_global_position, rect_global_position,
from, to,
0.12, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
)
if overhead != 0.0:
tween.interpolate_property(scroll_container, "scroll_vertical",
scroll_container.scroll_vertical, scroll_container.scroll_vertical + overhead,
0.12, Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
)
tween.start()
yield(tween, "tween_completed")
editable.set_as_toplevel(false)
editable.mouse_filter = MOUSE_FILTER_PASS
rect_min_size.y = 0
editable.rect_position = Vector2.ZERO
_in_fit_in_animation = false
@ -96,15 +149,52 @@ func _fit_in_animation():
func _move_block(event):
_offset += event.relative.y
editable.set_global_position(_previous_position + Vector2(0.0, _offset))
var virtual_position = _previous_global_position + Vector2(0.0, _offset)
var overhead = _topic_overhead(virtual_position.y)
virtual_position.y -= overhead
if get_index() == topic_feed.get_child_count() - 2:
if virtual_position.y > rect_global_position.y:
virtual_position.y = rect_global_position.y
_set_global_position(virtual_position)
scroll_container.scroll_vertical = _previous_scroll + overhead
func _is_mouse_on_control() -> bool:
return get_global_rect().has_point(get_viewport().get_mouse_position())
# How much topic is out of scroll_container bounds.
func _topic_overhead(y_pos):
var scroll_rect = scroll_container.get_global_rect()
scroll_rect.size.y -= editable.rect_size.y
var overhead = 0
# Higher?
if y_pos < scroll_rect.position.y:
overhead = y_pos - scroll_rect.position.y
# Lower?
if y_pos > scroll_rect.end.y:
overhead = y_pos - scroll_rect.end.y
return overhead
func _is_mouse_on_topic() -> bool:
var on_topic = get_global_rect().has_point(get_global_mouse_position())
return _is_mouse_on_topic_feed() and on_topic
func _is_mouse_on_topic_feed() -> bool:
return scroll_container.get_global_rect().has_point(get_global_mouse_position())
func _is_grabbed() -> bool:
return topic_feed.currently_grabbed_topic == self
func set_previous_position():
_previous_position = editable.rect_global_position
_previous_global_position = editable.rect_global_position
func check_for_passing() -> bool:
@ -134,19 +224,29 @@ func check_for_passing() -> bool:
topic_feed.currently_grabbed_topic,
get_index()
)
_something_passed = true
Data.topics.dirty_flag = true
return true
return false
func setup_tween():
if _previous_position != editable.rect_global_position:
if _something_passed:
var _previous_local_position = _previous_global_position - rect_global_position
tween.stop_all()
tween.interpolate_property(self, "global_position",
_previous_position, rect_global_position, 0.15,
tween.interpolate_property(self, "local_position",
_previous_local_position, Vector2.ZERO, 0.15,
Tween.TRANS_LINEAR, Tween.EASE_IN_OUT
)
tween.start()
_something_passed = false
yield(tween, "tween_completed")
func _set_global_position(value):
editable.set_global_position(value)
func _set_local_position(value):
editable.rect_position = value

View File

@ -22,6 +22,25 @@ func _setup(): # Override.
_setup_appearance()
func _setup_popup_menu_items(): # Override.
var is_selected = _is_part_of_multi_selection()
if not is_selected:
popup_menu.add_item("Insert New", 0)
popup_menu.add_item("Edit", 1)
popup_menu.add_separator("Change Type")
if type != TYPE_CASUAL or is_selected:
popup_menu.add_radio_check_item("Casual", 2)
if type != TYPE_DAILY or is_selected:
popup_menu.add_radio_check_item("Daily", 3)
if type != TYPE_URGENT or is_selected:
popup_menu.add_radio_check_item("Urgent", 4)
popup_menu.add_separator("")
popup_menu.add_item("Delete", 5)
func _adjust_appearance_to_user(): # Override.
match type:
TYPE_CASUAL:
@ -40,7 +59,11 @@ func _adjust_appearance_to_user(): # Override.
func _update_color():
var addition = Color(0.1, 0.12, 0.15) if _is_selected() else Color.black
var addition
if _is_selected():
addition = Color(0.1, 0.12, 0.15)
else:
addition = Color.black
nine_patch.self_modulate = color + addition
@ -51,10 +74,52 @@ func _is_selected() -> bool:
return false
func _is_part_of_multi_selection() -> bool:
if get_parent().topic_feed:
return _is_selected() and parent.topic_feed.selected_topics.size() > 1
else:
return false
func _delete():
associated_topic.delete()
if _is_part_of_multi_selection():
parent.topic_feed._delete_selected_topics()
else:
associated_topic.delete()
func _on_popup_menu_id_pressed(id):
match id:
0: # Insert new Topic.
Data.topics.add_topic(parent.get_index())
1: # Edit.
_enable_edit_mode()
text_edit.grab_focus()
yield(get_tree(), "idle_frame")
text_edit.select_all()
2: # Change type to CASUAL.
if _is_part_of_multi_selection():
parent.topic_feed._change_type_of_selected_topics(TYPE_CASUAL)
else:
associated_topic.change_type(TYPE_CASUAL)
_adjust_appearance_to_user()
3: # Change type to DAILY.
if _is_part_of_multi_selection():
parent.topic_feed._change_type_of_selected_topics(TYPE_DAILY)
else:
associated_topic.change_type(TYPE_DAILY)
_adjust_appearance_to_user()
4: # Change type to URGENT.
if _is_part_of_multi_selection():
parent.topic_feed._change_type_of_selected_topics(TYPE_URGENT)
else:
associated_topic.change_type(TYPE_URGENT)
_adjust_appearance_to_user()
5: # Delete.
_delete()
func _on_text_edit_confirmed(confirmed_content): # Override
associated_topic.content = confirmed_content
_disable_edit_mode()
Data.topics.dirty_flag = true

View File

@ -25,8 +25,9 @@ func _input(event):
func set_all_previous_positions():
for topic in get_children():
if topic != currently_grabbed_topic:
topic.set_previous_position()
if topic is TopicDraggable:
if topic != currently_grabbed_topic:
topic.set_previous_position()
func check_all_passings():
@ -36,9 +37,10 @@ func check_all_passings():
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 topic is TopicDraggable:
if topic != currently_grabbed_topic:
if topic.check_for_passing():
did_passing_occur = true
if did_passing_occur:
yield(get_tree(), "idle_frame")
@ -47,21 +49,34 @@ func check_all_passings():
func setup_all_tweens():
for topic in get_children():
if topic != currently_grabbed_topic:
topic.setup_tween()
if topic is TopicDraggable:
if topic != currently_grabbed_topic:
topic.setup_tween()
func update_all_colors():
for topic in get_children():
topic.editable._update_color()
if topic is TopicDraggable:
topic.editable._update_color()
func _delete_selected_topics():
for topic in selected_topics:
topic.editable._delete()
topic.editable.associated_topic.delete()
selected_topics.clear()
func _on_data_topic_added(topic):
func _change_type_of_selected_topics(type: int):
for topic in selected_topics:
topic.editable.associated_topic.change_type(type)
topic.editable._adjust_appearance_to_user()
selected_topics.clear()
update_all_colors()
func _on_data_topic_added(topic, position):
var topic_node = topic.create_node()
add_child(topic_node)
move_child(topic_node, position)
topic_node.editable._adjust_appearance_to_user()

View File

@ -20,6 +20,7 @@ __meta__ = {
[node name="TopicEditable" parent="." instance=ExtResource( 1 )]
margin_right = 32.0
margin_bottom = 171.0
mouse_filter = 1
size_flags_horizontal = 3
script = ExtResource( 3 )
@ -36,6 +37,7 @@ patch_margin_bottom = 12
[node name="VBoxContainer" parent="TopicEditable" index="1"]
margin_right = 32.0
margin_bottom = 171.0
mouse_filter = 2
[node name="MarginContainer" parent="TopicEditable/VBoxContainer" index="0"]
margin_right = 32.0
@ -44,6 +46,7 @@ margin_bottom = 166.0
[node name="Content" parent="TopicEditable/VBoxContainer/MarginContainer" index="0"]
margin_right = 15.0
margin_bottom = 161.0
mouse_filter = 2
[node name="ReferenceLabel" parent="TopicEditable/VBoxContainer/MarginContainer" index="1"]
margin_right = 15.0
@ -53,12 +56,14 @@ autowrap = true
[node name="ContentFitTextEdit" parent="TopicEditable/VBoxContainer/MarginContainer" index="2"]
margin_right = 15.0
margin_bottom = 161.0
mouse_filter = 1
expand_width = false
[node name="HBoxContainer" type="HBoxContainer" parent="TopicEditable/VBoxContainer" index="1"]
margin_top = 162.0
margin_right = 32.0
margin_bottom = 171.0
mouse_filter = 2
custom_constants/separation = 0
alignment = 2
@ -74,6 +79,7 @@ margin_left = 24.0
margin_right = 32.0
margin_bottom = 9.0
rect_min_size = Vector2( 8, 0 )
mouse_filter = 2
[node name="PopupMenu" parent="TopicEditable" index="2"]
margin_right = 32.0

View File

@ -1,6 +0,0 @@
extends PanelContainer
func _ready():
for _i in range(30):
Data.topics.add_topic(randi() % 3)

View File

@ -1,7 +1,7 @@
[gd_scene load_steps=4 format=2]
[ext_resource path="res://user_interface/main.theme" type="Theme" id=1]
[ext_resource path="res://user_interface/topic_panel/topic_panel.gd" type="Script" id=2]
[ext_resource path="res://user_interface/topic_panel/add_button.tscn" type="PackedScene" id=2]
[ext_resource path="res://user_interface/topic_panel/topic_feed.gd" type="Script" id=3]
[node name="TopicPanel" type="PanelContainer"]
@ -9,7 +9,9 @@ margin_right = 328.0
margin_bottom = 396.0
size_flags_vertical = 3
theme = ExtResource( 1 )
script = ExtResource( 2 )
__meta__ = {
"_edit_use_anchors_": false
}
[node name="MarginContainer" type="MarginContainer" parent="."]
margin_right = 328.0
@ -24,5 +26,10 @@ scroll_horizontal_enabled = false
[node name="TopicFeed" type="VBoxContainer" parent="MarginContainer/ScrollContainer"]
margin_right = 312.0
margin_bottom = 56.0
size_flags_horizontal = 3
script = ExtResource( 3 )
[node name="AddButton" parent="MarginContainer/ScrollContainer/TopicFeed" instance=ExtResource( 2 )]
margin_right = 312.0
margin_bottom = 56.0