everyone. I want to show a cluster using mapbox. I get it to the point where I can see the number of markers within a cluster. However, if I zoom into the map, the display does not change to where I see individual markers on the map. See image. I use the following lib for the mapbox for React: https://visgl.github.io/react-map-gl/docs/api-reference/map . Thank you very much
useEffect(() => {
const points = alleArtikel.map((artikel) => ({
type: "Feature",
properties: {
cluster: false,
artikelId: artikel._id,
name: artikel.name,
beschreibung: artikel.beschreibung,
lng: artikel.long,
lat: artikel.lat,
bild: artikel.bild,
userId: artikel.userId,
},
geometry: {
type: "Point",
coordinates: [parseFloat(artikel.long), parseFloat(artikel.lat)],
},
}));
setPoints(points);
}, [alleArtikel]);
useEffect(() => {
supercluster.load(points);
setClusters(supercluster.getClusters(bounds, zoom));
}, [points, zoom, bounds]);
useEffect(() => {
if (mapRef.current) {
setBounds(mapRef.current.getMap().getBounds().toArray().flat());
}
}, [mapRef?.current]);
{clusters?.map((artikel) => {
const { cluster: isCluster, point_count } = artikel.properties;
const [longitude, latitude] = artikel.geometry.coordinates;
if (isCluster) {
return (
<Marker
key={artikel.id}
longitude={longitude}
latitude={latitude}
onClick={() => setShowPopup(true)}
>
<div
className="cluster-marker"
style={{
width: `${13 + (point_count / points.length) * 20}px`,
height: `${13 + (point_count / points.length) * 20}px`,
}}
onClick={() => {
const zoom = Math.min(
supercluster.getClusterExpansionZoom(artikel.id),
10
);
mapRef?.current.flyTo({
center: [longitude, latitude],
zoom,
speed: 1,
});
}}
>
{point_count}
</div>
</Marker>
);
}
return (
<Marker
key={artikel.properties.artikelId}
longitude={longitude}
latitude={latitude}
>
<Box sx={{ position: "realtive" }}>
<Tooltip title={artikel.properties.beschreibung}>
<img
src={artikel.properties.bild}
width={40}
height={40}
/>
</Tooltip>
{showPopup && (
<Popup
closeOnClick={false}
closeButton={true}
longitude={longitude}
latitude={latitude}
anchor="bottom"
onClose={() => setShowPopup(false)}
style={{ position: "absolute", top: -40 }}
>
<Stack direction={"column"}>
<Box>
<img
src={artikel.properties.bild}
style={{ maxWidth: 200 }}
></img>
</Box>
<Box>
<Typography variant="body2" align="center">
{artikel.art}
</Typography>
</Box>
<Box>
<Typography variant="body1" align="center">
{artikel.name}
</Typography>
</Box>
<Box>
<Button variant="contained" fullWidth>
anfragen
</Button>
</Box>
</Stack>
</Popup>
)}
</Box>
</Marker>
);
})}
This is what the map looks like when it is initially loaded

If I zoom in very closely, the point does not change or split
