在jquery移动web应用程序中使用带有markerclusterer的google maps v3,工作正常。如果有26个或更多的标记,我希望默认的缩放操作,我有一个listview,我想填充群集中所有标记点击时的细节,只要该群集包含25个或更少的标记。markerclusterer点击群集以获取子标记
我在哪里,我需要把我的代码,在这里markerclusterer.js确定的onclick事件......
/**
* Triggers the clusterclick event and zoom's if the option is set.
*
* @param {google.maps.MouseEvent} event The event to propagate
*/
ClusterIcon.prototype.triggerClusterClick = function(event) {
var markerClusterer = this.cluster_.getMarkerClusterer();
// Trigger the clusterclick event.
google.maps.event.trigger(markerClusterer, 'clusterclick', this.cluster_, event);
if (markerClusterer.isZoomOnClick()) {
// Zoom into the cluster.
this.map_.fitBounds(this.cluster_.getBounds());
}
//my code will go here...
//get number of markers in clicked cluster
//if > 25 then zoom as normal
//else get cluster's child markers and loop through to add to listview
};
...但有只访问标记的数组的一个简单的方法包含在点击的群集内,假设有25个或更少的标记,并且如果不是正常放大。
我可以照顾Listview更新好,但不知道如何隔离任何给定群集的标记......任何人都可以帮忙吗?哦,我已经在markerclusterer.js中将zoomOnCLick设置为False,但是也许我应该将其保持为true,并使用少于26个标记的集群来更新我的列表视图。
在此先感谢。
有没有npm包? – TomP