sumatrapdf icon indicating copy to clipboard operation
sumatrapdf copied to clipboard

Zoom position resets in book view when switching PDFs

Open Splinter7149 opened this issue 2 years ago • 2 comments

Hi there, please see video attached. In book view mode for ANY pdf, when you zoom in onto the right page:

  • with the center column off-screen,
  • and a high enough zoom-level that there is still space to scroll right,

the page shift to the furthest right it can when switching PDFs. I've tested this with a couple PDFs and they all exhibit this behaviour, it's quite frustrating when I need to switch back and forth and the position is different.

sumatrapdfzoombookviewerrorr.webm

Splinter7149 avatar Jul 28 '23 10:07 Splinter7149

Not sure if that's what you see but I got the following to reproduce:

  • open pdf, Ctrl + 8, zoom really big, scroll right so that only second page is visible but not y-scrolled to the end
  • switch to home tab
  • switch back to pdf tab

Another way to repro is: close and re-open to restore state.

The page will be scrolled all the way to the right. Also Happens in Ctrl + 7.

Looks like dm->GetScrollState() doesn't return the right page / scroll position or SetScrollState() doesn't restore it properly.

kjk avatar May 11 '24 17:05 kjk

Pretty sure the problem is: newPt.x += viewPort.x; in DisplayModel::SetScrollState.

It doesn't take into account 2-page layout. Should subtract the width of previous page.

kjk avatar May 13 '24 01:05 kjk