我想在多段线路径上的 mouseover / mouseout 时显示和隐藏工具提示,问题是我的多段线路径的笔划宽度仅为2,因此在 mouseover 事件中不容易击中该区域,这绝对不方便用户体验。
我想知道是否有一种方法可以使用任意宽度使该命中区域更宽,但对用户不可见?
我的代码片段如下
path = new google.maps.Polyline(plotOptions);
path.setMap(that.map);
this.polyPathArray.push(path);
google.maps.event.addListener(path, 'mouseover', (function(index) {
return function(polyMouseevent) {
$(".table>tbody>tr>td").removeClass('highlight');
$(".table>tbody>tr").eq(index).find("td").addClass('highlight');
var latlngVal = '';
if(polyMouseevent) {
latlngVal = polyMouseevent.latLng;
} else {
//calculate a random position on a polyline
}
that.infowindows[index].setPosition(latlngVal);
that.infowindows[index].open(that.map);
};
})(i));
任何帮助,将不胜感激 :)