Leaflet MarkerCluster Spiderfy动态线条颜色

时间:2015-08-24 16:07:12

标签: leaflet

我正在使用LeafLet MarkerCluster插件(https://github.com/Leaflet/Leaflet.markercluster

有谁知道是否可以动态为MarkerCluster Spiderfy线颜色着色?

例如,我可以动态设置其他内容:

            markersFeatureLayer.eachLayer(function(layer) {
                layer.feature.properties.line = 'green';
                    layer.setIcon(L.MyMarkers.icon({
                        icon: layer.feature.properties.myData.icon,
                        markerColor: layer.feature.properties['icon-color'],
                        iconColor: '#FFFFFF'
                      }));
              mapClusterLayer.addLayer(layer);
            });

或者这个

     mapClusterLayer = new L.MarkerClusterGroup({
        maxClusterRadius: 2,   
        spiderfyDistanceMultiplier: 3,
        removeOutsideVisibleBounds: false,
            iconCreateFunction: function(cluster) {
              return new L.DivIcon({
                iconSize: [30, 30],
                html: '<div style="text-align:center;color:#fff;background:' +
                'green' + '">' + cluster.getChildCount() + '</div>',
              });
            }        
          });

我希望每个蜘蛛线都等于markerColor。所以每个人都会有独特的颜色。

有什么想法吗?

0 个答案:

没有答案