Trigger update_street_width functionality only on streets

This commit is contained in:
Markus Koch 2020-04-26 17:02:14 +02:00
parent 1ddb724140
commit 2f02ca1d2a

View File

@ -186,6 +186,8 @@ function load_geojson(name, url, iconname, iconcolor, active=1, style={}) {
switch (iconname) { switch (iconname) {
case "street": case "street":
onEachFeature = function(feature, layer) { onEachFeature = function(feature, layer) {
layer.myTag = iconname;
layer.myName = name;
layer.on("click", function (e) { layer.on("click", function (e) {
current_feature = feature; current_feature = feature;
}); });
@ -494,11 +496,11 @@ function update_street_width() {
w = 2**zoom * 0.016 * 2; w = 2**zoom * 0.016 * 2;
} }
var myStyle = {weight: w, opacity: 0.7}; var myStyle = {weight: w, opacity: 0.7};
for (var i = 0; i < layers._layers.length; i++) { mymap.eachLayer( function(layer) {
if (!layers._layers[i].layer._layers) if ( layer.myTag && layer.myTag === "street") {
continue; layer.setStyle(myStyle);
layers._layers[i].layer.setStyle(myStyle); }
} });
} }
function update_outline_visibility() { function update_outline_visibility() {