Вопрос

I am trying to adjust the line color, fill color and opacity within my map circle.

    <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> 

Changing the radius value works properly, however adjusting strokeColor, strokeOpacity, strokeWeight, etc has no impact on the map.

How do I override these settings?

Это было полезно?

Решение

As the source says, you can pass your options as a second argument:

circle = [{lng: <%= @listing.longitude %>, lat: <%= @listing.latitude %>, radius: 2500 }]
circle_options = { strokeColor:"#0000FF",strokeOpacity: 1, strokeWeight: 3, fillColor: 'transparent' }
handler.addCircles(circle, circle_options);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top