Zoom by using mouse scroll (Not by using ctrl+scroll)

I want to zoom in and out by using mouse scroll instead of using CTRL+MOUSESCROLL. I am using a single paged pdf so by using mouse scroll should zoom in and zoom out to the point where mouse is pointing.
I have implemented this much of code for zoom in and out but it wont zoom with respect to the mouse pointer’s location. Instead it zooms to the top left corner of the page.
Let me know how to make this work perfectly!
Here ,
public static ZOOM_OUT = 1.25;
public static ZOOM_IN = 0.8;


The second and third arguments are the offset values to the current mouse position. If you want to zoom in with respect to the current mouse position then you actually don’t want to have any offsets. I think if you just pass 0 and 0 in it should work.


1 Like