[Libreoffice-commits] core.git: android/source

Ximeng Zu uznomis at yahoo.com
Tue Apr 18 12:26:50 UTC 2017


 android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java |   13 ++++++++++
 1 file changed, 13 insertions(+)

New commits:
commit 50938d84de555ac8dd3151f44e8ba20276ddd7be
Author: Ximeng Zu <uznomis at yahoo.com>
Date:   Wed Apr 5 16:38:13 2017 -0500

    Double tap zooms in and out
    
    Added double tap action in
    JavaPanZoomController. This commit depends
    on "restrict zoom to page width".
    
    Change-Id: Ifbe13f698ea01af2223beede9211a13b4970a3d5
    Reviewed-on: https://gerrit.libreoffice.org/36164
    Tested-by: Jenkins <ci at libreoffice.org>
    Reviewed-by: Tomaž Vajngerl <quikee at gmail.com>

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 ce6f4e9b99f7..1d109cf426a1 100644
--- a/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
+++ b/android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java
@@ -50,6 +50,9 @@ class JavaPanZoomController
     // The maximum amount we allow you to zoom into a page
     private static final float MAX_ZOOM = 4.0f;
 
+    // The threshold zoom factor of whether a double tap triggers zoom-in or zoom-out
+    private static final float DOUBLE_TAP_THRESHOLD = 1.0f;
+
     // The maximum amount we would like to scroll with the mouse
     private final float MAX_SCROLL;
 
@@ -981,6 +984,16 @@ class JavaPanZoomController
 
     @Override
     public boolean onDoubleTap(MotionEvent motionEvent) {
+        // Double tap zooms in or out depending on the current zoom factor
+        PointF viewPoint = getMotionInDocumentCoordinates(motionEvent);
+        ZoomConstraints constraints = mTarget.getZoomConstraints();
+        float zoomFactor = getMetrics().getZoomFactor();
+        if (zoomFactor >= DOUBLE_TAP_THRESHOLD) {
+            animatedMove(viewPoint, constraints.getMinZoom());
+        } else {
+            animatedMove(viewPoint, DOUBLE_TAP_THRESHOLD);
+        }
+
         LOKitShell.sendTouchEvent("DoubleTap", getMotionInDocumentCoordinates(motionEvent));
         return true;
     }


More information about the Libreoffice-commits mailing list