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

Commit a20833c0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Fix bug in calculating path in ArcMotion"

parents 71a24be9 575ffb85
Loading
Loading
Loading
Loading
+8 −2
Original line number Diff line number Diff line
@@ -216,7 +216,13 @@ public class ArcMotion extends PathMotion {

        boolean isMovingUpwards = startY > endY;

        if ((Math.abs(deltaX) < Math.abs(deltaY))) {
        if (deltaY == 0) {
            ex = dx;
            ey = dy + (Math.abs(deltaX) * 0.5f * mMinimumHorizontalTangent);
        } else if (deltaX == 0) {
            ex = dx + (Math.abs(deltaY) * 0.5f * mMinimumVerticalTangent);
            ey = dy;
        } else if ((Math.abs(deltaX) < Math.abs(deltaY))) {
            // Similar triangles bfa and bde mean that (ab/fb = eb/bd)
            // Therefore, eb = ab * bd / fb
            // ab = hypotenuse
@@ -254,7 +260,7 @@ public class ArcMotion extends PathMotion {
        float maximumArcDist2 = midDist2 * mMaximumTangent * mMaximumTangent;

        float newArcDistance2 = 0;
        if (arcDist2 < minimumArcDist2) {
        if (arcDist2 != 0 && arcDist2 < minimumArcDist2) {
            newArcDistance2 = minimumArcDist2;
        } else if (arcDist2 > maximumArcDist2) {
            newArcDistance2 = maximumArcDist2;