feat(global): use geoEquirectangular

This commit is contained in:
hamster1963 2024-11-25 21:55:22 +08:00
parent 1306dbde80
commit dba1528116

View File

@ -1,7 +1,7 @@
"use client"; "use client";
import { countryCodeMapping } from "@/lib/geo"; import { countryCodeMapping } from "@/lib/geo";
import { geoEqualEarth, geoPath } from "d3-geo"; import { geoEquirectangular, geoPath } from "d3-geo";
import { AnimatePresence, m } from "framer-motion"; import { AnimatePresence, m } from "framer-motion";
import { useTranslations } from "next-intl"; import { useTranslations } from "next-intl";
import { useState } from "react"; import { useState } from "react";
@ -33,9 +33,10 @@ export function InteractiveMap({
.map((code) => countryCodeMapping[code]) .map((code) => countryCodeMapping[code])
.filter((code) => code !== undefined); .filter((code) => code !== undefined);
const projection = geoEqualEarth() const projection = geoEquirectangular()
.scale(180) .scale(140)
.translate([width / 2, height / 2]); .translate([width / 2, height / 2])
.rotate([-12, 0, 0]);
const path = geoPath().projection(projection); const path = geoPath().projection(projection);