Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

PDF.js viewer pinch to zoom

I'm using PDF.js for rendering my documents on a web app I'm working on.

However I need to enable pinch to zoom on mobile devices for this and it doesn't look like the library itself allows native zooming.

Is there a library that I could use to the code to simulate (at the very least) pinch and zoom on the same scale as the viewers dropdown zoom selection?

like image 398
Jordan Avatar asked Aug 11 '14 22:08

Jordan


1 Answers

I had found an answer to this solution. I ended up using hammer.js for the pdf.js

http://hammerjs.github.io/

edit

var mc = new Hammer.Manager(myElement, myOptions);

mc.add( new Hammer.Pan({ direction: Hammer.DIRECTION_ALL, threshold: 0 }) );
mc.add( new Hammer.Tap({ event: 'quadrupletap', taps: 4 }) );

mc.on("pan", handlePan);
mc.on("quadrupletap", handleTaps);
like image 121
Jordan Avatar answered Oct 03 '22 08:10

Jordan