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;
54
54
bottom : 0 ;
55
55
height : $height ;
56
56
width : 1px ;
57
+ transform : translateX (0px ) scaleX (0 );
57
58
transform-origin : 0 ;
58
59
59
60
.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 {
45
45
selector : 'mat-ink-bar' ,
46
46
host : {
47
47
'class' : 'mat-ink-bar' ,
48
+ '[class.mat-ink-bar-animations-enabled]' : 'shouldAnimate' ,
48
49
} ,
49
50
} )
50
51
export class MatInkBar {
52
+ /** Whether the ink bar should animate to its position. */
53
+ shouldAnimate = false ;
54
+
51
55
constructor (
52
56
private _elementRef : ElementRef < HTMLElement > ,
53
57
private _ngZone : NgZone ,
@@ -88,12 +92,7 @@ export class MatInkBar {
88
92
const positions = this . _inkBarPositioner ( element ) ;
89
93
const inkBar = this . _elementRef . nativeElement ;
90
94
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
-
97
95
inkBar . style . transform = `translateX(${ positions . left } px) scaleX(${ positions . width } )` ;
96
+ this . shouldAnimate = true ;
98
97
}
99
98
}
You can’t perform that action at this time.
0 commit comments