mikespub-org / intity-epubjs-reader

Epub.js Reader with zipfs.php
https://github-org.mikespub.net/intity-epubjs-reader/
MIT License
0 stars 1 forks source link

Touchscreen swipe to turn page is unpredictable #3

Closed dunxd closed 5 months ago

dunxd commented 5 months ago

When I try to turn the page by swiping left or right often I get multiple page turns instead of one, and sometimes I can't move back or forwards at all.

I think that there is a conflict between this feature and many browsers implementing back and forth navigation using left/right swipe gestures.

I am having the issue on an Android phone when using Chrome, Brave or Edge browsers.

IMHO it is better to just have the page turn buttons on phones the same as on desktop browsers. Or at least make this a preference that can be set by the user.

mikespub commented 5 months ago

Hi @dunxd

you'd better report this directly to @intity at https://github.com/intity/epubreader-js - I'm not doing anything with it other than re-package it

intity commented 5 months ago

@dunxd

When I try to turn the page by swiping left or right often I get multiple page turns instead of one, and sometimes I can't move back or forwards at all.

This is a known issue, but I don't have a solution yet. I'm trying to understand the architecture of the epub.js library to fix this.

dunxd commented 5 months ago

@intity - I really want to make your ereader the default for HA COPS as I think it is amazing. However the page turning is such a fundamental feature that it has to work out of the box on mobile browsers. There were no issues with the page turn buttons either side of the content as appears on desktop browsers. It is just the swiping I am seeing problems with.

It would be great to get swipe page turns working, but it feels to me like a feature that could be in a beta version or a PR until all the issues are resolved. If the main version which @mikespub is incorporating into COPS had the stable link based page turning then I think your reader is ready to go today, and then add in the touch gesture later when it is working without problems.

I am happy to test with the mobile devices that I have (Samsung Android and iPad) although I have to set up a test web server that can host the reader and some content. If you have any pointers on that, it would be really appreciated.

intity commented 5 months ago

@dunxd This can be customized. You need to override the mobile device detection function, then set options.arrows="toolbar" if it is a mobile device.

mikespub commented 5 months ago

In that case you can probably adapt the COPS config_local.php file with something like:

$config['cops_epubjs_reader_settings'] = '{
  arrows: "toolbar", // none | content | toolbar - depending on this.isMobile
  openbook: false
}';

or specify the settings directly in the 'epubjs-reader.html' template for testing

dunxd commented 5 months ago

I somehow missed the config setting to specify the settings. I have gone for this

$config['cops_epubjs_reader_settings'] = '{
    arrows: "content",
    flow: "paginated",
    openbook: false
}';

which works pretty well. The swipe functionality is still there, and still behaves oddly, but the page turn buttons are back which is great. I will propose the above as the default settings for COPS in a PR.

I've done a release of HA COPS which has this change, and allows switching between monocle and epubjs-reader.

I do have some thoughts on making the page turn buttons work better on smaller screens. I'll do those through pull requests to https://github.com/intity/epubreader-js

intity commented 4 months ago

Hi, I've been working on a fork of epub.js for a while to update dependencies and fix deprecated features. I also made a change to the Snap class, which provides the swipe functionality. In fact, I increased the default value for the duration option from 80 to 300 units. This option will determine the delay time when transforming the frame, which makes the swipe smoother. You can test the paginated-continuous example on a mobile device. If you continue to see the swipe issue, please open an issue.