@navigoo/map-components 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/components/MapView.tsx +12 -5
package/package.json
CHANGED
@@ -50,20 +50,26 @@ const MapView: React.FC<MapViewProps> = ({
|
|
50
50
|
return [];
|
51
51
|
};
|
52
52
|
|
53
|
-
|
53
|
+
useEffect(() => {
|
54
54
|
if (mapContainerRef.current && !mapRef.current) {
|
55
|
+
const maxZoom = 16;
|
55
56
|
mapRef.current = L.map(mapContainerRef.current, {
|
56
57
|
center: [7.365, 12.3], // Centre approximatif du Cameroun
|
57
58
|
zoom: 7, // Zoom ajusté pour voir l'ensemble du Cameroun
|
58
59
|
minZoom: 6,
|
59
|
-
maxZoom:
|
60
|
-
maxBounds: [
|
60
|
+
maxZoom: maxZoom,
|
61
|
+
maxBounds: [
|
62
|
+
[1.65, 8.4], // Coin sud-ouest du Cameroun
|
63
|
+
[13.08, 16.2], // Coin nord-est du Cameroun
|
64
|
+
],
|
61
65
|
maxBoundsViscosity: 1.0,
|
62
66
|
});
|
63
67
|
|
64
68
|
L.tileLayer('https://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png', {
|
65
|
-
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a>',
|
66
|
-
maxZoom:
|
69
|
+
attribution: '© <a href="https://www.openstreetmap.org/copyright">OpenStreetMap</a> contributors',
|
70
|
+
maxZoom: maxZoom,
|
71
|
+
tileSize: 256,
|
72
|
+
zoomOffset: 0,
|
67
73
|
}).addTo(mapRef.current);
|
68
74
|
|
69
75
|
L.Icon.Default.mergeOptions({
|
@@ -72,6 +78,7 @@ const MapView: React.FC<MapViewProps> = ({
|
|
72
78
|
shadowUrl: 'https://unpkg.com/leaflet@1.9.4/dist/images/marker-shadow.png',
|
73
79
|
});
|
74
80
|
|
81
|
+
|
75
82
|
routeLayerRef.current = L.layerGroup().addTo(mapRef.current);
|
76
83
|
|
77
84
|
mapRef.current.on('click', async (e: L.LeafletMouseEvent) => {
|