3.5.2 • Published 3 years ago

pan-zoom v3.5.2

Weekly downloads
161
License
MIT
Repository
github
Last release
3 years ago

pan-zoom tiny unstable

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.

npm install pan-zoom

const panzoom = require('pan-zoom');

let unpanzoom = panzoom(document.body, e => {
  // e contains all the params related to the interaction

  // pan deltas
  e.dx;
  e.dy;

  // zoom delta
  e.dz;

  // coordinates of the center
  e.x;
  e.y;

  // type of interaction: mouse, touch, keyboard
  e.type;

  // target element event is applied to
  e.target;

  // original element event started from
  e.srcElement;

  // initial coordinates of interaction
  e.x0;
  e.y0;
});

// call to remove panzoom handler from the target
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

3.5.2

3 years ago

3.5.1

4 years ago

3.5.0

5 years ago

3.4.1

5 years ago

3.4.0

6 years ago

3.3.0

6 years ago

3.2.2

6 years ago

3.2.1

6 years ago

3.2.0

6 years ago

3.1.0

6 years ago

3.0.0

6 years ago

2.3.2

6 years ago

2.3.1

6 years ago

2.3.0

6 years ago

2.2.1

6 years ago

2.2.0

6 years ago

2.1.1

6 years ago

2.1.0

6 years ago

2.0.0

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago