sproutcore/sproutcore — pull request #1103 by nicolasbadia (2013-09-29 09:20:22+00:00)
Title: Fixes conflict when adjusting a layout while a transition is setup

This PR fixes https://github.com/sproutcore/sproutcore/pull/1063 and also includes https://github.com/sproutcore/sproutcore/pull/1100

When a view is render, we may want to adjust the size of the view depending of its content. This is an issue if a transition is defined because the initial layout of the view (and not the one that will be adjusted) will be use to run the transition.

To solve this, the idea is to run the animation (this is where the frames of the transition are defined) only on the next runloop (this is why I added some `invokeNext`).

But the animation still needs to be setup during the current runloop. For example, if we had defined a fadeIn animation, the view needs to be hide before being shown again by the animation. So the initial layout, `_preTransitionLayout`, which is also the final one, needs to be save before the setup.

This means that when we adjust the layout of the view we also need to adjust `_preTransitionLayout`, which is why there is the `_adjustTransitionIfNeeded` method. But not when the animation is being setup, which is why there is also a `_transitionIsSetup` flag.

Let me know if you can think of a better way to fix this or if you have better names for the news methods I've created.