我想在鼠标悬停/移出折线路径时显示和隐藏工具提示,问题是我的折线路径只有2的描边宽度,因此很难在鼠标悬停事件中触发该区域,这对用户体验来说绝对不方便。
我想知道是否有一种方法可以使用任意宽度使该命中区域更宽,但对用户不可见?
以下是我的代码片段:
我想知道是否有一种方法可以使用任意宽度使该命中区域更宽,但对用户不可见?
以下是我的代码片段:
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));
非常感谢您的帮助:)