本文介绍了无法点击填写圈子吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的地图中有一个mousemove事件,现在我想只用笔划线画一个圆.

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
    });

问题在于该圆的透明填充中心仍在捕获"鼠标事件,因此它不会进入我的"Map mousemove"侦听器.

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?

推荐答案

在传递给构造函数的CircleOptions中添加clickable: false:

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
});

这篇关于无法点击填写圈子吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-05 13:33