From 9e805ea8da36fb118911542af09b9a746e45058f Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Wed, 14 Feb 2024 18:37:26 +0100 Subject: [PATCH] fix: make default picto always white for now fix #1594 --- umap/static/umap/img/marker.svg | 10 ++++++---- umap/static/umap/js/umap.forms.js | 2 +- umap/static/umap/js/umap.icon.js | 2 +- umap/static/umap/js/umap.js | 1 + 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/umap/static/umap/img/marker.svg b/umap/static/umap/img/marker.svg index 9b579a76..eefae220 100644 --- a/umap/static/umap/img/marker.svg +++ b/umap/static/umap/img/marker.svg @@ -1,4 +1,6 @@ - - - - \ No newline at end of file + + + + + + diff --git a/umap/static/umap/js/umap.forms.js b/umap/static/umap/js/umap.forms.js index 380c8e9a..4ee82042 100644 --- a/umap/static/umap/js/umap.forms.js +++ b/umap/static/umap/js/umap.forms.js @@ -682,7 +682,7 @@ L.FormBuilder.IconUrl = L.FormBuilder.BlurInput.extend({ }, isDefault: function () { - return !this.value() || this.value() === this.obj.getMap().options.default_iconUrl + return !this.value() || this.value() === U.DEFAULT_ICON_URL }, showSymbolsTab: async function () { diff --git a/umap/static/umap/js/umap.icon.js b/umap/static/umap/js/umap.icon.js index 6393fa8a..a771108e 100644 --- a/umap/static/umap/js/umap.icon.js +++ b/umap/static/umap/js/umap.icon.js @@ -222,7 +222,7 @@ U.Icon.setIconContrast = function (icon, parent, src, bgcolor) { if (L.DomUtil.contrastedColor(parent, bgcolor)) { // Decide whether to switch svg to white or not, but do it // only for internal SVG, as invert could do weird things - if (L.Util.isPath(src) && src.endsWith('.svg')) { + if (L.Util.isPath(src) && src.endsWith('.svg') && src !== U.DEFAULT_ICON_URL) { // Must be called after icon container is added to the DOM // An image icon.style.filter = 'invert(1)' diff --git a/umap/static/umap/js/umap.js b/umap/static/umap/js/umap.js index dacfb9eb..4d2b3707 100644 --- a/umap/static/umap/js/umap.js +++ b/umap/static/umap/js/umap.js @@ -139,6 +139,7 @@ U.Map = L.Map.extend({ this.setOptionsFromQueryString(geojson.properties) L.Map.prototype.initialize.call(this, el, geojson.properties) + U.DEFAULT_ICON_URL = this.options.default_iconUrl // After calling parent initialize, as we are doing initCenter our-selves if (geojson.geometry) this.options.center = this.latLng(geojson.geometry)