X-Git-Url: https://git.openstreetmap.org./rails.git/blobdiff_plain/7b05c1c060f3f85f47413ec7db984180514d3ba6..475a3fd83615fec2a1b79d04f3323ae45c917ccd:/app/assets/javascripts/leaflet.layers.js diff --git a/app/assets/javascripts/leaflet.layers.js b/app/assets/javascripts/leaflet.layers.js index 35b958c7a..3f577b532 100644 --- a/app/assets/javascripts/leaflet.layers.js +++ b/app/assets/javascripts/leaflet.layers.js @@ -61,18 +61,16 @@ L.OSM.layers = function (options) { input.on("click", function () { layers.forEach(function (other) { - if (other === layer) { - map.addLayer(other); - } else { + if (other !== layer) { map.removeLayer(other); } }); - map.fire("baselayerchange", { layer: layer }); + map.addLayer(layer); }); item.on("dblclick", toggle); - map.on("layeradd layerremove", function () { + map.on("baselayerchange", function () { input.prop("checked", map.hasLayer(layer)); }); }); @@ -121,10 +119,9 @@ L.OSM.layers = function (options) { } else { map.removeLayer(layer); } - map.fire("overlaylayerchange", { layer: layer }); }); - map.on("layeradd layerremove", function () { + map.on("overlayadd overlayremove", function () { input.prop("checked", map.hasLayer(layer)); });