Skip to content
Commit 31345c2d authored by Michael Underwood's avatar Michael Underwood
Browse files

Revert add/rm attr in favour of whole layer

The original idea of swapping out the old attribution for the new
instead of completely removing and re-adding the layer had merit, but
led to incorrect attributions on the map if other layer properties were
also changed. Specifically, if props changed attribution "A" to "B" and
name "layer A" to "layer B", then:
* Attribution "A" would be remove and "B" added.
* The layer would be removed from the map entirely.
* The layer would be added back, _with its original options.attribution_
  still equal to "A".
* Attribution on the map would read "A, B".

This updated approach resolves that by changing the option on the layer
object before re-adding it to the map, and otherwise letting Leaflet
take care of adding and removing attributions as the layer is changed.
parent 3fc04ba8
Loading
Loading
Loading
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment