Skip to content

resetStyle doesn't reset styles changed away from a default #1112

@calvinmetcalf

Description

@calvinmetcalf

If you run setStyle on a layer to change a style away from one you didn't set, so it was just the default, like

var myLayer = L.geoJson('',{style:function(){return {dashArray:"5, 10"}}}).addTo(map);
var myLines = [{
    "type": "LineString",
    "coordinates": [[-100, 40], [-105, 45], [-110, 55]]
}, {
    "type": "LineString",
    "coordinates": [[-105, 40], [-110, 45], [-115, 55]]
}];
myLayer.addData(myLines);
myLayer.setStyle({color:"red",dashArray:null});

then running reset style on it

myLayer.eachLayer(function(l){myLayer.resetStyle(l);});

only changes back the styles to ones that you set not ones that were changed away form the default, i.e. dashArray is changed back but not color

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions