Open strattonpress opened 4 years ago
I am currently experiencing this issue. Did you find a solution for it?
@BrianSladek haven't found a solution yet.
Any updates/hints? This is major issue for small sceen devices like phones.
I can confirm also that using console to load last position will display correctly. The issue has to do with refresh
This happens because:
The solution is simply running rendition.display(lastPositionHere)
after applying any themes or style changes. AFAIK that's the only way.
A similar problem occurs when you resize the view multiple times in a row. While it keeps the same location with each resize, the location gradually drifts away from the original location. See https://github.com/futurepress/epub.js/pull/959.
Thank you johnfactotum for the hints when chanaging font size. The mentioned issue appear even without changing the font. some pages location will load parent position.
It happens when locationOf of content.js returns empty position -> position = range.getBoundingClientRect();
getBoundingClientRect returns 0 for some ranges(RTL books)
to recover from this issue i have to create a container from the range and get bounding client rectangle from the parent node let container = range.startContainer position = container.parentNode.getBoundingClientRect()
I have stored the current CFI location on
rendition.on("relocated")
but there are some pages whererendition.display(lastPositionHere)
doesn't work correctly. Like, when refreshing the page, epubjs displays the not the last position but the last position's "parent". Then I tried executingrendition.display(lastPositionHere)
on the Firefox console and then it renders correctly. It's as if epubjs was displaying the last position but when the styles were applied (larger font size), the viewer adjusted.