DragArea2D - Maybells/celeste-godot-utilities GitHub Wiki

Inherits: Area2D > CollisionObject2D > Node2D > CanvasItem > Node > Object

Description

Allows the user to move the parent object by dragging with the mouse.

Properties

type property default value
bool grab_centered True
bool restrict_x False
bool restrict_y False
bool dragging False
Vector2 drag_offset Null

Methods

return type method signature
null pick_up()
null put_down()

Signals

  • picked_up()

Called when parent starts following the mouse.


  • put_down()

Called when parent stops following the mouse.


Properties Descriptions

grab_centered

  • bool grab_centered
_Default_ `True`
If true, the dragged parent will move so that the mouse is at (0, 0). If false, the dragged parent will move so that the mouse retains the same relative position.

restrict_x

_Default_ `False`
Prevent dragging from moving parent along the x-axis

restrict_y

_Default_ `False`
Prevent dragging from moving parent along the y-axis

dragging

Whether the object is currently being dragged


drag_offset

The initial mouse position relative to the dragged object


Method Descriptions

pick_up

  • void pick_up()

Makes the parent start following the mouse.


put_down

  • void put_down()

Makes the parent stop following the mouse.


⚠️ **GitHub.com Fallback** ⚠️