我有一条 Google Maps V3 折线。我可以检测整个多段线上的点击事件,但我可以对点击事件做更高级的事情吗?
我想做的是检测折线的哪一部分被点击,并在警报中显示。
routePath = new google.maps.Polyline({
path: routeCoordinates,
strokeColor: "#CC33FF",
strokeWeight: 3
});
routePath.setMap(map);
google.maps.event.addListener(routePath, 'click', function() {
alert(routePath);
// TODO: display which section of the polyline has been clicked?
});
有谁知道如何在谷歌地图中做到这一点?
谢谢!