From c2fa88f4d436394ec7e75e606bad9d23698e4676 Mon Sep 17 00:00:00 2001 From: sercan Date: Tue, 17 Aug 2021 22:05:13 +0300 Subject: [PATCH] (fuse/drawer) Fixed: Final opacity of the overlay is not permanent due to player being destroyed right after the animation --- src/@fuse/components/drawer/drawer.component.scss | 2 +- src/@fuse/components/drawer/drawer.component.ts | 9 +++++++++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/@fuse/components/drawer/drawer.component.scss b/src/@fuse/components/drawer/drawer.component.scss index 79a2938f..2016b2d4 100644 --- a/src/@fuse/components/drawer/drawer.component.scss +++ b/src/@fuse/components/drawer/drawer.component.scss @@ -116,7 +116,7 @@ fuse-drawer { left: 0; right: 0; z-index: 299; - opacity: 0; + opacity: 1; background-color: rgba(0, 0, 0, 0.6); /* Fixed mode */ diff --git a/src/@fuse/components/drawer/drawer.component.ts b/src/@fuse/components/drawer/drawer.component.ts index 7b38e0a7..d644c14b 100644 --- a/src/@fuse/components/drawer/drawer.component.ts +++ b/src/@fuse/components/drawer/drawer.component.ts @@ -211,6 +211,12 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy */ ngOnDestroy(): void { + // Finish the animation + if ( this._player ) + { + this._player.finish(); + } + // Deregister the drawer from the registry this._fuseDrawerService.deregisterComponent(this.name); } @@ -338,6 +344,7 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy // Create the enter animation and attach it to the player this._player = this._animationBuilder.build([ + style({opacity: 0}), animate('300ms cubic-bezier(0.25, 0.8, 0.25, 1)', style({opacity: 1})) ]).create(this._overlay); @@ -346,6 +353,7 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy // Destroy the player this._player.destroy(); + this._player = null; }); // Play the animation @@ -382,6 +390,7 @@ export class FuseDrawerComponent implements OnChanges, OnInit, OnDestroy // Destroy the player this._player.destroy(); + this._player = null; // If the backdrop still exists... if ( this._overlay )