|
3 | 3 | * @name material.components.panel |
4 | 4 | */ |
5 | 5 | angular |
6 | | - .module('material.components.panel', [ |
7 | | - 'material.core', |
8 | | - 'material.components.backdrop' |
9 | | - ]) |
10 | | - .service('$mdPanel', MdPanelService); |
| 6 | + .module('material.components.panel', [ |
| 7 | + 'material.core', |
| 8 | + 'material.components.backdrop' |
| 9 | + ]) |
| 10 | + .service('$mdPanel', MdPanelService); |
11 | 11 |
|
12 | 12 |
|
13 | 13 | /***************************************************************************** |
@@ -1578,12 +1578,6 @@ MdPanelRef.prototype._updatePosition = function(init) { |
1578 | 1578 | var positionConfig = this.config['position']; |
1579 | 1579 |
|
1580 | 1580 | if (positionConfig) { |
1581 | | - // Use the vendor prefixed version of transform. |
1582 | | - // Note that the offset should be assigned before the position, in |
1583 | | - // order to avoid tiny jumps in the panel's position, on slower browsers. |
1584 | | - var prefixedTransform = this._$mdConstant.CSS.TRANSFORM; |
1585 | | - this.panelEl.css(prefixedTransform, positionConfig.getTransform()); |
1586 | | - |
1587 | 1581 | positionConfig._setPanelPosition(this.panelEl); |
1588 | 1582 |
|
1589 | 1583 | // Hide the panel now that position is known. |
@@ -2465,11 +2459,24 @@ MdPanelPosition.prototype.getTransform = function() { |
2465 | 2459 | return (translateX + ' ' + translateY).trim(); |
2466 | 2460 | }; |
2467 | 2461 |
|
| 2462 | + |
| 2463 | +/** |
| 2464 | + * Sets the `transform` value for a panel element. |
| 2465 | + * @param {!angular.JQLite} panelEl |
| 2466 | + * @returns {!angular.JQLite} |
| 2467 | + * @private |
| 2468 | + */ |
| 2469 | +MdPanelPosition.prototype._setTransform = function(panelEl) { |
| 2470 | + return panelEl.css(this._$mdConstant.CSS.TRANSFORM, this.getTransform()); |
| 2471 | +}; |
| 2472 | + |
| 2473 | + |
2468 | 2474 | /** |
2469 | 2475 | * True if the panel is completely on-screen with this positioning; false |
2470 | 2476 | * otherwise. |
2471 | 2477 | * @param {!angular.JQLite} panelEl |
2472 | 2478 | * @return {boolean} |
| 2479 | + * @private |
2473 | 2480 | */ |
2474 | 2481 | MdPanelPosition.prototype._isOnscreen = function(panelEl) { |
2475 | 2482 | // this works because we always use fixed positioning for the panel, |
@@ -2531,17 +2538,21 @@ MdPanelPosition.prototype._reduceTranslateValues = |
2531 | 2538 | MdPanelPosition.prototype._setPanelPosition = function(panelEl) { |
2532 | 2539 | // Only calculate the position if necessary. |
2533 | 2540 | if (this._absolute) { |
| 2541 | + this._setTransform(panelEl); |
2534 | 2542 | return; |
2535 | 2543 | } |
2536 | 2544 |
|
2537 | 2545 | if (this._actualPosition) { |
2538 | 2546 | this._calculatePanelPosition(panelEl, this._actualPosition); |
| 2547 | + this._setTransform(panelEl); |
2539 | 2548 | return; |
2540 | 2549 | } |
2541 | 2550 |
|
2542 | 2551 | for (var i = 0; i < this._positions.length; i++) { |
2543 | 2552 | this._actualPosition = this._positions[i]; |
2544 | 2553 | this._calculatePanelPosition(panelEl, this._actualPosition); |
| 2554 | + this._setTransform(panelEl); |
| 2555 | + |
2545 | 2556 | if (this._isOnscreen(panelEl)) { |
2546 | 2557 | break; |
2547 | 2558 | } |
|
0 commit comments