2
我試圖通過更改組合菜單的值來更改圓的半徑。所以我寫了一個onchange的函數,如下所示。如何更改Google Map API中標記周圍的圓的半徑
function changeRadius(){
var selectedRadius = (document.getElementById("circle_radius").value)*1000;
var circle = new google.maps.Circle({
map: map,
radius: selectedRadius // radius unit is meter.
});
var marker2 = new google.maps.Marker({
map: map,
position: new google.maps.LatLng(40,-90),
draggable: true,
title: 'Drag me!'
});
circle1.bindTo('center', marker2, 'position');
}
但它不起作用。任何想法?
谷歌地圖API文檔沒有說明任何bindTo()函數爲圓,它是你自己的函數,它是做什麼的? – slawekwin
這個問題是https://stackoverflow.com/questions/15095118/interactive-circle-in-google-map-which-changes-on-changing-radius的重複,你想要的答案在這裏:https:/ /stackoverflow.com/a/15095490/1290746 – kris