user3723365
user3723365

Reputation: 5

leaflet map bounds meteor

I have a leaflet map in meteor project with polygns on it. I set the bounds like that:

 var map = L.map('map', {
    doubleClickZoom: false,
    maxBounds: maxBounds,
    minZoom:2,
    maxZoom:16
}).locate({setView: true, maxZoom: 16});

maxBounds is a nested array:

var maxBounds= [[31.838389, 35.223155],[31.807467, 35.260148]]

I want to expand the bounds but whenever I do that and get the zoom out, the polygons are getting messy.. What can I do to solve that?
Thank you a lot!!

Upvotes: 0

Views: 62

Answers (1)

HudsonPH
HudsonPH

Reputation: 1878

change your array for this:

var southWest = new L.LatLng(31.838389, 35.223155),
    northEast = new L.LatLng(31.807467, 35.260148),
    maxBounds = new L.LatLngBounds(southWest, northEast);

More info:

http://leafletjs.com/reference.html#map-maxbounds

http://leafletjs.com/reference.html#latlngbounds

Upvotes: 0

Related Questions