I’ve searched quite a bit and can’t figure this out. I’m updating a map from v2 to v3. It allows the user to resize the map container. After changing the container size, in v2 I just did map.checkResize() and it just worked. For the v3 version, I used map.fitBounds(map.getBounds()) and it doesn’t do anything I can see. I maintain a crosshair marker right at the center of the container, so it’s obvious the v3 resize is not working right.
I’ve also tried placing the bounds functions in a ‘bounds_changed’ event callback function, as well as map.setOptions(mapOptions) both in and outside of the callback. It’s clear the map is unaware of the container size change. How do I get the map to recognize the new container size?
This is currently on a local test server so I can’t provide a link. I could make an illustrative sample on a live server, but I’m hoping this a generic enough question to make that unnecessary. I don’t need specific code, I just want to know what basic steps I need to do to get the map to work properly in it’s new container size.
In v2
map.checkResize(), the code in v3 uses like this:And getting the size of map container like this: