6

私が取り組んでいる気の利いた新しいプロジェクトでポリゴンを作成している最中です。この問題は、infoWindow にカーソルを合わせるたびに発生し、ポリゴンで mouseout イベントが発生します。マウスがポリゴンとinfoWindowの外に移動しない限り、mouseoutイベントを発生させたくありません。何か案は?関連するコードのほとんどを次に示します。

    infoWindow = new google.maps.InfoWindow({
          content: myContent
    });

    var polygon = new google.maps.Polygon({
          paths: polygonPath,
          strokeColor: data.color,
          strokeOpacity: 0.5,
          strokeWeight: 0,
          fillColor: data.color,
          fillOpacity: 0.5,
          id:polygonId,
          name: data.name,
          shortDesc: data.short_desc,
          map: map 
    }); 


    google.maps.event.addListener(polygon, 'click', function(e){
          infoWindow.open(map);
          infoWindow.setPosition(e.latLng);
    });

    google.maps.event.addListener(polygon, 'mouseout', function(){
          infoWindow.close();
    });
4

1 に答える 1