我想在google maps v3 ex中为复杂多边形中的每个多边形制作点击事件:
var path1 = [new google.maps.LatLng(31.246599, 29.999199),
new google.maps.LatLng(29.999199, 31.246599),
new google.maps.LatLng(30.246599,28.999199)];
var path2 = [new google.maps.LatLng(31, 30),
new google.maps.LatLng(29.999199, 31.246599),
new google.maps.LatLng(30.246599,28.999199)];
poly = new google.maps.Polygon({
paths: [path1, path2],
strokeColor: "#FF0000",
strokeOpacity: 0.8,
strokeWeight: 3,
fillColor: "#FF0000",
fillOpacity: 0.35,
map: map });
// i want to make click event for a polygon that represents by path1
// and the other that represents by path2
感谢
答案 0 :(得分:2)
然后创建两个多边形poly1和poly2并处理它们上的点击事件:
google.maps.event.addListener(poly1, 'click', function (e) {
....
});
google.maps.event.addListener(poly2, 'click', function (e) {
....
});