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

Commit 02e3c9d0 authored by Hongwei Wang's avatar Hongwei Wang
Browse files

Fixes the PiP edge intersect for fling

Bug: 135896456
Test: Fling the PiP window towards edge
Change-Id: Ia10823b9aa21e32223fbd8938719ebf31dfc936b
parent a5cc26d1
Loading
Loading
Loading
Loading
+0 −10
Original line number Original line Diff line number Diff line
@@ -24,8 +24,6 @@ import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.Rect;
import android.util.Size;
import android.util.Size;
import android.view.Gravity;
import android.view.Gravity;
import android.view.ViewConfiguration;
import android.widget.Scroller;


import java.io.PrintWriter;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.ArrayList;
@@ -180,14 +178,6 @@ public class PipSnapAlgorithm {
        // If we're not flinging along the current edge, find the closest point instead.
        // If we're not flinging along the current edge, find the closest point instead.
        final double distanceVert = Math.hypot(vertPoint.x - x, vertPoint.y - y);
        final double distanceVert = Math.hypot(vertPoint.x - x, vertPoint.y - y);
        final double distanceHoriz = Math.hypot(horizPoint.x - x, horizPoint.y - y);
        final double distanceHoriz = Math.hypot(horizPoint.x - x, horizPoint.y - y);
        // Ensure that we're actually going somewhere
        if (distanceVert == 0) {
            return horizPoint;
        }
        if (distanceHoriz == 0) {
            return vertPoint;
        }
        // Otherwise use the closest point
        return Math.abs(distanceVert) > Math.abs(distanceHoriz) ? horizPoint : vertPoint;
        return Math.abs(distanceVert) > Math.abs(distanceHoriz) ? horizPoint : vertPoint;
    }
    }