Zoom by scrolling on the mouse, without holding CTRL

Which product are you using?
PDF.js Express Viewer

PDF.js Express Version
‘8.7.0’

Detailed description of issue
“I want to zoom in and out using the mouse scroll, but without holding down CTRL.

Expected behaviour
Zoom in and out using the mouse scroll, but without holding down CTRL.

Does your issue happen with every document, or just one?
Every

Link to document
https://nunb.mpanel.app/eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3N1ZUlkIjoxOTI0MSwiZXhwIjoxNjgwNjkyOTE3LCJpbnN0YW5jZSI6ImhhbnphbWVkaWEifQ.ey_ELUK-xXqOlXJKaKkfDdVXVQ8SRLxH6lFbHHYFwdw

Hello djordje.krstic97,

We have a hotkey api found here: PDFJS Express WebViewer Namespace: Hotkeys
however with the scroll wheel you will have to capture the browser scroll event and override it, then call:
documentViewer.zoomTo(documentViewer.getZoomLevel() + 1); // or however much you want to zoom in

Best regards,
Tyler Gordon

Hi tgordon,

I wasn’t able to catch the browser scroll event and override it in the way you suggested. Do “hotkeys” work on version 8.7?"

Beste regards,
Djordje

Hello djordje.krstic97,

You may have to attach the listener to App div or content div (depends on your integration)


Then listening to the onScroll event, by programmatically adding the eventlistener or just attaching it like so:

 <div id="content" onScroll="handleOnScroll();">

Looking again through our hotkeys, it looks like we don’t have one for scrolling. So capturing the scroll event would be the only option here.

Best regards,
Tyler Gordon