Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
update(domNode, element) {
super.update(domNode, element);
this._leafletElement
.style("width", `${this.width()}px`)
.style("height", `${this.height()}px`)
;
const baseLayer = this.baseLayer();
if (this._prevCRS !== baseLayer.crs()) {
this._prevCRS = baseLayer.crs();
if (this._leafletMap) {
this.syncLayers([], domNode, element);
this._leafletMap.remove();
this._leafletElement.html("");
}
this._leafletMap = new Map(this._leafletElement.node(), {
trackResize: false,
zoomControl: false,
zoomSnap: this.mapType() === "AlbersPR" ? 0.1 : 1,
crs: baseLayer.crs(),
maxZoom: (baseLayer as any).getMaxZoom ? (baseLayer as any).getMaxZoom() : 18
});
this._leafletMap.setView([this.defaultLat(), this.defaultLong()], this.defaultZoom());
this._leafletMap["attributionControl"].setPrefix(baseLayer.attribution());
this._leafletMap.on("zoomend", e => this.layers().forEach(layer => layer.zoomEnd(e)));
this._leafletMap.on("moveend", e => this.layers().forEach(layer => layer.moveEnd(e)));
this._leafletMap.on("viewreset", e => this.layers().forEach(layer => layer.viewReset(e)));
this._renderCount = 0;
}
this.syncLayers([baseLayer, ...this.layers()], domNode, element);
this._leafletMap.invalidateSize();