PiP: Constrain pinch-resize input to start inside PiP bounds.
Previously, we just check for any two down input event - but they should both be inside the PiP bounds for the gesture to start. Bug: 184789307 Test: Manual. Have only one finger inside PiP and one finger outside and try to pinch, no longer resizes. Change-Id: Ia2193f8d754423013e98d08399f00e665d353b14
This commit is contained in:
@@ -380,14 +380,17 @@ public class PipResizeGestureHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
final Rect pipBounds = mPipBoundsState.getBounds();
|
||||
if (action == MotionEvent.ACTION_POINTER_DOWN) {
|
||||
if (mFirstIndex == -1 && mSecondIndex == -1) {
|
||||
if (mFirstIndex == -1 && mSecondIndex == -1
|
||||
&& pipBounds.contains((int) ev.getRawX(0), (int) ev.getRawY(0))
|
||||
&& pipBounds.contains((int) ev.getRawX(1), (int) ev.getRawY(1))) {
|
||||
mAllowGesture = true;
|
||||
mFirstIndex = 0;
|
||||
mSecondIndex = 1;
|
||||
mDownPoint.set(ev.getRawX(mFirstIndex), ev.getRawY(mFirstIndex));
|
||||
mDownSecondPoint.set(ev.getRawX(mSecondIndex), ev.getRawY(mSecondIndex));
|
||||
mDownBounds.set(mPipBoundsState.getBounds());
|
||||
mDownBounds.set(pipBounds);
|
||||
|
||||
mLastPoint.set(mDownPoint);
|
||||
mLastSecondPoint.set(mLastSecondPoint);
|
||||
|
||||
Reference in New Issue
Block a user