Gestion des icones des pois affichés sur les carte des pages poi

This commit is contained in:
leosw committed 2026-10-20 19:40:12 +02:00
1 parent 32e8804a5b
commit 9e06578c4b
4 files changed
+15 -17

No files matched your search

+1 -1
View File
@@ -41,7 +41,7 @@
?>
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
<?php } ?>
"default": { color: "#ef2929", size: 16, shape: "square", icon: "<?=$config['views_url']?>img/default.svg" }
"default": { color: "#ef2929", size: 16, shape: "square", icon: "<?=$config['views_url']?>third/leaflet/images/marker-icon.png" }
};
</script>
+1 -1
View File
@@ -251,7 +251,7 @@ $( "#name" ).change(function() {
?>
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
<?php } ?>
"default": { color: "#ef2929", size: 16, shape: "square", icon: "<?=$config['views_url']?>img/default.svg" }
"default": { color: "#ef2929", size: 16, shape: "square", icon: "<?=$config['views_url']?>third/leaflet/images/marker-icon.png" }
};
</script>
+1 -1
View File
@@ -312,7 +312,7 @@
?>
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
<?php } ?>
"default": { color: "#ef2929", size: 16, shape: "square", icon: "<?=$config['views_url']?>img/default.svg" }
"default": { color: "#ef2929", size: 16, shape: "square", icon: "<?=$config['views_url']?>third/leaflet/images/marker-icon.png" }
};
</script>
+12 -14
View File
@@ -155,14 +155,10 @@ $(document).ready(function() {
var startLat = (typeof poi_lat !== "undefined" && poi_lat) ? poi_lat : 47;
var startLon = (typeof poi_lon !== "undefined" && poi_lon) ? poi_lon : 3;
// Icône : si poi_type défini, on l’utilise, sinon icône Leaflet par défaut
var poiicon = null;
// Icône centrale : même règle que les POIs
var poiType = (typeof poi_type !== "undefined" && poi_type) ? poi_type : "default";
if (typeof poi_type !== "undefined" && poi_type) {
poiicon = L.icon({
iconSize: [24, 24],
iconAnchor: [12, 12],
iconUrl: root + "views/img/" + poi_type + ".svg"
});
var poiicon = getMarkerIconFor(poiType, mymap.getZoom());
}
if (poiicon) {
@@ -171,6 +167,13 @@ $(document).ready(function() {
poi_layer = L.marker([startLat, startLon], { draggable: isEdit }).addTo(mymap);
}
// Si le zoom change, on recalcule la taille comme pour les POIs
mymap.on('zoomend', function() {
if (poi_layer) {
poi_layer.setIcon(getMarkerIconFor(poiType, mymap.getZoom()));
}
});
if (isEdit) {
poi_layer.bindTooltip("Glissez moi au bon endroit.", { permanent: true, direction: 'auto' }).openTooltip();
}
@@ -204,15 +207,10 @@ $(document).ready(function() {
}
});
var editPoiIcon = L.icon({
iconSize: [24, 24],
iconAnchor: [12, 12]
});
$("#type_selector label").click(function(e) {
poi_layer.unbindTooltip();
editPoiIcon.options.iconUrl = e.currentTarget.firstChild.currentSrc;
poi_layer.setIcon(editPoiIcon);
poiType = e.currentTarget.getAttribute("for");
poi_layer.setIcon(getMarkerIconFor(poiType, mymap.getZoom()));
});
$("#elevation_icon").click(function(e) {