You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Sorry to post this message here but there is no other user forum for Monocle so I gotta do it here. Is there any way to read the contents of the page being displayed? We are trying to implement a read aloud feature in monocle that would sync an audio file with the text being displayed in the reader. As far as my understanding of Monocle so far goes, the iFrame content is being divided into pages depending on the dimensions of the reader and the iFrame is being translated accordingly. But is there any function or way to hack into it such that only the contents of the current page are retrieved?
Thank you,
The text was updated successfully, but these errors were encountered:
You can do this using the getClientRects DOM function. Basically, if you know the pixel offset of the current page (crudely: page-width * page-number), you can go through each DOM element and check whether any of its rectangles are in the rectangle of the current page.
Obviously this is computationally expensive and you probably want to cache your rectangles if you are doing it frequently.
This is exactly how the Stencil control works — if Stencil doesn't do what you need, I recommend reading through that code and adapt the technique to your needs.
Hello,
Sorry to post this message here but there is no other user forum for Monocle so I gotta do it here. Is there any way to read the contents of the page being displayed? We are trying to implement a read aloud feature in monocle that would sync an audio file with the text being displayed in the reader. As far as my understanding of Monocle so far goes, the iFrame content is being divided into pages depending on the dimensions of the reader and the iFrame is being translated accordingly. But is there any function or way to hack into it such that only the contents of the current page are retrieved?
Thank you,
The text was updated successfully, but these errors were encountered: