Re: How to detect if mouse on border of view
Re: How to detect if mouse on border of view
- Subject: Re: How to detect if mouse on border of view
- From: Graham Cox <email@hidden>
- Date: Fri, 19 Feb 2010 15:53:43 +1100
On 19/02/2010, at 3:44 PM, Mazen M. Abdel-Rahman wrote:
> I was wondering if there is a straight forward away to know if the mouse is on the border of a view? I know how to detect if the mouse enters a view area by using NSTrackingArea - but how can I tell if the mouse is on a border? I would like to replicate iCal's behavior where a user can modify an event on the calendar by clicking on the edge of the appt. rectangle and dragging it.
The "border" of a view doesn't really exist - it's infinitely narrow.
What you really want is to detect that the mouse is inside the view but within a pixel or two of the edge. That is easy to work out by comparing the mouse point against the bounds to whatever degree of precision you want (I'd suggest not making it too precise, as it will be hard to hit - 4 pixels minimum is probably OK).
--Graham
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden