Touch-enabled Element Zoom & Pan Library – EasyPZ

Category: Javascript , Zoom | February 15, 2019
Author: michaschwab
Views Total: 985
Official Page: Go to website
Last Update: February 15, 2019
License: MIT

Preview:

Touch-enabled Element Zoom & Pan Library – EasyPZ

Description:

EasyPZ is a standalone, dependency-free JavaScript library used to zoom and pan any element with mouse and touch interactions.

Basic usage:

Download and insert the JavaScript file ‘easypz.latest.min.js’ into the web page.

<script src="easypz.latest.min.js"></script>

Add the ‘easypz’ attribute to element you want to zoom and pan.

<svg easypz='{"applyTransformTo": "svg > *"}' height="400" width="400">
  <polygon points="100,10 40,198 190,78 10,78 160,198"
  style="fill:lime;stroke:purple;stroke-width:5;fill-rule:nonzero;" />
</svg>

All possible options.

modes: "SIMPLE_PAN", "HOLD_ZOOM_IN", "CLICK_HOLD_ZOOM_OUT", "WHEEL_ZOOM", "PINCH_ZOOM", "DBLCLICK_ZOOM_IN", "DBLRIGHTCLICK_ZOOM_OUT"],
applyTransformTo: "",
replaceVariables: false

Callback functions available.

onPanned: function() {},
onZoomed: function() {},
onTransformed: function() {},
onResetAbsoluteScale: function() {},

Changelog:

02/15/2018

  • Bugfix

10/07/2018

  • Allow switching between mouse- and touch-based interactions on hybrid devices.

09/17/2018

  • Tweak to make the momentum interactions more flexible and obtain more information.

You Might Be Interested In:


Leave a Reply