Skip to content
  • Jonathan Wilkes's avatar
    snap to closest grid line until we've travelled half the distance to the next · fc2f67c4
    Jonathan Wilkes authored
    This gives what is to me smoother and more predictable snapping motion with
    respect to the current mouse position.
    
    For example-- imagine the grid cell size is 10 and the selected object under
    the mouse already has its top left corner aligned with vertical grid line #2.
    
    If I begin dragging that object to the left, within a single pixel of motion
    it will snap to vertical grid line #1 which is 9 pixels away from the
    object's current position.
    
    With this commit, the user must drag the object cellsize / 2 pixels before it
    snaps to a new position.
    
    To me this seems smoother as it rounds to the nearest grid line rather than
    to the grid line with the smallest coordinate value.
    fc2f67c4