Cooperative gestures

This example shows how to enable cooperative gestures with a specific language.

See how it behaves: on desktop, zoom using the mouse wheel. On mobile, touch and move the map.

Windows: Use Ctrl + scroll to zoom the map.
Mac: Use ⌘ + scroll to zoom the map.
Mobile: Use two fingers to move the map.

NPM module setup


npm install --save @maptiler/sdk
import { Map, MapStyle, config } from '@maptiler/sdk';
import '@maptiler/sdk/dist/maptiler-sdk.css';

config.apiKey = 'YOUR_MAPTILER_API_KEY_HERE';
const map = new Map({
  container: 'map',
  style: MapStyle.STREETS,
  center: [-77.04, 38.907],
  zoom: 11.15,
  cooperativeGestures: true,
  locale: {
    'CooperativeGesturesHandler.WindowsHelpText': 'Utilice Ctrl + desplazamiento para hacer zoom en el mapa.',
    'CooperativeGesturesHandler.MacHelpText': 'Usa ⌘ + desplazamiento para hacer zoom en el mapa.',
    'CooperativeGesturesHandler.MobileHelpText': 'Usa dos dedos para mover el mapa.',
  },
});
Hide map navigation controls

Hide map navigation controls

Tutorials

Hide the map navigation and zoom controls.

Create a non-interactive map

Create a non-interactive map

Examples

Disable interactivity to create a static map.

Disable scroll zoom

Disable scroll zoom

Examples

Prevent scroll actions from zooming your interactive map.

Toggle interactions

Toggle interactions

Examples

Enable or disable specific user interaction handlers on maps.

Was this helpful?