Javascript 如何在MarkerClusterGroup中设置每个群集的选项
我使用以下方法创建自己的MarkerClusterGroup:Javascript 如何在MarkerClusterGroup中设置每个群集的选项,javascript,leaflet,leaflet.markercluster,Javascript,Leaflet,Leaflet.markercluster,我使用以下方法创建自己的MarkerClusterGroup: this.cluster = leaflet.markerClusterGroup({ zoomToBoundsOnClick: false, showCoverageOnHover: false, spiderfyDistanceMultiplier: 3, spiderLegPolylineOptions: { weight: 1.5, color: "#1BA5D
this.cluster = leaflet.markerClusterGroup({
zoomToBoundsOnClick: false,
showCoverageOnHover: false,
spiderfyDistanceMultiplier: 3,
spiderLegPolylineOptions: {
weight: 1.5,
color: "#1BA5D0",
lineCap: "butt",
dashArray: "10 10",
opacity: 0.5
}
});
如何为该组中的每个簇应用一些选项(只要它实际上是传单.Marker)?特别是,我想设置riseonhaver:true
我发现用自定义窗格控制整个MarkerClusterGroup定位是有困难的,但这不是我的情况最后,我找到了答案。可在
iconCreateFunction
内设置选项:
this.cluster = leaflet.markerClusterGroup({
iconCreateFunction: cluster => {
cluster.options.riseOnHover = true;
}
});