summaryrefslogtreecommitdiff
path: root/ui/chat_window.gd
diff options
context:
space:
mode:
authorDaniel Weipert <git@mail.dweipert.de>2025-01-05 16:54:36 +0100
committerDaniel Weipert <git@mail.dweipert.de>2025-01-05 16:54:36 +0100
commit35b0f811f23f029110373798b19d9d0895d907f0 (patch)
tree2e4906a992c2569fa0f89dbe0f079010a734cc41 /ui/chat_window.gd
parente08a29e73ea4f7e6d78e8e7f5a6e7033dbc1f542 (diff)
next commit
Diffstat (limited to 'ui/chat_window.gd')
-rw-r--r--ui/chat_window.gd17
1 files changed, 17 insertions, 0 deletions
diff --git a/ui/chat_window.gd b/ui/chat_window.gd
index c88a3ee..7841d57 100644
--- a/ui/chat_window.gd
+++ b/ui/chat_window.gd
@@ -3,6 +3,9 @@ extends PanelContainer
@export var player_color: Color = Color8(255, 255, 255)
+var is_dragging := false
+var drag_anchor := Vector2.ZERO
+
func _ready() -> void:
# clear test label
@@ -57,3 +60,17 @@ func _on_broadcast_formatted_message_packet_received(packet: BroadcastFormattedM
format.size = packet.font_size
add_message(packet.message, format)
+
+
+func _process(_delta: float) -> void:
+ if is_dragging:
+ global_position += get_global_mouse_position() - drag_anchor
+ drag_anchor = get_global_mouse_position()
+
+
+func _on_handle_gui_input(event: InputEvent) -> void:
+ if event.is_action_pressed("primary_click"):
+ is_dragging = true
+ drag_anchor = get_global_mouse_position()
+ elif event.is_action_released("primary_click"):
+ is_dragging = false