Commit 00219f20 authored by Sp3r4z's avatar Sp3r4z
Browse files

[Script] Simplify layer function

parent 23d2c451
......@@ -11,20 +11,15 @@ createCircle = (lat,lng) => {
addToLayerGroup( L.circle([lat,lng], {radius: 100000}) )
},
addToLayerGroup = (elm) => {
if(layerGroup == null) {
layerGroup = L.layerGroup([elm])
layerGroup.addTo(theMap)
}
else {
layerGroup.addLayer(elm)
}
layerGroup.addLayer(elm)
},
clearLayer = _ => {
layerGroup.clearLayers()
}
let theMap = L.map('map').setView([46.415,1.461], 6),
layerGroup = null
layerGroup = L.layerGroup()
layerGroup.addTo(theMap)
L.tileLayer('http://{s}.tile.osm.org/{z}/{x}/{y}.png', {
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap contributors</a>',
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment