feat(map): show based name if based

This commit is contained in:
Gigi
2022-04-28 12:14:04 +02:00
parent 071b3b61fb
commit 00305f87cb

View File

@@ -56,9 +56,22 @@ title: Twentyone.World
} }
return cGray; return cGray;
} }
function basedName(iso) {
let country = countries.find(c => c.alpha3 == iso);
if (country && country.country && country.name) {
return country.country + ": " + country.name;
}
return "";
}
map.addLayer('countries', { map.addLayer('countries', {
title: function (d) { return d.name }, title: function (d) {
if (isBased(d.iso)) {
return basedName(d.iso);
} else {
return d.name;
}
},
styles: { styles: {
stroke: cDarkGray, stroke: cDarkGray,
fill: cGray fill: cGray