diff options
author | Ximeng Zu <uznomis@yahoo.com> | 2017-04-05 16:38:13 -0500 |
---|---|---|
committer | Tomaž Vajngerl <quikee@gmail.com> | 2017-04-18 14:26:26 +0200 |
commit | 50938d84de555ac8dd3151f44e8ba20276ddd7be (patch) | |
tree | 658bea0d9ca7082523f4b22286239575d2d809c1 /android | |
parent | d09617eb41dc0e52776cd62709d218991f71c409 (diff) |
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@libreoffice.org>
Reviewed-by: Tomaž Vajngerl <quikee@gmail.com>
Diffstat (limited to 'android')
-rw-r--r-- | android/source/src/java/org/mozilla/gecko/gfx/JavaPanZoomController.java | 13 |
1 files changed, 13 insertions, 0 deletions
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; } |