Thumbnail doesn't change automatically - RadaeePDF.com
Signin/Signup with: 
Welcome, Guest
Username: Password: Remember me
Questions about iOS development and PDF
  • Page:
  • 1

TOPIC: Thumbnail doesn't change automatically

Thumbnail doesn't change automatically 4 years 3 months ago #7914

  • Joyce
  • Joyce's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
I have tried following the solution to modify the position of thumbnail (although instead of horizontal, I am now using vertical one).
By setting int top = 10, the first thumbnail now locates at my desired position.
Yet, when I start scrolling the pdf, I found out that the thumbnail doesn't change accordingly (e.g. upon scrolling from page 1 to page 2 or even page 3, the thumbnail doesn't change, while scrolling up to page 4 will the selected thumbnail changes from 1 to 4).
I have identified the responsible codes for this and which should be vGetDeltaToCenterPage::: in PDFV.m .
I have added the same method for the interface PDFVThmb (so that the codes in other interfaces won't be affected) and are as follows:
-(void)vGetDeltaToCenterPage:(int)pageno : (int *)dx : (int *)dy
{
if( m_pages == NULL || m_doc == NULL || m_w <= 0 || m_h <= 0 ) return;
PDFVPage *vpage = m_pages[pageno];
int left = [vpage GetX] - m_page_gap/2;
int top = [vpage GetY] - m_page_gap/2;
int w = [vpage GetWidth] + m_page_gap;
int h = [vpage GetHeight] + m_page_gap;
int x = left + (w - m_w)/2;
int y = top + (h - (m_h/2+10))/2;       <------ This line should be modified
*dx = x - m_x;
*dy = y - m_y;
}
- (void)vLayout
{
......
int top = 10;   // original version: int top = m_h/2;
......
}
The original version of that line is
int y = top + (h - m_h)/2;
Anyone can help me on the calculation? I have tried modifying the line but there are still some cases that the thumbnail doesn't change accordingly.
Any help is appreciated.

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

Last edit: by timore. Reason: code modified

Thumbnail doesn't change automatically 4 years 3 months ago #7918

  • radaee
  • radaee's Avatar
  • Offline
  • Moderator
  • Moderator
  • Posts: 859
  • Karma: 43
  • Thank you received: 13
is it this?
int y = top + (h - m_h/2 - 10)/2;

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

Last edit: by .

Thumbnail doesn't change automatically 4 years 3 months ago #7920

  • Joyce
  • Joyce's Avatar Topic Author
  • Offline
  • Fresh Boarder
  • Fresh Boarder
  • Posts: 4
  • Thank you received: 0
In some cases that works, but some still doesn't......
it seems to be related to the height of the thumbnail holding view...

Just an additional piece of information,
in -(void)vLayout
the final line is still
m_doch = top + m_h/2;
instead of
m_doch = top + 10;
If I set that to top + 10 (originally I want the last thumbnail to be located at the bottom of the thumbnail holding view),
but it seems that the calculations will be affected.

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

Last edit: by timore. Reason: information added
  • Page:
  • 1
Powered by Kunena Forum