Skip to content

Commit

Permalink
Do not call AttributionControl._update for removed tile layer
Browse files Browse the repository at this point in the history
  • Loading branch information
yohanboniface committed Dec 14, 2023
1 parent 8ce09b0 commit beb9e38
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 4 deletions.
4 changes: 3 additions & 1 deletion umap/static/umap/js/umap.controls.js
Original file line number Diff line number Diff line change
Expand Up @@ -1246,8 +1246,10 @@ L.U.AttributionControl = L.Control.Attribution.extend({
},

_update: function () {
// Layer is no more on the map
if (!this._map) return
L.Control.Attribution.prototype._update.call(this)
// Use our how container, so we can hide/show on small screens
// Use our own container, so we can hide/show on small screens
const credits = this._container.innerHTML
this._container.innerHTML = ''
const container = L.DomUtil.add(
Expand Down
2 changes: 1 addition & 1 deletion umap/tests/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class MapFactory(factory.django.DjangoModelFactory):
"attribution": "\xa9 OSM Contributors",
"maxZoom": 18,
"minZoom": 0,
"url_template": "http://{s}.osm.fr/{z}/{x}/{y}.png",
"url_template": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png",
},
"tilelayersControl": True,
"zoom": 7,
Expand Down
2 changes: 1 addition & 1 deletion umap/tests/integration/test_export_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ def test_umap_export(map, live_server, datalayer, page):
"attribution": "© OSM Contributors",
"maxZoom": 18,
"minZoom": 0,
"url_template": "http://{s}.osm.fr/{z}/{x}/{y}.png",
"url_template": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png",
},
"tilelayersControl": True,
"zoom": 7,
Expand Down
2 changes: 1 addition & 1 deletion umap/tests/test_map_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -624,7 +624,7 @@ def test_download(client, map, datalayer):
"attribution": "© OSM Contributors",
"maxZoom": 18,
"minZoom": 0,
"url_template": "http://{s}.osm.fr/{z}/{x}/{y}.png",
"url_template": "https://{s}.tile.openstreetmap.fr/osmfr/{z}/{x}/{y}.png",
},
"tilelayersControl": True,
"zoom": 7,
Expand Down

0 comments on commit beb9e38

Please sign in to comment.