Skip to content

the AlloyFinger (Enhanced Edition),add singlePinch singleRotate singleRotate & vue react plugins.

License

Notifications You must be signed in to change notification settings

arjenhill/ZingFinger

Repository files navigation

ZingFinger

npm version gzip size monthly npm installs license

ZingFinger Super tiny size multi-touch gestures library for the web.

Enhanced Edition: add singlePinch singleRotate singleRotate

Preview

You can touch this → Demo example

img

Usage

NPM

zingfinger

Install the library with npm into your local modules directory:

npm install zingfinger --save

CDN

JavaScript

var af = new ZingFinger(element, {
  touchStart: function () {},
  touchMove: function () {},
  touchEnd: function () {},
  touchCancel: function () {},
  multipointStart: function () {},
  multipointEnd: function () {},
  tap: function () {},
  doubleTap: function () {},
  longTap: function () {},
  singleTap: function () {},
  rotate: function (evt) {
    console.log(evt.angle);
  },
  pinch: function (evt) {
    console.log(evt.zoom);
  },
  pressMove: function (evt) {
    console.log(evt.deltaX);
    console.log(evt.deltaY);
  },
  swipe: function (evt) {
    console.log("swipe" + evt.direction);
  },
  singlePinch: function (evt) {
    console.log(evt.zoom);
  },
  singleRotate: function (evt) {
    console.log(evt.angle);
  },
});

Vue

// JavaScript
Vue.use(ZingFingerVue); // use ZingFingerVue's plugin
var h = new Vue({
    el: '#el',
    methods: {
        tap: function() { console.log('onTap'); }
        ...
    }
});

// import
import Vue from "vue";
import ZingFinger from "zingfinger";
import ZingFingerPlugin from "zingfinger/plugin/vue/zingfinger";
Vue.use(ZingFingerPlugin, {
  ZingFinger,
});
<div id="cnt">
  <div v-finger:tap="tap" v-finger:long-tap="longTap" ...>
    <div>the element that you want to bind event</div>
  </div>
</div>

React

Expect to contribute

Reference

License

This content is released under the MIT License.

About

the AlloyFinger (Enhanced Edition),add singlePinch singleRotate singleRotate & vue react plugins.

Resources

License

Stars

Watchers

Forks

Packages

No packages published