@map-gesture-controls/core 0.1.4 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +89 -0
  2. package/package.json +23 -2
package/README.md ADDED
@@ -0,0 +1,89 @@
1
+ # @map-gesture-controls/core
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@map-gesture-controls/core?style=flat-square)](https://www.npmjs.com/package/@map-gesture-controls/core)
4
+ [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg?style=flat-square)](https://opensource.org/licenses/MIT)
5
+ [![Bundle size](https://img.shields.io/bundlephobia/minzip/@map-gesture-controls/core?style=flat-square&label=minzipped)](https://bundlephobia.com/package/@map-gesture-controls/core)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-typed-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
7
+
8
+ **Turn any web map into a hands-free experience.** This is the map-agnostic gesture detection engine behind [map-gesture-controls](https://github.com/sanderdesnaijer/map-gesture-controls). It uses [MediaPipe](https://developers.google.com/mediapipe) hand-tracking WASM to detect hand gestures from a webcam feed, classify them in real time, and expose a clean event-driven API. All processing runs locally in the browser. No video data ever leaves the device.
9
+
10
+ > Building with OpenLayers? Use [`@map-gesture-controls/ol`](https://www.npmjs.com/package/@map-gesture-controls/ol) instead. It wraps this package and adds map integration out of the box.
11
+
12
+ ## What it does
13
+
14
+ - Detects hands and classifies gestures at 30+ fps using MediaPipe Hand Landmarker
15
+ - Recognizes **fist** (pan), **open palm** (zoom), and **idle** states
16
+ - Manages gesture transitions with dwell timers and grace periods to avoid flickering
17
+ - Provides a configurable webcam overlay with corner/full/hidden display modes
18
+ - Ships fully typed TypeScript declarations
19
+
20
+ ## Install
21
+
22
+ ```bash
23
+ npm install @map-gesture-controls/core
24
+ ```
25
+
26
+ ## Quick start
27
+
28
+ ```ts
29
+ import { GestureController } from '@map-gesture-controls/core';
30
+ import '@map-gesture-controls/core/style.css';
31
+
32
+ const controller = new GestureController({
33
+ onGestureFrame(frame) {
34
+ // frame.hands contains detected hands with landmarks and gesture type
35
+ console.log(frame);
36
+ },
37
+ });
38
+
39
+ // Must be called from a user interaction (button click) for webcam permission
40
+ await controller.start();
41
+ ```
42
+
43
+ ## Exports
44
+
45
+ | Export | Type | Description |
46
+ | --- | --- | --- |
47
+ | `GestureController` | Class | Opens the webcam, runs MediaPipe detection, and emits gesture frames |
48
+ | `GestureStateMachine` | Class | Manages gesture state transitions with dwell and grace timers |
49
+ | `WebcamOverlay` | Class | Renders a configurable camera preview overlay |
50
+ | `classifyGesture` | Function | Classifies a set of hand landmarks into `fist`, `openPalm`, or `none` |
51
+ | `getHandSize` | Function | Computes the bounding size of a hand from its landmarks |
52
+ | `getTwoHandDistance` | Function | Measures the distance between two detected hands |
53
+ | `DEFAULT_WEBCAM_CONFIG` | Constant | Default webcam overlay settings |
54
+ | `DEFAULT_TUNING_CONFIG` | Constant | Default tuning parameters |
55
+
56
+ Full TypeScript types are exported for `GestureMode`, `GestureFrame`, `DetectedHand`, `WebcamConfig`, `TuningConfig`, and more.
57
+
58
+ ## Gesture recognition
59
+
60
+ | Gesture | Detection rule | Use case |
61
+ | --- | --- | --- |
62
+ | **Fist** | One hand, 3+ fingers curled | Pan / drag |
63
+ | **Open palm** | Two hands, all fingers extended and spread | Zoom in/out |
64
+ | **Idle** | Anything else | No action |
65
+
66
+ Gestures are confirmed after a configurable dwell period (default 80 ms) and held through a grace period (default 150 ms) to prevent flickering when tracking briefly drops.
67
+
68
+ ## Use cases
69
+
70
+ - **Kiosk and exhibit displays** where touch screens get dirty or break down
71
+ - **Accessibility** for users who cannot use a mouse or touchscreen
72
+ - **Touchless interfaces** in medical, industrial, or public environments
73
+ - **Custom map integrations** beyond OpenLayers (build your own adapter using this core engine)
74
+
75
+ ## Browser support
76
+
77
+ Requires **WebGL**, **`getUserMedia`** (webcam), and **WASM** support. Works in Chrome 111+, Edge 111+, Firefox 115+, and Safari 17+.
78
+
79
+ ## Documentation
80
+
81
+ Full docs, live demos, and configuration reference at **[sanderdesnaijer.github.io/map-gesture-controls](https://sanderdesnaijer.github.io/map-gesture-controls/)**
82
+
83
+ ## Privacy
84
+
85
+ MediaPipe WASM and the hand landmarker model are loaded from public CDNs. No video frames are sent to any server. All gesture processing happens locally in the browser.
86
+
87
+ ## License
88
+
89
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-gesture-controls/core",
3
- "version": "0.1.4",
3
+ "version": "0.1.5",
4
4
  "description": "Map-agnostic hand gesture detection and state machine (MediaPipe)",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -30,8 +30,29 @@
30
30
  "keywords": [
31
31
  "mediapipe",
32
32
  "hand-gestures",
33
- "gesture-detection"
33
+ "gesture-detection",
34
+ "gesture-recognition",
35
+ "hand-tracking",
36
+ "webcam",
37
+ "touchless",
38
+ "hands-free",
39
+ "accessibility",
40
+ "computer-vision",
41
+ "wasm",
42
+ "kiosk",
43
+ "map",
44
+ "interaction"
34
45
  ],
46
+ "homepage": "https://sanderdesnaijer.github.io/map-gesture-controls/",
47
+ "repository": {
48
+ "type": "git",
49
+ "url": "https://github.com/sanderdesnaijer/map-gesture-controls.git",
50
+ "directory": "packages/map-gesture-core"
51
+ },
52
+ "bugs": {
53
+ "url": "https://github.com/sanderdesnaijer/map-gesture-controls/issues"
54
+ },
55
+ "author": "Sander de Snaijer",
35
56
  "overrides": {
36
57
  "esbuild": "^0.25.0"
37
58
  },