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

committed by
Jason Aden

parent
858dea98e5
commit
105e920b69
@ -9,7 +9,7 @@ import {AUTO_STYLE, AnimationPlayer, NoopAnimationPlayer, ɵStyleData} from '@an
|
||||
|
||||
import {AnimationDriver} from '../../src/render/animation_driver';
|
||||
import {containsElement, invokeQuery, matchesElement} from '../../src/render/shared';
|
||||
|
||||
import {allowPreviousPlayerStylesMerge} from '../../src/util';
|
||||
|
||||
/**
|
||||
* @experimental Animation support is experimental.
|
||||
@ -56,12 +56,15 @@ export class MockAnimationPlayer extends NoopAnimationPlayer {
|
||||
public duration: number, public delay: number, public easing: string,
|
||||
public previousPlayers: any[]) {
|
||||
super();
|
||||
previousPlayers.forEach(player => {
|
||||
if (player instanceof MockAnimationPlayer) {
|
||||
const styles = player.currentSnapshot;
|
||||
Object.keys(styles).forEach(prop => this.previousStyles[prop] = styles[prop]);
|
||||
}
|
||||
});
|
||||
|
||||
if (allowPreviousPlayerStylesMerge(duration, delay)) {
|
||||
previousPlayers.forEach(player => {
|
||||
if (player instanceof MockAnimationPlayer) {
|
||||
const styles = player.currentSnapshot;
|
||||
Object.keys(styles).forEach(prop => this.previousStyles[prop] = styles[prop]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
this.totalTime = delay + duration;
|
||||
}
|
||||
|
Reference in New Issue
Block a user