From d7644ac3be704b24cf5c869f24782ecf5a90e895 Mon Sep 17 00:00:00 2001 From: Erik Welander Date: Thu, 7 Feb 2019 11:50:07 -0800 Subject: [PATCH] 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 --- src/lib/checkbox/checkbox.ts | 25 ++----------------------- 1 file changed, 2 insertions(+), 23 deletions(-) diff --git a/src/lib/checkbox/checkbox.ts b/src/lib/checkbox/checkbox.ts index 2c6d485bc66..31d1a088839 100644 --- a/src/lib/checkbox/checkbox.ts +++ b/src/lib/checkbox/checkbox.ts @@ -49,11 +49,6 @@ import {MAT_CHECKBOX_CLICK_ACTION, MatCheckboxClickAction} from './checkbox-conf // Increasing integer for generating unique ids for checkbox components. let nextUniqueId = 0; -// TODO(josephperrott): Revert to constants for ripple radius once 2018 Checkbox updates have -// landed. -// The radius for the checkbox's ripple, in pixels. -let calculatedRippleRadius = 0; - /** * Provider Expression that allows mat-checkbox to register as a ControlValueAccessor. * This allows it to support [(ngModel)]. @@ -220,9 +215,8 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc }); } - ngAfterViewChecked() { - this._calculateRippleRadius(); - } + // TODO: Delete next major revision. + ngAfterViewChecked() {} ngOnDestroy() { this._focusMonitor.stopMonitoring(this._elementRef); @@ -455,19 +449,4 @@ export class MatCheckbox extends _MatCheckboxMixinBase implements ControlValueAc return `mat-checkbox-anim-${animSuffix}`; } - - // TODO(josephperrott): Revert to constants for ripple radius once 2018 Checkbox updates have - // landed. - /** - * Calculate the radius for the ripple based on the ripple elements width. Only calculated once - * for the application. - */ - private _calculateRippleRadius() { - if (!calculatedRippleRadius) { - const rippleWidth = - this._elementRef.nativeElement.querySelector('.mat-checkbox-ripple').clientWidth || 0; - calculatedRippleRadius = rippleWidth / 2; - } - this.ripple.radius = calculatedRippleRadius; - } }