1

我正在尝试调整我的地图圈内的线条颜色、填充颜色和不透明度。

    <script type="text/javascript">
      circle = [{lng: <%= @listing.longitude %>, lat: <%= @listing.latitude %>, radius: 2500, strokeColor:"#0000FF",strokeOpacity: 1, strokeWeight: 3, fillColor: 'transparent'}]
      handler = Gmaps.build('Google');
      handler.buildMap({ provider: {}, internal: {id: 'map'}}, function(){
      markers = handler.addMarkers(<%=raw @hash.to_json %>);
      handler.bounds.extendWith(markers);
      handler.addCircles(circle);
      handler.fitMapToBounds()
      handler.getMap().setZoom(12);
    }); </script> 

更改半径值可以正常工作,但是调整 strokeColor、strokeOpacity、strokeWeight 等对地图没有影响。

如何覆盖这些设置?

4

1 回答 1

2

正如消息来源所说,您可以将选项作为第二个参数传递:

circle = [{lng: <%= @listing.longitude %>, lat: <%= @listing.latitude %>, radius: 2500 }]
circle_options = { strokeColor:"#0000FF",strokeOpacity: 1, strokeWeight: 3, fillColor: 'transparent' }
handler.addCircles(circle, circle_options);
于 2013-11-21T22:40:06.790 回答