I am using ngMaps in Angular. I have created a map and included a shape (circle) that can be adjusted depending on my radius value.
Is it possible to set the bounds of the map to adjust to include the entire circle?
Here is my view:
<ng-map class="bu-map"
default-style="false"
scrollwheel="false"
style="margin: 0 -15px"
data-ng-style="{'height': appCtrl.windowHeight - 81 + 'px'}"
map-type-control="false"
>
<shape id="circle"
name="circle"
centered="true"
stroke-color='#FF0000'
stroke-opacity="0.8"
stroke-weight="1"
center="{{listCtrl.queryBounds.centerPoint}}"
radius="{{listCtrl.queryBounds.radius}}"
editable="false"></shape>
</ng-map>
and my controller:
NgMap.getMap().then((map) => {
bu.map = map;
map.setCenter(centerPoint);
bu.queryBounds = {
centerPoint: [centerPoint.lat, centerPoint.lng],
// miles to meters conversion
radius: (parseFloat(searchQuery.radius) || 1) * 1600,
};
map.setZoom(10);
});
});
In this case, searchQuery.radius can be adjusted which adjusts the circle that is drawn on the map however it is too big for the map sometimes and the zoom doesn't adjust.
I did a calculation on setZoom but the setZoom values aren't diverse enough to perfectly include the circle.
Is this possible with setBounds?
Thanks!