Skip to content

snapEdges()

function snapEdges(
candidates,
targets,
tolerance
):
| {
offset: number;
position: number;
}
| null;

Finds the closest target within tolerance for any of the candidate edges. Returns the offset to apply and the matched position.

Parameter Type
candidates number[]
targets number[]
tolerance number

| { offset: number; position: number; } | null