Skip to main content

calculateClosestEdge()

calculateClosestEdge(over, active): "top" | "bottom"

Calculates which edge of a drop target is closest to the dragged item

Parameters

over

The drop target from dnd-kit

Over | null

active

Active

The active dragged item from dnd-kit

Returns

"top" | "bottom"

'top' if the dragged item's center is above the midpoint, 'bottom' otherwise