@@ -1104,10 +1104,11 @@ MdPanelRef.prototype._addStyles = function() {
1104
1104
// correctly. This is necessary so that the panel will have a defined height
1105
1105
// and width.
1106
1106
self . _$rootScope [ '$$postDigest' ] ( function ( ) {
1107
- self . _panelEl . css ( 'top' , positionConfig . getTop ( self . _panelEl ) ) ;
1108
- self . _panelEl . css ( 'bottom' , positionConfig . getBottom ( self . _panelEl ) ) ;
1109
- self . _panelEl . css ( 'left' , positionConfig . getLeft ( self . _panelEl ) ) ;
1110
- self . _panelEl . css ( 'right' , positionConfig . getRight ( self . _panelEl ) ) ;
1107
+ positionConfig . _calculatePanelPosition ( self . _panelEl ) ;
1108
+ self . _panelEl . css ( 'top' , positionConfig . getTop ( ) ) ;
1109
+ self . _panelEl . css ( 'bottom' , positionConfig . getBottom ( ) ) ;
1110
+ self . _panelEl . css ( 'left' , positionConfig . getLeft ( ) ) ;
1111
+ self . _panelEl . css ( 'right' , positionConfig . getRight ( ) ) ;
1111
1112
1112
1113
// Use the vendor prefixed version of transform.
1113
1114
var prefixedTransform = self . _$mdConstant . CSS . TRANSFORM ;
@@ -1412,9 +1413,6 @@ function MdPanelPosition() {
1412
1413
/** @private {!DOMRect} */
1413
1414
this . _relativeToRect ;
1414
1415
1415
- /** @private {boolean} */
1416
- this . _panelPositionCalculated = false ;
1417
-
1418
1416
/** @private {string} */
1419
1417
this . _top = '' ;
1420
1418
@@ -1677,44 +1675,36 @@ MdPanelPosition.prototype.withOffsetY = function(offsetY) {
1677
1675
1678
1676
/**
1679
1677
* Gets the value of `top` for the panel.
1680
- * @param {!angular.JQLite } panelEl
1681
1678
* @returns {string }
1682
1679
*/
1683
- MdPanelPosition . prototype . getTop = function ( panelEl ) {
1684
- this . _calculatePanelPosition ( panelEl ) ;
1680
+ MdPanelPosition . prototype . getTop = function ( ) {
1685
1681
return this . _top ;
1686
1682
} ;
1687
1683
1688
1684
1689
1685
/**
1690
1686
* Gets the value of `bottom` for the panel.
1691
- * @param {!angular.JQLite } panelEl
1692
1687
* @returns {string }
1693
1688
*/
1694
- MdPanelPosition . prototype . getBottom = function ( panelEl ) {
1695
- this . _calculatePanelPosition ( panelEl ) ;
1689
+ MdPanelPosition . prototype . getBottom = function ( ) {
1696
1690
return this . _bottom ;
1697
1691
} ;
1698
1692
1699
1693
1700
1694
/**
1701
1695
* Gets the value of `left` for the panel.
1702
- * @param {!angular.JQLite } panelEl
1703
1696
* @returns {string }
1704
1697
*/
1705
- MdPanelPosition . prototype . getLeft = function ( panelEl ) {
1706
- this . _calculatePanelPosition ( panelEl ) ;
1698
+ MdPanelPosition . prototype . getLeft = function ( ) {
1707
1699
return this . _left ;
1708
1700
} ;
1709
1701
1710
1702
1711
1703
/**
1712
1704
* Gets the value of `right` for the panel.
1713
- * @param {!angular.JQLite } panelEl
1714
1705
* @returns {string }
1715
1706
*/
1716
- MdPanelPosition . prototype . getRight = function ( panelEl ) {
1717
- this . _calculatePanelPosition ( panelEl ) ;
1707
+ MdPanelPosition . prototype . getRight = function ( ) {
1718
1708
return this . _right ;
1719
1709
} ;
1720
1710
@@ -1735,7 +1725,7 @@ MdPanelPosition.prototype.getTransform = function() {
1735
1725
1736
1726
/**
1737
1727
* Gets the first x/y position that can fit on-screen.
1738
- * @returns {string }
1728
+ * @returns {{x: string, y: string} }
1739
1729
*/
1740
1730
MdPanelPosition . prototype . getActualPosition = function ( ) {
1741
1731
// TODO(gmoothart): intelligently pick the first on-screen position.
@@ -1766,16 +1756,13 @@ MdPanelPosition.prototype._reduceTranslateValues =
1766
1756
*/
1767
1757
MdPanelPosition . prototype . _calculatePanelPosition = function ( panelEl ) {
1768
1758
// Only calculate the position if necessary.
1769
- if ( this . _absolute || this . _panelPositionCalculated ) {
1759
+ if ( this . _absolute ) {
1770
1760
return ;
1771
1761
}
1772
1762
1773
1763
// TODO(ErinCoughlan): Update position on scroll.
1774
1764
// TODO(ErinCoughlan): Position panel intelligently to keep it on screen.
1775
1765
1776
- // Indicate that the position is calculated so it can be skipped next time.
1777
- this . _panelPositionCalculated = true ;
1778
-
1779
1766
var panelBounds = panelEl [ 0 ] . getBoundingClientRect ( ) ;
1780
1767
var panelWidth = panelBounds . width ;
1781
1768
var panelHeight = panelBounds . height ;
0 commit comments