map zone interactive plus grande
This commit is contained in:
parent
32221214bb
commit
4c3717df81
|
@ -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);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -63,8 +63,11 @@ class SitesMap extends BlockBase {
|
|||
<g
|
||||
id="site-$index"
|
||||
data-geofield="$geofieldData"
|
||||
transform="
|
||||
translate($x,$y)">
|
||||
transform="translate($x,$y)"
|
||||
style="cursor: pointer;" <!-- Change le curseur pour indiquer l'interaction -->
|
||||
>
|
||||
<rect width="40" height="40" fill="transparent" onclick="handleCircleClick('$datacontent')"></rect> <!-- Zone d'interaction invisible -->
|
||||
|
||||
<circle
|
||||
class="site-link"
|
||||
data-content="$datacontent"
|
||||
|
|
Loading…
Reference in New Issue