Skip to content

Commit 2de743d

Browse files
committed
adjust min zoom on map
1 parent 55b65d4 commit 2de743d

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

client/src/components/Map/MapComponent.jsx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,13 @@ import React, { useEffect, useState, useRef } from 'react'
33
import L from 'leaflet'
44
import { MapContainer, Marker, TileLayer } from 'react-leaflet'
55

6-
function MapComponent({ markers, maxZoom = 20, minZoom = 0, defaultZoom, mapClassName = "w-full h-full" }) {
6+
function MapComponent({ markers, maxZoom = 20, minZoom = 2, defaultZoom, mapClassName = "w-full h-full" }) {
77
const validMarkers = markers.filter((marker) => marker.lat !== null && marker.lng !== null)
88
const icon = L.icon({ iconUrl: "/images/map/marker-icon.png" })
99
const mapRef = useRef(null)
1010
const bounds = validMarkers.map((marker) => [marker.lat, marker.lng])
1111

1212
return (
13-
// Make sure you set the height and width of the map container otherwise the map won't show
1413
<MapContainer center={bounds[0]} maxZoom={maxZoom} minZoom={minZoom} zoom={defaultZoom} ref={mapRef} className={mapClassName} bounds={bounds} markerZoomAnimation={true} touchZoom={true} style={{
1514
zIndex: 0
1615
}}>

0 commit comments

Comments
 (0)