0

toggle regions

This commit is contained in:
Michael Writhe
2011-04-14 08:30:56 -06:00
parent 183d278f81
commit d51d863bed

View File

@@ -171,15 +171,9 @@ function drawMapControls() {
var item = regionGroups[idx]; var item = regionGroups[idx];
items.push({"label": item.label, "checked": item.checked, items.push({"label": item.label, "checked": item.checked,
"action": function(n, l, checked) { "action": function(n, l, checked) {
if (checked) { jQuery.each(regionCollection[l], function(i,elem) {
jQuery.each(regionCollection[l], function(i,elem) { elem.setMap(checked ? map : null);
elem.setVisible('visible'); });
});
} else {
jQuery.each(regionCollection[l], function(i,elem) {
elem.setVisible('hidden');
});
}
}}); }});
} }
createDropDown("Regions", items); createDropDown("Regions", items);
@@ -240,7 +234,7 @@ function initRegions() {
name: region.label, name: region.label,
clickable: false, clickable: false,
geodesic: false, geodesic: false,
map: map, map: null,
strokeColor: region.color, strokeColor: region.color,
strokeOpacity: region.opacity, strokeOpacity: region.opacity,
strokeWeight: 2, strokeWeight: 2,
@@ -254,7 +248,7 @@ function initRegions() {
name: region.label, name: region.label,
clickable: false, clickable: false,
geodesic: false, geodesic: false,
map: map, map: null,
strokeColor: region.color, strokeColor: region.color,
strokeOpacity: region.opacity, strokeOpacity: region.opacity,
strokeWeight: 2, strokeWeight: 2,
@@ -263,8 +257,6 @@ function initRegions() {
}); });
} }
regionCollection[label].push(shape); regionCollection[label].push(shape);
prepareRegionShape(shape, region);
} }
} }
} }