set map icons when map is loaded

This commit is contained in:
Valentin 2024-10-01 11:04:42 +02:00
parent da38f5e932
commit 1d7dfe72c2
1 changed files with 7 additions and 2 deletions

View File

@ -146,12 +146,16 @@ import router from './router/router';
} }
function setupEtapeMapPopup(store) { function setupEtapeMapPopup(store) {
setTimeout(() => { jQuery(document).bind('leaflet.map', function(event, map, lMap) {
//setTimeout(() => {
const icons = document.querySelectorAll('.leaflet-map-divicon'); const icons = document.querySelectorAll('.leaflet-map-divicon');
for (let icon of icons) { for (let icon of icons) {
const colorContainer = icon.querySelector('.couleur'); const colorContainer = icon.querySelector('.couleur');
const colorDiv = colorContainer.querySelector('div > div:nth-of-type(4)'); const colorDiv = colorContainer.querySelector('div > div:nth-of-type(4)');
const color = colorDiv.innerText.substring(colorDiv.innerText.indexOf('>') + 1, colorDiv.innerText.indexOf('<', colorDiv.innerText.indexOf('>') + 1)).trim(); const color = colorDiv.innerText.substring(colorDiv.innerText.indexOf('>') + 1, colorDiv.innerText.indexOf('<', colorDiv.innerText.indexOf('>') + 1)).trim();
console.log(color);
const nid = icon.querySelector('.nid'); const nid = icon.querySelector('.nid');
const nidValue = nid.querySelector('div > div').innerText; const nidValue = nid.querySelector('div > div').innerText;
@ -178,7 +182,8 @@ import router from './router/router';
icon.style.transform = icon.style.transform.split(' ')[0] + icon.style.transform.split(' ')[1] + icon.style.transform.split(' ')[2]; icon.style.transform = icon.style.transform.split(' ')[0] + icon.style.transform.split(' ')[1] + icon.style.transform.split(' ')[2];
}) })
} }
}, 500); // }, 500);
});
} }
init() init()