CheckConstraints
@whittakertech/mosaic / checkConstraints
Function: checkConstraints()
function checkConstraints(input): ConstraintResult;Defined in: constraints.ts:160
Evaluates whether a drop operation is permitted.
Applies MosaicJS’s built-in, deterministic constraints to a proposed drag-and-drop interaction.
A drop is permitted when the target is the dragged element itself (a no-op
self-drop), when it matches selectors.node, or — when configured — when it
matches selectors.dropTarget. A target matching neither is rejected with
reason "invalid-target". When selectors.group is configured, a drop
whose target resolves to a different group than the dragged node’s own is
rejected with reason "group-boundary" unless crossGroupDrag is set (#13).
When container/depth are supplied (#12), a drop that would nest the
dragged node inside itself or one of its own descendants is rejected with
reason "circular-nesting", and a drop exceeding maxNestingDepth is
rejected with reason "nesting-depth-exceeded".
Parameters
input
The ConstraintInput describing the proposed drop
Returns
A ConstraintResult indicating whether the drop is allowed
Remarks
Constraint evaluation is synchronous and side-effect free. This function
covers MosaicJS’s built-in constraints only. As of v0.4, custom
user-defined constraints are also supported — see
MosaicOptions.constraints — and are evaluated by
DragController after this function’s built-in checks pass, using the
exact same ConstraintInput shape, so a user constraint has an
identical signature and calling convention to this one.