mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
Removed router animations since they are causing problems on Edge and also they make Fuse feel slower
This commit is contained in:
parent
562ae61098
commit
8db1206c91
|
@ -367,36 +367,6 @@
|
|||
|
||||
</div>
|
||||
|
||||
<!-- ROUTER ANIMATION -->
|
||||
<div class="group">
|
||||
|
||||
<h2>Router Animation</h2>
|
||||
|
||||
<mat-form-field class="w-100-p">
|
||||
<mat-select class="p-0" formControlName="routerAnimation">
|
||||
<mat-option value="none">
|
||||
None
|
||||
</mat-option>
|
||||
<mat-option value="slideUp">
|
||||
Slide up
|
||||
</mat-option>
|
||||
<mat-option value="slideDown">
|
||||
Slide down
|
||||
</mat-option>
|
||||
<mat-option value="slideRight">
|
||||
Slide right
|
||||
</mat-option>
|
||||
<mat-option value="slideLeft">
|
||||
Slide left
|
||||
</mat-option>
|
||||
<mat-option value="fadeIn">
|
||||
Fade in
|
||||
</mat-option>
|
||||
</mat-select>
|
||||
</mat-form-field>
|
||||
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -21,5 +21,4 @@ export interface FuseConfig
|
|||
}
|
||||
};
|
||||
customScrollbars: boolean;
|
||||
routerAnimation: 'fadeIn' | 'slideUp' | 'slideDown' | 'slideRight' | 'slideLeft' | 'none';
|
||||
}
|
||||
|
|
|
@ -29,6 +29,5 @@ export const fuseConfig: FuseConfig = {
|
|||
background: 'mat-fuse-dark-900-bg'
|
||||
}
|
||||
},
|
||||
customScrollbars: true,
|
||||
routerAnimation : 'none'
|
||||
customScrollbars: true
|
||||
};
|
||||
|
|
|
@ -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<any>;
|
||||
|
||||
/**
|
||||
* 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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user