# zingfinger **Repository Path**: feng2008/zingfinger ## Basic Information - **Project Name**: zingfinger - **Description**: ZingFinger 是一款超小(仅有 2k)的手势库,是 AlloyFinger 增强版:添加单指缩放、旋转,兼容捏、划、按、拖动等多手指手势 - **Primary Language**: JavaScript - **License**: MIT - **Default Branch**: master - **Homepage**: https://www.oschina.net/p/zingfinger - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 1 - **Created**: 2020-10-19 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # `ZingFinger` [![npm version](https://img.shields.io/npm/v/zingfinger.svg)](https://www.npmjs.com/package/zingfinger) [![gzip size](https://img.shields.io/bundlephobia/minzip/zingfinger.svg?label=gzip%20size)](https://www.npmjs.com/package/zingfinger) [![monthly npm installs](https://img.shields.io/npm/dm/zingfinger.svg?label=npm%20downloads)](https://www.npmjs.com/package/zingfinger) ![license](https://img.shields.io/badge/license-MIT-blue.svg) ZingFinger Super tiny size multi-touch gestures library for the web. Enhanced Edition: add singlePinch singleRotate singleRotate # Preview You can touch this → [Demo example](https://ilgei.github.io/ZingFinger/example/) ![img](./example/asset/example.gif) # Usage ## NPM [![zingfinger](https://nodei.co/npm/zingfinger.png)](https://npmjs.org/package/zingfinger) Install the library with npm into your local modules directory: ```js npm install zingfinger --save ``` ## CDN [![](https://img.shields.io/badge/jsDelivr-CDN-red.svg)](https://www.jsdelivr.com/package/npm/zingfinger) [![](https://img.shields.io/badge/UNPKG-CDN-red.svg)](https://unpkg.com/zingfinger/) ## JavaScript ```js 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 ```js // 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, }); ``` ```html
the element that you want to bind event
``` ## React Expect to contribute # Reference - [AlloyFinger](http://alloyteam.github.io/AlloyFinger/) - [css3transform](https://github.com/Tencent/omi/tree/master/packages/omi-transform) # License This content is released under the [MIT](http://opensource.org/licenses/MIT) License.