class_name ProfileWindow extends Window

var dragging : bool = false
var adding_subwindow : bool = false

func _on_focus_exited() -> void:
	var focused_node = get_viewport().gui_get_focus_owner()
	if is_ancestor_of(focused_node) or adding_subwindow:
		return
	else:
		_on_close_requested()

func _on_close_requested() -> void:
	queue_free()

func _on_drag_region_gui_input(event: InputEvent) -> void:
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT:
			dragging = event.pressed
	elif dragging and event is InputEventMouseMotion:
		position += Vector2i(event.screen_relative)
			
