gpt4 book ai didi

google-maps-api-3 - Google Maps Api v3,自定义“群集”图标

转载 作者:行者123 更新时间:2023-12-03 08:34:20 24 4
gpt4 key购买 nike

如何更改群集图标?我想有一个相同的图标,除了蓝色以外还有其他颜色。

最佳答案

初始化MarkerClusterer对象时,需要使用styles参数-下面的代码显示默认样式,因此,如果要重新着色图标之一,只需将相关的url更改为图像即可。

//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: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m2.png",
width: 56
},
{
height: 66,
url: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m3.png",
width: 66
},
{
height: 78,
url: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m4.png",
width: 78
},
{
height: 90,
url: "https://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images/m5.png",
width: 90
}]}

//init clusterer with your options
var mc = new MarkerClusterer(map, markers, mcOptions);

关于google-maps-api-3 - Google Maps Api v3,自定义“群集”图标,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4416089/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com