From 0f1ca3598248c6df7fe456e198ce6519397b0247 Mon Sep 17 00:00:00 2001 From: Toufic Batache Date: Thu, 24 Aug 2017 05:25:03 +0300 Subject: [PATCH] fix(ripple): Correct unbounded ripple diameter (#1098) Closes #1067 --- packages/mdc-ripple/foundation.js | 2 +- packages/mdc-toolbar/mdc-toolbar.scss | 10 ++++------ test/unit/mdc-ripple/foundation.test.js | 2 +- 3 files changed, 6 insertions(+), 8 deletions(-) diff --git a/packages/mdc-ripple/foundation.js b/packages/mdc-ripple/foundation.js index e63ba2ab595..bdf57dc851e 100644 --- a/packages/mdc-ripple/foundation.js +++ b/packages/mdc-ripple/foundation.js @@ -471,7 +471,7 @@ export default class MDCRippleFoundation extends MDCFoundation { this.frame_ = this.adapter_.computeBoundingRect(); const maxDim = Math.max(this.frame_.height, this.frame_.width); - const surfaceDiameter = Math.sqrt(Math.pow(this.frame_.width, 2) + Math.pow(this.frame_.height, 2)); + const surfaceDiameter = Math.min(this.frame_.width, this.frame_.height); // 60% of the largest dimension of the surface this.initialSize_ = maxDim * MDCRippleFoundation.numbers.INITIAL_ORIGIN_SCALE; diff --git a/packages/mdc-toolbar/mdc-toolbar.scss b/packages/mdc-toolbar/mdc-toolbar.scss index 97006801edc..ec1ac246296 100644 --- a/packages/mdc-toolbar/mdc-toolbar.scss +++ b/packages/mdc-toolbar/mdc-toolbar.scss @@ -93,8 +93,10 @@ cursor: pointer; } - &__icon:last-of-type { - padding-right: 16px; + @media (min-width: $mdc-toolbar-mobile-breakpoint) { + &__icon:last-of-type { + margin-right: 8px; + } } &__icon--menu { @@ -115,10 +117,6 @@ padding: 16px; } - .mdc-toolbar__icon:last-child { - padding: 16px 8px; - } - .mdc-toolbar__title { margin-left: 16px !important; } diff --git a/test/unit/mdc-ripple/foundation.test.js b/test/unit/mdc-ripple/foundation.test.js index d72b685e2b4..c93bc89cea2 100644 --- a/test/unit/mdc-ripple/foundation.test.js +++ b/test/unit/mdc-ripple/foundation.test.js @@ -253,7 +253,7 @@ testFoundation(`#layout sets ${strings.VAR_FG_SCALE} based on the difference bet const maxSize = Math.max(width, height); const initialSize = maxSize * numbers.INITIAL_ORIGIN_SCALE; - const surfaceDiameter = Math.sqrt(Math.pow(width, 2) + Math.pow(height, 2)); + const surfaceDiameter = Math.min(width, height); const maxRadius = surfaceDiameter + numbers.PADDING; const fgScale = maxRadius / initialSize;