在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