babluboy / bookworm

A simple ebook reader for Elementary OS
GNU General Public License v3.0
1.32k stars 100 forks source link

Add finger swipe gestures to go to next or previous pages #287

Closed mnussbaum closed 4 years ago

mnussbaum commented 4 years ago

This PR adds gestures to go to the next or previous page by swiping from right to left to or left to right respectively. This makes bookworm more usable on tablet devices where it can be hard to tap the existing page flip buttons using fingers.

Fixes https://github.com/babluboy/bookworm/issues/272

mnussbaum commented 4 years ago

Hmm, testing this a bit more I think it can still be improved. Right now if I swipe mostly vertically but a bit to the left or right it registers as a page flip, when it seems like it should only register as a page flip if the action is mostly horizontal.

mnussbaum commented 4 years ago

I updated the swipe action handler to filter out mostly-vertical gestures that should trigger page scroll up/down and only let through page flip sideways actions now. I chose a value for mostly-vertical that feels correct in testing, but is rather arbitrary.

I think this is ready for review now!

mnussbaum commented 4 years ago

I just spent a six hour plane ride reading using this branch and have pushed one further vertical-swipe filtering change. Happy to report that after this change the branch gives a really nice swipe experience

babluboy commented 4 years ago

Many thanks for this PR - while I don’t have access to a touch screen running Ubuntu this is going to make bookworm very touch screen friendly....

Now that we have the updates to the code to handle swipe, should I keep my changes for clicking on the left and right edges?

mnussbaum commented 4 years ago

Thanks for merging this! I think your changes to enable clicking the sides to flip pages are still helpful for mouse users, as it adds a much larger surface area then just the small arrow buttons to enable a common user action, so my preference would be to leave them in place