google map api v3を使用して、円をマーカーに正常にバインドしました。マーカーをドラッグ可能にすると、円も移動するので、これを知っています。
マーカーがクリックされた場合、どうすれば円を参照できますか。表示されていない場合、またはその逆の場合は、円を表示する必要があります。
マーカーと円を作成するためのコードは次のとおりです
var markerOptions = {
title: title,
icon: markerImage,
shadow: markerShadow,
position: latlng,
map: map
}
var marker = new google.maps.Marker(markerOptions);
// Add a Circle overlay to the map.
var circle = new google.maps.Circle({
map: map,
radius: 50*1609.34,// 50 MI
visible: false
});
//circle.bindTo('map', marker);
circle.bindTo('center', marker, 'position');
スタックオーバーフローに関する回答を見つけたので、中央のバインディングだけでなく、削除されたマップのバインディングも実行する必要があると思いましたが、それは機能しませんでした。
これがマーカーのクリックイベントです。
google.maps.event.addListener(marker, "click", function() {
var infowindowOptions = {
content: html
}
var infowindow = new google.maps.InfoWindow(infowindowOptions);
cm_setInfowindow(infowindow);
infowindow.open(map, marker);
marker.setIcon(markerImageOut);
marker.circle({visible: true});
何か案は。クリックまたはマウスオーバーしたばかりのマーカーのバインドされた円を操作する必要があります。