readium / readium-js-viewer

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

How to load annotations when initializing chapters #655

Open wtfshine opened 6 years ago

wtfshine commented 6 years ago

I have a question as follows: Each time the highlight is loaded, the label position is always offset, which is why for example: reader.on(Globals.Events.CONTENT_DOCUMENT_LOADED, function ($iframe, spineItem) { if (_initialized) { _highlightsManager.attachAnnotations($iframe, spineItem, reader.getLoadedSpineItems()); _highlightsManager.addHighlight(spineItem.idref,cfi,id,"test-highlight"); } else { _initializedLate = true; } });