SummerDay/addons/summer_day/tools/canvas/hand.gd
2022-01-03 23:53:28 +01:00

29 lines
561 B
GDScript

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