ConstrainFunction
ConstrainFunction<
EL,E> = (desiredLoc,dragEl,constrainRect,size,currentPos,e) =>PointXY
Definition of a function that can be used to constrain the movement of an element that is being dragged. The function is given the "desiredLoc", which is the location the element would be moved to if not constrained, and it is expected to return either some other value, meaning place the element at that position, or null, meaning for the given desired location there is no preferred position and the element should not be moved.
Type Parameters
EL
EL
E
E
Parameters
desiredLoc
Position the element will be placed at if unconstrained
dragEl
EL
the element that is being dragged
constrainRect
size
The size of the element being dragged
currentPos
e
E
The event associated with this tick of the drag lifecycle.