Skip to content

Configuration Reference

All configuration is passed to GestureMapController at construction time. Every key is optional; unspecified keys use the defaults shown below. The configuration is shared across all adapters (OpenLayers, Google Maps).

ts
const controller = new GestureMapController({
  map,          // required: your map instance (ol/Map or google.maps.Map)
  webcam: { ... },   // optional: WebcamConfig
  tuning: { ... },   // optional: TuningConfig
  debug: false,      // optional: boolean
});

WebcamConfig

Controls the webcam video overlay rendered on top of the map.

KeyTypeDefaultDescription
enabledbooleantrueShow or hide the overlay entirely. Set to false to run gesture detection without showing the camera feed.
mode'corner' | 'full' | 'hidden''corner''corner' renders a small picture-in-picture overlay. 'full' fills the map container. 'hidden' hides the video but keeps the canvas skeleton visible.
position'bottom-right' | 'bottom-left' | 'top-right' | 'top-left''bottom-right'Which corner to anchor the overlay when mode === 'corner'.
widthnumber320Overlay width in pixels (corner mode).
heightnumber240Overlay height in pixels (corner mode).
marginnumber16Distance in pixels from the nearest viewport edges.
opacitynumber0.85CSS opacity of the overlay (0 = transparent, 1 = fully opaque).

Example: move overlay to top-left

ts
const controller = new GestureMapController({
  map,
  webcam: {
    position: 'top-left',
    margin: 12,
    opacity: 0.75,
  },
});

TuningConfig

Controls gesture detection sensitivity, smoothing, and timing.

KeyTypeDefaultDescription
actionDwellMsnumber80Time in milliseconds a gesture must be held before it is confirmed as active. Prevents accidental triggers.
releaseGraceMsnumber150Time in milliseconds the state machine waits before returning to idle after a gesture ends. Prevents flickering.
panDeadzonePxnumber0Minimum hand movement in normalised-coordinate pixels required to register a pan. Increase this to filter hand tremor.
zoomDeadzoneRationumber0.005Minimum fractional change in right wrist vertical position required to register a zoom step.
rotateDeadzoneRadnumber0.005Minimum change in the wrist-to-wrist angle (radians) required to emit a rotate delta. Lower values make rotation respond to smaller wrist tilts; higher values filter out micro jitter.
smoothingAlphanumber0.35Exponential moving average factor for landmark positions. 0 = maximum smoothing (very slow response), 1 = raw unsmoothed input.
minDetectionConfidencenumber0.65MediaPipe hand detection confidence threshold (0 to 1). Lower values detect more hands but with more false positives.
minTrackingConfidencenumber0.65MediaPipe hand tracking confidence threshold (0 to 1).
minPresenceConfidencenumber0.60MediaPipe hand presence confidence threshold (0 to 1).

Example: tuning for responsiveness

Lower dwell time and dead zone for faster, more immediate response:

ts
const controller = new GestureMapController({
  map,
  tuning: {
    actionDwellMs: 40, // confirm gestures faster
    releaseGraceMs: 80, // return to idle faster
    panDeadzonePx: 0, // direct panning for slow movement
    rotateDeadzoneRad: 0.0005, // respond to slower wrist tilts
  },
});

Example: tuning for precision

Higher smoothing and dead zones for slow, deliberate control:

ts
const controller = new GestureMapController({
  map,
  tuning: {
    smoothingAlpha: 0.2, // heavy smoothing, slow but stable
    panDeadzonePx: 20, // require larger movements
    zoomDeadzoneRatio: 0.01, // require larger zoom gesture
    actionDwellMs: 120, // require longer hold before confirming
  },
});

Example: debug mode

Logs the active gesture mode to the browser console on every frame:

ts
const controller = new GestureMapController({
  map,
  debug: true,
});