Add control for hide/show of component layers (only regions for now)

This commit is contained in:
Mike Primm 2011-08-25 17:07:00 -05:00
parent af3301c22b
commit 5bacbfe42b
3 changed files with 15 additions and 1 deletions

View file

@ -165,6 +165,7 @@ componentconstructors['regions'] = function(dynmap, configuration) {
var activeLayer = undefined;
function undraw() {
if (activeLayer) {
dynmap.layercontrol.removeLayer(activeLayer);
dynmap.map.removeLayer(activeLayer);
activeLayer = undefined;
}
@ -183,6 +184,7 @@ componentconstructors['regions'] = function(dynmap, configuration) {
result: function(regionsLayer) {
activeLayer = regionsLayer;
dynmap.map.addLayer(activeLayer);
dynmap.layercontrol.addOverlay(activeLayer, regionType);
}
}));
}