android-pdfview icon indicating copy to clipboard operation
android-pdfview copied to clipboard

Double tap to zoom

Open tippl opened this issue 10 years ago • 3 comments

Is it possible to double tap to zoom? The only thing it does is double tap to reset zoom.

tippl avatar May 22 '14 17:05 tippl

Would be nice indeed, PR is welcome!

JoanZapata avatar May 23 '14 10:05 JoanZapata

@JoanZapata and @tippl hey guys i found a way to zoom on double tap

@JoanZapata first of all thanks for this wonderful library for pdfs , i have used it with a vertical view pager for my app with some modifications to this library and it works as smooth as butter ;P

Ok for having Double tap zoom we have to add some extra code to 2 classes ( PDFView, DragPinchManager ) here is the code below ..

1st - PDFView.java

add this in constructor -

paint.setAntiAlias(true); paint.setFilterBitmap(true); paint.setDither(true);

next Add this new method

public void doubleTapZoomWithAnimation() 
{
        animationManager.startZoomAnimation(zoom, 3.5f);
}

2nd- DragPinchManager.java

change the onDoubleTap method to the below code

@Override
    public void onDoubleTap(float x, float y) {
        if (isZooming()) {
            //TODO reset
            pdfView.resetZoomWithAnimation();
        }else{
            //TODO zoom
            pdfView.doubleTapZoomWithAnimation();
        }
    }

And the now the Double tap is good to go ;)

Cheers , Vinay Sasalatti

vinaysasalatti-android avatar Jun 04 '16 13:06 vinaysasalatti-android

@vinaysasalatti-android thanks for your answer . but only zoom and no center with double click position

SuperXFan avatar Jul 21 '16 10:07 SuperXFan