Product: pdftron/webviewer
Product Version: 8.4.1
Please give a brief summary of your issue:
I have mapped annotations in PDF web view from my API. It shows coordinates when mouse enters in web view. I used mouseEnter and mouseLeave function to show and disappears coordinates on the web view. If I scroll down to next page it does not show the annotations. To display annotation on next page after scroll each time i have to scroll my mouse out and then back into the webview.
Please describe your issue and provide steps to reproduce it:
documentViewer.addEventListener(“documentLoaded”, async () => {
rectangleAnnotFunction();
});
const rectangleAnnotFunction = () => {
props?.rectCords?.forEach(async (element) => {
const rectangleAnnot = new Annotations.RectangleAnnotation();
rectangleAnnot.X = element.left - 2;
rectangleAnnot.Y = element.top - 2;
rectangleAnnot.HE = ${element.page}
rectangleAnnot.Width = element.right - element.left + 4;
rectangleAnnot.Height = element.bottom - element.top + 4;
rectangleAnnot.Author = annotationManager.getCurrentUser();
rectangleAnnot.StrokeColor = new Annotations.Color(78, 125, 233);
rectangleAnnot.FillColor = new Annotations.Color(78, 125, 233, 0.1);
annotationManager.addAnnotation(rectangleAnnot);
annotationManager.redrawAnnotation(rectangleAnnot);
const annots = annotationManager.getAnnotationsList();
const annotations = annots.filter(
(annot) =>
annot instanceof
instance.Core.Annotations.RectangleAnnotation
);
annotations.forEach((rectangle) => {
rectangle.Hidden = false;
rectangle.Color = “#4e7de9”;
});
});
};
documentViewer.addEventListener("mouseLeave", () => {
const annots = annotationManager.getAnnotationsList();
const annotations = annots.filter(
(annot) =>
annot instanceof
instance.Core.Annotations.RectangleAnnotation
);
annotations.forEach((rectangle) => {
rectangle.Hidden = true;
});
annotationManager.drawAnnotationsFromList(annotations);
});
documentViewer.addEventListener("mouseEnter", async () => {
console.log("mouseEntermouseEntermouseEntermouseEnter");
const annots = annotationManager.getAnnotationsList();
const annotations = annots.filter(
(annot) =>
annot instanceof
instance.Core.Annotations.RectangleAnnotation
);
annotations.forEach((rectangle) => {
rectangle.Hidden = false;
});
annotationManager.drawAnnotationsFromList(annotations);
});
Please provide a link to a minimal sample where the issue is reproducible: