I decided to use Core Animation for the shadows and simply have my
control draw it's content. One particular view is a calendar which
selects a day in mouseDown:, the code works perfectly without Core
Animation layer backing enabled; however when I enable it random
days are selected instead of the one I intended.
I discovered that the reason behind this was that I got the mouse
down point using convertPointFromBase:, changing this to use
convertPoint:fromView: with a nil view argument (I assumed this was
the same as sending my previous message) works as expected.
I believe your assumption is incorrect. convertPoint:fromView:NIL
converts from window coordinates to view coordinates.
convertPointFromBase: converts from base coordinates to view
coordinates, and base coordinates are defined by the CA layer.
Here's the relevant quote from the Leopard Developer Release Notes:
Pixel Alignment and Transforming View Coordinates To and From "Base"
Space (Updated since WWDC 2007 Seed)
In Leopard, NSView provides a new set of methods that should be used
when performing pixel-alignment of view content. They provide the
means to transform geometry to and from a "base" coordinate space
that is pixel-aligned with the backing store into which the view is
For conventional view rendering, in which a view hierarchy is drawn
flattened into a window backing store, this "base" space is the same
as the coordinate system of the window, and the results of using
these new methods are the same as converting geometry to and from
view "nil" using the existing -covert[Rect/Point/Size]:[to/
Views that are rendered into backing layers in a Core Animation
layer tree, however, have their own individual backing stores, which
may be aligned such that window space is not necessarily the
appropriate coordinate system in which to perform pixel alignment
Mouse event locations are in window coordinates, so passing them to
convertPointFromBase will accidentally work with no layer backing, but
fail with layer backing turned on. As you saw.
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