Fired when the user cancels a "box zoom" interaction, or when the bounding box does not meet the minimum size threshold. See BoxZoomHandler.
Fired when a "box zoom" interaction ends. See BoxZoomHandler.
Fired when a "box zoom" interaction starts. See BoxZoomHandler.
Fired when a pointing device (usually a mouse) is pressed and released at the same point on the map.
Fired when the right button of the mouse is clicked or the context menu key is pressed within the map.
Fired when any map data loads or changes. See MapDataEvent for more information.
Fired when a request for one of the map's sources' tiles or data is aborted.
Fired when any map data (style, source, tile, etc) begins loading or
changing asynchronously. All dataloading
events are followed by a data
,
dataabort
or error
event.
Fired when a pointing device (usually a mouse) is pressed and released twice at the same point on the map in rapid succession.
Note: Under normal conditions, this event will be preceded by two click
events.
Fired repeatedly during a "drag to pan" interaction. See DragPanHandler.
Fired when a "drag to pan" interaction ends. See DragPanHandler.
Fired when a "drag to pan" interaction starts. See DragPanHandler.
Fired when an error occurs. This is GL JS's primary error reporting
mechanism. We use an event instead of throw
to better accommodate
asynchronous operations. If no listeners are bound to the error
event, the
error will be printed to the console.
Fired after the last frame rendered before the map enters an "idle" state:
Fired immediately after all necessary resources have been downloaded and the first visually complete rendering of the map has occurred.
Fired when a pointing device (usually a mouse) is pressed within the map.
Fired when a pointing device (usually a mouse) is moved while the cursor is inside the map. As you move the cursor across the map, the event will fire every time the cursor changes position within the map.
Fired when a point device (usually a mouse) leaves the map's canvas.
Fired when a pointing device (usually a mouse) is moved within the map. As you move the cursor across a web page containing a map, the event will fire each time it enters the map or any child elements.
Fired when a pointing device (usually a mouse) is released within the map.
Fired repeatedly during an animated transition from one view to another, as the result of either user interaction or methods such as Map#flyTo.
Fired just after the map completes a transition from one view to another, as the result of either user interaction or methods such as Map#jumpTo.
Fired just before the map begins a transition from one view to another, as the result of either user interaction or methods such as Map#jumpTo.
Fired repeatedly during the map's pitch (tilt) animation between one state and another as the result of either user interaction or methods such as Map#flyTo.
Fired immediately after the map's pitch (tilt) finishes changing as the result of either user interaction or methods such as Map#flyTo.
Fired whenever the map's pitch (tilt) begins a change as the result of either user interaction or methods such as Map#flyTo .
Fired immediately after the map has been removed with Map#remove.
Fired whenever the map is drawn to the screen, as the result of
Fired immediately after the map has been resized.
Fired repeatedly during a "drag to rotate" interaction. See DragRotateHandler.
Fired when a "drag to rotate" interaction ends. See DragRotateHandler.
Fired when a "drag to rotate" interaction starts. See DragRotateHandler.
Fired when one of the map's sources loads or changes, including if a tile belonging to a source loads or changes.
Fired when a request for one of the map's sources' data is aborted.
Fired when one of the map's sources begins loading or changing asynchronously.
All sourcedataloading
events are followed by a sourcedata
, sourcedataabort
or error
event.
Fired when the map's style loads or changes.
Fired when the map's style begins loading or changing asynchronously.
All styledataloading
events are followed by a styledata
or error
event.
Fired when an icon or pattern needed by the style is missing. The missing image can be added with Map#addImage within this event listener callback to prevent the image from being skipped. This event can be used to dynamically generate icons and patterns.
Fired when terrain is changed
Fired when a touchcancel
event occurs within the map.
Fired when a touchend
event occurs within the map.
Fired when a touchmove
event occurs within the map.
Fired when a touchstart
event occurs within the map.
Fired when the WebGL context is lost.
Fired when the WebGL context is restored.
Fired when a wheel
event occurs within the map.
Fired repeatedly during an animated transition from one zoom level to another, as the result of either user interaction or methods such as Map#flyTo.
Fired just after the map completes a transition from one zoom level to another, as the result of either user interaction or methods such as Map#flyTo.
Fired just before the map begins a transition from one zoom level to another, as the result of either user interaction or methods such as Map#flyTo.
// Initialize the map
let map = new Map({ // map options });
// Set an event listener
map.on('the-event-name', () => {
console.log('An event has occurred!');
});
MapEventType
- a mapping between the event name and the event value. These events are used with the Map#on method. When using alayerId
with Map#on method, please refer to MapLayerEventType. The following example can be used for all the events.