@@ -814,7 +814,7 @@ angular
814814 * @description
815815 * Sets the value of the offset in the x-direction.
816816 *
817- * @param {string } offsetX
817+ * @param {string|number } offsetX
818818 * @returns {!MdPanelPosition }
819819 */
820820
@@ -824,7 +824,7 @@ angular
824824 * @description
825825 * Sets the value of the offset in the y-direction.
826826 *
827- * @param {string } offsetY
827+ * @param {string|number } offsetY
828828 * @returns {!MdPanelPosition }
829829 */
830830
@@ -2861,23 +2861,23 @@ MdPanelPosition.prototype._validateXPosition = function(xPosition) {
28612861/**
28622862 * Sets the value of the offset in the x-direction. This will add to any
28632863 * previously set offsets.
2864- * @param {string|function(MdPanelPosition): string } offsetX
2864+ * @param {string|number| function(MdPanelPosition): string } offsetX
28652865 * @returns {!MdPanelPosition }
28662866 */
28672867MdPanelPosition . prototype . withOffsetX = function ( offsetX ) {
2868- this . _translateX . push ( offsetX ) ;
2868+ this . _translateX . push ( addUnits ( offsetX ) ) ;
28692869 return this ;
28702870} ;
28712871
28722872
28732873/**
28742874 * Sets the value of the offset in the y-direction. This will add to any
28752875 * previously set offsets.
2876- * @param {string|function(MdPanelPosition): string } offsetY
2876+ * @param {string|number| function(MdPanelPosition): string } offsetY
28772877 * @returns {!MdPanelPosition }
28782878 */
28792879MdPanelPosition . prototype . withOffsetY = function ( offsetY ) {
2880- this . _translateY . push ( offsetY ) ;
2880+ this . _translateY . push ( addUnits ( offsetY ) ) ;
28812881 return this ;
28822882} ;
28832883
@@ -2993,9 +2993,8 @@ MdPanelPosition.prototype.getActualPosition = function() {
29932993MdPanelPosition . prototype . _reduceTranslateValues =
29942994 function ( translateFn , values ) {
29952995 return values . map ( function ( translation ) {
2996- // TODO(crisbeto): this should add the units after #9609 is merged.
29972996 var translationValue = angular . isFunction ( translation ) ?
2998- translation ( this ) : translation ;
2997+ addUnits ( translation ( this ) ) : translation ;
29992998 return translateFn + '(' + translationValue + ')' ;
30002999 } , this ) . join ( ' ' ) ;
30013000 } ;
@@ -3525,7 +3524,6 @@ function getElement(el) {
35253524 return angular . element ( queryResult ) ;
35263525}
35273526
3528-
35293527/**
35303528 * Gets the computed values for an element's translateX and translateY in px.
35313529 * @param {!angular.JQLite|!Element } el
@@ -3553,3 +3551,12 @@ function getComputedTranslations(el, property) {
35533551
35543552 return output ;
35553553}
3554+
3555+ /**
3556+ * Adds units to a number value.
3557+ * @param {string|number } value
3558+ * @return {string }
3559+ */
3560+ function addUnits ( value ) {
3561+ return angular . isNumber ( value ) ? value + 'px' : value ;
3562+ }
0 commit comments