diff options
Diffstat (limited to 'android/source/src')
-rw-r--r-- | android/source/src/java/org/libreoffice/LOKitThread.java | 8 | ||||
-rw-r--r-- | android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java | 2 |
2 files changed, 6 insertions, 4 deletions
diff --git a/android/source/src/java/org/libreoffice/LOKitThread.java b/android/source/src/java/org/libreoffice/LOKitThread.java index 27568ace5599..fd40c3089102 100644 --- a/android/source/src/java/org/libreoffice/LOKitThread.java +++ b/android/source/src/java/org/libreoffice/LOKitThread.java @@ -184,9 +184,11 @@ class LOKitThread extends Thread { private void updateZoomConstraints() { if (mTileProvider == null) return; mLayerClient = mContext.getLayerClient(); - // Set min zoom to the page width so that you cannot zoom below page width - final float minZoom = mLayerClient.getViewportMetrics().getWidth()/mTileProvider.getPageWidth(); - mLayerClient.setZoomConstraints(new ZoomConstraints(1f, minZoom, 0f)); + // Set default zoom to the page width and min zoom so that the whole page is visible + final float pageHeightZoom = mLayerClient.getViewportMetrics().getHeight() / mTileProvider.getPageHeight(); + final float pageWidthZoom = mLayerClient.getViewportMetrics().getWidth() / mTileProvider.getPageWidth(); + final float minZoom = Math.min(pageWidthZoom, pageHeightZoom); + mLayerClient.setZoomConstraints(new ZoomConstraints(pageWidthZoom, minZoom, 0f)); } /** diff --git a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java index ef3d28e8ebb3..f1973d980e32 100644 --- a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java +++ b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java @@ -983,7 +983,7 @@ class JavaPanZoomController PointF pointOfTap = getMotionInDocumentCoordinates(motionEvent); ImmutableViewportMetrics metrics = getMetrics(); float newZoom = metrics.getZoomFactor() >= - DOUBLE_TAP_THRESHOLD ? mTarget.getZoomConstraints().getMinZoom() : DOUBLE_TAP_THRESHOLD; + DOUBLE_TAP_THRESHOLD ? mTarget.getZoomConstraints().getDefaultZoom() : DOUBLE_TAP_THRESHOLD; // calculate new top_left point from the point of tap float ratio = newZoom/metrics.getZoomFactor(); float newLeft = pointOfTap.x - 1/ratio * (pointOfTap.x - metrics.getOrigin().x / metrics.getZoomFactor()); |