correction map loaded trigger to display map icons

This commit is contained in:
Valentin 2024-10-01 11:40:10 +02:00
parent 1d7dfe72c2
commit bd07a046de
1 changed files with 38 additions and 36 deletions

View File

@ -29,7 +29,7 @@ import router from './router/router';
// } (Drupal)); // } (Drupal));
(function (Drupal, drupalSettings) { (function ($, Drupal, drupalSettings) {
const CaravaneTheme = function () { const CaravaneTheme = function () {
const _is_front = drupalSettings.path.isFront const _is_front = drupalSettings.path.isFront
console.log('drupalSettings', drupalSettings) console.log('drupalSettings', drupalSettings)
@ -146,9 +146,9 @@ import router from './router/router';
} }
function setupEtapeMapPopup(store) { function setupEtapeMapPopup(store) {
jQuery(document).bind('leaflet.map', function(event, map, lMap) { Drupal.behaviors.customLeafletInteraction = {
attach: function(context, settings) {
//setTimeout(() => { $(context).on('leafletMapInit', function (e, settings, map, mapid, markers) {
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');
@ -182,12 +182,14 @@ 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);
}); });
} }
}
}
init() init()
} // end CaravaneTheme() } // end CaravaneTheme()
CaravaneTheme() CaravaneTheme()
})(Drupal, drupalSettings) })(jQuery, Drupal, drupalSettings)