Skip to content

Options for FillPattern object #20

@asecondwill

Description

@asecondwill

Is it possible to pass options into a

var circle = new L.Circle({LatLng}, {radius}, { fillPattern: stripes({spaceColor: '#FFFF00'}), fillOpacity: 1.0}); circle.addTo(_map);

I'd like to do this so I can declare the pattern once, but pass through a background color for different map features in geojson, something like this:

var features = new L.GeoJSON.AJAX("/my_features",{
    onEachFeature: onEachFeature,

    style: function (feature) {
			style = feature.properties && feature.properties.style ;
			if (feature.properties.pattern == 'stripes'){				
				style.fillPattern = stripes({spaceColor: feature.properties.style['fillColor']});
			}
      return style;
    },

		pointToLayer: pointToLayer
}).addTo(map);

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions