Lab

Event Stacking

Hold a stack to take it whole, or move one with the arrow keys.

a four-day calendar whose events drag between slots. drop a card on another and they join as a pile, and the pile compresses to fit the cell it is in.

key insight: dragSnapToOrigin's spring has to match the layout spring exactly. drag writes an offset from a box the drop has already moved, and layout's own transform unwinds from the old cell, so the two compose to the pointer on the first frame and the target cell on the last. different springs send the card round a curve.

dragConstraints is a plain object of numbers and never the grid's ref. ref constraints put a ResizeObserver on the draggable and rewrite x/y on every resize, which strands a card that changed height mid-drop a cell away from where it was dropped.


More experiments