File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change @@ -54,6 +54,7 @@ $mat-tab-animation-duration: 500ms !default;
5454 bottom : 0 ;
5555 height : $height ;
5656 width : 1px ;
57+ transform : translateX (0 ) scaleX (0 );
5758 transform-origin : 0 ;
5859
5960 .mat-tab-group-inverted-header & {
Original file line number Diff line number Diff line change @@ -45,9 +45,13 @@ export function _MAT_INK_BAR_POSITIONER_FACTORY(): _MatInkBarPositioner {
4545 selector : 'mat-ink-bar' ,
4646 host : {
4747 'class' : 'mat-ink-bar' ,
48+ '[class.mat-ink-bar-animations-enabled]' : 'shouldAnimate' ,
4849 } ,
4950} )
5051export class MatInkBar {
52+ /** Whether the ink bar should animate to its position. */
53+ shouldAnimate = false ;
54+
5155 constructor (
5256 private _elementRef : ElementRef < HTMLElement > ,
5357 private _ngZone : NgZone ,
@@ -88,12 +92,7 @@ export class MatInkBar {
8892 const positions = this . _inkBarPositioner ( element ) ;
8993 const inkBar = this . _elementRef . nativeElement ;
9094
91- // We want to prevent the ink bar from animating on the initial load.
92- // Enable animations only if the ink bar has been translated before.
93- if ( inkBar . style . transform ) {
94- inkBar . classList . add ( 'mat-ink-bar-animations-enabled' ) ;
95- }
96-
9795 inkBar . style . transform = `translateX(${ positions . left } px) scaleX(${ positions . width } )` ;
96+ this . shouldAnimate = true ;
9897 }
9998}
You can’t perform that action at this time.
0 commit comments