diff options
author | Markus Koch <markus@notsyncing.net> | 2020-04-26 17:02:14 +0200 |
---|---|---|
committer | Markus Koch <markus@notsyncing.net> | 2020-04-26 17:02:14 +0200 |
commit | 2f02ca1d2a0d489ec65619a8d64c3deb76af2694 (patch) | |
tree | 5e915fc54edc1da4aeb390111cb13aa9c6cc36d0 | |
parent | 1ddb72414082f60da2aa9742e14aaea965871093 (diff) | |
download | lifomapserver-2f02ca1d2a0d489ec65619a8d64c3deb76af2694.tar.gz lifomapserver-2f02ca1d2a0d489ec65619a8d64c3deb76af2694.tar.bz2 lifomapserver-2f02ca1d2a0d489ec65619a8d64c3deb76af2694.zip |
Trigger update_street_width functionality only on streets
-rw-r--r-- | htdocs/mapscript.js | 12 |
1 files changed, 7 insertions, 5 deletions
diff --git a/htdocs/mapscript.js b/htdocs/mapscript.js index 735dcd9..6b23688 100644 --- a/htdocs/mapscript.js +++ b/htdocs/mapscript.js @@ -186,6 +186,8 @@ function load_geojson(name, url, iconname, iconcolor, active=1, style={}) { switch (iconname) { case "street": onEachFeature = function(feature, layer) { + layer.myTag = iconname; + layer.myName = name; layer.on("click", function (e) { current_feature = feature; }); @@ -494,11 +496,11 @@ function update_street_width() { w = 2**zoom * 0.016 * 2; } var myStyle = {weight: w, opacity: 0.7}; - for (var i = 0; i < layers._layers.length; i++) { - if (!layers._layers[i].layer._layers) - continue; - layers._layers[i].layer.setStyle(myStyle); - } + mymap.eachLayer( function(layer) { + if ( layer.myTag && layer.myTag === "street") { + layer.setStyle(myStyle); + } + }); } function update_outline_visibility() { |