Skip to content
This repository was archived by the owner on Sep 5, 2024. It is now read-only.

Commit 060a54b

Browse files
committed
fix(panel): Fixes custom animations in the demo to account for opacity.
1 parent 16f4aee commit 060a54b

File tree

3 files changed

+17
-15
lines changed

3 files changed

+17
-15
lines changed

src/components/panel/demoPanelAnimations/script.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ AnimationCtrl.prototype.showDialog = function() {
8282
hasBackdrop: true,
8383
};
8484

85-
this._panelRef = this._mdPanel.open(config);
85+
this._mdPanel.open(config);
8686
};
8787

8888

src/components/panel/demoPanelAnimations/style.css

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
}
2727

2828
.demo-dialog-custom-animation-open {
29+
opacity: 1;
2930
transition: all 1s linear, opacity 1ms;
3031
transform: rotate(390deg);
3132
}
3233

3334
.demo-dialog-custom-animation-close {
35+
opacity: 0;
3436
transition: all 1s linear, opacity 1ms;
3537
transform: rotate(0deg);
3638
}

src/components/panel/panel.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ MdPanelService.prototype.newPanelPosition = function() {
705705
* @returns {MdPanelAnimation}
706706
*/
707707
MdPanelService.prototype.newPanelAnimation = function() {
708-
return new MdPanelAnimation();
708+
return new MdPanelAnimation(this._$injector);
709709
};
710710

711711

@@ -749,7 +749,7 @@ function MdPanelRef(config, $injector) {
749749
/** @private @const {!angular.$mdCompiler} */
750750
this._$mdCompiler = $injector.get('$mdCompiler');
751751

752-
/** @private @const */
752+
/** @private @const {!angular.$mdConstant} */
753753
this._$mdConstant = $injector.get('$mdConstant');
754754

755755
/** @private @const {!angular.$mdUtil} */
@@ -1323,7 +1323,7 @@ MdPanelRef.prototype._animateOpen = function() {
13231323
done();
13241324
};
13251325

1326-
animationConfig.animateOpen(self._panelEl, self._$mdUtil.dom.animator)
1326+
animationConfig.animateOpen(self._panelEl)
13271327
.then(done, warnAndOpen);
13281328
});
13291329
};
@@ -1354,7 +1354,7 @@ MdPanelRef.prototype._animateClose = function() {
13541354
done();
13551355
};
13561356

1357-
animationConfig.animateClose(self._panelEl, self._$mdUtil.dom.animator)
1357+
animationConfig.animateClose(self._panelEl)
13581358
.then(done, warnAndClose);
13591359
});
13601360
};
@@ -1833,9 +1833,13 @@ MdPanelPosition.prototype._calculatePanelPosition = function(panelEl) {
18331833
* animation: panelAnimation
18341834
* });
18351835
*
1836+
* @param {!angular.$injector} $injector
18361837
* @final @constructor
18371838
*/
1838-
function MdPanelAnimation() {
1839+
function MdPanelAnimation($injector) {
1840+
/** @private @const {!angular.$mdUtil} */
1841+
this._$mdUtil = $injector.get('$mdUtil');
1842+
18391843
/**
18401844
* @private {{element: !angular.JQLite|undefined, bounds: !DOMRect}|
18411845
* undefined}
@@ -1850,9 +1854,6 @@ function MdPanelAnimation() {
18501854

18511855
/** @private {string|{open: string, close: string} */
18521856
this._animationClass = '';
1853-
1854-
/** @private {!angular.$q.Promise|undefined} **/
1855-
this._reverseAnimation;
18561857
}
18571858

18581859

@@ -1947,10 +1948,11 @@ MdPanelAnimation.prototype.withAnimation = function(cssClass) {
19471948
/**
19481949
* Animate the panel open.
19491950
* @param {!angular.JQLite} panelEl
1950-
* @param animator
19511951
* @returns {!angular.$q.Promise}
19521952
*/
1953-
MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
1953+
MdPanelAnimation.prototype.animateOpen = function(panelEl) {
1954+
var animator = this._$mdUtil.dom.animator;
1955+
19541956
this._fixBounds(panelEl);
19551957
var animationOptions = {};
19561958

@@ -2006,7 +2008,6 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
20062008
// panel transform.
20072009
}
20082010

2009-
var self = this;
20102011
return animator
20112012
.translate3d(panelEl, openFrom, openTo, animationOptions);
20122013
};
@@ -2015,10 +2016,10 @@ MdPanelAnimation.prototype.animateOpen = function(panelEl, animator) {
20152016
/**
20162017
* Animate the panel close.
20172018
* @param {!angular.JQLite} panelEl
2018-
* @param animator
20192019
* @returns {!angular.$q.Promise}
20202020
*/
2021-
MdPanelAnimation.prototype.animateClose = function(panelEl, animator) {
2021+
MdPanelAnimation.prototype.animateClose = function(panelEl) {
2022+
var animator = this._$mdUtil.dom.animator;
20222023
var reverseAnimationOptions = {};
20232024

20242025
// Include the panel transformations when calculating the animations.
@@ -2072,7 +2073,6 @@ MdPanelAnimation.prototype.animateClose = function(panelEl, animator) {
20722073
// panel transform.
20732074
}
20742075

2075-
var self = this;
20762076
return animator
20772077
.translate3d(panelEl, closeFrom, closeTo, reverseAnimationOptions);
20782078
};

0 commit comments

Comments
 (0)