diff options
Diffstat (limited to 'platform/android')
-rwxr-xr-x | platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java b/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java index 5ecc75d8..10cf78ca 100755 --- a/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java +++ b/platform/android/example/mupdf/src/main/java/com/artifex/mupdf/android/DocViewBase.java @@ -477,9 +477,14 @@ public class DocViewBase mScale *= ratio; scaleChildren(); - // scroll so the left edged is flush to the viewport. + // scroll horizontally so the left edge is flush with the viewport. mXScroll += getScrollX(); + // scroll vertically to maintain the center. + int oldy = mViewport.centerY() - mLastBlockRect.top; + int newy = (int) ((float) oldy * ratio); + mYScroll -= (newy-oldy); + requestLayout(); } |