Type Alias MapEventType
boxzoomcancel: MapLibreZoomEvent;
boxzoomend: MapLibreZoomEvent;
boxzoomstart: MapLibreZoomEvent;
click: MapMouseEvent;
contextmenu: MapMouseEvent;
cooperativegestureprevented: MapLibreEvent<WheelEvent | TouchEvent> & {
gestureType: "wheel_zoom" | "touch_pan";
};
data: MapDataEvent;
dataabort: MapDataEvent;
dataloading: MapDataEvent;
dblclick: MapMouseEvent;
drag: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
dragend: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
dragstart: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
error: ErrorEvent;
idle: MapLibreEvent;
load: MapLibreEvent;
mousedown: MapMouseEvent;
mousemove: MapMouseEvent;
mouseout: MapMouseEvent;
mouseover: MapMouseEvent;
mouseup: MapMouseEvent;
move: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
moveend: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
movestart: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
pitch: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
pitchend: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
pitchstart: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
projectiontransition: MapProjectionEvent;
remove: MapLibreEvent;
render: MapLibreEvent;
resize: MapLibreEvent;
rotate: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
rotateend: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
rotatestart: MapLibreEvent<MouseEvent | TouchEvent | undefined>;
sourcedata: MapSourceDataEvent;
sourcedataabort: MapSourceDataEvent;
sourcedataloading: MapSourceDataEvent;
styledata: MapStyleDataEvent;
styledataloading: MapStyleDataEvent;
styleimagemissing: MapStyleImageMissingEvent;
terrain: MapTerrainEvent;
tiledataloading: MapDataEvent;
touchcancel: MapTouchEvent;
touchend: MapTouchEvent;
touchmove: MapTouchEvent;
touchstart: MapTouchEvent;
webglcontextlost: MapContextEvent;
webglcontextrestored: MapContextEvent;
wheel: MapWheelEvent;
zoom: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
zoomend: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
zoomstart: MapLibreEvent<MouseEvent | TouchEvent | WheelEvent | undefined>;
}
Index
Properties
Properties
boxzoomcancel
Fired when the user cancels a "box zoom" interaction, or when the bounding box does not meet the minimum size threshold. See BoxZoomHandler.
boxzoomend
Fired when a "box zoom" interaction ends. See BoxZoomHandler.
boxzoomstart
Fired when a "box zoom" interaction starts. See BoxZoomHandler.
click
Fired when a pointing device (usually a mouse) is pressed and released at the same point on the map.
contextmenu
Fired when the right button of the mouse is clicked or the context menu key is pressed within the map.
cooperativegestureprevented
gestureType: "wheel_zoom" | "touch_pan";
}
Fired whenever the cooperativeGestures option prevents a gesture from being handled by the map. This is useful for showing your own UI when this happens.
data
Fired when any map data loads or changes. See MapDataEvent for more information.
dataabort
Fired when a request for one of the map's sources' tiles or data is aborted.
dataloading
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.
dblclick
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.
drag
Fired repeatedly during a "drag to pan" interaction. See DragPanHandler.
dragend
Fired when a "drag to pan" interaction ends. See DragPanHandler.
dragstart
Fired when a "drag to pan" interaction starts. See DragPanHandler.
error
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.
idle
Fired after the last frame rendered before the map enters an "idle" state:
- No camera transitions are in progress
- All currently requested tiles have loaded
- All fade/transition animations have completed
load
Fired immediately after all necessary resources have been downloaded and the first visually complete rendering of the map has occurred.
mousedown
Fired when a pointing device (usually a mouse) is pressed within the map.
mousemove
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.
mouseout
Fired when a point device (usually a mouse) leaves the map's canvas.
mouseover
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.
mouseup
Fired when a pointing device (usually a mouse) is released within the map.
move
Fired repeatedly during an animated transition from one view to another, as the result of either user interaction or methods such as Map.flyTo.
moveend
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.
movestart
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.
pitch
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.
pitchend
Fired immediately after the map's pitch (tilt) finishes changing as the result of either user interaction or methods such as Map.flyTo.
pitchstart
Fired whenever the map's pitch (tilt) begins a change as the result of either user interaction or methods such as Map.flyTo .
projectiontransition
Fired when map's projection is modified in other ways than by map being moved.
remove
Fired immediately after the map has been removed with Map.remove.
render
Fired whenever the map is drawn to the screen, as the result of
- a change to the map's position, zoom, pitch, or bearing
- a change to the map's style
- a change to a GeoJSON source
- the loading of a vector tile, GeoJSON file, glyph, or sprite
resize
Fired immediately after the map has been resized.
rotate
Fired repeatedly during a "drag to rotate" interaction. See DragRotateHandler.
rotateend
Fired when a "drag to rotate" interaction ends. See DragRotateHandler.
rotatestart
Fired when a "drag to rotate" interaction starts. See DragRotateHandler.
sourcedata
Fired when one of the map's sources loads or changes, including if a tile belonging to a source loads or changes.
sourcedataabort
Fired when a request for one of the map's sources' data is aborted.
sourcedataloading
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.
styledata
Fired when the map's style loads or changes.
styledataloading
Fired when the map's style begins loading or changing asynchronously.
All styledataloading events are followed by a styledata
or error event.
styleimagemissing
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.
terrain
Fired when terrain is changed
tiledataloading
touchcancel
Fired when a touchcancel event occurs within the map.
touchend
Fired when a touchend event occurs within the map.
touchmove
Fired when a touchmove event occurs within the map.
touchstart
Fired when a touchstart event occurs within the map.
webglcontextlost
Fired when the WebGL context is lost.
webglcontextrestored
Fired when the WebGL context is restored.
wheel
Fired when a wheel event occurs within the map.
zoom
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.
zoomend
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.
zoomstart
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.
MapEventType- a mapping between the event name and the event value. These events are used with the Map.on method. When using alayerIdwith Map.on method, please refer to MapLayerEventType. The following example can be used for all the events.Example