PDF.js Express Version
7.3.1
Detailed description of issue
Annotations are getting displaced when we zoom in and out abit fast. Even while tracing annotations are getting shifted. But this shift get resolved as soon as I zoom abit slow and doesn’t invoke annotationsChanged event. Means its just a temporary displacement of annotations.
Expected behaviour
Should not get displaced.
Does your issue happen with every document, or just one?
Every Document (Heavy document creates even more displ.)
Code snippet
const {docViewer} = instance;
const docContainer = instance.iframeWindow.document.querySelector('[data-element="documentContainer"]');
docContainer.addEventListener('wheel', onWheel, {passive: false});
function onWheel(e) {
e.preventDefault();
let newZoomFactor;
if (e.deltaY < 0) {
newZoomFactor = docViewer.getZoom() * WorkAreaConstants.ZOOM_OUT;
} else if (e.deltaY > 0) {
newZoomFactor = docViewer.getZoom() * WorkAreaConstants.ZOOM_IN;
}
if (newZoomFactor < 10) {
docViewer.zoomToMouse(newZoomFactor, 0, 0);
}
const containers = instance.iframeWindow.document.body.querySelectorAll('.hacc');
containers.forEach(item => {
item.style.opacity = 0.6;
});
}