Q:

NSBezierPath containsPoint: is too sensitive when path not closed

I have a problem with the containsPoint method.  I draw some boxes and connectors between the boxes.  The connectors are basicly a single curve, based on a single curveToPoint:controlPoint1:controlPoint2 call.  When I now try to select this curve/path with the mouse then this is tricky to do.  The containsPoint: method seems to be very sensitive.  I tried to draw the line bigger (setLineWidth:), but that doesn't seem to help.  
Any ideas what I need to do differently? 

A:

For a CGPath, you can always create a closed path which is the contour of the stroked path using:
CGPathRef strokedPath = CGPathCreateCopyByStrokingPath(
    path,             // your original CGPathRef
    NULL,             // don't transform
    10.0,             // lineWidth
    kCGLineCapButt,   // lineCap    (default value)
    kCGLineJoinMiter, // lineJoin   (default value)
    0.0               // miterLimit
);

You can read more about path hit testing here (by Ole Begemann) and here (by Rob Napier).