Remove coverage polygon from map when we are removed from the map. Fixes #38

This commit is contained in:
danzel
2012-08-20 10:59:27 +12:00
parent 492d8a0d27
commit 167ef4aa1e
+6
View File
@@ -192,6 +192,12 @@ L.MarkerClusterGroup = L.FeatureGroup.extend({
shownPolygon = null;
}
}, this);
map.on('layerremove', function (opt) {
if (shownPolygon && opt.layer === this) {
map.removeLayer(shownPolygon);
shownPolygon = null;
}
}, this);
}
},