Angular で ngMaps を使用しています。マップを作成し、半径の値に応じて調整できる形状 (円) を含めました。
円全体を含むようにマップの境界を調整するように設定することは可能ですか?
これが私の見解です:
<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>
そして私のコントローラー:
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);
});
});
この場合、searchQuery.radius を調整して、マップ上に描画される円を調整できますが、マップに対して大きすぎる場合があり、ズームが調整されません。
setZoom で計算を行いましたが、setZoom の値は円を完全に含めるのに十分なほど多様ではありません。
これは setBounds で可能ですか?
ありがとう!