DragDropManager is the core class that orchestrates all drag and drop operations. It manages entities, coordinates sensors and modifiers, handles collision detection, and dispatches events throughout the drag lifecycle.
Constructor
Creates a new drag and drop manager instance.DragDropManagerInput<T, U>
Configuration object for the manager.
extends Draggable
Type parameter for draggable entities.
extends Droppable
Type parameter for droppable entities.
Properties
actions
DragActions<T, U, DragDropManager<T, U>>
Actions that can be performed during drag operations.
collisionObserver
CollisionObserver<T, U>
Observes and manages collision detection between draggable and droppable entities.
dragOperation
DragOperation<T, U>
Tracks the current drag operation state and metadata.
monitor
DragDropMonitor<T, U, DragDropManager<T, U>>
Monitors and emits drag and drop events.
registry
DragDropRegistry<T, U, DragDropManager<T, U>>
Registry that manages draggable and droppable entities, as well as sensors, modifiers, and plugins.
renderer
Renderer
Handles rendering of drag and drop visual feedback.
plugins
Plugin<any>[]
Gets or sets the list of active plugins.
modifiers
Modifier<any>[]
Gets or sets the list of active modifiers.
sensors
Sensor<any>[]
Gets or sets the list of active sensors.
Methods
destroy()
Cleans up resources and stops any active drag operations.void
No return value.
- Stops any active drag operation (marking it as canceled)
- Destroys all active modifiers
- Unregisters all entities
- Cleans up the collision observer
DragActions
Theactions property provides methods for controlling drag operations:
start()
Starts a new drag operation.object
required
Configuration for the drag operation.
AbortController
An AbortController that can be used to cancel the drag operation.
Errorif no drag source is setErrorif another operation is already active
beforedragstart(preventable) - Before initializationdragstart- After initialization completes
move()
Moves the dragged entity to a new position.object
required
Configuration for the move operation.
by or to should be provided.
Events dispatched:
dragmove(preventable ifcancelableis true)
stop()
Stops the current drag operation.object
Configuration for stopping the operation.
dragend- Withsuspend()method for async cleanup
setDragSource()
Sets the source of the drag operation.T | UniqueIdentifier
required
The draggable entity or its unique identifier.
setDropTarget()
Sets the target of the drop operation.UniqueIdentifier | null | undefined
required
The unique identifier of the droppable entity, or null/undefined to clear the target.
Promise<boolean>
A promise that resolves to true if the
dragover event was prevented.dragover(preventable) - If status is dragging