Size of Core Animation Layer
Size of Core Animation Layer
- Subject: Size of Core Animation Layer
- From: K.Darcy Otto <email@hidden>
- Date: Wed, 27 Jan 2010 23:43:32 -0800
I'm having some difficulties translating between a Core Animation
layer size, and the size of that layer in the NSView subclass I'm
using. I can identify the layer from a mouseclick without difficulty,
using the following code:
-(void)mouseDown:(NSEvent *)theEvent
{
NSPoint translated = [window convertScreenToBase:[NSEvent
mouseLoctaion];
CGPoint point = NSPointToCGPoint(translated);
CALayer *rootLayer = [[window contentView] layer]; // give me the
background layer of the window
id hitLayer = [rootLayer hitTest:point]; // gives me the CALayer that
was clicked
...
}
But now, I want to see what the size of the hitLayer is, in the
window's coordinate system. The following doesn't work:
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.
_______________________________________________
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