summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author John Reck <jreck@google.com> 2018-02-07 14:34:33 -0800
committer John Reck <jreck@google.com> 2018-02-07 14:36:02 -0800
commit92aef5d9fea5f3445ffe9cd110dcd62c0375f02b (patch)
tree5257ebf507d0d27abddbca454ab872d5365bf310
parent400e08ddc70191930734fa77f356b738c86b7196 (diff)
Clamp ripple starting x/y further
Ensure that the start x/y is clamped to accomidate the animations' starting radius as well Bug: 72173993 Test: Clicked on controls in API demos Change-Id: I2a56a240a9cd0f77bdc458930d1a844611ea7148
-rw-r--r--graphics/java/android/graphics/drawable/RippleForeground.java3
1 files changed, 2 insertions, 1 deletions
diff --git a/graphics/java/android/graphics/drawable/RippleForeground.java b/graphics/java/android/graphics/drawable/RippleForeground.java
index 4129868079c7..a8dc34af292b 100644
--- a/graphics/java/android/graphics/drawable/RippleForeground.java
+++ b/graphics/java/android/graphics/drawable/RippleForeground.java
@@ -110,6 +110,7 @@ class RippleForeground extends RippleComponent {
// Take 60% of the maximum of the width and height, then divided half to get the radius.
mStartRadius = Math.max(bounds.width(), bounds.height()) * 0.3f;
+ clampStartingPosition();
}
@Override
@@ -350,7 +351,7 @@ class RippleForeground extends RippleComponent {
final float cY = mBounds.exactCenterY();
final float dX = mStartingX - cX;
final float dY = mStartingY - cY;
- final float r = mTargetRadius;
+ final float r = mTargetRadius - mStartRadius;
if (dX * dX + dY * dY > r * r) {
// Point is outside the circle, clamp to the perimeter.
final double angle = Math.atan2(dY, dX);