addOverlay(layer: Layer, name: string, checked: boolean = false) { if (checked && this.props.leaflet.map != null) { this.props.leaflet.map.addLayer(layer) } this.leafletElement.addOverlay(layer, name) }
updateLeafletElement(fromProps: Props, toProps: Props) { super.updateLeafletElement(fromProps, toProps) const { url: prevUrl, opacity: _po, zIndex: _pz, ...prevParams } = fromProps const { url, opacity: _o, zIndex: _z, ...params } = toProps if (url !== prevUrl) { this.leafletElement.setUrl(url) } if (!isEqual(params, prevParams)) { this.leafletElement.setParams(params) } }
updateLeafletElement(fromProps: Props, toProps: Props) { if (toProps.positions !== fromProps.positions) { this.leafletElement.setLatLngs(toProps.positions) } this.setStyleIfChanged(fromProps, toProps) }
updateView() { // Set the map view around the points including the location of the car //let wp = this.state.waypoints; //if (wp.length > 0) this.map.fitBounds(wp); // Set the map view around the current fix this.map.panTo([this.state.lat, this.state.lng]) }
createLeafletElement(props: LayersControlProps): LeafletElement { const { children: _children, ...options } = props return new Control.Layers(undefined, undefined, options) }
componentDidUpdate(): void { this.props.leaflet.map.invalidateSize(); if (this.props.fitBoundsOnUpdate) { this.fitBounds(); } this.reset(); }
updateLeafletElement(fromProps: Props, toProps: Props) { if (toProps.bounds !== fromProps.bounds) { this.leafletElement.setBounds(toProps.bounds) } this.setStyleIfChanged(fromProps, toProps) }
componentDidMount() { super.componentDidMount() if (this.props.play === true) { this.leafletElement.getElement().play() } }
addBaseLayer(layer: Layer, name: string, checked: boolean = false) { if (checked && this.props.leaflet.map != null) { this.props.leaflet.map.addLayer(layer) } this.leafletElement.addBaseLayer(layer, name) }