pan-zoom

Panning and zooming events for any target. May come handy for webgl, canvas, svg, images or pure html manipulations. Handles mobile pinch-zoom, drag and scroll interactions, provides inertial movement.
See demo.

const panzoom = require('pan-zoom');
let unpanzoom = panzoom(document.body, e => {
e.dx;
e.dy;
e.dz;
e.x;
e.y;
e.type;
e.target;
e.srcElement;
e.x0;
e.y0;
});
unpanzoom()
See test.js
for basic use-case.
Alternatives
Credits
This package puts together high-quality tiny components, so acknowledgment to their authors:
License
© 2017 Dmitry Yv. MIT License