PiP: Divide up the magnetic percent by 2.

At max size, doing a brute percentage calculation using width / minWidth
ends up with a magnetic distance that's too big. Divide by 2 again to
make it more natural.

Bug: 190657668
Test: Pinch to max size, drag down - doesn't immediate snap to it
anymore

Change-Id: Ib5de742b753239a151686c1a85b27a6fe553a577
This commit is contained in:
Ben Lin
2021-06-10 14:47:15 -07:00
parent 53c5d85bef
commit 8a8b1f632a

View File

@@ -536,8 +536,9 @@ public class PipResizeGestureHandler {
mPipTaskOrganizer.scheduleFinishResizePip(mLastResizeBounds,
PipAnimationController.TRANSITION_DIRECTION_USER_RESIZE, callback);
}
final float magnetRadiusPercent = (float) mLastResizeBounds.width() / mMinSize.x / 2.f;
mPipDismissTargetHandler
.setMagneticFieldRadiusPercent((float) mLastResizeBounds.width() / mMinSize.x);
.setMagneticFieldRadiusPercent(magnetRadiusPercent);
mPipUiEventLogger.log(
PipUiEventLogger.PipUiEventEnum.PICTURE_IN_PICTURE_RESIZE);
} else {