Detect mouse over nsbezierpath

444 views Asked by At

I'm a starting developer and I have this single window Mac application with a custom view inside. Inside that custom ceix I have defined multiple nsbezierpath. Each nsbezierpath represents a region of my map so they are not rectangular at all.

What I would like to have is a way to detect when my mouse enter a nsbezierpath so that I could display the name of the region over which the mouse is hovering.

I can't seem to find where to start, any ideas ?

Thanks for looking into my problem

1

There are 1 answers

0
Wain On BEST ANSWER

Set up a tracking area to detect mouse movement (NSTrackingArea). Be sure that the mouse location is in the view coordinate system, then use the location in a call to containsPoint: on each bezier path to determine which ones the mouse is over.