PDF.js Express Version
“name”: “webviewer”,
“description”: “PDFJS Express”,
“version”: “7.2.0”,
Detailed description of issue
I want to enable panning while tracing/drawing any tool like (AnnotationCreatePerimeterMeasurement) and (AnnotationCreateAreaMeasurement). I have used setToolMode to enable tracing. Now while tracing, User should be able to zoom and pan while tracing.
I have got some information regarding this. So Can you give me some working snippet of this idea because it didn’t work as expected. -
You can implement the auto scrolling functionality by listening to the mouseMove event on the docViewer. The idea is to listen to this event, and in the event handler you can check if currently the mouse position is near the edge of the viewport. If this is the case, you can call docViewer.getScrollViewElement to get the scroll container and set its scrollTop or scrollLeft to scroll.
Expected behaviour
User should be able to pan while tracing annotations like Perimeter and area tool.
Does your issue happen with every document, or just one?
Every Document
Link to document
Any Pdf document.
Code snippet
This works but only when mouse goes close to viewer’s border, but I want to enable panning even if it is not close to the webviewer’s border. User should be free to pan while tracing.
instance.docViewer.on('mouseMove', e => {
const docContainer1 = instance.iframeWindow.document.querySelector('[data-element="documentContainer"]');
docContainer1.scrollTop = e.y;
docContainer1.scrollLeft = e.x;
});