Unclickable fill in Circle?

拈花ヽ惹草 提交于 2020-01-05 10:32:19

问题


I have a mousemove event in my map and now I want to draw a circle with just the stroke line.

var circle = new google.maps.Circle({
        strokeColor: '#0000FF',
        strokeWeight: 2,
        fillOpacity: 0,
        map: map,
        center: new google.maps.LatLng(lat, lon),
        radius: 100
    });

The problem is that the transparent fill center of that circle is still "capturing" the mouse event so it doesn't go to my Map mousemove listener.

Is there any way to really set the circle fill center to transparent as in: transparent color AND transparent dealing with mouse events?

In alternative, a way to easily propagate the event to the Map?


回答1:


Add clickable: false to the CircleOptions passed to the constructor:

var circle = new google.maps.Circle({
    strokeColor: '#0000FF',
    strokeWeight: 2,
    fillOpacity: 0,
    clickable: false,
    map: map,
    center: new google.maps.LatLng(lat, lon),
    radius: 100
});


来源:https://stackoverflow.com/questions/17071101/unclickable-fill-in-circle

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!