title: How to select a single Curve in a Path in Paper.js?
body: <p>I need to distinctly select a single Curve of a clicked Path, how can I do that? </p>
  
  <p>For example, in <a href="http://sketch.paperjs.org/#S/dVJbS8MwFP4rh76shdHNeYOJT/oqCAo+OB/S5nSNS3NKcroxxv67J+tuoiu0JPmunHSTONVgMk3eFshlnQyTknTcL5WHZm2NQ3gEhyt4VVynuwUZx+nVeDwE+WTZw8zPXE/NA3ta4BNZ8iIbeNSDP+iH0VwLeheRM1RpfeY/OfpfptxFyv2eMhpBQIslAzm7Bq5NgLLzS4QCeYXoQBUkO+W0nFhaCX3eoONwMeD6GAAXOTcT4Uxu9yXiW3WuZENOerxQF/CZVi7FpSRlm4iDPLVhmUCrWvR56+lbaudy9o6Be2reRvfswC/JBbKYW5r/i5sqFfnJf5+RG8Ym78eCWhLZd3jgbAFtQPilkSE6YtDYa4ybg7IWqIgNA1RyraVV3vD6XHW43lNOpcT6GBQXW/m1Co9qsSsekunn1/YH" rel="nofollow noreferrer">this sketch</a> we can select a whole path when clicked on it: </p>
  
  <p><a href="https://i.stack.imgur.com/HJrDm.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HJrDm.png" alt="enter image description here"></a></p>
  
  <p>Currently I can detect the curve (not sure if it is the appropriate approach, anyway): </p>
  
  <pre><code>..onMouseDown = (event) ~&gt;
      hit = scope.project.hitTest event.point
      if hit?item
          # select only that specific segment
          curves = hit.item.getCurves!
          nearest = null
          dist = null
          for i, curve of curves
              _dist = curve.getNearestPoint(event.point).getDistance(event.point)
              if _dist &lt; dist or not nearest?
                  nearest = i
                  dist = _dist
  
          selected-curve = curves[nearest]
              ..selected = yes
  </code></pre>
  
  <p>But whole path is selected anyway:</p>
  
  <p><a href="https://i.stack.imgur.com/CCmnW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/CCmnW.png" alt="enter image description here"></a></p>
  
  <p>What I want to achieve is something like this: </p>
  
  <p><a href="https://i.stack.imgur.com/R8GfO.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/R8GfO.png" alt="enter image description here"></a></p>