Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 92aef5d9 authored by John Reck's avatar John Reck
Browse files

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
parent 400e08dd
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -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);