RadaeePDF.com :: Topic: move to point on pdf where click occured (1/1)
Welcome, Guest
Username: Password: Remember me

Signin/Signup with:

Questions about Android development and PDF

TOPIC: move to point on pdf where click occured

move to point on pdf where click occured 3 years 5 months ago #6289

  • apait
  • apait's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • Karma: 0
hi,

i have a pdf, on doubletap i want to zoom into the pdf and center it on the coordinate where the doubletap was.

In ReaderController you have following code, which i extended:

public boolean OnPDFDoubleTapped(float x, float y)
{
this.m_pdv.vSetScale(this.m_pdv.vGetScale() +1, (int)x, (int)y);
return false;
}

zoom works, but the pdf only jumps to the top/left corner.

i tried following, but without any luck:
this.m_pdv.vSetPos(pos, (int)x, (int)y)

so, how can i just move to a point on the pdf, where i detected a click?
The topic has been locked.

move to point on pdf where click occured 3 years 5 months ago #6298

  • apait
  • apait's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • Karma: 0
okay, my bad, i just forgot to return true for the gesturelistener...

works:

public boolean OnPDFDoubleTapped(float x, float y){
m_pdv.vSetScale(m_pdv.vGetScale() + Global.zoomStep, x, y);
return true;
}

but is it possible to "center" the point where i the click occured?

now i'm zooming in and the point on the pdf where i clicked stays... i would like to move the pdf, so the point where i clicked is centered...
The topic has been locked.

move to point on pdf where click occured 3 years 5 months ago #6319

  • apait
  • apait's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • Karma: 0
any answer?
The topic has been locked.

move to point on pdf where click occured 3 years 5 months ago #6329

  • radaee
  • radaee's Avatar
  • OFFLINE
  • Moderator
  • Posts: 825
  • Thank you received: 10
  • Karma: 43
like this:
m_pdv.vSetScale(m_pdv.vGetScale() + Global.zoomStep, m_pdv.GetWidth()/2, m_pdv.GetHeight()/2);
The topic has been locked.

move to point on pdf where click occured 3 years 5 months ago #6435

  • apait
  • apait's Avatar
  • OFFLINE
  • Junior Boarder
  • Posts: 36
  • Karma: 0
no, thats not working...
with m_pdv.GetWidth()/2, m_pdv.GetHeight()/2 it just centers the zoomed in page, regardless where the click occured.

any other ideas? ;)
The topic has been locked.
Powered by Kunena Forum