getClusters () 函数不起作用

getClusters () function is not working

根据文档 - 获取 markerCluster 的所有集群的正确方法是调用 getClusters() 函数。

我创建了 markerCluster:

   markerCluster = new MarkerClusterer($scope.map, $scope.markers, mcOptions);

然后,当标记被聚类时,我正在获取聚类总数(每个视口)并且不想获取聚类然后访问每个聚类的标记。 (更改地图时计算集群数)

 $scope.map.addListener('idle', countClusters);

        function countClusters() {
            console.log('get clusters number', markerCluster.getTotalClusters());
            console.log('clusters', markerCluster.getClusters());
        }

结果是'get clusters number' - 2;但是对于 getClusters() - 出现错误 - markerCluster.getClusters 不是函数。

找不到原因:(

问题与 markercluster.js 版本有关,已通过更改为

解决
<script src="https://google-maps-utility-library-v3.googlecode.com/svn/tags/markerclustererplus/2.1.2/src/markerclusterer.js"></script>