# alloyfinger

> super tiny size multi-touch gestures library for the web.

Latest version **0.1.16** (published 2019-01-03) · MIT license · 0 weekly downloads

## Install

```sh
npm install alloyfinger
pnpm add alloyfinger
yarn add alloyfinger
bun add alloyfinger
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.16 |
| Published | 2019-01-03 |
| First published | 2016-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 987.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3436 |
| Author | dntzhang |
| Maintainers | dntzhang |
| Keywords | gesture, touch, multitouch |

## Links

- npm: https://www.npmjs.com/package/alloyfinger
- Repository: https://github.com/AlloyTeam/AlloyFinger
- Homepage: https://github.com/AlloyTeam/AlloyFinger#readme
- Issues: https://github.com/AlloyTeam/AlloyFinger/issues
- npm.io page: https://npm.io/package/alloyfinger

## Recent versions

- 0.1.16 (latest) — 2019-01-03
- 0.1.15 — 2018-06-11
- 0.1.14 — 2018-06-05
- 0.1.13 — 2018-01-04
- 0.1.12 — 2017-12-28
- 0.1.11 — 2017-12-01
- 0.1.10 — 2017-09-18
- 0.1.8 — 2017-06-22
- 0.1.7 — 2017-05-15
- 0.1.6 — 2017-03-03
- 0.1.5 — 2017-02-18
- 0.1.4 — 2016-12-27
- 0.1.3 — 2016-11-18
- 0.1.2 — 2016-05-31
- 0.1.1 — 2016-05-28
- … 1 more at https://npm.io/package/alloyfinger/versions

## README

# Preview

You can touch this → [http://alloyteam.github.io/AlloyFinger/](http://alloyteam.github.io/AlloyFinger/)

# Install

You can install it via npm:

```html
npm install alloyfinger
```

# Usage

```js
var af = new AlloyFinger(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);
    }
});

/**
 * this method can also add or remove the event handler
 */
var onTap = function() {};

af.on('tap', onTap);
af.on('touchStart', function() {});

af.off('tap', onTap);

/**
 * this method can destroy the instance
 */
af = af.destroy();
```

### Omi Version:


```js
import { render, tag, WeElement } from 'omi'
import 'omi-finger'

@tag('my-app')
class MyApp extends WeElement {
  install() {
    this.data.wording = 'Tap or Swipe Me!'
  }

  handleTap = (evt) => {
    this.data.wording += '\r\nTap'
    this.update()
  }

  handleSwipe = (evt) => {
    this.data.wording += '\r\nSwipe-' + evt.direction
    this.update()
  }

  render() {
    return (
      <div>
        <omi-finger onTap={this.handleTap} abc={{a:1}} onSwipe={this.handleSwipe}>
          <div class="touchArea" >
            {this.data.wording}
          </div>
        </omi-finger>
      </div>
    )
  }

  css() {
    return `.touchArea{
                  background-color: green;
                  width: 200px;
                  min-height: 200px;
                  text-align: center;
                  color:white;
                  height:auto;
                  white-space: pre-line;
              }`
  }
}

render(<my-app></my-app>, 'body')
```

* [omi-finger](https://github.com/Tencent/omi/tree/master/packages/omi-finger)
* [css3transform](https://github.com/Tencent/omi/tree/master/packages/omi-transform)

# Others

* [AlloyCrop](https://github.com/AlloyTeam/AlloyCrop)


# License
This content is released under the [MIT](http://opensource.org/licenses/MIT) License.

---
_Source: https://npm.io/package/alloyfinger · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
