An open API service indexing awesome lists of open source software.

https://github.com/hesprs/pointeract

πŸ–±οΈπŸ€ Library for multitouch and all other gestures.
https://github.com/hesprs/pointeract

frontend interaction pointer-events typescript

Last synced: 8 days ago
JSON representation

πŸ–±οΈπŸ€ Library for multitouch and all other gestures.

Awesome Lists containing this project

README

          



Pointeract



Modern, lightweight, robust and extensible user interaction resolver



CI Status


Test Coverage


Code Quality


Documentation


npm package


library security


package size

Typescript
Made by Humans



Demo
β€’

Documentation
β€’

npm

## What's Pointeract?

Pointeract is a tiny JavaScript/TypeScript utility library focusing on one thing - handling user interactions with DOM elements, e.g. multitouch and touchpad.

With the unique strength of versatile typings in TypeScript and its dynamic nature, Pointeract have achieved a highly _modular, extendable and efficient_ architecture. Its core bundle size is only **1KB** minified + gzipped, functionalities come from also byte-sized modules. It's fully **tree-shakable**, the fewer modules you use, the smaller your bundle is.

## Advantages

- **🐣 Tiny**: With base **1KB** minified and gzipped, **1-2KB** for normal usage.
- **πŸ’ͺ Robust**: Excels at complex gestures where most interaction libraries fail, [Why?](https://pointeract.consensia.cc/development/testing#monkey-test)
- **🧩 Extensible**: Extend Pointeract effortlessly via our module API.
- **πŸ”Œ Flexible during Runtime**: Options are updated reactively. Stop/start any module during runtime.
- **πŸ›‘οΈ Safe**: Not modifying the DOM (except the `PreventDefault` module). Meticulous clean up prevents memory leaks.

## Get Started

Install Pointeract using your favorite package manager:

```sh
# npm
$ npm add pointeract

# pnpm
$ pnpm add pointeract

# yarn
$ yarn add pointeract

# bun
$ bun add pointeract
```

Or include the following lines directly in your HTML file:

```html

import { Pointeract } from 'https://unpkg.com/pointeract/dist/index.js';

```

This link ships the latest ESM version by default, to access CJS version or earlier versions, try using a different URL like:

```html

```

The link above ships version 1.0.1 in CJS.

Then simply grab the core class and a module:

```TypeScript
import { Pointeract, Drag } from 'pointeract';

new Pointeract({ element: yourElement }, Drag)
.start()
.on('drag', e => console.log(e));
```

Congratulations! You can now press your mouse or finger to the element and move, the console will log events like a waterfall.

**Read next**: dive into the usage of Pointeract in [Use Pointeract](https://pointeract.consensia.cc/basic/use-pointeract).

## Currently Supported Features

- **Click (Double Click, Triple Click, Quadruple Click, Any Click)**
- **Drag**
- **Pan and Zoom via Mouse Wheel (`ctrl`/`shift` key binding, touchpad support)**
- **Pan and Zoom via Multitouch (Pan, Pinch)**
- **One-line Prevent Default**
- **Smooth Everything (drag / pan / zoom / any interaction involving numbers)**

Those interactions are shipped via modules, which can be composed from a single drag-and-drop to a canvas app.

Missing your desired interaction? [Write your own module](https://pointeract.consensia.cc/development/custom-modules)!

## How Pointeract Stands Out?

There're already plenty of interaction libraries out there, most famous ones are `Interact.js` and `Hammer.js`, but Pointeract is different.

| Criteria | Pointeract | [Hammer.js](https://hammerjs.github.io) | [Interact.js](https://interactjs.io) |
| :--------------------------------------------------------------------------------------- | :---------------------------------------------------: | :----------------------------------------------: | :-------------------------------------------------: |
| Written in TypeScript? | βœ… | ❌ | βœ… |
| Tree-shakeable? | [βœ…](https://bundlephobia.com/package/pointeract) | [❌](https://bundlephobia.com/package/hammerjs) | [❌](https://bundlephobia.com/package/interactjs) |
| Bundle Size (Minified + Gzipped) | πŸ‘‘ [3KB](https://bundlephobia.com/package/pointeract) | [7KB](https://bundlephobia.com/package/hammerjs) | [28KB](https://bundlephobia.com/package/interactjs) |
| Last Updated | πŸ‘‘ Actively Maintained | 2015 | 2023 |
| Features | Pointer and Wheel Related | Pointer Related | πŸ‘‘ Pointer and Wheel Related + Comprehensive Utils |
| Robust? (See [Testing](https://pointeract.consensia.cc/development/testing#monkey-test)) | βœ… | ❌ Element Jerks | ❌ Element Ignores the Second Touch |
| Extensible? | βœ… | ❌ | ❌ |

## Get Involved

This project welcomes anyone that have ideas to improve it.

- [Open a pull request](https://github.com/hesprs/pointeract/compare) for a new module, event standard, documentation update, and so on.
- [Open an issue](https://github.com/hesprs/pointeract/issues/new) if you find a bug.
- [Start a new thread in Discussions](https://github.com/hesprs/pointeract/discussions/new) if you have feature requests or questions, please avoid posting them in Issues.
- [Report a vulnerability](https://github.com/hesprs/pointeract/security/advisories/new) if you find one, please do not disclose it publicly.

## Copyright and License

Copyright ©️ 2025-2026 Hesprs (HeΜ„sperus) | [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0.html)