API / Map
MapEvents
Listen to events on the map from inside a MapLibre component. Each on* prop adds a listener for the event with the same name.
Set layer to listen only to mouse events on that layer, such as click, mousemove, or contextmenu. This component does not render anything.
import { MapEvents } from 'svelte-maplibre'; Examples
Props
- layer
stringLimit the event handlers to a certain layer.
- onclick
(e: maplibregl.MapMouseEvent) => void - ondblclick
(e: maplibregl.MapMouseEvent) => void - onmousemove
(e: MapMoveEvent) => void - onmovestart
(e: MapMoveEvent) => void - onmoveend
(e: MapMoveEvent) => void - onzoomstart
(e: maplibregl.MapMovementEvent) => void - onzoom
(e: maplibregl.MapMovementEvent) => void - onzoomend
(e: maplibregl.MapMovementEvent) => void - onpitch
(e: maplibregl.MapMovementEvent) => void - onrotate
(e: maplibregl.MapMovementEvent) => void - onwheel
(e: maplibregl.MapWheelEvent) => void - ondata
(e: maplibregl.MapSourceDataEvent | maplibregl.MapStyleDataEvent) => void - onstyledata
(e: maplibregl.MapStyleDataEvent) => void - onidle
(e: maplibregl.MapLibreEvent) => void
Source: src/lib/MapEvents.svelte