V-Leaflet Map in SubWindow and Resize Event

Hi,
I am struggeling with some little problem using Vaadin 7 and the v-leaflet Addon.

I have a SubWindow where i place a LMap as content.


public class SubWindowSample extends Window
{
   public SubWindowSample( final String caption )
   {
      super( caption );

      final LMap map = new LMap();
      map.setCenter( 50.06465, 19.94498 );

      final BaseLayer baselayer = new BaseLayer();
      baselayer.setName( "OpenStreetMap" );
      baselayer.setAttributionString( "OpenStreetMap" );
      baselayer.setUrl( "http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png" );
      map.setBaseLayers( baselayer );
  
      map.setImmediate( true );
      map.setSizeFull();
      
      this.setHeight( "600px" );
      this.setWidth( "600px" );
      this.setContent( map );
 
}

When I zoom out and In, everything is fine. But when i resize the window to make it
bigger
, then the Tiles are not loaded so that the whole window is filled up. It simply stays grey. Even when i zoom out and in and move the map around.
When i make it
smaller
then the initial size, there is no problem.

Though the Map component seems to be resized ,because the label is always show in the lower right corner.
When i set the map to a fixed size (e.g. 1000x1000 pixels), then i can resize the window and zoom out/in without problems, as long as i stay below this map size.
But doing this, I get scrollbars on the Window, which i don’t want.

How can i force the map to reload the (missing) tiles or expand to the correct size automatically?

The attachment shows the problem on a screenshot.
13116.jpg

I managed a workaround by reinitializing the map component after the resize event. But its probably not the way it should be done.

Hi,

Looks like the underlaying leaflet library should be notified on each size change. Would you add an issue report to the projects github page:
https://github.com/mstahv/v-leaflet

cheers,
matti

Hi,

There is now version 0.0.9 that should fix this issue. It also uses more recent leaflet under the hood, so there are some other small enhancements as well.

cheers,
matti