@@ -11,8 +11,6 @@ import {
11
11
ChangeDetectionStrategy ,
12
12
Input ,
13
13
ElementRef ,
14
- SimpleChanges ,
15
- OnChanges ,
16
14
ViewEncapsulation ,
17
15
Optional ,
18
16
Inject ,
@@ -82,8 +80,8 @@ const INDETERMINATE_ANIMATION_TEMPLATE = `
82
80
host : {
83
81
'role' : 'progressbar' ,
84
82
'class' : 'mat-progress-spinner' ,
85
- '[style.width.px]' : '_elementSize ' ,
86
- '[style.height.px]' : '_elementSize ' ,
83
+ '[style.width.px]' : 'diameter ' ,
84
+ '[style.height.px]' : 'diameter ' ,
87
85
'[attr.aria-valuemin]' : 'mode === "determinate" ? 0 : null' ,
88
86
'[attr.aria-valuemax]' : 'mode === "determinate" ? 100 : null' ,
89
87
'[attr.aria-valuenow]' : 'value' ,
@@ -95,16 +93,12 @@ const INDETERMINATE_ANIMATION_TEMPLATE = `
95
93
changeDetection : ChangeDetectionStrategy . OnPush ,
96
94
encapsulation : ViewEncapsulation . None ,
97
95
} )
98
- export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements CanColor ,
99
- OnChanges {
96
+ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements CanColor {
100
97
101
98
private _value = 0 ;
102
99
private _strokeWidth : number ;
103
100
private _fallbackAnimation = false ;
104
101
105
- /** The width and height of the host element. Will grow with stroke width. */
106
- _elementSize = BASE_SIZE ;
107
-
108
102
/** Tracks diameters of existing instances to de-dupe generated styles (default d = 100) */
109
103
private static diameters = new Set < number > ( [ BASE_SIZE ] ) ;
110
104
@@ -123,7 +117,6 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
123
117
if ( ! this . _fallbackAnimation && ! MatProgressSpinner . diameters . has ( this . _diameter ) ) {
124
118
this . _attachStyleNode ( ) ;
125
119
}
126
- this . _updateElementSize ( ) ;
127
120
}
128
121
private _diameter = BASE_SIZE ;
129
122
@@ -164,12 +157,6 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
164
157
_elementRef . nativeElement . classList . add ( animationClass ) ;
165
158
}
166
159
167
- ngOnChanges ( changes : SimpleChanges ) {
168
- if ( changes . strokeWidth || changes . diameter ) {
169
- this . _updateElementSize ( ) ;
170
- }
171
- }
172
-
173
160
/** The radius of the spinner, adjusted for stroke width. */
174
161
get _circleRadius ( ) {
175
162
return ( this . diameter - BASE_STROKE_WIDTH ) / 2 ;
@@ -202,7 +189,7 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
202
189
203
190
/** Stroke width of the circle in percent. */
204
191
get _circleStrokeWidth ( ) {
205
- return this . strokeWidth / this . _elementSize * 100 ;
192
+ return this . strokeWidth / this . diameter * 100 ;
206
193
}
207
194
208
195
/** Dynamically generates a style tag containing the correct animation for this diameter. */
@@ -230,11 +217,6 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
230
217
. replace ( / E N D _ V A L U E / g, `${ 0.2 * this . _strokeCircumference } ` )
231
218
. replace ( / D I A M E T E R / g, `${ this . diameter } ` ) ;
232
219
}
233
-
234
- /** Updates the spinner element size based on its diameter. */
235
- private _updateElementSize ( ) {
236
- this . _elementSize = this . _diameter + Math . max ( this . strokeWidth - BASE_STROKE_WIDTH , 0 ) ;
237
- }
238
220
}
239
221
240
222
@@ -251,8 +233,8 @@ export class MatProgressSpinner extends _MatProgressSpinnerMixinBase implements
251
233
'role' : 'progressbar' ,
252
234
'mode' : 'indeterminate' ,
253
235
'class' : 'mat-spinner mat-progress-spinner' ,
254
- '[style.width.px]' : '_elementSize ' ,
255
- '[style.height.px]' : '_elementSize ' ,
236
+ '[style.width.px]' : 'diameter ' ,
237
+ '[style.height.px]' : 'diameter ' ,
256
238
} ,
257
239
inputs : [ 'color' ] ,
258
240
templateUrl : 'progress-spinner.html' ,
0 commit comments