fix(animations): properly handle cancelled animation style application
This commit is contained in:

committed by
Jason Aden

parent
858dea98e5
commit
105e920b69
@ -7,7 +7,7 @@
|
||||
*/
|
||||
import {AnimationPlayer} from '@angular/animations';
|
||||
|
||||
import {copyStyles, eraseStyles, setStyles} from '../../util';
|
||||
import {allowPreviousPlayerStylesMerge, copyStyles} from '../../util';
|
||||
|
||||
import {DOMAnimation} from './dom_animation';
|
||||
|
||||
@ -26,7 +26,7 @@ export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
public time = 0;
|
||||
|
||||
public parentPlayer: AnimationPlayer|null = null;
|
||||
public previousStyles: {[styleName: string]: string | number};
|
||||
public previousStyles: {[styleName: string]: string | number} = {};
|
||||
public currentSnapshot: {[styleName: string]: string | number} = {};
|
||||
|
||||
constructor(
|
||||
@ -37,11 +37,12 @@ export class WebAnimationsPlayer implements AnimationPlayer {
|
||||
this._delay = <number>options['delay'] || 0;
|
||||
this.time = this._duration + this._delay;
|
||||
|
||||
this.previousStyles = {};
|
||||
previousPlayers.forEach(player => {
|
||||
let styles = player.currentSnapshot;
|
||||
Object.keys(styles).forEach(prop => this.previousStyles[prop] = styles[prop]);
|
||||
});
|
||||
if (allowPreviousPlayerStylesMerge(this._duration, this._delay)) {
|
||||
previousPlayers.forEach(player => {
|
||||
let styles = player.currentSnapshot;
|
||||
Object.keys(styles).forEach(prop => this.previousStyles[prop] = styles[prop]);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private _onFinish() {
|
||||
|
Reference in New Issue
Block a user