Added comments; remove SVG 'g' elements with no children
This commit is contained in:
		
							
								
								
									
										10
									
								
								index.js
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								index.js
									
									
									
									
									
								
							| @@ -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) | ||||
|   | ||||
		Reference in New Issue
	
	Block a user