Google maps fitBounds () not working properly

I am trying to zoom in to a few kilometers in place (e.g. in Paris), for example:

map.myCircle = circle;

// update radius
map.myCircle.radius = newRadius;

// update map - ZOOM
map.myCircle.setMap(null);
map.fitBounds(map.myCircle.getBounds());
map.myCircle.setMap(map);

Codepen

This gives enter image description here

As you can see, fitBoundsdoes not fit the boundaries of the circle.

When you increase (up and down) the radius, you can see that the map scale does not change, but the radius of the circle changes.

Is there a way to synchronize the image scale with the radius of the circle and make a circle by touching the map fields?

+4
source share

Source: https://habr.com/ru/post/1615293/


All Articles