Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about Android development and PDF
  • Page:
  • 1

TOPIC:

Double tap Zoom 9 years 3 weeks ago #10477

  • digitalpages
  • digitalpages's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
Hi,

I need create a feature using double tap for enable zoom, but I can't do the layout goes to the position tapped.

Follow my code:

public void doZoom(int x, int y) {
final float scale = m_layout.vGetZoom();
float zoomTo = scale + 1;
if (scale >= maxZoom) {
zoomTo = 1.0f;
}
m_layout.vZoomStart();
final PDFPos pdfPos = PDFGetPos(x, y);
m_layout.vZoomSet(x, y, pdfPos, zoomTo);
m_layout.vZoomConfirmed();
}

Thanks

Please Log in or Create an account to join the conversation.

Double tap Zoom 9 years 3 weeks ago #10479

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
if you want a doubleZoom In/Out you only have to add the following line at the end of OnPDFDoubleTapped method of PDFReader class before the return statement:
Global.zoomStep *= -1;

Maybe this will help you : www.radaeepdf.com/forum/Android-developm...et?limitstart=0#9795

If you want a different behaviour please better explain your needs..

Please Log in or Create an account to join the conversation.

Last edit: by Davide.

Double tap Zoom 9 years 3 weeks ago #10489

  • digitalpages
  • digitalpages's Avatar Topic Author
  • Offline
  • New Member
  • New Member
  • Posts: 3
  • Thank you received: 0
HI,

I'm using PDFLayoutView and this don't have a onPDFDoubleTapped method.

My code do a zoom, but I need center de pega zoomed in the tapped position, this not work in my code.

Do you recommend I change the view I'm using?

Thanks

Please Log in or Create an account to join the conversation.

Double tap Zoom 9 years 3 weeks ago #10492

  • Davide
  • Davide's Avatar
  • Offline
  • User is blocked
  • User is blocked
  • Posts: 814
  • Thank you received: 65
Hi,
try to add this method to PDFLayoutView:
public PDFLayout getLayout(){
return m_layout;
}

then change your code with something like that
PDFLayout layout = m_view.getLayout();
PDFLayout.PDFPos pdfPos= layout.vGetPos((int) x, (int) y);

If it doesn't work, check x and y values...are they correctly passed to your method?

Please Log in or Create an account to join the conversation.

  • Page:
  • 1
Powered by Kunena Forum