DnD State Manager
Overview
The DndStateManager is a small internal helper that keeps track of drag state for a single drag interaction context.
Each drag context (such as a BaseDropZone or DragListComponent) owns its own instance of the state manager, allowing them to operate independently.
It provides observable streams for the current drop state, instruction feedback, and closest edge, and exposes simple update methods used internally by drag and drop zones.
import { DndStateManager } from 'ngx-builder-dnd';
API Reference
Properties
| Name | Description |
|---|---|
dropTarget: DragState | Returns the current drop state value. |
instruction: Instruction | null | Returns the current instruction. |
closestEdge: Edge | null | Returns the current closest edge. |
Observables
| Name | Description |
|---|---|
dropTarget$: Observable<DragState> | Emits the current drag state for the drop target. |
instruction$: Observable<Instruction | null> | Emits the current drag Instruction, or null when no instruction exists. |
closestEdge$: Observable<Edge | null> | Emits the closest edge during dragging, or null otherwise. |
Methods
DropZone overrides some of the default behaviors defined in BaseDropZone. These changes tailor the class for drop-only tree items:
| Method | Description |
|---|---|
updateInstruction(instruction: Instruction | null): void | Updates the current instruction emitted during a drag interaction. |
updateDropTarget(state: DragState): void | Updates the drop target state. |
updateClosestEdge(Edge | null): void | Updates the closest hovered edge. |
destroy(): void | Completes all internal subjects and cleans up resources. |
See Also
- Base Drop Zone - Provides shared logic for drop-zone implementations.
- Drag List Component - Renders a draggable list container.