Google Maps Cluster v3 - 无法标注样式标签文字

时间:2018-03-14 14:16:21

标签: javascript google-maps google-maps-api-3 markerclusterer

我收到了以下代码:

var options = {
  styles: [
      {

          url: 'assets/images/marker/m1.png',
          height: 37,
          width: 25,
          anchorText:[0,-150],
      },
      {

          url: 'assets/images/marker/m2.png',
          height: 37,
          width: 25,
          anchorText:[0,-150],
      },
      {

          url: 'assets/images/marker/m3.png',
          height: 37,
          width: 25,
          anchorText:[0,-150],
      },
      {

          url: 'assets/images/marker/m4.png',
          height: 37,
          width: 25,
          anchorText:[0,-150],
      },
      {

          url: 'assets/images/marker/m5.png',
          height: 37,
          width: 25,
          anchorText:[0,-150],
      }
  ],
  maxZoom: 10
};

我读到anchorText可以在x或y方向(以像素为单位)移动集群内的数字但不知何故它没有。

看起来像这样:
enter image description here

API的内容再次发生了变化吗?

1 个答案:

答案 0 :(得分:1)

如果您使用的是this MarkerClusterer library,则设置标签文字的锚点位置的样式属性的名称为anchor,而不是anchorText

请查看this source code comment有关支持的选项。

  

' anchor' :(数组)标签文本的锚位置。