クラスタアイコンを変更するにはどうすればよいですか?私は同じアイコンを青以外の色で使いたいと思っています。
57128 次
4 に答える
66
MarkerClustererオブジェクトを初期化するときにstylesパラメーターを使用する必要があります-以下のコードはデフォルトのスタイルを示しているため、アイコンの1つを色変更する場合は、関連する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);
于 2010-12-12T20:29:48.023 に答える
10
Googleは彼のリポジトリを変更しました。最新のクラスターリポジトリは次のとおりです:https ://github.com/googlemaps/js-marker-clusterer images:https ://github.com/googlemaps/js-marker-clusterer/tree/gh-pages/images
ソースをダウンロードして、ローカルパスからリンクを提供することも検討してください。このようにして、アプリケーションが必要とするリソースをより細かく制御できるようになります。
local_path "/pucblic/"
mcOptions = {styles: [{
height: 53,
url: local_path+"m1.png",
width: 53
},
{
height: 56,
url: local_path+"m2.png",
width: 56
},
{
height: 66,
url: local_path+"m3.png",
width: 66
},
{
height: 78,
url: local_path+"m4.png",
width: 78
},
{
height: 90,
url: local_path+"m5.png",
width: 90
}]}
于 2016-05-12T12:07:21.580 に答える
2
ショートカットは、次のように画像パスを上書きします。
MarkerClusterer.prototype.MARKER_CLUSTER_IMAGE_PATH_ =
"https://raw.githubusercontent.com/googlemaps/v3-utility-library/master/markerclustererplus/images/m";
于 2016-05-28T12:47:39.527 に答える
2
こちらがオリジナル写真です
markerClusterOptions = {styles: [{
height: 53,
url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m1.png",
width: 53
},
{
height: 56,
url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m2.png",
width: 56
},
{
height: 66,
url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m3.png",
width: 66
},
{
height: 78,
url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m4.png",
width: 78
},
{
height: 90,
url: "https://developers.google.com/maps/documentation/javascript/examples/markerclusterer/m5.png,
width: 90
}]}
markerCluster = new MarkerClusterer(map, markers,markerClusterOptions);
于 2018-01-06T11:29:56.640 に答える