Which event gets fired when scrolling to the left or right of the document

Hello,

I am using the webviewer inside a pager (like swiperjs). When the user swipes the individual page I want to fire an event off to let them know that they need to go left or right.

I have managed to create my own event inside toucheventsmanager.js file, however, this only works on mobile device. How can I do the same on desktop, infact I can’t seem to track any scroll event.


if (swipedToRight === true) {
          fireEvent(Events.SWIPE_RIGHT);
        }
        if (swipedToLeft === true) {
          fireEvent(Events.SWIPE_LEFT);
        }

Any help would be appreciated.

Thanks

Maybe trying something like this?

window.addEventListener("scroll", function(){
    // Do something after scrolling  
});

or this?

window.onscroll = function () {  
    // Do something after scrolling  
}

Thanks, I am looking to find out I can find out where the scroll position is with relation to the page, easy on touch events not so easy it seems on mouse dragging events.

I linked into handleScroll inside DocumentContainer, but it again has no relation to where in the page it is.

Hi Nathan,

After looking at this issue, there’s a few things that might work here.

  1. PDFTron Systems Inc. | Documentation Looking at the guide here, there seems to be a function that is able to convert the window points to coordinates inside the page.
  2. Using the same guide as above, you should be able to use the scrollViewElement in documentViewer to retrieve the exact page coordinates you need. (PDFTron WebViewer Class: DocumentViewer)
  3. I also saw this function in the API that might help you out as well (PDFTron WebViewer Namespace: Core).

Best,
Will