mstahv / v-leaflet

Leaflet add-on for Vaadin
Other
43 stars 38 forks source link

LMap in HorizontalSplitPanel, zoomToExtent #170

Closed gbuompastore closed 6 years ago

gbuompastore commented 6 years ago

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)

mstahv commented 6 years ago

Hi, there is probably some timing issue, but I couldn't reproduce the issue. Which browser are you using?

gbuompastore commented 6 years ago

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.

gbuompastore commented 6 years ago

Great! Thanks a lot!

2018-02-26 9:43 GMT+01:00 Matti Tahvonen notifications@github.com:

Closed #170 https://github.com/mstahv/v-leaflet/issues/170 via 012f8e2 https://github.com/mstahv/v-leaflet/commit/012f8e2f38d4962d1847be3a0571f7f365a966c1 .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mstahv/v-leaflet/issues/170#event-1491484527, or mute the thread https://github.com/notifications/unsubscribe-auth/AE0AqDeSYBzJdDsZ9anpswdMxIP2JHf3ks5tYm6fgaJpZM4RkeJC .

mstahv commented 6 years ago

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.

gbuompastore commented 6 years ago

Tested, seems to work very well!

2018-02-26 9:46 GMT+01:00 Matti Tahvonen notifications@github.com:

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.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/mstahv/v-leaflet/issues/170#issuecomment-368428722, or mute the thread https://github.com/notifications/unsubscribe-auth/AE0AqD-JsrugdDuBjjOQV8eMhztDM6Xhks5tYm9igaJpZM4RkeJC .