thanks to everyone for your input. i've learned quite a lot! an interesting topic indeed :). thanks again.
On Thu, Jun 18, 2009 at 1:45 AM, WT<jrca...@gmail.com> wrote: > Hi David, > > On Jun 18, 2009, at 12:42 AM, David Duncan wrote: > >> Your solution works because you've scaled the coordinate system, so the >> translation needs to be scaled too (to get the change specified by the >> translation). > > Yes, that was the point I was trying to make on earlier posts, though in a > confusing way. My intuition was correct but I was too tired to understand > why. It's actually rather simple. A scaling is like changing the size of > your ruler or meter-stick (a smaller ruler produces larger lengths, so the > object you're measuring appears bigger, and vice-versa). The problem is, > though, that changing your ruler also changes how far you travel when you > apply a translation (changing your ruler *is* changing the scale of your > entire coordinate system). Thus, if you scale up, you also travel more, and > if you scale down, you travel less, and always by the same factor. So, in > order to travel the correct distance *and* make your object have a different > size, you need to divide the translation offset by the scale of your > scaling. The translation offset, of course, has to be the correct one, and > that was a vector from the object's center to the center of the screen. > > I am a bit confused now by something you said, though. > >> The issue with a translation is that it starts to confuse your >> expectations of the relationship between a view's center and the view's >> frame, because the center isn't altered by the transform, only the frame is. >> This is also why I recommend not using translations as part of your >> transform if they are not necessary, because then you look at the center of >> the view and you discover that it hasn't actually moved, yet your view is >> clearly not where it was before you set the transform. >> >> Of note at this point is that the view's center is in its super view's >> coordinate system, while the view's bounds is in its own coordinate system >> (and thus the origin is usually, but need not be, CGPointZero). > > If the center is in the superview's coordinate system, how can it not be > changed by a translation? In the view's own coordinate system, yes, I can > see that that's true, because then the center is half-way the bounds' width > and height, and those don't change under a translation. > > Wagner > _______________________________________________ > > 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/chunk1978%40gmail.com > > This email sent to chunk1...@gmail.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 arch...@mail-archive.com