У меня проблема с тем, что я пытаюсь изменить размер и цвет шрифта на кластерах маркеров, но добавление стилей препятствует отображению изображения? Если я закомментирую раздел стилей, изображение будет отображаться правильно.
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
})
Как я могу добавить стили к маркеру, но сохранить изображение, которое используется?
Решено в соответствии с предложением Кристиана Д. Ковачева выше.
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 объекту стиля требуется URL , который перезаписывает imagePath .
Решение:
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
})