I am having trouble understanding how Core Animation
geometry interacts with NSView geometry in a
layer-hosting situation.

I have an NSView that hosts a root layer, and it has
two sublayers that I need the user to be able to drag
each around. I want to be able to convert a mouse
coordinate into a point suitable for -hitTest:'ing on
my root layer. I can convert from the mouse
coordinates to the view's coordinates, but then I am
not sure how to proceed. The convertPoint:fromView:
method of NSView translates into the bounds rectangle,
which is distinct from the view's frame. CALayers
don't have this bounds/frame distinction, and I'm not
sure whether the view's *frame* or it's *bounds* get
applied to the hosted layer.

I looked at how GeekGameBoard does it:
    CGPoint where = NSPointToCGPoint([self
convertPoint: locationInWindow fromView: nil]);
    where = [_gameboard convertPoint: where fromLayer:
self.layer];
    CALayer *layer = [_gameboard hitTest: where];

...which is straightforward enough BUT when I use
Quartz Debug to double the scale factor, GeekGameBoard
breaks, as if mouse movements/locations were halved.
How do I convert points between these coordinate
spaces in a more savvy manner?

I think I get Core Animation's geometry within Core
Animation, but I still don't get how it relates to the
device and NSView geometry. Given the huge textures
Core Animation wants to make when I create sublayers
on a layer with a shrinking transform, it almost seems
that 1 unit always corresponds to 1 pixel. How does
Core Animation's geometry relate to NSView's
resolution independent geometry?

thanks,
-natevw


      
____________________________________________________________________________________
¡Capacidad ilimitada de almacenamiento en tu correo!
No te preocupes más por el espacio de tu cuenta con Correo Yahoo!:              
        
http://correo.espanol.yahoo.com/
_______________________________________________

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]

Reply via email to