Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

markerclusterer: anchor offset for cluster icons

I'm trying to slightly offset cluster icons created by the Google Maps Markerclusterer (V3). Short of modifying the existing code, I can't find a way to do this. Does anybody have an idea?

The Styles object in which you can provide a custom image URL accepts an anchor property, but this is to offset the generated marker item count.

Thanks!

like image 776
Dick Avatar asked Feb 01 '11 18:02

Dick


1 Answers

The proper way to do it is to adjust the anchorIcon property like this:

var clusterStyles = [
{
    height: 64,
    width: 53,
    anchorIcon: [20, 140]
},
{
    height: 64,
    width: 53,
    anchorIcon: [20, 140]
},
{
    height: 64,
    width: 53,
    anchorIcon: [20, 140]
}
];

var mcOptions = {
    styles: clusterStyles
};

var markerCluster = new MarkerClusterer(map, markers, mcOptions);
like image 95
NXT Avatar answered Nov 18 '22 01:11

NXT