This section describes how to use map gestures.
Map Kit provides multiple gestures for users to interact with maps. For example, pinch with two fingers to zoom in or out on the map, drag with one finger to pan the map view, rotate with two fingers to change the map orientation, and slide up or down with two fingers to adjust the map view angle. These gestures are enabled by default. You can use APIs provided by the MapComponentController class to disable some of the gestures.

The following table lists the map gesture APIs. Gestures can be enabled or disabled in either of the following ways:
During map initialization, set whether to enable gestures in the initialization parameter MapOptions. For details, please refer to Displaying a Map.
Call the set method provided by MapComponentController to enable or disable related gestures.
| API | Description |
|---|---|
| setZoomGesturesEnabled(enabled: boolean): void | Sets whether to enable zoom gestures. The default value is true. |
| setScrollGesturesEnabled(enabled: boolean): void | Sets whether to enable scroll gestures. The default value is true. |
| setRotateGesturesEnabled(enabled: boolean): void | Sets whether to enable rotation gestures. The default value is true. |
| setTiltGesturesEnabled(enabled: boolean): void | Sets whether to enable tilt gestures. The default value is true. |
| setAllGesturesEnabled(enabled: boolean): void | Sets whether to enable gestures. The default value is true. |
Obtain a mapController object during map initialization. For details about the map initialization function, please refer to Displaying a Map.
You can use a mapController object to enable or disable relevant map gestures.
Zoom gestures:
A user can pinch two fingers to zoom in or out on the map.
this.mapController.setZoomGesturesEnabled(true);
Scroll gestures:
A user can drag the map to move it.
this.mapController.setScrollGesturesEnabled(true);
Rotation gestures:
A user can rotate the map by placing two fingers on it and rotating.
this.mapController.setRotateGesturesEnabled(true);
Tilt gestures:
A user can tilt the map by sliding two fingers up and down on the map.
this.mapController.setTiltGesturesEnabled(true);
Enabling or disabling all gestures:
Call the setAllGesturesEnabled method to enable or disable all gestures.
// Disable all gestures. this.mapController.setAllGesturesEnabled(false);