就像以下:
https://github.com/vasturiano/globe.gl const customMarker = document.createElement("div");
const backGroundColor = theme == "dark" ? "bg-white/90" : "bg-black/90";
customMarker.className = "w-2 h-20 rounded-full" + " " + backGroundColor;
if (!device.location?.longitude || !device.location?.latitude) return;
new mapboxgl.Marker({
element: customMarker,
pitchAlignment: "map",
rotationAlignment: "map"
})
.setLngLat([device.location?.longitude, device.location?.latitude] as [
number,
number
])
.setRotation(45)
.addTo(mapRef.current!);
this这样的标记:
我在2007 - 09年左右在虚拟地球上做了广泛的工作。根据您的代码,您已经阅读了它,从最后一行的代码中,您提到的.setRotation(45)。通过.setRotation(90)尝试一下。它可能起作用