mstahv / v-leaflet

Leaflet add-on for Vaadin

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Vaadin Flyto fucntion returns zoom level : NaN

normandhenault opened this issue · comments

Then the map becomes useless after a Flyto ... Can you assist ?

public class cSessionData {

   public LMap leafletMap;

public void initializeMap() {
    leafletMap = InitMap.InitierLeafletMAp();
}

public LMap mGetMap() {
    return leafletMap;
}

}

public class InitMap {

static public LMap InitierLeafletMAp() {

    final LMap leafletMap = new LMap();
    //nooorm.kl9nn1o2
    LTileLayer pk = new LTileLayer();

    pk.setUrl("http://{s}.tiles.mapbox.com/v3/nooorm.n0c3a5hb/{z}/{x}/{y}.png"); 
    pk.setMaxZoom(25);

    pk.setDetectRetina(true);

    leafletMap.addBaseLayer(pk, "OSM");

    final Bounds b = new Bounds();
    b.setNorthEastLat(300);
    b.setNorthEastLon(300);
    b.setSouthWestLat(-300);
    b.setSouthWestLon(-300);

    leafletMap.setMaxBounds(b);
    leafletMap.setMinZoom(1);
    leafletMap.setSizeFull();
    leafletMap.setMaxZoom(22);
    leafletMap.setView(45.483333,-73.600000, 16.0);
    leafletMap.addControl(new LScale());
    leafletMap.setId("leafletmap");

    //leafletMap.setZoomLevel(2);

    return leafletMap;
}

}

public void flythis(final double longitude, final double latitude, final cSessionData lSessionData) {

            final Point pointend = new Point();
            pointend.setLat(latitude);
            pointend.setLon(longitude);

            lSessionData.mGetMap().flyTo(pointend, 14.0);

}

and this works ...

lSessionData.mGetMap().setView(pointend.getLat(), pointend.getLon(), 17.0);