Skip to content

Commit d7644ac

Browse files
alurjelbourn
authored andcommitted
Don't recalculate rippleRadius when its 0 (#14875)
* Don't recalculate rippleRadius when its 0 * Update checkbox.ts * Delete _calculateRippleRadius instead. * Update golden * Update golden, again * Re-add AfterViewChecked to checkbox.ts * Update golden
1 parent 4002470 commit d7644ac

File tree

1 file changed

+2
-23
lines changed

1 file changed

+2
-23
lines changed

src/lib/checkbox/checkbox.ts

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -49,11 +49,6 @@ import {MAT_CHECKBOX_CLICK_ACTION, MatCheckboxClickAction} from './checkbox-conf
4949
// Increasing integer for generating unique ids for checkbox components.
5050
let nextUniqueId = 0;
5151

52-
// TODO(josephperrott): Revert to constants for ripple radius once 2018 Checkbox updates have
53-
// landed.
54-
// The radius for the checkbox's ripple, in pixels.
55-
let calculatedRippleRadius = 0;
56-
5752
/**
5853
* Provider Expression that allows mat-checkbox to register as a ControlValueAccessor.
5954
* This allows it to support [(ngModel)].
@@ -220,9 +215,8 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
220215
});
221216
}
222217

223-
ngAfterViewChecked() {
224-
this._calculateRippleRadius();
225-
}
218+
// TODO: Delete next major revision.
219+
ngAfterViewChecked() {}
226220

227221
ngOnDestroy() {
228222
this._focusMonitor.stopMonitoring(this._elementRef);
@@ -455,19 +449,4 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc
455449

456450
return `mat-checkbox-anim-${animSuffix}`;
457451
}
458-
459-
// TODO(josephperrott): Revert to constants for ripple radius once 2018 Checkbox updates have
460-
// landed.
461-
/**
462-
* Calculate the radius for the ripple based on the ripple elements width. Only calculated once
463-
* for the application.
464-
*/
465-
private _calculateRippleRadius() {
466-
if (!calculatedRippleRadius) {
467-
const rippleWidth =
468-
this._elementRef.nativeElement.querySelector('.mat-checkbox-ripple').clientWidth || 0;
469-
calculatedRippleRadius = rippleWidth / 2;
470-
}
471-
this.ripple.radius = calculatedRippleRadius;
472-
}
473452
}

0 commit comments

Comments
 (0)