0.0.6 • Published 11 years ago

pinch-component v0.0.6

Weekly downloads
24
License
-
Repository
-
Last release
11 years ago

pinch

pinch in and out on elements on handheld devices.

Installation

Install with component(1):

$ component install component/pinch

Example

pinch(img, function(e) {
  dot.style.left = e.x + 'px';
  dot.style.top = e.y + 'px';
  dot.style['-webkit-transform'] = 'scale(' + e.scale + ')';
});

API

Pinch(el, fn)

Initialize Pinch with the element el and callback function fn.

pinch(img, function(e) {
  var midpoint = { x: e.x, y: e.y };
  var scale = e.scale;
});

The event object e is augmented with following keys:

  • x: the x coordinate of the midpoint between your two fingers
  • y: the y coordinate of the midpoint between your two fingers
  • scale: the relative distance between your two fingers starting at 1.

Pinch.unbind()

Unbind

TODO

  • add e.rotate support for android

License

MIT

0.0.6

11 years ago

0.0.5

11 years ago

0.0.4

11 years ago

0.0.3

11 years ago

0.0.2

11 years ago

0.0.1

11 years ago