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

Commit 46ea4828 authored by Chet Haase's avatar Chet Haase Committed by Android (Google) Code Review
Browse files

Merge "Fix issue with touch MOVE events on transformed containers"

parents d6665fc4 ddc8e713
Loading
Loading
Loading
Loading
+16 −16
Original line number Original line Diff line number Diff line
@@ -896,11 +896,25 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
            return super.dispatchTouchEvent(ev);
            return super.dispatchTouchEvent(ev);
        }
        }


        // Calculate the offset point into the target's local coordinates
        float xc;
        float yc;
        if (target.hasIdentityMatrix() || mAttachInfo == null) {
            xc = scrolledXFloat - (float) target.mLeft;
            yc = scrolledYFloat - (float) target.mTop;
        } else {
            // non-identity matrix: transform the point into the view's coordinates
            final float[] localXY = mAttachInfo.mTmpTransformLocation;
            localXY[0] = scrolledXFloat;
            localXY[1] = scrolledYFloat;
            target.getInverseMatrix().mapPoints(localXY);
            xc = localXY[0] - (float) target.mLeft;
            yc = localXY[1] - (float) target.mTop;
        }

        // if have a target, see if we're allowed to and want to intercept its
        // if have a target, see if we're allowed to and want to intercept its
        // events
        // events
        if (!disallowIntercept && onInterceptTouchEvent(ev)) {
        if (!disallowIntercept && onInterceptTouchEvent(ev)) {
            final float xc = scrolledXFloat - (float) target.mLeft;
            final float yc = scrolledYFloat - (float) target.mTop;
            mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;
            mPrivateFlags &= ~CANCEL_NEXT_UP_EVENT;
            ev.setAction(MotionEvent.ACTION_CANCEL);
            ev.setAction(MotionEvent.ACTION_CANCEL);
            ev.setLocation(xc, yc);
            ev.setLocation(xc, yc);
@@ -922,20 +936,6 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager


        // finally offset the event to the target's coordinate system and
        // finally offset the event to the target's coordinate system and
        // dispatch the event.
        // dispatch the event.
        float xc;
        float yc;
        if (hasIdentityMatrix() || mAttachInfo == null) {
            xc = scrolledXFloat - (float) target.mLeft;
            yc = scrolledYFloat - (float) target.mTop;
        } else {
            // non-identity matrix: transform the point into the view's coordinates
            final float[] localXY = mAttachInfo.mTmpTransformLocation;
            localXY[0] = scrolledXFloat;
            localXY[1] = scrolledYFloat;
            getInverseMatrix().mapPoints(localXY);
            xc = localXY[0] - (float) target.mLeft;
            yc = localXY[1] - (float) target.mTop;
        }
        ev.setLocation(xc, yc);
        ev.setLocation(xc, yc);


        if ((target.mPrivateFlags & CANCEL_NEXT_UP_EVENT) != 0) {
        if ((target.mPrivateFlags & CANCEL_NEXT_UP_EVENT) != 0) {