mirror of
https://github.com/richard-loafle/fuse-angular.git
synced 2025-01-10 04:25:08 +00:00
(Sidebar) Don't enable the animations right away to prevent initial animations
This commit is contained in:
parent
b46f81b6ac
commit
acbed8e305
|
@ -11,9 +11,6 @@ fuse-sidebar {
|
||||||
min-width: 280px;
|
min-width: 280px;
|
||||||
max-width: 280px;
|
max-width: 280px;
|
||||||
z-index: 1000;
|
z-index: 1000;
|
||||||
transition-property: transform, width, min-width, max-width;
|
|
||||||
transition-duration: 150ms;
|
|
||||||
transition-timing-function: ease-in-out;
|
|
||||||
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.35);
|
box-shadow: 0 2px 8px 0 rgba(0, 0, 0, 0.35);
|
||||||
background: white;
|
background: white;
|
||||||
|
|
||||||
|
@ -47,6 +44,12 @@ fuse-sidebar {
|
||||||
max-width: 64px;
|
max-width: 64px;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&.animations-enabled {
|
||||||
|
transition-property: transform, width, min-width, max-width;
|
||||||
|
transition-duration: 150ms;
|
||||||
|
transition-timing-function: ease-in-out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.fuse-sidebar-overlay {
|
.fuse-sidebar-overlay {
|
||||||
|
|
|
@ -52,6 +52,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
private _player: AnimationPlayer;
|
private _player: AnimationPlayer;
|
||||||
private _unsubscribeAll: Subject<any>;
|
private _unsubscribeAll: Subject<any>;
|
||||||
|
|
||||||
|
@HostBinding('class.animations-enabled')
|
||||||
|
private _animationsEnabled: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
|
@ -80,6 +83,7 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
this.invisibleOverlay = false;
|
this.invisibleOverlay = false;
|
||||||
|
|
||||||
// Set the private defaults
|
// Set the private defaults
|
||||||
|
this._animationsEnabled = false;
|
||||||
this._unsubscribeAll = new Subject();
|
this._unsubscribeAll = new Subject();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,6 +201,20 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
// @ Private methods
|
// @ Private methods
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Setup the visibility of the sidebar
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _setupVisibility(): void
|
||||||
|
{
|
||||||
|
// Remove the existing box-shadow
|
||||||
|
this._renderer.setStyle(this._elementRef.nativeElement, 'box-shadow', 'none');
|
||||||
|
|
||||||
|
// Make the sidebar invisible
|
||||||
|
this._renderer.setStyle(this._elementRef.nativeElement, 'visibility', 'hidden');
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Setup the sidebar position
|
* Setup the sidebar position
|
||||||
*
|
*
|
||||||
|
@ -226,6 +244,7 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
// Return if the lockedOpen wasn't set
|
// Return if the lockedOpen wasn't set
|
||||||
if ( !this.lockedOpen )
|
if ( !this.lockedOpen )
|
||||||
{
|
{
|
||||||
|
// Return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -292,20 +311,6 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Setup the visibility of the sidebar
|
|
||||||
*
|
|
||||||
* @private
|
|
||||||
*/
|
|
||||||
private _setupVisibility(): void
|
|
||||||
{
|
|
||||||
// Remove the existing box-shadow
|
|
||||||
this._renderer.setStyle(this._elementRef.nativeElement, 'box-shadow', 'none');
|
|
||||||
|
|
||||||
// Make the sidebar invisible
|
|
||||||
this._renderer.setStyle(this._elementRef.nativeElement, 'visibility', 'hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the backdrop
|
* Show the backdrop
|
||||||
*
|
*
|
||||||
|
@ -416,6 +421,23 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
}, delayAmount);
|
}, delayAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Enable the animations
|
||||||
|
*
|
||||||
|
* @private
|
||||||
|
*/
|
||||||
|
private _enableAnimations(): void
|
||||||
|
{
|
||||||
|
// Return if animations already enabled
|
||||||
|
if ( this._animationsEnabled )
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._animationsEnabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
// @ Public methods
|
// @ Public methods
|
||||||
// -----------------------------------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------------------------------
|
||||||
|
@ -430,6 +452,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
// Show the sidebar
|
// Show the sidebar
|
||||||
this._showSidebar();
|
this._showSidebar();
|
||||||
|
|
||||||
|
@ -450,6 +475,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
// Hide the backdrop
|
// Hide the backdrop
|
||||||
this._hideBackdrop();
|
this._hideBackdrop();
|
||||||
|
|
||||||
|
@ -487,6 +515,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
// Unfold the sidebar temporarily
|
// Unfold the sidebar temporarily
|
||||||
this.unfolded = true;
|
this.unfolded = true;
|
||||||
}
|
}
|
||||||
|
@ -503,6 +534,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
// Fold the sidebar back
|
// Fold the sidebar back
|
||||||
this.unfolded = false;
|
this.unfolded = false;
|
||||||
}
|
}
|
||||||
|
@ -518,6 +552,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
// Fold
|
// Fold
|
||||||
this.folded = true;
|
this.folded = true;
|
||||||
}
|
}
|
||||||
|
@ -533,6 +570,9 @@ export class FuseSidebarComponent implements OnInit, OnDestroy
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Enable the animations
|
||||||
|
this._enableAnimations();
|
||||||
|
|
||||||
// Unfold
|
// Unfold
|
||||||
this.folded = false;
|
this.folded = false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user