多边形显示正常,我在 chrome 中调试时没有看到任何错误。在 c# 代码中查询多边形的数据点,但与此问题无关。当我单击多边形时,js 代码似乎会触发,但我没有得到任何信息气泡。接下来,我将向信息气泡中添加有关多边形的信息,但首先需要先让它弹出。任何帮助,将不胜感激!
var map = new google.maps.Map(document.getElementById('map'), {
zoom: 5,
center: new google.maps.LatLng(30.2979536, -97.7470835),
mapTypeId: google.maps.MapTypeId.ROADMAP
});
<%for(int i = 0; i < this.zips2.Count; ++i )%>
<%{ %>
<%if ( layerType == "Orders" )
{
GetOrderColor(zips3[i]);
}
else
{
GetAptColor(zips3[i]);
} %>
var paths = [<%=zips2[i]%>];
var color = "<%=color%>";
var shape = new google.maps.Polygon({
paths: paths,
strokeColor: color,
strokeOpacity: 0.8,
strokeWeight: 2,
fillColor: color,
fillOpacity: 0.35,
clickable: true
});
shape.setMap(map);
google.maps.event.addListener(shape, 'rightclick', function(event) {
var contentString = '<div id="content:">' + "Test" + '</div>';
infowindow1 = new google.maps.InfoWindow();
infowindow1.setContent(contentString);
infowindow1.open(map, this);
});
<%} %>