I have a map, which is displayed or hidden depending on a button click.
I init the map while it is hidden, add layer, add markers, and call fitBounds()
for the markers.
My problem is that when the map is hidden, fitBounds
doesn't work. After switching to visible, the map is shown but fully zoomed out. When I call fitBounds
again, the map is shown correctly.
How do I know when the map is ready? I tried mapReady
, but it is also called when the map is hidden.
Is there another way?
Thanks!