Skip to content

Commit 090919f

Browse files
committed
fixed dev issue #23
1 parent 9a8853d commit 090919f

File tree

1 file changed

+18
-21
lines changed

1 file changed

+18
-21
lines changed

scripts/map.js

Lines changed: 18 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -398,42 +398,39 @@ $(window).on('load', function() {
398398
polygonsLegend.addTo(map);
399399
allPolygonLegends.push(polygonsLegend);
400400

401-
// This is triggered when user changes the radio button
402-
$('.polygons-legend' + p + ' input:radio[name="prop"]').change(function() {
403-
polygon = parseInt($(this).val().split(';')[0]);
404-
layer = parseInt($(this).val().split(';')[1]);
405-
406-
if (layer == -1) {
407-
$('.polygons-legend' + polygon).find('.polygons-legend-scale').hide();
408-
if (map.hasLayer(allGeojsons[polygon])) {
409-
map.removeLayer(allGeojsons[polygon]);
410-
if (map.hasLayer(allTextLabelsLayers[polygon])) {
411-
map.removeLayer(allTextLabelsLayers[polygon]);
412-
}
413-
}
414-
} else {
415-
updatePolygons();
416-
}
417-
});
418-
419401
p++;
420402
}
421403

422404
// Generate polygon labels layers
423405
for (i in allTextLabels) {
424406
var g = L.featureGroup(allTextLabels[i]);
425407
allTextLabelsLayers.push(g);
426-
g.addTo(map);
427408
}
428-
togglePolygonLabels();
409+
410+
// This is triggered when user changes the radio button
411+
$('.ladder input:radio[name="prop"]').change(function() {
412+
polygon = parseInt($(this).val().split(';')[0]);
413+
layer = parseInt($(this).val().split(';')[1]);
414+
415+
if (layer == -1) {
416+
$('.polygons-legend' + polygon).find('.polygons-legend-scale').hide();
417+
if (map.hasLayer(allGeojsons[polygon])) {
418+
map.removeLayer(allGeojsons[polygon]);
419+
if (map.hasLayer(allTextLabelsLayers[polygon])) {
420+
map.removeLayer(allTextLabelsLayers[polygon]);
421+
}
422+
}
423+
} else {
424+
updatePolygons();
425+
}
426+
});
429427

430428
for (t = 0; t < p; t++) {
431429
if (getPolygonSetting(t, '_polygonShowOnStart') == 'on') {
432430
$('.ladder input:radio[name="prop"][value="' + t + ';0"]').click();
433431
} else {
434432
$('.ladder input:radio[name="prop"][value="' + t + ';-1"]').click();
435433
}
436-
437434
}
438435

439436
$('.polygons-legend-merged h6').eq(0).click().click();

0 commit comments

Comments
 (0)