Skip to content

Commit c86078b

Browse files
committed
Update attribution when adding map if empty
This fixes the attributions not being fetched and not showing initially when the map is added to the DOM and the layer is added to the map at a later point (e.g. on a button click).
1 parent fdcfaaf commit c86078b

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

leaflet-bing-layer.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,11 @@ L.TileLayer.Bing = L.TileLayer.extend({
154154
onAdd: function (map) {
155155
map.on('moveend', this._updateAttribution, this)
156156
L.TileLayer.prototype.onAdd.call(this, map)
157+
158+
if (this._attributions.length === 0) {
159+
this._updateAttribution()
160+
}
161+
157162
this._attributions.forEach(function (attribution) {
158163
map.attributionControl.addAttribution(attribution)
159164
})

0 commit comments

Comments
 (0)