I am having trouble properly zooming to a specific marker.
When trying to change the view to a designated marker, I am unable to achieve it successfully.
I have attempted:
map.setCenter(location);
map.setZoom(20);
as well as
map.fitBounds(new google.maps.latLngBounds(location,location));
In the first scenario, I find myself zoomed in without the center actually shifting. In the second case, the map displays an overview of a large area instead of zooming in.
One potential solution might involve using a delay between setting the center and adjusting the zoom level, but I consider that workaround less than ideal. I would much prefer a more elegant solution.
How do others approach this challenge?
Additionally, if there is a way to show the infowindow without altering its content, that would be a nice feature to have. However, my primary concern remains zooming in accurately on the marker.
Thank you for your assistance.