UNPKG

675 BJavaScriptView Raw
1import { createElementObject, createTileLayerComponent, updateGridLayer, withPane } from '@react-leaflet/core';
2import { TileLayer } from 'leaflet';
3export const WMSTileLayer = createTileLayerComponent(function createWMSTileLayer({ eventHandlers: _eh , params ={} , url , ...options }, context) {
4 const layer = new TileLayer.WMS(url, {
5 ...params,
6 ...withPane(options, context)
7 });
8 return createElementObject(layer, context);
9}, function updateWMSTileLayer(layer, props, prevProps) {
10 updateGridLayer(layer, props, prevProps);
11 if (props.params != null && props.params !== prevProps.params) {
12 layer.setParams(props.params);
13 }
14});