Skip to main content

snap

Function snap 

pub fn snap(
    moving: Placement,
    others: &[Placement],
    threshold: i32,
) -> Placement
Expand description

Pull moving magnetically onto nearby lines of others: its left or right edge onto either of their edges, its centre onto their centre, and likewise top, middle and bottom. Each axis snaps on its own to the closest line within threshold; beyond it the display stays exactly where it was put.