Вопрос

This is the code to drawing a line on the map in Google maps v3:

var line = new google.maps.Polyline({
path: lineCoordinates,
strokeOpacity: 0,
icons: [{
  icon: lineSymbol,
  offset: '0',
  repeat: '20px'
}],
map: map

});

The repeat property can help us to draw dashed line. But I want to change this property dynamically. Something like this: setRepeat('20px');

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

Решение

you must re-assign the icons-property of the line, e.g.:

  line.set('icons',[{icon:line.icons[0].icon,
                     offset:line.icons[0].offset,
                     repeat:'50px'}]);
Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top