我正在尝试调整地图圆圈中的线条颜色,填充颜色和不透明度。
<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等对地图没有影响。
如何覆盖这些设置?
答案 0 :(得分:2)
As the source says,您可以将您的选项作为第二个参数传递:
circle = [{lng: <%= @listing.longitude %>, lat: <%= @listing.latitude %>, radius: 2500 }]
circle_options = { strokeColor:"#0000FF",strokeOpacity: 1, strokeWeight: 3, fillColor: 'transparent' }
handler.addCircles(circle, circle_options);