@@ -1128,40 +1128,29 @@ MdPanelRef.prototype._createPanel = function() {
1128
1128
1129
1129
/**
1130
1130
* Adds the styles for the panel, such as positioning and z-index.
1131
- * @return {!angular.$q.Promise }
1131
+ * @return {!angular.$q.Promise<MdPanelRef> }
1132
1132
* @private
1133
1133
*/
1134
1134
MdPanelRef . prototype . _addStyles = function ( ) {
1135
- this . _panelContainer . css ( 'z-index' , this . _config [ 'zIndex' ] ) ;
1136
- this . _panelEl . css ( 'z-index' , this . _config [ 'zIndex' ] + 1 ) ;
1137
-
1138
-
1139
- if ( this . _config [ 'fullscreen' ] ) {
1140
- this . _panelEl . addClass ( '_md-panel-fullscreen' ) ;
1141
- return this . _$q . resolve ( this ) ; // Don't setup positioning.
1142
- }
1143
-
1144
- return this . _configurePosition ( ) ;
1145
- } ;
1146
-
1147
-
1148
- /**
1149
- * Configure the position of the panel.
1150
- * @return {!angular.$q.Promise }
1151
- * @private
1152
- */
1153
- MdPanelRef . prototype . _configurePosition = function ( ) {
1154
- var positionConfig = this . _config [ 'position' ] ;
1155
- if ( ! positionConfig ) {
1156
- return this . _$q . resolve ( this ) ;
1157
- }
1158
-
1159
1135
var self = this ;
1160
1136
return this . _$q ( function ( resolve ) {
1137
+ self . _panelContainer . css ( 'z-index' , self . _config [ 'zIndex' ] ) ;
1138
+ self . _panelEl . css ( 'z-index' , self . _config [ 'zIndex' ] + 1 ) ;
1139
+
1140
+ if ( self . _config [ 'fullscreen' ] ) {
1141
+ self . _panelEl . addClass ( '_md-panel-fullscreen' ) ;
1142
+ return resolve ( self ) ; // Don't setup positioning.
1143
+ }
1144
+
1145
+ var positionConfig = self . _config [ 'position' ] ;
1146
+ if ( ! positionConfig ) {
1147
+ return resolve ( self ) ; // Don't setup positioning.
1148
+ }
1149
+
1161
1150
// Wait for angular to finish processing the template, then position it
1162
- // correctly. This is necessary so that the panel will have a defined
1163
- // height and width.
1164
- return self . _$rootScope [ '$$postDigest' ] ( function ( ) {
1151
+ // correctly. This is necessary so that the panel will have a defined height
1152
+ // and width.
1153
+ self . _$rootScope [ '$$postDigest' ] ( function ( ) {
1165
1154
self . _panelEl . css ( 'top' , positionConfig . getTop ( self . _panelEl ) ) ;
1166
1155
self . _panelEl . css ( 'bottom' , positionConfig . getBottom ( self . _panelEl ) ) ;
1167
1156
self . _panelEl . css ( 'left' , positionConfig . getLeft ( self . _panelEl ) ) ;
@@ -1171,7 +1160,7 @@ MdPanelRef.prototype._configurePosition = function() {
1171
1160
var prefixedTransform = self . _$mdConstant . CSS . TRANSFORM ;
1172
1161
self . _panelEl . css ( prefixedTransform , positionConfig . getTransform ( ) ) ;
1173
1162
1174
- return resolve ( self ) ;
1163
+ resolve ( self ) ;
1175
1164
} ) ;
1176
1165
} ) ;
1177
1166
} ;
@@ -1960,10 +1949,14 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
1960
1949
this . _fixBounds ( panelEl ) ;
1961
1950
var animationOptions = { } ;
1962
1951
var reverseAnimationOptions = { } ;
1963
- var openFrom = animator . toTransformCss ( "" ) ;
1964
- var openTo = animator . toTransformCss ( "" ) ;
1965
- var closeFrom = animator . toTransformCss ( "" ) ;
1966
- var closeTo = animator . toTransformCss ( "" ) ;
1952
+
1953
+ // Include the panel transformations when calculating the animations.
1954
+ var panelTransform = panelEl [ 0 ] . style . transform || '' ;
1955
+
1956
+ var openFrom = animator . toTransformCss ( panelTransform ) ;
1957
+ var openTo = animator . toTransformCss ( panelTransform ) ;
1958
+ var closeFrom = animator . toTransformCss ( panelTransform ) ;
1959
+ var closeTo = animator . toTransformCss ( panelTransform ) ;
1967
1960
1968
1961
switch ( this . _animationClass ) {
1969
1962
case MdPanelAnimation . animation . SLIDE :
@@ -1976,23 +1969,33 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
1976
1969
reverseAnimationOptions = {
1977
1970
transitionInClass : '_md-panel-animate-leave'
1978
1971
} ;
1979
- openFrom = animator . toTransformCss ( animator . calculateSlideToOrigin (
1980
- panelEl , this . _openFrom ) || "" ) ;
1981
- closeTo = animator . toTransformCss ( animator . calculateSlideToOrigin (
1982
- panelEl , this . _closeTo ) ) ;
1972
+
1973
+ var openSlide = animator . calculateSlideToOrigin (
1974
+ panelEl , this . _openFrom ) || '' ;
1975
+ openFrom = animator . toTransformCss ( openSlide + ' ' + panelTransform ) ;
1976
+
1977
+ var closeSlide = animator . calculateSlideToOrigin (
1978
+ panelEl , this . _closeTo ) || '' ;
1979
+ closeTo = animator . toTransformCss ( closeSlide + ' ' + panelTransform ) ;
1983
1980
break ;
1981
+
1984
1982
case MdPanelAnimation . animation . SCALE :
1985
1983
animationOptions = {
1986
1984
transitionInClass : '_md-panel-animate-enter'
1987
1985
} ;
1988
1986
reverseAnimationOptions = {
1989
1987
transitionInClass : '_md-panel-animate-scale-out _md-panel-animate-leave'
1990
1988
} ;
1991
- openFrom = animator . toTransformCss ( animator . calculateZoomToOrigin (
1992
- panelEl , this . _openFrom ) || "" ) ;
1993
- closeTo = animator . toTransformCss ( animator . calculateZoomToOrigin (
1994
- panelEl , this . _closeTo ) ) ;
1989
+
1990
+ var openScale = animator . calculateZoomToOrigin (
1991
+ panelEl , this . _openFrom ) || '' ;
1992
+ openFrom = animator . toTransformCss ( openScale + ' ' + panelTransform ) ;
1993
+
1994
+ var closeScale = animator . calculateZoomToOrigin (
1995
+ panelEl , this . _closeTo ) || '' ;
1996
+ closeTo = animator . toTransformCss ( closeScale + ' ' + panelTransform ) ;
1995
1997
break ;
1998
+
1996
1999
case MdPanelAnimation . animation . FADE :
1997
2000
animationOptions = {
1998
2001
transitionInClass : '_md-panel-animate-enter'
@@ -2001,6 +2004,7 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
2001
2004
transitionInClass : '_md-panel-animate-fade-out _md-panel-animate-leave'
2002
2005
} ;
2003
2006
break ;
2007
+
2004
2008
default :
2005
2009
if ( angular . isString ( this . _animationClass ) ) {
2006
2010
animationOptions = {
@@ -2019,6 +2023,9 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
2019
2023
transitionOutClass : this . _animationClass [ 'open' ]
2020
2024
} ;
2021
2025
}
2026
+
2027
+ // TODO(ErinCoughlan): Combine the user's custom transforms with the
2028
+ // panel transform.
2022
2029
}
2023
2030
2024
2031
var self = this ;
0 commit comments