• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Size of Core Animation Layer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Size of Core Animation Layer
      • From: vincent habchi <email@hidden>
  • Prev by Date: Re: CALayer maybe silly question
  • Next by Date: Re: Uncaught exceptions not terminating my app
  • Previous by thread: Re: 10.6 : Class xxx does not implement the 'NSWindowDelegate' protocol
  • Next by thread: Re: Size of Core Animation Layer
  • Index(es):
    • Date
    • Thread