summaryrefslogtreecommitdiff
path: root/ui/window.gd
blob: 25b0988b5c4aca27f45f898ef6edb847460c155e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
extends PanelContainer


var is_dragging := false
var drag_anchor := Vector2.ZERO


func _process(_delta: float) -> void:
	if is_dragging:
		global_position += get_global_mouse_position() - drag_anchor
		#%TitleBar.size # TODO: use title bar size as min/max. dont let the bar vanish
		drag_anchor = get_global_mouse_position()


func _on_title_bar_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