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

Commit 3de6d62f authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Only take vertical, upward velocity into account for escaping the...

Merge "Only take vertical, upward velocity into account for escaping the dismiss target." into rvc-dev am: 254dcfd5 am: f6d8b1cf am: f4cdc287

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/11904326

Change-Id: Ib93c562e6da233265d3c50c44eae2efb7c12476c
parents baf3d542 f4cdc287
Loading
Loading
Loading
Loading
+5 −4
Original line number Diff line number Diff line
@@ -241,7 +241,7 @@ abstract class MagnetizedObject<T : Any>(
     * to the target. If this velocity is reached, the object will be freed even if it wasn't moved
     * outside the magnetic field radius.
     */
    var flingUnstuckFromTargetMinVelocity = 1000f
    var flingUnstuckFromTargetMinVelocity = 4000f

    /**
     * Sets the maximum X velocity above which the object will not stick to the target. Even if the
@@ -414,9 +414,10 @@ abstract class MagnetizedObject<T : Any>(
            cancelAnimations()

            if (objectStuckToTarget) {
                if (hypot(velX, velY) > flingUnstuckFromTargetMinVelocity) {
                    // If the object is stuck, but it was forcefully flung away from the target,
                    // tell the listener so the object can be animated out of the target.
                if (-velY > flingUnstuckFromTargetMinVelocity) {
                    // If the object is stuck, but it was forcefully flung away from the target in
                    // the upward direction, tell the listener so the object can be animated out of
                    // the target.
                    magnetListener.onUnstuckFromTarget(
                            targetObjectIsStuckTo!!, velX, velY, wasFlungOut = true)
                } else {