extends Node2D

## Mouse Gesture Demo: Track swipes and display trail

var is_swiping: bool = false
var trail_points: PackedVector2Array = []

func _ready():
	$Label.text = "Click and drag to draw a trail"

func _input(event: InputEvent):
	if event is InputEventMouseButton:
		if event.button_index == MOUSE_BUTTON_LEFT:
			if event.pressed:
				# Click down → start swipe
				is_swiping = true
				trail_points.clear()
				trail_points.append(event.position)
				$StatusLabel.text = "Swiping..."
			else:
				# Click up → end swipe
				is_swiping = false
				$StatusLabel.text = "Trail complete! %d points recorded" % trail_points.size()
	
	elif event is InputEventMouseMotion and is_swiping:
		# Mouse moved while button held → accumulate trail
		trail_points.append(event.position)
		queue_redraw()

func _draw():
	if trail_points.size() > 1:
		for i in range(trail_points.size() - 1):
			draw_line(trail_points[i], trail_points[i + 1], Color.BLUE, 3.0)
