Closed Ynsinan closed 1 year ago
I solved the problem TrackingMap.tsx Changes
{dataForRouting.map((eachPoint, index) => {
return (
<Routing
key={index}
eachPoint={eachPoint}
dataSource={markersDataSource[index]}
color={routeWayColor[index]}
bounds={markersCoordinatesForMapCentering}
/>
);
})}
Routing.tsx Changes adding the addTo(map) under
if (bounds.length && bounds.length > 0) {
bounds.forEach(marker => {
markerBounds.extend([marker.latitude, marker.longitude]);
});
map.fitBounds(markerBounds);
}
Glad to hear you solved it! I'll go ahead and close this issue for now
I don't want to manually enter a center coordinate and zoom ratio.What I want is for the screen to adjust the zoom ratio according to the markers. Automatically fit them all on the screen.
Thank you very much in advance
TrackingMap.tsx
Routing.tsx
FakeData.ts