Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[EPUB reflow] We can move the offset by pinching the page #146

Closed
mickael-menu opened this issue Nov 18, 2020 · 12 comments
Closed

[EPUB reflow] We can move the offset by pinching the page #146

mickael-menu opened this issue Nov 18, 2020 · 12 comments
Labels
bug Something isn't working

Comments

@mickael-menu
Copy link
Member

mickael-menu commented Nov 18, 2020

We can move the offset of a page by pinching it, then dragging it in a single gesture.

@johanpoirier wrote in #166:

This is caused by those lines of code: https://github.com/readium/r2-navigator-kotlin/blob/develop/r2-navigator/src/main/java/org/readium/r2/navigator/R2WebView.kt#L735-L738

The mLastMotionX is set by the second finger down, so the xDiff is almost never greater than mTouchSlop: https://github.com/readium/r2-navigator-kotlin/blob/develop/r2-navigator/src/main/java/org/readium/r2/navigator/R2WebView.kt#L677

My question is: why are we mixing touch pointers values into mLastMotionX?

90648045-58db4600-e239-11ea-8e33-ebad3ab4492c

@mickael-menu mickael-menu added the bug Something isn't working label Nov 18, 2020
@mickael-menu
Copy link
Member Author

mickael-menu commented Jan 18, 2021

Still happening, but not a major issue.

@mickael-menu mickael-menu transferred this issue from readium/r2-navigator-kotlin Jul 29, 2022
@mickael-menu
Copy link
Member Author

I took a look while working on #143, and I think it's actually a useful feature/bug. This allows to stretch a text selection across two pages, by dragging it. So I didn't fix it, however once the selection is dismissed, the page will be snapped back into place.

@SeijiFukuoka
Copy link

Hi @mickael-menu, I'm trying to not allow user to text select across two pages, how i can disable this selection, could you help me?

@mickael-menu
Copy link
Member Author

Try with the code from #143 (branch fix/issue-86) and see if it helps.

@SeijiFukuoka
Copy link

SeijiFukuoka commented Aug 10, 2022

@mickael-menu
Unfortunately, using this branch fix/issue-86, the user can select across two pages, I have recorded a example using test-app with Moby Dick epub.

When i select one word at top area of page and try to select something above, this bug happens.

ezgif-5-54cb4d080b

@mickael-menu
Copy link
Member Author

We got some users that reported this bug but I was never able to reproduce it myself, so I'm not sure what's going on.

I wonder if the onTap event is being fired which causes the reader to go to the previous page. Would mind checking if VisualReaderFragment.onTap is being called when you try to interact with the selection handle?

@SeijiFukuoka
Copy link

I put some breakpoints and VisualReaderFragment.onTap is not being called when I interact with text selection.
I'm trying to identify which methods are called when I interact with text selection to top direction.

@mickael-menu
Copy link
Member Author

Thanks, let me know if you need some help navigating the code.

I believe the selection dragging events might be handled here:

if ((mLastMotionX > (width - mGutterSize)) || (mLastMotionX < mGutterSize)) {

@SeijiFukuoka
Copy link

I put some breakpoints and logs and unfortunately when I try to select more text to top direction, the method onTouchEvent are not called. This method are called only when we interact ou change pages without text selection selecting something.

Could be a configuration on some javascript lib related to text selection? And one interesting fact is the bug don't happen if we try to select a word at top section and drag the text selection to bottom direction of webview page.

screen-20220811-100842.mp4

I'm still searching how to not allow user to text select to top direction without returning to previous page, but if you have any other ideas, please tell me.

Thanks in advance.

@mickael-menu
Copy link
Member Author

I'm not sure, could be an issue with a specific version of the Android System WebView too. Could you share which version you have on your device? You can find it in Settings > Apps > Android System WebView. Try updating it if it's outdated to see if it helps.

@SeijiFukuoka
Copy link

I have check webview version and it's at last version. Could you tell me if it's possible to log or put a breakpoint inside gesture.js file? I tried to put and debug with chrome inspect and tried to use Android.logbut without success.

@mickael-menu
Copy link
Member Author

chrome://inspect and Android.log() should work, you probably didn't rebuild the JavaScript bundles:

# If you don't already have Yarn installed
$ brew install yarn

$ cd readium/navigator

# To do only the first time
$ make install

# To do every time you change a JavaScript file
$ make scripts

The Android.log() should appear in the Logcat panel if you filter by "Debug":

2022-08-16 18:54:32.865 10029-10189/org.readium.r2reader D/R2BasicWebView: JavaScript: Test log

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants