mouseExited isn't called when mouse leaves trackingArea while scrolling

前端 未结 2 812
轻奢々
轻奢々 2020-12-07 15:19

Why mouseExited/mouseEntered isn\'t called when mouse exits from NStrackingArea by scrolling or doing animation?

I create code like this:

Mouse entered and e

2条回答
  •  萌比男神i
    2020-12-07 15:29

    @Michael offers a great answer, and solved my problem. But there is one thing,

    if (CGRectContainsPoint([self bounds], mouseLocation))
    {
        [self mouseEntered: nil];
    }
    else
    {
        [self mouseExited: nil];
    }
    

    I found CGRectContainsPoint works in my box, not CGPointInRect,

提交回复
热议问题