https://github.com/jcquintas/web-gestures
The core engine of GestureEvents, a modern and robust multi-pointer gesture detection library for JavaScript.
https://github.com/jcquintas/web-gestures
Last synced: about 2 months ago
JSON representation
The core engine of GestureEvents, a modern and robust multi-pointer gesture detection library for JavaScript.
- Host: GitHub
- URL: https://github.com/jcquintas/web-gestures
- Owner: JCQuintas
- License: mit
- Created: 2025-04-10T22:11:11.000Z (2 months ago)
- Default Branch: main
- Last Pushed: 2025-04-21T09:45:05.000Z (about 2 months ago)
- Last Synced: 2025-04-21T10:43:16.194Z (about 2 months ago)
- Language: TypeScript
- Size: 544 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
```ts
import { GestureManager, PanGesture } from '@web-gesture/core';const gestureManager = new GestureManager({
root: document.body,
touchAction: 'none',
gestures: [
new PanGesture({
name: 'pan',
threshold: 10,
maxPointers: 1,
minPointers: 1,
direction: ['up', 'down', 'left', 'right'],
}),
],
});const element = document.getElementById('my-element');
gestureManager.registerElement('pan', element);element.addEventListener('panStart', event => {
const detail = event.detail;
console.log('Pan started at:', detail.centroid);
});element.addEventListener('pan', event => {
const detail = event.detail;
console.log('Pan move at:', detail.centroid);
});element.addEventListener('panEnd', event => {
const detail = event.detail;
console.log('Pan ended at:', detail.centroid);
});
```