Which CA Layer am I dragging over?
Which CA Layer am I dragging over?
- Subject: Which CA Layer am I dragging over?
- From: "K. Darcy Otto" <email@hidden>
- Date: Thu, 28 Jan 2010 09:26:16 -0800
On 28-Jan-10, at 2:47 AM, vincent habchi wrote:
Le 28 janv. 2010 à 08:43, K.Darcy Otto a écrit :
NSRect rect = NSRectFromCGRect([hitLayer frame]);
float width = rect.size.width;
That is, it returns a width, but not the width in the current
window coordinates. Any ideas? Thanks.
What do you mean by "not the width in the current window
coordinates"? By definition, a width is coordinate independent, as
long as your underlying metric space remains the same (thanks to
Einstein).
Vincent
Maybe I'm going at this the wrong way. I've got a bunch of CA layers
with images, and I'm dragging with the mouse. The question I would
like to answer is: which CA layer is the mouse currently being dragged
over?
The solution I am pursuing is as follows:
1. From -mouseDragged, set up a series of NSTrackingAreas that
correspond to each CA layer that I'm interested in.
2. The NSTrackingAreas will trigger -mouseEntered and -mouseExited for
the CA layers
3. Use the NSEvent data from -mouseEntered to determine the current
screen position and -hitTest to determine layer
The problem is that I'm having difficulty setting up the
NSTrackingAreas. Given CA layer x, I want to discover the position of
x in the window so I can set up the tracking area. Is this the right
way to solve this problem? If so, how do I get the rect for layer x?_______________________________________________
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