27 lines
615 B
GDScript
27 lines
615 B
GDScript
extends SummerDayTool
|
|
class_name SummerDayHandCanvasTool
|
|
|
|
|
|
func _init():
|
|
priority = 1
|
|
|
|
|
|
var hand_grabbed = false
|
|
|
|
|
|
func _check_for_use(event: InputEvent, tool_context: SummerDayToolContext):
|
|
if event is InputEventMouseButton:
|
|
if event.button_index == BUTTON_LEFT:
|
|
hand_grabbed = event.is_pressed() and event.control
|
|
if event.button_index == BUTTON_MIDDLE:
|
|
hand_grabbed = event.is_pressed()
|
|
|
|
if event is InputEventMouseMotion:
|
|
return hand_grabbed
|
|
|
|
return false
|
|
|
|
|
|
func _run(event: InputEvent, tool_context: SummerDayToolContext):
|
|
tool_context.canvas_state.canvas_transform.origin += event.relative
|