i am find some problems with my code... I am doing a map with marker icons that i place with a getJSON no problem to do that, the problem is that i have different icons and i create a function to build and set them:
logoMarker(nVelos, statut) {
let choixMarker;
let LeafIcon = L.Icon.extend({
options: {
shadowUrl: "./img/shadow.png",
iconSize: [40, 50],
iconAnchor: [0, 50],
popupAnchor: [21, -45],
shadowSize: [50, 35],
shadowAnchor: [0, 35]
}
});
// construction icon rouge si station fermée
if (statut === "CLOSED") {
choixMarker = new LeafIcon({
iconUrl: "./img/veloRouge.png"
});
// construction icon orange si il ya moins de 3 vélos
} else if (nVelos <= 3) {
choixMarker = new LeafIcon({
iconUrl: "./img/veloOrange.png"
});
// construction icon vert pour le reste
} else {
choixMarker = new LeafIcon({
iconUrl: "./img/veloVert.png"
});
}
//console.log(nVelos);
console.log(choixMarker);
return choixMarker;
}
the problem is that only the else green icon appears.
thx
Aucun commentaire:
Enregistrer un commentaire