working example of snapping to closest line