Skip to content

Commit

Permalink
Change markers bouding box to map bounding box on the first load.
Browse files Browse the repository at this point in the history
  • Loading branch information
tienhoah committed May 10, 2024
1 parent 4b2d716 commit 821436d
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/components/LeafletMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -603,11 +603,14 @@ class LeafletMap extends Component {
if (markersData.length === 0) {
this.map.setView(mapProperty.center, mapProperty.zoom)
} else {
const mapBounds = markersCluster.getBounds().pad(0.5)
const markerBounds = markersCluster.getBounds()

this.map.fitBounds(markerBounds)

const mapBounds = this.map.getBounds()
const mapBoundingBox = this.createBoundingBox(mapBounds)
const mapBoundingBoxCorner = mapBounds.getSouth()

this.map.fitBounds(mapBounds)
this.setState({
mapZoomLevel: this.map.getZoom(),
mapBoundingBoxCorner,
Expand Down

0 comments on commit 821436d

Please sign in to comment.