Usually, dragging is initiated by pressing down on a motion component with a drag prop
and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we
might want to initiate that dragging from a different component than the draggable one.
By creating a dragControls using the useDragControls hook, we can pass this into
the draggable component's dragControls prop. It exposes a start method
that can start dragging from pointer events on other components.
Usually, dragging is initiated by pressing down on a
motioncomponent with adragprop and moving it. For some use-cases, for instance clicking at an arbitrary point on a video scrubber, we might want to initiate that dragging from a different component than the draggable one.By creating a
dragControlsusing theuseDragControlshook, we can pass this into the draggable component'sdragControlsprop. It exposes astartmethod that can start dragging from pointer events on other components.