Skip to content

Commit

Permalink
fixed dev issue #23
Browse files Browse the repository at this point in the history
  • Loading branch information
JackDougherty committed Apr 10, 2017
1 parent 9a8853d commit 090919f
Showing 1 changed file with 18 additions and 21 deletions.
39 changes: 18 additions & 21 deletions scripts/map.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,42 +398,39 @@ $(window).on('load', function() {
polygonsLegend.addTo(map);
allPolygonLegends.push(polygonsLegend);

// This is triggered when user changes the radio button
$('.polygons-legend' + p + ' input:radio[name="prop"]').change(function() {
polygon = parseInt($(this).val().split(';')[0]);
layer = parseInt($(this).val().split(';')[1]);

if (layer == -1) {
$('.polygons-legend' + polygon).find('.polygons-legend-scale').hide();
if (map.hasLayer(allGeojsons[polygon])) {
map.removeLayer(allGeojsons[polygon]);
if (map.hasLayer(allTextLabelsLayers[polygon])) {
map.removeLayer(allTextLabelsLayers[polygon]);
}
}
} else {
updatePolygons();
}
});

p++;
}

// Generate polygon labels layers
for (i in allTextLabels) {
var g = L.featureGroup(allTextLabels[i]);
allTextLabelsLayers.push(g);
g.addTo(map);
}
togglePolygonLabels();

// This is triggered when user changes the radio button
$('.ladder input:radio[name="prop"]').change(function() {
polygon = parseInt($(this).val().split(';')[0]);
layer = parseInt($(this).val().split(';')[1]);

if (layer == -1) {
$('.polygons-legend' + polygon).find('.polygons-legend-scale').hide();
if (map.hasLayer(allGeojsons[polygon])) {
map.removeLayer(allGeojsons[polygon]);
if (map.hasLayer(allTextLabelsLayers[polygon])) {
map.removeLayer(allTextLabelsLayers[polygon]);
}
}
} else {
updatePolygons();
}
});

for (t = 0; t < p; t++) {
if (getPolygonSetting(t, '_polygonShowOnStart') == 'on') {
$('.ladder input:radio[name="prop"][value="' + t + ';0"]').click();
} else {
$('.ladder input:radio[name="prop"][value="' + t + ';-1"]').click();
}

}

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

0 comments on commit 090919f

Please sign in to comment.