readium / r2-navigator-swift

BSD 3-Clause "New" or "Revised" License
19 stars 47 forks source link

word selection issue #187

Open singhranakumar22gmailcom opened 3 years ago

singhranakumar22gmailcom commented 3 years ago

i am useing readium library for epub .when i am holding on the first word then it's getting selected and when i am touching and holding on second word then it's get selected with previous one ,like whole sentence get's selected.

word selection issue

macOS: 11.2 platform: x86_64 Xcode 12.4 Build version 12D4e

iOS version: 14.4 Model (e.g. iPhone 11 Pro Max): iPhone 12 Pro Max Is it an emulator? Yes

in utility.js

 document.addEventListener('selectionchange', debounce(50, function() {
        var info = {}
        var selection = document.getSelection();
       if (selection && selection.rangeCount > 0) {
            var rect = selection.getRangeAt(0).getBoundingClientRect();
            info['text'] = selection.toString().trim();
            info['frame'] = {
                'x': rect.left,
                'y': rect.top,
                'width': rect.width,
                'height': rect.height
            };
        }

        webkit.messageHandlers.selectionChanged.postMessage(info);
    }));
mickael-menu commented 3 years ago

I'm not sure what's going on, could you record a screencast showing the problem to lift any ambiguity?

And did you reproduce this on a real device?

We don't modify the web view selection in Readium.

https://user-images.githubusercontent.com/58686775/124120993-a9841800-da74-11eb-8267-55d3c28b32f6.mov

singhranakumar22gmailcom commented 3 years ago

https://user-images.githubusercontent.com/58514077/124142931-4ad89180-daa8-11eb-9f5c-4248c97da0cf.mov

in real device also it's working same.

mickael-menu commented 3 years ago

Yeah it looks really buggy but it seems pretty specific to this book. Can you reproduce the problem with one of the books in the sample test app?

singhranakumar22gmailcom commented 3 years ago

Hii , can u please share the link of your sample test app.

mickael-menu commented 3 years ago

https://github.com/readium/r2-testapp-swift/tree/develop/Sources/Resources/Samples

singhranakumar22gmailcom commented 3 years ago

These are epub files, can u please share the simple Xcode project.

mickael-menu commented 3 years ago

It's in the same repo. But I asked to see if you had the same problem in your app with one of these sample books.