SummerDay/addons/summer_day/tools/canvas/hand.gd

29 lines
561 B
GDScript3
Raw Normal View History

2022-01-03 23:53:28 +01:00
tool
2021-11-21 11:46:04 +01:00
extends SummerDayTool
class_name SummerDayHandCanvasTool
func _init():
priority = 1
2021-11-27 11:27:42 +01:00
modifier_layer = 1
2021-11-27 09:16:34 +01:00
var hand_grabbed = false
2022-01-02 16:42:55 +01:00
func _check_for_use(event: InputEvent):
2021-11-27 09:16:34 +01:00
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT:
hand_grabbed = event.is_pressed() and event.alt
2021-11-27 09:16:34 +01:00
if event.button_index == BUTTON_MIDDLE:
hand_grabbed = event.is_pressed()
if event is InputEventMouseMotion:
return hand_grabbed
return false
2022-01-02 16:42:55 +01:00
func _run(event: InputEvent):
SummerDay.canvas_state.canvas_transform.origin += event.relative