Path contains mouse position


Is there any method/api or technique one can use, to determine if a point (such as a mouse position) lies on or near a path, such as a non-closed path as a line, or an arrow?

I understand there is Path::contains but it refers to closed paths and I need to pinpoint a wavy line.

I’d appreciate anything!



Just turn the path into a stroke, and then see if the point is inside that.


I’m sorry, but how do I do that? Is “stroke” a class… or what? The only reference to strokes is in Graphics.strokePath
Am I missing something?


Use the PathStrokeType class.


Very nice. Works great. Thank you!