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

Commit 10280a87 authored by Eugene Susla's avatar Eugene Susla
Browse files

Fix magnification viewport drifting when scaling

Fixes: 32255388
Test: Ensure viewport no longer drifts when scaling
Change-Id: I1b12aeaa8e1d0282d6c35a27ee061f6cd7b0a667
parent aa2c46cc
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -446,8 +446,10 @@ class MagnificationController implements Handler.Callback {
            mMagnificationRegion.getBounds(viewport);
            final MagnificationSpec spec = mCurrentMagnificationSpec;
            final float oldScale = spec.scale;
            final float oldCenterX = (viewport.width() / 2.0f - spec.offsetX) / oldScale;
            final float oldCenterY = (viewport.height() / 2.0f - spec.offsetY) / oldScale;
            final float oldCenterX
                    = (viewport.width() / 2.0f - spec.offsetX + viewport.left) / oldScale;
            final float oldCenterY
                    = (viewport.height() / 2.0f - spec.offsetY + viewport.top) / oldScale;
            final float normPivotX = (pivotX - spec.offsetX) / oldScale;
            final float normPivotY = (pivotY - spec.offsetY) / oldScale;
            final float offsetX = (oldCenterX - normPivotX) * (oldScale / scale);