brunob / leaflet.fullscreen

Leaflet.Control.FullScreen for Leaflet
https://brunob.github.io/leaflet.fullscreen/
MIT License
376 stars 107 forks source link

On enter/exit full screen, wait until it's complete. #49

Closed jimmykirk closed 8 years ago

jimmykirk commented 8 years ago

I love this plugin, but my one request would be to allow leaflet to zoom to an extent AFTER the map is full screen or returned to normal. I included my function I use to do this in:

map.on('enterFullscreen', function(){
        auto_zoom_map();
    });

    map.on('exitFullscreen', function(){
        auto_zoom_map();
    });

However, there seems to be a race condition. If I run the function afterwards, it works perfectly.

brunob commented 8 years ago

I'm not sure to understand your bug, but you should try to "listen" to size change on your map.

jimmykirk commented 8 years ago

Thank you brunob. I am fairly new to JS. Thank you for the nudge.