use the baselayerchange event parameter instead of testing to see if a layer is added to the map

This commit is contained in:
Jon Atkins 2013-05-20 05:17:11 +01:00
parent 52bce7fa31
commit a525fb5144

View File

@ -259,10 +259,10 @@ window.setMapBaseLayer = function() {
//event to track layer changes and store the name
map.on('baselayerchange', function() {
map.on('baselayerchange', function(info) {
for(i in window.layerChooser._layers) {
var obj = window.layerChooser._layers[i];
if (!obj.overlay && map.hasLayer(obj.layer)) {
if (info.layer === obj.layer) {
localStorage['iitc-base-map'] = obj.name;
break;
}