谷歌地图,在圆圈上显示工具提示

And*_*res 9 google-maps tooltip google-maps-api-3

我知道我可以使用工具提示制作一个标记,显示"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'
    });
Run Code Online (Sandbox Code Playgroud)

我想用圆圈做同样的事但标题不起作用.

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
            });
Run Code Online (Sandbox Code Playgroud)

它打印圆圈但不显示消息"SOMETHING".

我该怎么做?有另一个属性来获得它吗?

提前致谢.

Dr.*_*lle 27

工具提示是通过titleDOM元素的native -attribute 创建的,但是他没有提供任何方法来访问包含该圆的DOMElement.

一种可能的解决方法可能是使用map-div的title属性(设置onmouseover并删除它onmouseout)

        //circle is the google.maps.Circle-instance
        google.maps.event.addListener(circle,'mouseover',function(){
             this.getMap().getDiv().setAttribute('title',this.get('title'));});

        google.maps.event.addListener(circle,'mouseout',function(){
             this.getMap().getDiv().removeAttribute('title');});
Run Code Online (Sandbox Code Playgroud)