Disable map rotation

Prevent users from rotating a 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', // container id
    style: MapStyle.STREETS,
    center: [-122.65, 45.52], // starting position
    zoom: 9 // starting zoom
});

// disable map rotation using right click + drag
map.dragRotate.disable();

// disable map rotation using touch rotation gesture
map.touchZoomRotate.disableRotation();
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.

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.

Was this helpful?