code: function _curveClick(e) {
          var self = e.target,
              bezierEditor = self.bezierEditor;
  
          var curveBoundingBox = bezierEditor._getCurveBoundingBox(),
              left = curveBoundingBox.left,
              top  = curveBoundingBox.top,
              x    = e.pageX - left,
              y    = e.pageY - top - HEIGHT_ABOVE,
              $P1  = $(bezierEditor.P1),
              $P2  = $(bezierEditor.P2);
  
          // Helper function to calculate distance between 2-D points
          function distance(x1, y1, x2, y2) {
              return Math.sqrt(Math.pow(x1 - x2, 2) + Math.pow(y1 - y2, 2));
          }
  
          // Find which point is closer
          var distP1 = distance(x, y, parseInt($P1.css("left"), 10), parseInt($P1.css("top"), 10)),
              distP2 = distance(x, y, parseInt($P2.css("left"), 10), parseInt($P2.css("top"), 10)),
              $P     = (distP1 < distP2) ? $P1 : $P2;
  
          $P.css({
              left: x + "px",
              top:  y + "px"
          });
          $P.get(0).focus();
  
          // update coords
          bezierEditor._cubicBezierCoords = bezierEditor.bezierCanvas
              .offsetsToCoordinates(bezierEditor.P1)
              .concat(bezierEditor.bezierCanvas.offsetsToCoordinates(bezierEditor.P2));
  
          bezierEditor._commitTimingFunction();
          bezierEditor._updateCanvas();
      }
docs: Event handlers 
  Handle click in <canvas> element
  
  @param {Event} e Mouse click event