我正在使用 MarkerCluster.js 在我的 google 地图 api 中创建集群。这些簇按照我想要的方式工作,但我想要的样式与黄色、蓝色和红色圆圈不同。我试图使用 MarkerStyleOptions,它说您有一系列样式,其中最小的簇图标在前,最大的簇图标在后。我尝试在下面创建这个,但我对使用什么语法感到非常困惑,并且找不到任何好的示例。
var clusterStyles = [
[opt_textColor: 'white'],
[opt_textColor: 'white'],
[opt_textColor: 'white']
];
var mcOptions = {
gridSize: 50,
styles: clusterStyles,
maxZoom: 15
};
var markerclusterer = new MarkerClusterer(map, cluster, mcOptions);
您需要做的是使用 url 来指定要使用的图像,而不是当前正在使用的蓝色/黄色/红色图像。也包括高度和宽度选项可能是个好主意。
var clusterStyles = [
{
textColor: 'white',
url: 'path/to/smallclusterimage.png',
height: 50,
width: 50
},
{
textColor: 'white',
url: 'path/to/mediumclusterimage.png',
height: 50,
width: 50
},
{
textColor: 'white',
url: 'path/to/largeclusterimage.png',
height: 50,
width: 50
}
];
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)