문제

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