I am using mapbox-gl-leaflet to render vector layers in leaflet. I have a set of background tiles where they can be added via layers control. Initially when opening the map for the first time and choosing every layer from the layers control there are no loading or update issues. The problem can appear when panning to a new area and choosing other background tiles from the layers control. The map can't load until a rezise or pan action is made. Example of background tile load stuck issue
map.on('baselayerchange', function (e) {
console.log("Layer Changed");
//map._update();
//map.invalidateSize();
//map._resize();
//map.resize();
//setTimeout(function(){ map.invalidateSize()}, 400);
//setTimeout(function(){ map.resize()}, 3000);
});
Commented out are all the functions I tried to call in order to solve the bug but so far none of the functions did the trick.
map.invalidateSize()
fix this problem. Maybe you call it to early, try:setTimeout(function(){ map.invalidateSize()}, 400);
– Falke Design