Class DndCollisions
- Namespace
- Velvet
- Assembly
- Velvet.Docs.dll
The built-in collision strategies: RectIntersection, ClosestCenter,
ClosestCorners and PointerWithin. Each is a pure function over a
DndCollisionQuery (no panel access) returning every colliding droppable ranked best
first, with the same ranking value, rounding and tie order as the algorithm of the same name in
@dnd-kit/core (packages/core/src/utilities/algorithms), computed in double precision
from the rects' float edges as it computes in JavaScript numbers. The context takes the first
entry as the over target. None of them consider occlusion; all are rect-based only.
public static class DndCollisions
- Inheritance
-
objectDndCollisions
Fields
- ClosestCenter
Every droppable, ranked by the distance from its center to the active rect's center, nearest first — the forgiving strategy sortable lists and coarse grids want. Equal distances keep registration order. A rect with a NaN edge is left out.
- ClosestCorners
Every droppable, ranked by the mean distance between its four corners and the active rect's corresponding four (top-left, top-right, bottom-left, bottom-right), rounded to four decimals, nearest first. Equal values keep registration order. A rect with a NaN edge is left out.
- PointerWithin
Droppables whose rect contains the pointer, edges included, ranked by the mean distance from the pointer to the rect's four corners, rounded to four decimals, smallest first. Equal values keep registration order. A query with no pointer collides with nothing.
- RectIntersection
Droppables overlapping the active rect, ranked by intersection ratio —
intersection / (droppable + active - intersection), rounded to four decimals — greatest first. Rects that only touch at an edge or corner do not collide. Equal ratios keep registration order.