Implemented ruler snapping