fix(animations): always cleanup players after they have finished internally (#13334)
Closes #13333 Closes #13334
This commit is contained in:

committed by
Victor Berchet

parent
c0b001a6af
commit
a26e054857
@ -44,16 +44,18 @@ export class ViewAnimationMap {
|
||||
|
||||
getAllPlayers(): AnimationPlayer[] { return this._allPlayers; }
|
||||
|
||||
remove(element: any, animationName: string): void {
|
||||
remove(element: any, animationName: string, targetPlayer: AnimationPlayer = null): void {
|
||||
const playersByAnimation = this._map.get(element);
|
||||
if (playersByAnimation) {
|
||||
const player = playersByAnimation[animationName];
|
||||
delete playersByAnimation[animationName];
|
||||
const index = this._allPlayers.indexOf(player);
|
||||
this._allPlayers.splice(index, 1);
|
||||
if (!targetPlayer || player === targetPlayer) {
|
||||
delete playersByAnimation[animationName];
|
||||
const index = this._allPlayers.indexOf(player);
|
||||
this._allPlayers.splice(index, 1);
|
||||
|
||||
if (Object.keys(playersByAnimation).length === 0) {
|
||||
this._map.delete(element);
|
||||
if (Object.keys(playersByAnimation).length === 0) {
|
||||
this._map.delete(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user