@@ -576,7 +576,7 @@ angular
576576 * @description
577577 * Sets the value of the offset in the x-direction.
578578 *
579- * @param {string } offsetX
579+ * @param {string|number } offsetX
580580 * @returns {!MdPanelPosition }
581581 */
582582
@@ -586,7 +586,7 @@ angular
586586 * @description
587587 * Sets the value of the offset in the y-direction.
588588 *
589- * @param {string } offsetY
589+ * @param {string|number } offsetY
590590 * @returns {!MdPanelPosition }
591591 */
592592
@@ -2003,23 +2003,23 @@ MdPanelPosition.prototype._validateXPosition = function(xPosition) {
20032003/**
20042004 * Sets the value of the offset in the x-direction. This will add to any
20052005 * previously set offsets.
2006- * @param {string } offsetX
2006+ * @param {string|number } offsetX
20072007 * @returns {!MdPanelPosition }
20082008 */
20092009MdPanelPosition . prototype . withOffsetX = function ( offsetX ) {
2010- this . _translateX . push ( offsetX ) ;
2010+ this . _translateX . push ( addUnits ( offsetX ) ) ;
20112011 return this ;
20122012} ;
20132013
20142014
20152015/**
20162016 * Sets the value of the offset in the y-direction. This will add to any
20172017 * previously set offsets.
2018- * @param {string } offsetY
2018+ * @param {string|number } offsetY
20192019 * @returns {!MdPanelPosition }
20202020 */
20212021MdPanelPosition . prototype . withOffsetY = function ( offsetY ) {
2022- this . _translateY . push ( offsetY ) ;
2022+ this . _translateY . push ( addUnits ( offsetY ) ) ;
20232023 return this ;
20242024} ;
20252025
@@ -2553,3 +2553,12 @@ function getElement(el) {
25532553 document . querySelector ( el ) : el ;
25542554 return angular . element ( queryResult ) ;
25552555}
2556+
2557+ /**
2558+ * Adds units to a number value.
2559+ * @param {string|number } value
2560+ * @return {string }
2561+ */
2562+ function addUnits ( value ) {
2563+ return angular . isNumber ( value ) ? value + 'px' : value ;
2564+ }
0 commit comments