readium / readium-js-viewer

👁 ReadiumJS viewer: default web app for Readium.js library
BSD 3-Clause "New" or "Revised" License
553 stars 186 forks source link

How can I get the pageX and pageY when going to next pagination part. #646

Closed deepeshuniyal closed 7 years ago

deepeshuniyal commented 7 years ago

This issue is a Question

Hi, On the selection of the text I have to open a popup. For doing this we have created and div and insert it inside the iframedoc on ReadiumSDK.Events.CONTENT_DOCUMENT_LOADED event and set it invisible, when user selecting the text then inside this event readium.reader.addIFrameEventListener('mouseup', function(e) we are changing this div to visible and its working fine on the first page.

The problem is when we are going in next page and select the text the popup still opening in the firstpage because PageX is not changing. So how can we get the PageX value according to the pagination.

Thanks.

danielweck commented 7 years ago

This is actually quite a complex issue due to how different web browsers compute "client rectangles" inside CSS columns (which is how reflowable documents are paginated in Readium). I would suggest using an existing library, and/or to look into how Hypothes.is are doing it: https://github.com/hypothesis/client/tree/master/src/annotator cc @JCCR