DragDetector

Primitive #45

🔍 Problem it solves

Components need to detect when an element is dragged (e.g., draggable panels, sortable items), track drag movement, and handle drag boundaries. Raw mouse/touch events are complex (touch vs mouse, coordinate calculations).

✅ Solution

DragDetector tracks mouse/touch movement from start to end, provides current position, delta movement, and drag status (isDragging). It handles boundaries and returns a cleanup function. This demo uses the library’s implementation (with fallback) to make the box draggable anywhere on screen.

🧩 Used by components

DraggablePanel, SortableItem, Slider, ResizableEdge, FloatingWindow

🎮 Interactive demo