Google Maps上的“闭合箭头”和“打开箭头”看起来相同,javascript API

时间:2020-08-07 10:44:09

标签: api arrows

我正在尝试在Google地图上添加所谓的“圆圈”,“闭合箭头”和“打开箭头”,而不是折线(我使用的是javascript google maps API)。

圆圈工作正常,但是很遗憾,箭头看起来与google API中的示例不同,而在我的应用中,箭头看起来相同。

我不知道为什么...

这是我的代码

var lineSymbolArrow = {
    path: google.maps.SymbolPath.FORWARD_OPEN_ARROW,
    fillOpacity: 1,
    scale: 2
};

if (index > 4 && index <= 6) return {
  stops: tour.stops.map((stop) => stop.location),
  stopMarkers: stopMarkers,
  finalisationMarkers: finalisationMarkers,
  color: colors[index],
  name: `Tour #${index + 1}`,
  isRendered: false,
  isShown: false,
  renderer: new google.maps.DirectionsRenderer({
    polylineOptions: {
      strokeColor: colors[index],
      strokeOpacity: 0,
      fillOpacity: 0,
      icons: [{
          icon: lineSymbolArrow,
          offset: '0',
          repeat: '20px'
      }],
    },
    preserveViewport: true,
    suppressInfoWindows: true,
    suppressMarkers: true,
  }),
};

var lineSymbolClosedArrow = {
    path: google.maps.SymbolPath.FORWARD_CLOSED_ARROW,
    fillOpacity: 1,
    scale: 2
};

if (index > 6 && index <= 40) return {
  stops: tour.stops.map((stop) => stop.location),
  stopMarkers: stopMarkers,
  finalisationMarkers: finalisationMarkers,
  color: colors[index],
  name: `Tour #${index + 1}`,
  isRendered: false,
  isShown: false,
  renderer: new google.maps.DirectionsRenderer({
    polylineOptions: {
      strokeColor: colors[index],
      strokeOpacity: 0,
      fillOpacity: 0,
      icons: [{
          icon: lineSymbolClosedArrow,
          offset: '0',
          repeat: '20px'
      }],
    },
    preserveViewport: true,
    suppressInfoWindows: true,
    suppressMarkers: true,
  }),
};

How the arrows look like How arrows should look like

0 个答案:

没有答案
相关问题