Knowledge Base and examples

Knowledge Base - How to handle doubleTap gesture with zoomIn and zoomOut?

This article shows how to handle zoomIn and zoomOut with the double tap.

Using RDPDFReader, you need to implement the listener OnPDFDoubleTapped in PDFViewAct:

@Override
public boolean OnPDFDoubleTapped(PDFLayout layout, float x, float y)
{
float mCurZoomLevel = layout.vGetZoom();
if(m_view.PDFGetScale() <= m_view.PDFGetMinScale())
Global.zoomStep = 1;
if((mCurZoomLevel > Global.zoomLevel && Global.zoomStep > 0) ||
(mCurZoomLevel == 1 && Global.zoomStep < 0)) //reverse zoom step
Global.zoomStep *= -1;

layout.vZoomSet((int) x, (int) y, layout.vGetPos((int) x, (int) y), mCurZoomLevel + Global.zoomStep);
return true;
}

Note: to change the zoom step or the max zoom level, you need to change Global.zoomStep and/or Global.zoomLevel.

 

Using PDFReader, you have to Override OnPDFDoubleTapped method of PDFReader class as following: 

public boolean OnPDFDoubleTapped(float x, float y)
{
if( m_status != STA_NORMAL ) return false;
if(m_view.vGetScale() == m_view.vGetMinScale())
m_view.vSetScale(m_view.vGetMaxScale(),x,y );
else
m_view.vSetScale(m_view.vGetMinScale(),x,y );
return true;
}
Applies To

RadaeePDF SDK for Android

Details

Created : 2015-08-18 08:53:42, Last Modified : 2017-03-03 09:56:26