@map-gesture-controls/ol 0.1.2 → 0.1.3

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 +124 -0
  2. package/package.json +25 -2
package/README.md ADDED
@@ -0,0 +1,124 @@
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
+ ## Install
15
+
16
+ ```bash
17
+ npm install @map-gesture-controls/ol ol
18
+ ```
19
+
20
+ ## Quick start
21
+
22
+ ```ts
23
+ import Map from 'ol/Map.js';
24
+ import View from 'ol/View.js';
25
+ import TileLayer from 'ol/layer/Tile.js';
26
+ import OSM from 'ol/source/OSM.js';
27
+ import { fromLonLat } from 'ol/proj.js';
28
+ import { GestureMapController } from '@map-gesture-controls/ol';
29
+ import '@map-gesture-controls/ol/style.css';
30
+
31
+ const map = new Map({
32
+ target: 'map',
33
+ layers: [new TileLayer({ source: new OSM() })],
34
+ view: new View({ center: fromLonLat([0, 0]), zoom: 2 }),
35
+ });
36
+
37
+ const controller = new GestureMapController({ map });
38
+
39
+ // Must be called from a user interaction (e.g. button click) for webcam permission
40
+ await controller.start();
41
+
42
+ // Later, to tear down:
43
+ controller.stop();
44
+ ```
45
+
46
+ ## How it works
47
+
48
+ 1. **Webcam capture** - `GestureController` opens the camera and feeds each frame to MediaPipe Hand Landmarker, returning 21 3D landmarks per hand.
49
+ 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.
50
+ 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.
51
+
52
+ ## Gestures
53
+
54
+ | Gesture | How to perform | Map action |
55
+ | --- | --- | --- |
56
+ | **Pan** | Make a fist with one hand, move it around | Drags the map |
57
+ | **Zoom** | Show two open palms, move hands apart or together | Zooms in or out |
58
+ | **Idle** | Any other hand position | Map stays still |
59
+
60
+ ## Configuration
61
+
62
+ All options are optional. Defaults work well out of the box.
63
+
64
+ ```ts
65
+ const controller = new GestureMapController({
66
+ map,
67
+ webcam: {
68
+ position: 'top-left', // overlay corner position
69
+ width: 240,
70
+ height: 180,
71
+ opacity: 0.7,
72
+ },
73
+ tuning: {
74
+ panScale: 3.0, // higher = faster panning
75
+ zoomScale: 2.0, // higher = faster zooming
76
+ actionDwellMs: 80, // ms before confirming a gesture
77
+ releaseGraceMs: 150, // ms grace period after gesture ends
78
+ },
79
+ debug: true, // log gesture state to console
80
+ });
81
+ ```
82
+
83
+ See the full configuration reference in the [documentation](https://sanderdesnaijer.github.io/map-gesture-controls/).
84
+
85
+ ## Exports
86
+
87
+ 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:
88
+
89
+ | Export | Type | Description |
90
+ | --- | --- | --- |
91
+ | `GestureMapController` | Class | High-level controller that wires gesture detection to an OpenLayers map |
92
+ | `OpenLayersGestureInteraction` | Class | Low-level OL interaction for custom setups |
93
+ | `GestureMapControllerConfig` | Type | Configuration interface |
94
+
95
+ ## Use cases
96
+
97
+ - **Museum and exhibit kiosks** - visitors explore maps without touching a shared screen
98
+ - **Accessibility** - hands-free map navigation for users with limited mobility
99
+ - **Live presentations** - control a projected map from across the room
100
+ - **Public displays** - touchless interaction in medical, retail, or transit environments
101
+
102
+ ## Requirements
103
+
104
+ - OpenLayers 10.x (`ol` as a peer dependency)
105
+ - A modern browser with WebGL, `getUserMedia`, and WASM support
106
+ - Chrome 111+, Edge 111+, Firefox 115+, Safari 17+
107
+
108
+ ## Related packages
109
+
110
+ | Package | Description |
111
+ | --- | --- |
112
+ | [`@map-gesture-controls/core`](https://www.npmjs.com/package/@map-gesture-controls/core) | Map-agnostic gesture detection engine (included in this package) |
113
+
114
+ ## Documentation
115
+
116
+ Full docs, live demos, and API reference at **[sanderdesnaijer.github.io/map-gesture-controls](https://sanderdesnaijer.github.io/map-gesture-controls/)**
117
+
118
+ ## Privacy
119
+
120
+ 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.
121
+
122
+ ## License
123
+
124
+ 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.3",
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
  },