@map-gesture-controls/ol 0.1.2 → 0.1.4

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 +128 -0
  2. package/package.json +25 -2
package/README.md ADDED
@@ -0,0 +1,128 @@
1
+ # @map-gesture-controls/ol
2
+
3
+ [![npm version](https://img.shields.io/npm/v/@map-gesture-controls/ol?style=flat-square)](https://www.npmjs.com/package/@map-gesture-controls/ol)
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/ol?style=flat-square&label=minzipped)](https://bundlephobia.com/package/@map-gesture-controls/ol)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-typed-blue?style=flat-square&logo=typescript)](https://www.typescriptlang.org/)
7
+
8
+ **Control OpenLayers maps with hand gestures.** No mouse, no touch, no backend. Point your webcam, make a fist to pan, show two open hands to zoom. Powered by [MediaPipe](https://developers.google.com/mediapipe) hand-tracking running entirely in the browser. Your camera feed never leaves the device.
9
+
10
+ ## Demo
11
+
12
+ Try it live at **[sanderdesnaijer.github.io/map-gesture-controls](https://sanderdesnaijer.github.io/map-gesture-controls/)**
13
+
14
+ <p align="center">
15
+ <img src="https://raw.githubusercontent.com/sanderdesnaijer/map-gesture-controls/main/docs/public/openlayers-gesture-control-demo.gif" alt="Screen recording of the map gesture demo: an OpenLayers map with a small webcam preview; the user pans with a fist and zooms with two open hands, all in the browser via MediaPipe." width="720" />
16
+ </p>
17
+
18
+ ## Install
19
+
20
+ ```bash
21
+ npm install @map-gesture-controls/ol ol
22
+ ```
23
+
24
+ ## Quick start
25
+
26
+ ```ts
27
+ import Map from 'ol/Map.js';
28
+ import View from 'ol/View.js';
29
+ import TileLayer from 'ol/layer/Tile.js';
30
+ import OSM from 'ol/source/OSM.js';
31
+ import { fromLonLat } from 'ol/proj.js';
32
+ import { GestureMapController } from '@map-gesture-controls/ol';
33
+ import '@map-gesture-controls/ol/style.css';
34
+
35
+ const map = new Map({
36
+ target: 'map',
37
+ layers: [new TileLayer({ source: new OSM() })],
38
+ view: new View({ center: fromLonLat([0, 0]), zoom: 2 }),
39
+ });
40
+
41
+ const controller = new GestureMapController({ map });
42
+
43
+ // Must be called from a user interaction (e.g. button click) for webcam permission
44
+ await controller.start();
45
+
46
+ // Later, to tear down:
47
+ controller.stop();
48
+ ```
49
+
50
+ ## How it works
51
+
52
+ 1. **Webcam capture** - `GestureController` opens the camera and feeds each frame to MediaPipe Hand Landmarker, returning 21 3D landmarks per hand.
53
+ 2. **Gesture classification** - `GestureStateMachine` classifies frames in real time: one closed fist means pan, two open palms means zoom, anything else is idle. Dwell timers and grace periods prevent accidental triggers.
54
+ 3. **Map integration** - `OpenLayersGestureInteraction` translates hand movement deltas into `ol/Map` pan offsets and zoom adjustments, with dead-zone filtering and exponential smoothing for a natural feel.
55
+
56
+ ## Gestures
57
+
58
+ | Gesture | How to perform | Map action |
59
+ | --- | --- | --- |
60
+ | **Pan** | Make a fist with one hand, move it around | Drags the map |
61
+ | **Zoom** | Show two open palms, move hands apart or together | Zooms in or out |
62
+ | **Idle** | Any other hand position | Map stays still |
63
+
64
+ ## Configuration
65
+
66
+ All options are optional. Defaults work well out of the box.
67
+
68
+ ```ts
69
+ const controller = new GestureMapController({
70
+ map,
71
+ webcam: {
72
+ position: 'top-left', // overlay corner position
73
+ width: 240,
74
+ height: 180,
75
+ opacity: 0.7,
76
+ },
77
+ tuning: {
78
+ panScale: 3.0, // higher = faster panning
79
+ zoomScale: 2.0, // higher = faster zooming
80
+ actionDwellMs: 80, // ms before confirming a gesture
81
+ releaseGraceMs: 150, // ms grace period after gesture ends
82
+ },
83
+ debug: true, // log gesture state to console
84
+ });
85
+ ```
86
+
87
+ See the full configuration reference in the [documentation](https://sanderdesnaijer.github.io/map-gesture-controls/).
88
+
89
+ ## Exports
90
+
91
+ This package re-exports the entire [`@map-gesture-controls/core`](https://www.npmjs.com/package/@map-gesture-controls/core) API, so you only need one import. On top of core, it adds:
92
+
93
+ | Export | Type | Description |
94
+ | --- | --- | --- |
95
+ | `GestureMapController` | Class | High-level controller that wires gesture detection to an OpenLayers map |
96
+ | `OpenLayersGestureInteraction` | Class | Low-level OL interaction for custom setups |
97
+ | `GestureMapControllerConfig` | Type | Configuration interface |
98
+
99
+ ## Use cases
100
+
101
+ - **Museum and exhibit kiosks** - visitors explore maps without touching a shared screen
102
+ - **Accessibility** - hands-free map navigation for users with limited mobility
103
+ - **Live presentations** - control a projected map from across the room
104
+ - **Public displays** - touchless interaction in medical, retail, or transit environments
105
+
106
+ ## Requirements
107
+
108
+ - OpenLayers 10.x (`ol` as a peer dependency)
109
+ - A modern browser with WebGL, `getUserMedia`, and WASM support
110
+ - Chrome 111+, Edge 111+, Firefox 115+, Safari 17+
111
+
112
+ ## Related packages
113
+
114
+ | Package | Description |
115
+ | --- | --- |
116
+ | [`@map-gesture-controls/core`](https://www.npmjs.com/package/@map-gesture-controls/core) | Map-agnostic gesture detection engine (included in this package) |
117
+
118
+ ## Documentation
119
+
120
+ Full docs, live demos, and API reference at **[sanderdesnaijer.github.io/map-gesture-controls](https://sanderdesnaijer.github.io/map-gesture-controls/)**
121
+
122
+ ## Privacy
123
+
124
+ All gesture processing runs locally in the browser. No video data is sent to any server. MediaPipe WASM and model files are loaded from public CDNs.
125
+
126
+ ## License
127
+
128
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@map-gesture-controls/ol",
3
- "version": "0.1.2",
3
+ "version": "0.1.4",
4
4
  "description": "Control OpenLayers maps with hand gestures via MediaPipe",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -35,9 +35,32 @@
35
35
  "openlayers",
36
36
  "mediapipe",
37
37
  "hand-gestures",
38
+ "gesture-control",
39
+ "gesture-recognition",
40
+ "hand-tracking",
38
41
  "map",
39
- "gesture-control"
42
+ "maps",
43
+ "gis",
44
+ "webcam",
45
+ "touchless",
46
+ "hands-free",
47
+ "accessibility",
48
+ "kiosk",
49
+ "computer-vision",
50
+ "wasm",
51
+ "interaction",
52
+ "ol"
40
53
  ],
54
+ "homepage": "https://sanderdesnaijer.github.io/map-gesture-controls/",
55
+ "repository": {
56
+ "type": "git",
57
+ "url": "https://github.com/sanderdesnaijer/map-gesture-controls.git",
58
+ "directory": "packages/ol-gesture-controls"
59
+ },
60
+ "bugs": {
61
+ "url": "https://github.com/sanderdesnaijer/map-gesture-controls/issues"
62
+ },
63
+ "author": "Sander de Snaijer",
41
64
  "overrides": {
42
65
  "esbuild": "^0.25.0"
43
66
  },