Fixed attributions disappearing, closed #405

This commit is contained in:
mourner 2012-02-13 13:12:36 +02:00
parent 0ef3058512
commit 2ebbfdf40c

View File

@ -3,7 +3,7 @@ L.Control.Attribution = L.Class.extend({
this._prefix = prefix || 'Powered by <a href="http://leaflet.cloudmade.com">Leaflet</a>'; this._prefix = prefix || 'Powered by <a href="http://leaflet.cloudmade.com">Leaflet</a>';
this._attributions = {}; this._attributions = {};
}, },
onAdd: function (map) { onAdd: function (map) {
this._container = L.DomUtil.create('div', 'leaflet-control-attribution'); this._container = L.DomUtil.create('div', 'leaflet-control-attribution');
L.DomEvent.disableClickPropagation(this._container); L.DomEvent.disableClickPropagation(this._container);
@ -28,7 +28,10 @@ L.Control.Attribution = L.Class.extend({
if (!text) { if (!text) {
return; return;
} }
this._attributions[text] = true; if (!this._attributions[text]) {
this._attributions[text] = 0;
}
this._attributions[text]++;
this._update(); this._update();
}, },
@ -36,7 +39,7 @@ L.Control.Attribution = L.Class.extend({
if (!text) { if (!text) {
return; return;
} }
delete this._attributions[text]; this._attributions[text]--;
this._update(); this._update();
}, },