On Jan 24, 2012, at 5:52 PM, David Duncan wrote:

>> Can anyone explain what's going on?
> 
> 
> The frame is an entirely synthesized property, based on the bounds, position, 
> anchorPoint and transform of a given layer. When you set the latter 
> parameters, the frame updates automatically but when you set the frame Core 
> Animation has to derive the new bounds & position values by applying the 
> anchorPoint and inverse transform. Thus when you set the frame of a layer 
> while it is under a transform, the inverse transform is first applied to get 
> a new size, then that size updates the bounds size.

Short of guessing the order of operations and doing the matrix math myself, I 
have only intuition to tell me that the size ending up at {1000, 0} is… odd. 
I'm hesitant to say wrong, but in my head I don't see who the inverse x the 
frame = {1000, 0}. 



> Moral of the story is that when a layer is transformed (or may be) you should 
> only manipulate its position and bounds. Stay far far away from the frame 
> property, as its just a bag of hurt.

So let me just throw this out there. Is there some reason it couldn't be 
changed so that


layer.frame = (0, 0, 100, 100);
layer.transform = xfm;
...
layer.frame = (0, 0, 200, 200);


is equivalent to:


layer.frame = (0, 0, 100, 100);
layer.transform = xfm;
…
layer.transform = identity;
layer.frame = (0, 0, 200, 200);
layer.transform = xfm;


The latter behaves nice and predictably, and if everyone is avoiding the "bag 
full of hurt" does it actually break anything?  *wishful thinking*




--
Seth Willits

_______________________________________________

Cocoa-dev mailing list ([email protected])

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

This email sent to [email protected]

Reply via email to