Added comments; remove SVG 'g' elements with no children

master
Aadhavan Srinivasan 2 weeks ago
parent 4658ec5a9d
commit 2e85a7c2b3

@ -402,12 +402,22 @@ function drawMap(world) {
const coordinates = [77.69916967457782,23.389970772934166];
const [xCoord, yCoord] = projection(coordinates);
// Add a listener to toggle the language display when a language is hovered on the map
document.querySelectorAll(".language").
forEach(function(element) {
element.addEventListener("mouseover", toggleLanguageDisplay);
element.addEventListener("mouseout", toggleLanguageDisplay);
});
// Remove all 'g' elements that have no children (they don't have a language, translation, or romanization). This must mean they accidentally got created when I created the 'textItems' variable
document.querySelectorAll("g").
forEach(function(element) {
if (element.childElementCount == 0) {
element.remove()
}
});
// svg.append("text")
// .attr("x", xCoord)
// .attr("y", yCoord)

Loading…
Cancel
Save