Compare commits

..

No commits in common. "fc6c367f97daf59b555cc1e8eda35f5a6e214571" and "6a0367c1928354acaa1f7c0f99995a6dda01c540" have entirely different histories.

5 changed files with 4 additions and 222 deletions

View File

@ -29,6 +29,7 @@ export default async function ServerGlobal() {
}
export async function Global({ countries = [] }: GlobalProps) {
// const t = useTranslations("Global");
const map = new DottedMap({ map: JSON.parse(mapJsonString) });
const countries_alpha3 = countries
@ -43,42 +44,6 @@ export async function Global({ countries = [] }: GlobalProps) {
);
if (feature) {
if (countryCode === "RUS") {
// 获取俄罗斯的多个边界
const bboxList = feature.geometry.coordinates.map((polygon: any) =>
turf.bbox({ type: "Polygon", coordinates: polygon }),
);
const spacing = 20; // 单位为千米
const options = { units: "kilometers" };
bboxList.forEach((bbox: any) => {
// @ts-expect-error ignore
const pointGrid = turf.pointGrid(bbox, spacing, options);
// 过滤出位于当前多边形内部的点
const pointsWithin = turf.pointsWithinPolygon(pointGrid, feature);
if (pointsWithin.features.length === 0) {
const centroid = turf.centroid(feature);
const [lng, lat] = centroid.geometry.coordinates;
map.addPin({
lat,
lng,
svgOptions: { color: "#FF4500", radius: 0.3 },
});
} else {
pointsWithin.features.forEach((point: any) => {
const [lng, lat] = point.geometry.coordinates;
map.addPin({
lat,
lng,
svgOptions: { color: "#FF4500", radius: 0.3 },
});
});
}
});
}
// 获取国家的边界框
const bbox = turf.bbox(feature);

BIN
bun.lockb

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1,6 +1,6 @@
{
"name": "nezha-dash",
"version": "1.4.5",
"version": "1.4.4-fix",
"private": true,
"scripts": {
"dev": "next dev -p 3040",
@ -25,7 +25,7 @@
"@turf/turf": "^7.1.0",
"@types/luxon": "^3.4.2",
"@typescript-eslint/eslint-plugin": "^8.15.0",
"caniuse-lite": "^1.0.30001683",
"caniuse-lite": "^1.0.30001680",
"class-variance-authority": "^0.7.0",
"clsx": "^2.1.1",
"country-flag-icons": "^1.5.13",