API / Layers
BackgroundLayer
Add a MapLibre background layer to the map. A background layer fills the full map with a color or a pattern.
This is a thin wrapper around Layer with type set to background. It does not use a source, so you can put it anywhere inside the map.
import { BackgroundLayer } from 'svelte-maplibre'; Generic parameters: FEATURE extends Feature = Feature
Examples
Props
- layout
BackgroundLayerSpecification["layout"] - applyToClusters
boolean
Inherited from CommonLayerProps
- id
anyDefault:
getId('background') - beforeId
stringDraw this layer under another layer. This is only evaluated when the component is created.
- beforeLayerType
string | ((layer: maplibregl.LayerSpecification) => boolean)Draw this layer all layers of this type. This is only evaluated when the component is created.
- filter
maplibregl.ExpressionSpecification - minzoom
number - maxzoom
number - hoverCursor
stringSet the cursor style to this value when the mouse is over the layer.
- manageHoverState
booleanDefault:
falseEnable to use hoverStateFilter or filter on
hover-state. Features must have anidproperty for this to work. - eventsIfTopMost
booleanDefault:
false - interactive
booleanDefault:
trueHandle mouse events on this layer.
- children
Snippet - onclick
(e: LayerClickInfo<FEATURE>) => void - ondblclick
(e: LayerClickInfo<FEATURE>) => void - onmouseenter
(e: LayerClickInfo<FEATURE>) => void - onmousemove
(e: LayerClickInfo<FEATURE>) => void - onmouseleave
(e: Pick<LayerClickInfo<FEATURE>, 'map' | 'layer' | 'source'>) => void
Source: src/lib/BackgroundLayer.svelte