Hide search marker/object when closing sidebar

Fixes #417
This commit is contained in:
John Firebaugh 2013-08-06 10:32:38 -07:00 committed by Tom Hughes
parent c6cde2653b
commit a1af4d5de1
2 changed files with 11 additions and 0 deletions

View file

@ -30,6 +30,11 @@ function initializeSearch(map) {
}); });
openSidebar(); openSidebar();
$("#sidebar").one("closed", function () {
map.removeLayer(marker);
map.removeObject();
});
} }
function clickSearchResult(e) { function clickSearchResult(e) {

View file

@ -146,6 +146,12 @@ L.extend(L.Map.prototype, {
map._objectLayer.addTo(map); map._objectLayer.addTo(map);
} }
}); });
},
removeObject: function() {
this._object = null;
if (this._objectLoader) this._objectLoader.abort();
if (this._objectLayer) this.removeLayer(this._objectLayer);
} }
}); });