Some of you may already have faced this issue. Centering Google Maps does not always work how it should, especially If you use markers. Here is how to fix this issue:
First I we need a map, for example this one here:
Now comes the important part. You need to add a listener on your map for the painted event. When the painted event is fired we do also need a timeout to set the center. This can be really small.
This should to it, the map will now be centered correctly.
Keine Kommentare:
Kommentar veröffentlichen