[英]Google Maps API - Marker Cluster Styles Prevent Image From Showing?
我有一個問題想要更改標記群集上的字體大小和顏色,但是添加樣式會阻止圖像顯示? 如果我注釋掉樣式部分,則圖像顯示正確。
const cluster = new MarkerClusterer(this.map, this.map_markers, {
imagePath: site_settings.template_directory + '/assets/images/marker-clusterer/m',
styles:[{
textSize: 12,
textColor: 'white'
}],
maxZoom: this.map_max_zoom - 1,
zoomOnClick: true
})
如何將樣式添加到標記中,但保留正在使用的圖像?
根據上述克里斯蒂安·科瓦切夫(Kristiyan D Kovachev)的建議,已解決。
new MarkerClusterer(this.map, this.map_markers, {
styles:[{
url: site_settings.template_directory + '/assets/images/marker-clusterer/m1.png',
textSize: 12,
width: 42,
height: 42,
textColor: 'white'
}],
maxZoom: this.map_max_zoom - 1,
zoomOnClick: true
})
根據MarkerCluster庫GitHub ,樣式對象需要一個覆蓋imagePath的URL 。
解:
new MarkerClusterer(this.map, this.map_markers, {
styles:[{
url: site_settings.template_directory + '/assets/images/marker-clusterer/m1.png',
textSize: 12,
width: 42,
height: 42,
textColor: 'white'
}],
maxZoom: this.map_max_zoom - 1,
zoomOnClick: true
})
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.