Fix snapping near edges