change approach. Now cursor position is a linear function of distance