有没有可能,如果标记的半径互相交叉就不画标记

is it possible that, if markers radiuses crosses each other not to draw marker?

本文关键字:有可能 如果      更新时间:2023-09-26

这是我的代码,谷歌用圆圈绘制标记,所以如果有圆圈相互交叉,我想点击不画标记

  google.maps.event.addListener(map, 'click', function(event) {
     var marker3 = placeMarker(event.latLng);
       google.maps.event.addListener(marker3, 'click', function(event) {
       });
  });
  function placeMarker(location) {
      var marker3 = new google.maps.Marker({
          position: location,
          map: map,
          draggable:true,   
      });
      radius = new google.maps.Circle(circleRadius);
      radius.bindTo('center', marker3, 'position');
      return marker3;
  }

可能的方法:为每个标记创建2个圆,现有的和另一个透明圆,半径是第一个标记的两倍。

第二个圆圈将在地图上不可见,但仍将存在,并防止地图触发点击事件。

  radius = new google.maps.Circle(circleRadius);
  radius2 = new  google.maps.Circle({fillOpacity:.0001,
                                     strokeWeight:0,
                                     map:radius.getMap(),
                                     radius:radius.getRadius()*2});
  radius.bindTo('center', marker3, 'position');
  radius2.bindTo('center', marker3, 'position');