Gestion des icones des pois affichés sur les carte des pages poi
This commit is contained in:
1 parent
32e8804a5b
commit
9e06578c4b
4 files changed
+15
-17
No files matched your search
@@ -41,7 +41,7 @@
|
|||||||
?>
|
?>
|
||||||
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
|
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
|
||||||
<?php } ?>
|
<?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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -251,7 +251,7 @@ $( "#name" ).change(function() {
|
|||||||
?>
|
?>
|
||||||
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
|
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
|
||||||
<?php } ?>
|
<?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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -312,7 +312,7 @@
|
|||||||
?>
|
?>
|
||||||
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
|
"<?=$k?>": { color: "<?=$color?>", size: <?=$size?>, shape: "<?=$shape?>", icon: "<?=$icon?>" },
|
||||||
<?php } ?>
|
<?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>
|
</script>
|
||||||
|
|
||||||
|
|||||||
@@ -155,14 +155,10 @@ $(document).ready(function() {
|
|||||||
var startLat = (typeof poi_lat !== "undefined" && poi_lat) ? poi_lat : 47;
|
var startLat = (typeof poi_lat !== "undefined" && poi_lat) ? poi_lat : 47;
|
||||||
var startLon = (typeof poi_lon !== "undefined" && poi_lon) ? poi_lon : 3;
|
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
|
// Icône centrale : même règle que les POIs
|
||||||
var poiicon = null;
|
var poiType = (typeof poi_type !== "undefined" && poi_type) ? poi_type : "default";
|
||||||
if (typeof poi_type !== "undefined" && poi_type) {
|
if (typeof poi_type !== "undefined" && poi_type) {
|
||||||
poiicon = L.icon({
|
var poiicon = getMarkerIconFor(poiType, mymap.getZoom());
|
||||||
iconSize: [24, 24],
|
|
||||||
iconAnchor: [12, 12],
|
|
||||||
iconUrl: root + "views/img/" + poi_type + ".svg"
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (poiicon) {
|
if (poiicon) {
|
||||||
@@ -171,6 +167,13 @@ $(document).ready(function() {
|
|||||||
poi_layer = L.marker([startLat, startLon], { draggable: isEdit }).addTo(mymap);
|
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) {
|
if (isEdit) {
|
||||||
poi_layer.bindTooltip("Glissez moi au bon endroit.", { permanent: true, direction: 'auto' }).openTooltip();
|
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) {
|
$("#type_selector label").click(function(e) {
|
||||||
poi_layer.unbindTooltip();
|
poi_layer.unbindTooltip();
|
||||||
editPoiIcon.options.iconUrl = e.currentTarget.firstChild.currentSrc;
|
poiType = e.currentTarget.getAttribute("for");
|
||||||
poi_layer.setIcon(editPoiIcon);
|
poi_layer.setIcon(getMarkerIconFor(poiType, mymap.getZoom()));
|
||||||
});
|
});
|
||||||
|
|
||||||
$("#elevation_icon").click(function(e) {
|
$("#elevation_icon").click(function(e) {
|
||||||
|
|||||||
Reference in new issue
Block a user