tool
extends SummerDayTool
class_name SummerDayHandCanvasTool


func _init():
	priority = 1
	modifier_layer = 1


var hand_grabbed = false


func _check_for_use(event: InputEvent):
	if event is InputEventMouseButton:
		if event.button_index == BUTTON_LEFT:
			hand_grabbed = event.is_pressed() and event.alt
		if event.button_index == BUTTON_MIDDLE:
			hand_grabbed = event.is_pressed()
	
	if event is InputEventMouseMotion:
		return hand_grabbed
	
	return false


func _run(event: InputEvent):
	SummerDay.canvas_state.canvas_transform.origin += event.relative
