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

Commit 897247b2 authored by Chet Haase's avatar Chet Haase
Browse files

Fix bug with pivot point not including translationXY factors

Change-Id: Ib16cd0acc007405fea24664327554019e24c2ac9
parent cad0cffe
Loading
Loading
Loading
Loading
+16 −8
Original line number Diff line number Diff line
@@ -5094,20 +5094,23 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
                }
            }
            mMatrix.reset();
            if (!nonzero(mRotationX) && !nonzero(mRotationY)) {
                mMatrix.setTranslate(mTranslationX, mTranslationY);
                mMatrix.preRotate(mRotation, mPivotX, mPivotY);
                mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY);
            if (nonzero(mRotationX) || nonzero(mRotationY)) {
            } else {
                if (mCamera == null) {
                    mCamera = new Camera();
                    matrix3D = new Matrix();
                }
                mCamera.save();
                mMatrix.preScale(mScaleX, mScaleY, mPivotX, mPivotY);
                mCamera.rotateX(mRotationX);
                mCamera.rotateY(mRotationY);
                mCamera.rotateZ(-mRotation);
                mCamera.getMatrix(matrix3D);
                matrix3D.preTranslate(-mPivotX, -mPivotY);
                matrix3D.postTranslate(mPivotX, mPivotY);
                matrix3D.postTranslate(mPivotX + mTranslationX, mPivotY + mTranslationY);
                mMatrix.postConcat(matrix3D);
                mCamera.restore();
            }
@@ -5148,7 +5151,8 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    }

    /**
     * Sets the degrees that the view is rotated around the pivot point.
     * Sets the degrees that the view is rotated around the pivot point. Increasing values
     * result in clockwise rotation.
     *
     * @param rotation The degrees of rotation.
     * @see #getPivotX()
@@ -5177,7 +5181,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    }

    /**
     * Sets the degrees that the view is rotated around the vertical axis through pivot point.
     * Sets the degrees that the view is rotated around the vertical axis through the pivot point.
     * Increasing values result in counter-clockwise rotation from the viewpoint of looking
     * down the y axis.
     *
     * @param rotationY The degrees of Y rotation.
     * @see #getPivotX()
@@ -5206,7 +5212,9 @@ public class View implements Drawable.Callback, KeyEvent.Callback, Accessibility
    }

    /**
     * Sets the degrees that the view is rotated around the horizontal axis through pivot point.
     * Sets the degrees that the view is rotated around the horizontal axis through the pivot point.
     * Increasing values result in clockwise rotation from the viewpoint of looking down the
     * x axis.
     *
     * @param rotationX The degrees of X rotation.
     * @see #getPivotX()