2

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

The Tom
  • 2,790
  • 6
  • 29
  • 33
  • Do you know how to get the mouse position and hit test the bezier? What specifically is the problem? – Wain Dec 17 '13 at 17:42
  • I tried adding the mouseMoved method but it doesn't get triggered at all. So I figure I'm missing something but I don't know what. I do know however how to get the location in view when mouseDown is triggered. – The Tom Dec 17 '13 at 17:52

1 Answers1

4

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.

Wain
  • 118,658
  • 15
  • 128
  • 151