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

Selection end becomes the start of page when not directly over text #2542

Closed
grssam opened this issue Jan 10, 2013 · 2 comments
Closed

Selection end becomes the start of page when not directly over text #2542

grssam opened this issue Jan 10, 2013 · 2 comments

Comments

@grssam
Copy link

grssam commented Jan 10, 2013

open any pdf and start selecting some text.
Until you are directly over text while dragging your mouse, the selection will have proper starting and ending. As soon as you move over some empty space , say space between two paragraphs that you want to select, the selection's end point will shift to the start of the page.

My hunch is that when you are not over any text, and you convert the mouse coordinates to text offset, it returns -1, so the selection end goes to offset -1, or 0, that is the start of the page. If this is the issue, we should probably fallback to the previously used selection end offset in such cases.

@mitar
Copy link
Contributor

mitar commented Jul 3, 2013

+1 for this.

Are you sure this is not just a browser issue? So I am not sure if anybody is converting any coordinates to selection or anything in pdf.js code. It is how browser allows text selection on hidden text divs layered over the canvas in pdf.js. And the issue is that divs are positioned only over the text, so when you get with the mouse out of the text area, browser doesn't follow anymore what you are selecting.

We tried a very simple hack: for all text layer divs we added 100px right and bottom padding. And it works much better then.

@timvandermeij
Copy link
Contributor

I cannot reproduce this anymore with the latest viewer at https://mozilla.github.io/pdf.js/web/viewer.html. This has likely been addressed by #6591. Closing as fixed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants