From 8db1206c9131ba816e86783a709e5db33d32f04b Mon Sep 17 00:00:00 2001 From: Sercan Yemen Date: Fri, 15 Jun 2018 16:36:51 +0300 Subject: [PATCH] Removed router animations since they are causing problems on Edge and also they make Fuse feel slower --- .../theme-options.component.html | 30 ----- .../theme-options/theme-options.component.ts | 3 +- src/@fuse/types/fuse-config.ts | 1 - src/app/fuse-config/index.ts | 3 +- .../components/content/content.component.ts | 117 ++---------------- 5 files changed, 9 insertions(+), 145 deletions(-) diff --git a/src/@fuse/components/theme-options/theme-options.component.html b/src/@fuse/components/theme-options/theme-options.component.html index 4d0d2a1c..8f8cddab 100644 --- a/src/@fuse/components/theme-options/theme-options.component.html +++ b/src/@fuse/components/theme-options/theme-options.component.html @@ -367,36 +367,6 @@ - -
- -

Router Animation

- - - - - None - - - Slide up - - - Slide down - - - Slide right - - - Slide left - - - Fade in - - - - -
- diff --git a/src/@fuse/components/theme-options/theme-options.component.ts b/src/@fuse/components/theme-options/theme-options.component.ts index fa47697b..3cb4859c 100644 --- a/src/@fuse/components/theme-options/theme-options.component.ts +++ b/src/@fuse/components/theme-options/theme-options.component.ts @@ -81,8 +81,7 @@ export class FuseThemeOptionsComponent implements OnInit, OnDestroy background: new FormControl() }) }), - customScrollbars: new FormControl(), - routerAnimation : new FormControl() + customScrollbars: new FormControl() }); // Subscribe to the config changes diff --git a/src/@fuse/types/fuse-config.ts b/src/@fuse/types/fuse-config.ts index 2172caac..b0d511e2 100644 --- a/src/@fuse/types/fuse-config.ts +++ b/src/@fuse/types/fuse-config.ts @@ -21,5 +21,4 @@ export interface FuseConfig } }; customScrollbars: boolean; - routerAnimation: 'fadeIn' | 'slideUp' | 'slideDown' | 'slideRight' | 'slideLeft' | 'none'; } diff --git a/src/app/fuse-config/index.ts b/src/app/fuse-config/index.ts index 3677bb9e..4b9e9adc 100644 --- a/src/app/fuse-config/index.ts +++ b/src/app/fuse-config/index.ts @@ -29,6 +29,5 @@ export const fuseConfig: FuseConfig = { background: 'mat-fuse-dark-900-bg' } }, - customScrollbars: true, - routerAnimation : 'none' + customScrollbars: true }; diff --git a/src/app/layout/components/content/content.component.ts b/src/app/layout/components/content/content.component.ts index 9e48689f..0dcb007e 100644 --- a/src/app/layout/components/content/content.component.ts +++ b/src/app/layout/components/content/content.component.ts @@ -1,120 +1,17 @@ -import { Component, HostBinding, OnDestroy, OnInit, ViewEncapsulation } from '@angular/core'; -import { ActivatedRoute, NavigationEnd, Router } from '@angular/router'; -import { Subject } from 'rxjs'; -import { filter, map } from 'rxjs/operators'; -import { takeUntil } from 'rxjs/operators'; - -import { fuseAnimations } from '@fuse/animations'; -import { FuseConfigService } from '@fuse/services/config.service'; +import { Component, ViewEncapsulation } from '@angular/core'; @Component({ - selector: 'content', - templateUrl: './content.component.html', - styleUrls: ['./content.component.scss'], - encapsulation: ViewEncapsulation.None, - animations: fuseAnimations + selector : 'content', + templateUrl : './content.component.html', + styleUrls : ['./content.component.scss'], + encapsulation: ViewEncapsulation.None }) -export class ContentComponent implements OnInit, OnDestroy +export class ContentComponent { - fuseConfig: any; - - // @HostBinding('@routerTransitionUp') - routeAnimationUp: boolean; - - // @HostBinding('@routerTransitionDown') - routeAnimationDown: boolean; - - // @HostBinding('@routerTransitionRight') - routeAnimationRight: boolean; - - // @HostBinding('@routerTransitionLeft') - routeAnimationLeft: boolean; - - // @HostBinding('@routerTransitionFade') - routeAnimationFade: boolean; - - // Private - private _unsubscribeAll: Subject; - /** * Constructor - * - * @param {ActivatedRoute} _activatedRoute - * @param {FuseConfigService} _fuseConfigService - * @param {Router} _router */ - constructor( - private _activatedRoute: ActivatedRoute, - private _fuseConfigService: FuseConfigService, - private _router: Router - ) + constructor() { - // Set the defaults - this.routeAnimationUp = false; - this.routeAnimationDown = false; - this.routeAnimationRight = false; - this.routeAnimationLeft = false; - this.routeAnimationFade = false; - - // Set the private defaults - this._unsubscribeAll = new Subject(); - } - - // ----------------------------------------------------------------------------------------------------- - // @ Lifecycle hooks - // ----------------------------------------------------------------------------------------------------- - - /** - * On init - */ - ngOnInit(): void - { - // Subscribe to the router events for router animations - this._router.events - .pipe( - filter((event) => event instanceof NavigationEnd), - map(() => this._activatedRoute) - ) - .subscribe(() => - { - switch (this.fuseConfig.routerAnimation) - { - case 'fadeIn': - this.routeAnimationFade = !this.routeAnimationFade; - break; - case 'slideUp': - this.routeAnimationUp = !this.routeAnimationUp; - break; - case 'slideDown': - this.routeAnimationDown = !this.routeAnimationDown; - break; - case 'slideRight': - this.routeAnimationRight = !this.routeAnimationRight; - break; - case 'slideLeft': - this.routeAnimationLeft = !this.routeAnimationLeft; - break; - } - }); - - // Subscribe to config changes - this._fuseConfigService.config - .pipe(takeUntil(this._unsubscribeAll)) - .subscribe( - (config) => - { - this.fuseConfig = config; - } - ); - } - - /** - * On destroy - */ - ngOnDestroy(): void - { - // Unsubscribe from all subscriptions - this._unsubscribeAll.next(); - this._unsubscribeAll.complete(); } }