ventListener('touchmove', e => {
    onMove(e.touches[0]);
  });
  ctx.canvas.addEventListener('touchend', e => {
    onEnd(e.touches[0]);
  });
  ctx.canvas.addEventListener('mousedown', onStart);
  ctx.canvas.addEventListener('mouseup', onEnd);
  ctx.canvas.addEventListener('mousemove', onMove);

  function onStart(e) {
    moveLastPos = getRelativeMousePosition(ctx.canvas, e);
    const ndx = getClosestPoint(points, moveLastPos);
    const distSq = v2.distanceSq(points[ndx], moveLastPos);
    moveNdx = (