diff --git a/web/modules/custom/q2d_mod/assets/js/carte-interactive-qdd.js b/web/modules/custom/q2d_mod/assets/js/carte-interactive-qdd.js index c9ec3e9..eeee454 100644 --- a/web/modules/custom/q2d_mod/assets/js/carte-interactive-qdd.js +++ b/web/modules/custom/q2d_mod/assets/js/carte-interactive-qdd.js @@ -164,3 +164,16 @@ window.addEventListener('resize', function() { showPopup(popupContent.innerHTML, currentPopupRect.left - rect.left, currentPopupRect.top - rect.top); } }); + +// Gérer le clic ou le toucher des cercles +function handleCircleClick(content) { + showPopup(content, event.clientX, event.clientY, event.target.getAttribute('data-left-half') === 'true'); +} + +// Écouter les événements de clic et de toucher sur le SVG +svgElement.addEventListener('click', function(event) { + if (event.target.classList.contains('site-link') || event.target.tagName === 'rect') { + const content = event.target.getAttribute('data-content'); + handleCircleClick(content); + } +}); diff --git a/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php b/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php index d66353b..63c873a 100644 --- a/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php +++ b/web/modules/custom/q2d_mod/src/Plugin/Block/SitesMap.php @@ -63,8 +63,11 @@ class SitesMap extends BlockBase { + transform="translate($x,$y)" + style="cursor: pointer;" + > + +