I have a custom NSButton
class and want to check (within viewWillDraw
) if the users current mouse location is inside the buttons frame.
I get the mouse position using NSEvent.mouseLocation()
, but that gives me an absolute NSPoint
in relation to the screen itself.
self.frame
(= NSButton.frame) instead returns some relative coordinates, refering to the buttons superview.
As a result, self.frame.contains(NSEvent.mouseLocation())
does not work and I have no idea how to solve that!
Appreciate any help!