Skip to content

SnappingConfig

since v0.8.0

Configuration for node dragging behavior.

computeSnapForNodeDrag: (node) => null | Size

Computes the snap size for a node while dragging. If null is returned, a default snap size will be used. If computeSnapForNodeDrag is used, it takes precedence over defaultDragSnap.

Node

The node to compute the snap size for dragging.

null | Size

The snap size for the node while dragging, or null.

() => null

computeSnapForNodeSize: (node) => null | Size

Computes the snap size for a node while resizing. If null is returned, a default snap size will be used.

Node

The node to compute the snap size for resizing.

null | Size

The snap size for the node while resizing, or null.

() => null

computeSnapOffsetForNodeSize: (node) => null | Size

Computes the snap offset for a node while resizing. The snapped size follows the sequence offset + n * snap per axis, so a node with a 60px header snapping every 50px can snap to 60, 110, 160, … instead of 50, 100, 150, … If null is returned, defaultResizeSnapOffset is used. If computeSnapOffsetForNodeSize is used, it takes precedence over defaultResizeSnapOffset.

Node

The node to compute the snap offset for resizing.

null | Size

The snap offset for the node while resizing, or null.

() => null

1.3.0


defaultDragSnap: Size

The default snap size for node dragging. If computeSnapForNodeDrag is used, it takes precedence over this value.

{ width: 10, height: 10 }

defaultResizeSnap: Size

The default snap size for node resizing.

{ width: 10, height: 10 }

defaultResizeSnapOffset: Size

The default snap offset for node resizing. The snapped size follows the sequence offset + n * snap per axis (see computeSnapOffsetForNodeSize). If computeSnapOffsetForNodeSize is used, it takes precedence over this value.

{ width: 0, height: 0 }

1.3.0


shouldSnapDragForNode: (node) => boolean

Determines if a node should snap to grid while dragging.

Node

The node being dragged.

boolean

True if the node should snap to grid, false otherwise.

() => false

shouldSnapResizeForNode: (node) => boolean

Determines if a node should snap to grid while resizing.

Node

The node being resized.

boolean

True if the node should snap to grid, false otherwise.

() => false