Add getHandleType() and nearest point snapping function.