Problem MaxBounds and setView

17 views
Skip to first unread message

Luca Moiana

unread,
Feb 12, 2016, 6:22:59 AM2/12/16
to Leaflet

Hi there,

 

I have a prblem with maxBounds and setView; after setting MaxBounds in my map I used setView in order to zoom to a certain layer, when active. Everything works, except that the layer activated is not center in the map as you can see here:

 

Here is part of the code:http://lucamoiana.github.io/MDR/index.html


map.setMaxBounds(lungo.getBounds(), {



    padding
: [500, 500]

});

map
.on('layerremove', function(e) {

if (map.hasLayer(chiusuratraffico) == false) {

map
.setView([45.642, 8.954], 14);

};



});


Reply all
Reply to author
Forward
0 new messages