mirror of
https://github.com/Pax1601/DCSOlympus.git
synced 2025-10-29 16:56:34 +00:00
Added ability to define map layers
This commit is contained in:
parent
a84e190548
commit
6e6da64c51
@ -50,7 +50,7 @@ export type MapMarkerVisibilityControl = {
|
||||
export class Map extends L.Map {
|
||||
#ID: string;
|
||||
#state: string;
|
||||
#layer: L.TileLayer | null = null;
|
||||
#layer: L.TileLayer | L.LayerGroup | null = null;
|
||||
#preventLeftClick: boolean = false;
|
||||
#leftClickTimer: number = 0;
|
||||
#deafultPanDelta: number = 100;
|
||||
@ -281,14 +281,24 @@ export class Map extends L.Map {
|
||||
|
||||
if (layerName in this.#mapLayers) {
|
||||
const layerData = this.#mapLayers[layerName];
|
||||
var options: L.TileLayerOptions = {
|
||||
attribution: layerData.attribution,
|
||||
minZoom: layerData.minZoom,
|
||||
maxZoom: layerData.maxZoom,
|
||||
minNativeZoom: layerData.minNativeZoom,
|
||||
maxNativeZoom: layerData.maxNativeZoom
|
||||
};
|
||||
this.#layer = new L.TileLayer(layerData.urlTemplate, options);
|
||||
if (layerData instanceof Array) {
|
||||
let layers = layerData.map((layer: any) => {
|
||||
var options: L.TileLayerOptions = {
|
||||
attribution: layer.attribution,
|
||||
minZoom: layer.minZoom,
|
||||
maxZoom: layer.maxZoom
|
||||
};
|
||||
return new L.TileLayer(layer.urlTemplate, options);
|
||||
})
|
||||
this.#layer = new L.LayerGroup(layers);
|
||||
} else {
|
||||
var options: L.TileLayerOptions = {
|
||||
attribution: layerData.attribution,
|
||||
minZoom: layerData.minZoom,
|
||||
maxZoom: layerData.maxZoom
|
||||
};
|
||||
this.#layer = new L.TileLayer(layerData.urlTemplate, options);
|
||||
}
|
||||
}
|
||||
|
||||
this.#layer?.addTo(this);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user