Merge pull request #1562 from umap-project/svg-default-icon

feat: use svg for default icon (circle)
This commit is contained in:
Yohan Boniface 2024-01-29 18:05:45 +01:00 committed by GitHub
commit dd57794ca6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 10 additions and 6 deletions

View file

@ -216,7 +216,7 @@ class Map(NamedModel):
"umap_id": self.pk, "umap_id": self.pk,
"onLoadPanel": "none", "onLoadPanel": "none",
"captionBar": False, "captionBar": False,
"default_iconUrl": "%sumap/img/marker.png" % settings.STATIC_URL, "default_iconUrl": "%sumap/img/marker.svg" % settings.STATIC_URL,
"slideshow": {}, "slideshow": {},
} }
) )

View file

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="UTF-8"?>
<svg version="1.1" id="circle" xmlns="http://www.w3.org/2000/svg" width="15" height="15" viewBox="0 0 15 15">
<path d="M14,7.5c0,3.5899-2.9101,6.5-6.5,6.5S1,11.0899,1,7.5S3.9101,1,7.5,1S14,3.9101,14,7.5z"/>
</svg>

After

Width:  |  Height:  |  Size: 254 B

View file

@ -132,7 +132,7 @@ function initMap(options) {
map_update_permissions: '/map/{map_id}/update/permissions/', map_update_permissions: '/map/{map_id}/update/permissions/',
map_download: '/map/{map_id}/download/', map_download: '/map/{map_id}/download/',
}, },
default_iconUrl: '../src/img/marker.png', default_iconUrl: '../src/img/marker.svg',
zoom: 6, zoom: 6,
share_statuses: [ share_statuses: [
[1, 'Tout le monde (public)'], [1, 'Tout le monde (public)'],

View file

@ -46,7 +46,7 @@ def test_can_change_picto_at_map_level(map, live_server, page, pictos):
marker = page.locator(".umap-div-icon img") marker = page.locator(".umap-div-icon img")
expect(marker).to_have_count(1) expect(marker).to_have_count(1)
# Should have default img # Should have default img
expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
edit_settings = page.get_by_title("Edit map properties") edit_settings = page.get_by_title("Edit map properties")
expect(edit_settings).to_be_visible() expect(edit_settings).to_be_visible()
edit_settings.click() edit_settings.click()
@ -66,7 +66,7 @@ def test_can_change_picto_at_map_level(map, live_server, page, pictos):
symbols.click() symbols.click()
expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg") expect(marker).to_have_attribute("src", "/uploads/pictogram/star.svg")
undefine.click() undefine.click()
expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos): def test_can_change_picto_at_datalayer_level(map, live_server, page, pictos):
@ -147,7 +147,7 @@ def test_can_use_remote_url_as_picto(map, live_server, page, pictos):
marker = page.locator(".umap-div-icon img") marker = page.locator(".umap-div-icon img")
expect(marker).to_have_count(1) expect(marker).to_have_count(1)
# Should have default img # Should have default img
expect(marker).to_have_attribute("src", "/static/umap/img/marker.png") expect(marker).to_have_attribute("src", "/static/umap/img/marker.svg")
edit_settings = page.get_by_title("Edit map properties") edit_settings = page.get_by_title("Edit map properties")
expect(edit_settings).to_be_visible() expect(edit_settings).to_be_visible()
edit_settings.click() edit_settings.click()

View file

@ -442,7 +442,7 @@ class MapDetailMixin:
"urls": _urls_for_js(), "urls": _urls_for_js(),
"tilelayers": TileLayer.get_list(), "tilelayers": TileLayer.get_list(),
"editMode": self.edit_mode, "editMode": self.edit_mode,
"default_iconUrl": "%sumap/img/marker.png" % settings.STATIC_URL, # noqa "default_iconUrl": "%sumap/img/marker.svg" % settings.STATIC_URL, # noqa
"umap_id": self.get_umap_id(), "umap_id": self.get_umap_id(),
"starred": self.is_starred(), "starred": self.is_starred(),
"licences": dict((l.name, l.json) for l in Licence.objects.all()), "licences": dict((l.name, l.json) for l in Licence.objects.all()),