nPDF icon indicating copy to clipboard operation
nPDF copied to clipboard

Feature request : change page when scrolling

Open davy39 opened this issue 9 years ago • 7 comments

Hi, I wonder if it will be possible to automatically change page when arriving at the end (or beginning) of a page while scrolling. For now, change of pages seems to be done only with + and - The best would be to obtain "continuous" scrolling between multiple pages like we have in many desktop pdf readers. Thanks for your help

Edit : I've tried mupdf on Ubuntu and actually it changes automatically pages when scrolling

Edit2 : It's very confusing : man mupdf says the opposite :

   Scroll wheel
          Pan page up or down. Does not change page when reaching the bottom or top edge.

Edit3 : Now I understand that commands control Viewer.cpp : I tryed a simple patch witch kind of work when scrolling up (but we have to make it go at the bottom of previous page) but not when scrolling down... Is yPos always < (bounds.y1 - bounds.y0) - height ?

https://github.com/davy39/nPDF/commit/c6b3bce5c4f53cd7765f993133b69256452f1c18

davy39 avatar Nov 25 '15 16:11 davy39

@critor intentionally made it that way, because it takes so long to load the next page, and it would be annoying if a user accidentally went to the next page. If you can come up with a better idea feel free.

Legimet avatar Nov 26 '15 00:11 Legimet

Maybe it is related to the kind of PDF (heavy images, etc) because my pages (mostly text and math) are opening almost instantaneously. So I will be happy to have a complete scrolling mode:) @critor : do you have any clue about why next(); is never called in my patch ? https://github.com/davy39/nPDF/commit/c6b3bce5c4f53cd7765f993133b69256452f1c18 Would you have any time to help implement this ?

davy39 avatar Nov 26 '15 10:11 davy39

What you apparently didn't understand, is that you're not going to get a "complete scrolling mode", but a terrible user experience. Scrolling beyond the bottom of the page didn't scroll to the next page in a natural way. It completely cleared the screen, putting you on the top of the next page. So it's not natural to have some presses on the down-arrow key scrolling by a handful of pixels, and some other presses scrolling by a full screen height (240px).

Moreover, "almost instantaneously" is not "instantenously". By letting its finger on the down-arrow key one fraction of a second too late, the user who just wanted to check the bottom of a page is going to be shown the next page, whose display is not instantaneous (almost a second). So the user will then have to go back to the previous page (again, almost one more second), and then carefully scroll back to the bottom of the page.

critor avatar Nov 26 '15 11:11 critor

I understand your point, and probably the user experience may depends both on hardware and PDF. I'm actually using nspire cx cas overclocked with small text PDFs and I would say that pages are displaying with about 200ms which is really fine.

So in my case, I feel it more natural to explore a PDF by pressing one unique key than juggling between two ('down arrow' + '+'), even if it means some bigger steps while changing pages. In fact, that the way mupdf is acting when build for x11 (see here for code related to it).

You're absolutely right that it may be a really bad thing when it take so long to display, so I will not insist for it to be the default behaviour of nPDF. However, do you have an idea on why next() is never called when applying this simple patch https://github.com/davy39/nPDF/commit/c6b3bce5c4f53cd7765f993133b69256452f1c18

Finally, the best would of course be to achieve a "real" continuous scrolling mode (like in llpp ie. display both bottom of previous page and head of next one.). But I guess this implies a huge code modification, and I'm personally not ready for that yet...

davy39 avatar Nov 26 '15 12:11 davy39

Thank you for your fast and comprehensive reply.

Yes, the right way for a continuous scrolling with nPDF would be to show 2 pages at the same time : end of the previous page + start of the next page.

Your next() is never called, because yPos is automatically fixed each times it gets modified and thus is never out of bounds.

By the way Legimet, isn't there an error in Viewer.cpp on line 244 ? Shouldn't yPos = (xPos > (bounds.y1 - bounds.y0) - height)?(bounds.y1 - bounds.y0) - width:yPos; be yPos = (yPos > (bounds.y1 - bounds.y0) - height)?(bounds.y1 - bounds.y0) - width:yPos; ?

critor avatar Nov 26 '15 13:11 critor

Thank you !

So stupid am I : I looked every where else but I didn't see that xPos in place of yPos... That's why nothing was working ;) Now I'm happy, I got the scrolling mode I expected with this patch https://github.com/davy39/nPDF/commit/c7de00dc3ab83f466442b48c930b6a7b87f43010

Maybe if you think it could be useful for others, we could integrate that as an option in a configuration file.

Anyway, many thanks to @critor and @Legimet for your awesome work !

davy39 avatar Nov 26 '15 14:11 davy39

I fixed the error.

@davy39, a config option would be good. We could possibly allow 3 modes of scrolling: the current behavior, the behavior in your modified version, and a proper continuous scrolling mode.

Legimet avatar Nov 26 '15 16:11 Legimet