Interactions and Events of the Map
This article describes map interactions and events:
- Map Interaction: Amap JS API 2.0 provides rich map interaction features, including zooming, panning, rotating, and more. Users can operate the map through gestures or a mouse for a better map browsing experience.
- Map Events: Briefly introduce map event binding methods and callback content. For more events, please visit Map and Overlay Events.
Map Interaction Instructions
Interactive properties can be added and configured when initializing the map AMap.Map() to enable or disable corresponding properties. If no corresponding property is added, the property will be enabled by default.
2D / 3D Mode
PC End
Mobile
3D mode
PC End
Mobile
Map events
Map events are triggered after operations on the Map's base layer. The event callback returns a MapsEvent object, which contains information such as the target object of the trigger and the latitude and longitude of the trigger.
map.on("click", function (ev) {
//Object of the triggering event
var target = ev.target;
//Geographic coordinates of the triggering event, AMap.LngLat type
var lnglat = ev.lnglat;
//Pixel coordinates of the triggering event, AMap.Pixel type
var pixel = ev.pixel;
//Trigger Event Type
var type = ev.type;
});For more event system usage, please go to the map and overlay events.