OK. I found the Cluster.Popup function but I am not sure how to feed
the extents of the associated markers into the function. I was
thinking of using a function from ClusterMarker project but not sure
what vars need changing.
ClusterMarker.prototype.fitMapToMarkers=function(){
var $mapMarkers=this._mapMarkers, $markersBounds=new GLatLngBounds(),
i;
for(i=$mapMarkers.length-1; i>=0; i--){
$markersBounds.extend($mapMarkers[i].getLatLng());
}
var $fitMapToMarkersZoom=this._map.getBoundsZoomLevel
($markersBounds);
if(this.fitMapMaxZoom && $fitMapToMarkersZoom>this.fitMapMaxZoom){
$fitMapToMarkersZoom=this.fitMapMaxZoom;
}
this._map.setCenter($markersBounds.getCenter(),
$fitMapToMarkersZoom);
this.refresh();
};
And adapting for Clusterer.
Clusterer.PopUp = function ( cluster )
{
var clusterer = cluster.clusterer;
var html = '<table width="300">';
var n = 0;
for ( var i = 0; i < cluster.markers.length; ++i )
{
var marker = cluster.markers[i];
if ( marker != null )
{
++n;
html += '<tr><td>';
if (typeof marker.getIcon!="undefined" && marker.getIcon
().smallImage != null ){
html += '<img src="' + marker.getIcon().smallImage + '">'; }
else {
html += '<img src="' + marker.getIcon().image + '" width="' +
( marker.getIcon().iconSize.width / 2 ) + '" height="' +
( marker.getIcon().iconSize.height / 2 ) + '">'; }
html += '</td><td>' + marker.title + '</td></tr>';
if ( n == clusterer.maxLinesPerInfoBox - 1 && cluster.markerCount
> clusterer.maxLinesPerInfoBox )
{
html += '<tr><td colspan="2">...and ' + ( cluster.markerCount -
n )
+ ' more</td></tr>';
break;
}
}
}
html += '</table>';
clusterer.map.closeInfoWindow();
cluster.marker.openInfoWindowHtml( html );
clusterer.poppedUpCluster = cluster;
};
On Jun 14, 10:46 pm, "Jon \"Didjtal\" Detka" <[email protected]> wrote:
> Thanks for letting me know if I was on the right track.
> I will try my best but I am really out of my league at this point.
> I don't have a clue where to start with the "And %count More".
>
> jd
>
> > > I was actually thinking that it would be neat (and maybe easier) to
> > > make the "And ## More" a link that zooms to the markers.
>
> > Yes that does sound like it would be cool...
> > and even a good default... the code would track
> > an extents maybe associated with all the markers
> > when it clusters them.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Google Maps API" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/Google-Maps-API?hl=en
-~----------~----~----~----~------~----~------~--~---