Fix erratic dragging on /add_time page by refactoring mapcalc.closestPointOnPolyline.