質問

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