@@ -1337,6 +1337,12 @@ MdPanelRef.prototype._updatePosition = function(init) {
1337
1337
var positionConfig = this . config [ 'position' ] ;
1338
1338
1339
1339
if ( positionConfig ) {
1340
+ // Use the vendor prefixed version of transform.
1341
+ // Note that the offset should be assigned before the position, in
1342
+ // order to avoid tiny jumps in the panel's position, on slower browsers.
1343
+ var prefixedTransform = this . _$mdConstant . CSS . TRANSFORM ;
1344
+ this . panelEl . css ( prefixedTransform , positionConfig . getTransform ( ) ) ;
1345
+
1340
1346
positionConfig . _setPanelPosition ( this . panelEl ) ;
1341
1347
1342
1348
// Hide the panel now that position is known.
@@ -1360,10 +1366,6 @@ MdPanelRef.prototype._updatePosition = function(init) {
1360
1366
MdPanelPosition . absPosition . RIGHT ,
1361
1367
positionConfig . getRight ( )
1362
1368
) ;
1363
-
1364
- // Use the vendor prefixed version of transform.
1365
- var prefixedTransform = this . _$mdConstant . CSS . TRANSFORM ;
1366
- this . panelEl . css ( prefixedTransform , positionConfig . getTransform ( ) ) ;
1367
1369
}
1368
1370
} ;
1369
1371
@@ -2003,7 +2005,7 @@ MdPanelPosition.prototype._validateXPosition = function(xPosition) {
2003
2005
/**
2004
2006
* Sets the value of the offset in the x-direction. This will add to any
2005
2007
* previously set offsets.
2006
- * @param {string } offsetX
2008
+ * @param {string|function(MdPanelPosition): string } offsetX
2007
2009
* @returns {!MdPanelPosition }
2008
2010
*/
2009
2011
MdPanelPosition . prototype . withOffsetX = function ( offsetX ) {
@@ -2015,7 +2017,7 @@ MdPanelPosition.prototype.withOffsetX = function(offsetX) {
2015
2017
/**
2016
2018
* Sets the value of the offset in the y-direction. This will add to any
2017
2019
* previously set offsets.
2018
- * @param {string } offsetY
2020
+ * @param {string|function(MdPanelPosition): string } offsetY
2019
2021
* @returns {!MdPanelPosition }
2020
2022
*/
2021
2023
MdPanelPosition . prototype . withOffsetY = function ( offsetY ) {
@@ -2117,8 +2119,11 @@ MdPanelPosition.prototype.getActualPosition = function() {
2117
2119
MdPanelPosition . prototype . _reduceTranslateValues =
2118
2120
function ( translateFn , values ) {
2119
2121
return values . map ( function ( translation ) {
2120
- return translateFn + '(' + translation + ')' ;
2121
- } ) . join ( ' ' ) ;
2122
+ // TODO(crisbeto): this should add the units after #9609 is merged.
2123
+ var translationValue = angular . isFunction ( translation ) ?
2124
+ translation ( this ) : translation ;
2125
+ return translateFn + '(' + translationValue + ')' ;
2126
+ } , this ) . join ( ' ' ) ;
2122
2127
} ;
2123
2128
2124
2129
0 commit comments