map responsive

This commit is contained in:
2024-10-08 14:44:25 +02:00
parent 541aaff83c
commit 0f3c160735
5 changed files with 39 additions and 7 deletions

View File

@@ -51,6 +51,7 @@ class SitesMap extends BlockBase {
$geofield = $site->get('field_geofield')->get(0);
$lon = $geofield->lon;
$lat = $geofield->lat;
$geofieldData = "$lon,$lat"; // Utiliser une chaîne pour stocker la position
$x = round(($lon - $lonLeft) / ($lonRight - $lonLeft) * $vp_w);
$y = round(($latTop - $lat) / ($latTop - $latBottom) * $vp_h);
@@ -61,6 +62,7 @@ class SitesMap extends BlockBase {
$sites_paths .= <<<SVGSITEPATH
<g
id="site-$index"
data-geofield="$geofieldData"
transform="
translate($x,$y)">
<circle