Closed chriszrc closed 1 year ago
I see the problem. I've been playing a bit with accepting string and RegExp directly in layers
array, but not if it's an object. Would that be an acceptable solution?
What updates do override layer config? Source updates?
@markusand Sure, I can use the array format instead if that's where regex was supported. I dug into the source a bit, when the layers that are actively added to the map change, then the layer config gets overridden-
Let's see if this is enough. Otherwise reopen the issue.
If I have layers in my map like "layer","layer1","layer2", and pass in config options like this:
Layers "layer1" and "layer2" will also be added because of the broad regex matching here:
https://github.com/markusand/mapboxgl-legend/blob/c770843e3d971c3aeab76bbdb8287003752a87b6/src/LegendControl.ts#L104
Also, passing in a regex like
[^layer$]:"fill-color"
will work at first, but then the layer config appears to get overridden in subsequent updates, so that's not working either.