Google Maps Api v3,自定义集群图标 [英] Google Maps Api v3, custom Cluster icon
本文介绍了Google Maps Api v3,自定义集群图标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我如何更改群集图标?我wolud喜欢有相同的图标,其他颜色不是蓝色。
how can i change cluster icon? i wolud like to have same icon, with some other color than blue.
推荐答案
初始化MarkerClusterer对象时,需要使用styles参数 - 下面的代码显示了默认样式,所以如果您想重新选择其中一个图标,只需将相关url更改为图片即可。
You need to use styles parameter when initializing MarkerClusterer object - the code below shows default styles so if you want to recolour one of the icons just change the relevant url to your image...
//set style options for marker clusters (these are the default styles)
mcOptions = {styles: [{
height: 53,
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m1.png",
width: 53
},
{
height: 56,
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m2.png",
width: 56
},
{
height: 66,
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m3.png",
width: 66
},
{
height: 78,
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m4.png",
width: 78
},
{
height: 90,
url: "http://google-maps-utility-library-v3.googlecode.com/svn/trunk/markerclusterer/images/m5.png",
width: 90
}]}
//init clusterer with your options
var mc = new MarkerClusterer(map, markers, mcOptions);
这篇关于Google Maps Api v3,自定义集群图标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文