diff --git a/frameworks/core_foundation/views/view/statechart.js b/frameworks/core_foundation/views/view/statechart.js index 3e07e8b0f1..44e74775da 100644 --- a/frameworks/core_foundation/views/view/statechart.js +++ b/frameworks/core_foundation/views/view/statechart.js @@ -1639,35 +1639,35 @@ SC.CoreView.reopen( this._preTransitionFrame = this.get('borderFrame'); // Cache appropriate layout values. var layoutProperties = SC.get(transition, 'layoutProperties'); - // If the transition doesn't specify layoutProperties, cache all of them. - if (!layoutProperties) { - this._transitionLayoutCache = layout; - } - // Otherwise, cache just the specified ones. - else { + // If the transition specifies any layouts, cache them. + if (layoutProperties && layoutProperties.length) { this._transitionLayoutCache = {}; var i, prop, len = layoutProperties.length; for (i = 0; i < len; i++) { prop = layoutProperties[i]; - this._transitionLayoutCache[prop] = layout[prop] || null; + this._transitionLayoutCache[prop] = layout[prop] === undefined ? null : layout[prop]; } } }, /** @private */ _teardownTransition: function () { - // Some transition plugins will send a didTransitionIn/Out event even - // if the transition was cancelled. In either case, the transition can't - // be cleaned up multiple times. + // Make sure this isn't being called twice for the same transition. For example, + // some transition plugins will send a didTransitionIn/Out event even if the + // transition was cancelled. + + // If we have a hash of cached layout properties, adjust back to it. if (this._transitionLayoutCache) { - // Reset the layout with its cached values. this.adjust(this._transitionLayoutCache); - - // Clean up. - this._preTransitionLayout = null; - this._preTransitionFrame = null; - this._transitionLayoutCache = null; } + // Otherwise, just set the layout back to what it was. + else if (this._preTransitionLayout) { + this.set('layout', this._preTransitionLayout); + } + // Clean up. + this._preTransitionLayout = null; + this._preTransitionFrame = null; + this._transitionLayoutCache = null; }, /** @private Attempts to run a transition hide, ensuring any incoming transitions are stopped in place. */ diff --git a/frameworks/foundation/transitions/fade_transition.js b/frameworks/foundation/transitions/fade_transition.js index b59b70643e..581ffe3b2c 100644 --- a/frameworks/foundation/transitions/fade_transition.js +++ b/frameworks/foundation/transitions/fade_transition.js @@ -16,8 +16,8 @@ SC.mixin(SC.View, */ FADE_IN: { - /* @private Empty because we don't even need to reset opacity at the end: it ends up at 1. */ - layoutProperties: [], + /* @private */ + layoutProperties: ['opacity'], /** @private */ setup: function (view, options, inPlace) { diff --git a/frameworks/foundation/transitions/slide_transition.js b/frameworks/foundation/transitions/slide_transition.js index b9f8a995e0..11f38ffad7 100644 --- a/frameworks/foundation/transitions/slide_transition.js +++ b/frameworks/foundation/transitions/slide_transition.js @@ -16,6 +16,8 @@ SC.mixin(SC.View, */ SLIDE_IN: { + layoutProperties: ['top', 'bottom', 'left', 'right', 'height', 'width'], + /** @private Starts from outside of parent unless inPlace is true. */ setup: function (view, options, inPlace) { var parentView = view.get('parentView'), @@ -86,6 +88,8 @@ SC.mixin(SC.View, */ SLIDE_OUT: { + layoutProperties: ['top', 'bottom', 'left', 'right', 'height', 'width'], + /** @private Starts from current position. */ setup: function (view, options) { var viewFrame = view.get('borderFrame'),