LMap in HorizontalSplitPanel, zoomToExtent
gbuompastore opened this issue · comments
Take look this code:
LMap leafletMap = new LMap();
leafletMap.setSizeFull();
Bounds bounds = new Bounds();
bounds.setSouthWestLon(15.3308);bounds.setSouthWestLat(41.1427);bounds.setNorthEastLat(39.8847);
bounds.setNorthEastLon(16.887);
leafletMap.zoomToExtent(bounds);
leafletMap.addLayer(new LTileLayer("http://{s}.tile.openstreetmap.org/{z}/{x}/{y}.png"));
HorizontalSplitPanel sp = new HorizontalSplitPanel();
sp.setSizeFull();
sp.setFirstComponent(leafletMap);
sp.setSecondComponent(new Label("My Label"));
setContent(sp);
leafletMap.zoomToExtent([Bound]); dont' works well if the map isn't yet renderer (the zoom is setted very low)
Hi, there is probably some timing issue, but I couldn't reproduce the issue. Which browser are you using?
The issue is browser indipendent. You Can reproduce it with FireFox, Chrome or Edge. If you change the horizontalsplitpanel with vertical or horizontal layout the code works.
Yep, my bad, it sure reproduces. There is some timing issue with SplitPanel, the layout is probably not ready when rendering the map initially and later grows the area available for the map. I added a workaround, which don't seem to cause any side effects after small testing.