|
801 | 801 | }) |
802 | 802 | .attr("stroke", d => { |
803 | 803 | const country = normalizeCountryName(d.properties.name); |
804 | | - return byCountry.has(country) ? "rgba(255,255,255,0.78)" : "#4d4d4d"; |
| 804 | + const record = byCountry.get(country); |
| 805 | + return record ? (continentColors[record.continent] || "#aeeaf2") : "#5b5b5b"; |
805 | 806 | }) |
806 | 807 | .attr("stroke-width", d => { |
807 | 808 | const country = normalizeCountryName(d.properties.name); |
808 | 809 | return byCountry.has(country) ? 1.6 : 0.6; |
809 | 810 | }) |
810 | | - .attr("opacity", d => { |
811 | | - const country = normalizeCountryName(d.properties.name); |
812 | | - return byCountry.has(country) ? 0.94 : 0.68; |
813 | | - }) |
814 | 811 | .style("cursor", "pointer") |
815 | 812 | .on("mousemove", function (event, d) { |
816 | 813 | const rawName = d.properties.name || "Unknown country"; |
|
819 | 816 |
|
820 | 817 | if (record) { |
821 | 818 | d3.select(this) |
822 | | - .attr("opacity", 1) |
823 | 819 | .attr("stroke-width", 1.8); |
824 | 820 |
|
825 | 821 | tooltip |
|
844 | 840 | }) |
845 | 841 | .on("mouseleave", function () { |
846 | 842 | d3.select(this) |
847 | | - .attr("opacity", d => { |
848 | | - const country = normalizeCountryName(d.properties.name); |
849 | | - return byCountry.has(country) ? 0.94 : 0.68; |
850 | | - }) |
851 | 843 | .attr("stroke-width", d => { |
852 | 844 | const country = normalizeCountryName(d.properties.name); |
853 | | - return byCountry.has(country) ? 0.95 : 0.45; |
| 845 | + return byCountry.has(country) ? 1.6 : 0.6; |
854 | 846 | }); |
855 | 847 |
|
856 | 848 | tooltip.style("opacity", 0); |
|
0 commit comments