我知道我可以使用工具提示制作一个标记,显示“SOMETHING”,如下所示:
marker = new google.maps.Marker({
position: new google.maps.LatLng(lat,lon),
map: map,
draggable: true,
title:"SOMETHING",
icon: '/public/markers-map/male-2.png'
});
我想用圆圈做同样的事但标题不起作用。
new google.maps.Circle({
center: new google.maps.LatLng(lat,lon),
radius: 20,
strokeColor: "blue",
strokeOpacity: 1,
title:"SOMETHING",
strokeWeight: 1,
fillColor: "blue",
fillOpacity: 1,
map: map
});
它打印圆圈但不显示消息“SOMETHING”。
我该怎么做?有另一个属性来获得它吗?
提前致谢。
我们也可以直接在google.maps.Circle实例上添加事件监听器。
代码示例:
//circle is the google.maps.Circle-instance
circle.addListener('mouseover',function(){
this.getMap().getDiv().setAttribute('title',this.get('title'));
});
circle.addListener('mouseout',function(){
this.getMap().getDiv().removeAttribute('title');
});
刚写的替代品!