This project contains a small drag & drop utility for Godot (C#). It provides reusable classes to: create draggable Controls (Draggable), show a drag preview (DragPreview), carry custom payloads (IDragData / DragData) and accept drops in target Controls (DropZone).
- The user begins dragging a
DraggableControl. - Godot calls
_GetDragData(Vector2 atPosition)on theDraggable. DraggablecallsConstructDragData()(must be overridden) to obtain anIDragDataand creates aDragDataWrapper(nodeAbsolutePath, dragData)returned as aVariant.- If
_dragPreviewSceneis assigned,Draggableinstantiates the preview, initializes it (InitPreview) and registers it with the drag system viaSetDragPreview(). Controlthat act asDropZoneinspect theVariantduring_CanDropData. If theVariantcontains aDragDataWrapperandCanDropDataAt(Vector2)returnstrue, theDropZonenotifies the originating Control (usingDraggable.OnDataDropped(IDragData)) through theNodePathin the wrapper.
