umap-project / umap

uMap lets you create maps with OpenStreetMap layers in a minute and embed them in your site.
https://umap-project.org
Other
1.19k stars 226 forks source link

fix: do not try to create legend for non loaded classified layer #2234

Closed yohanboniface closed 3 weeks ago

yohanboniface commented 3 weeks ago

fix #2232

A classified layer needs to have compiled the data to known its classes/categories.

This commit review the way we build the legend: instead of creating with the whole caption panel, we just set a container and we populate it later. This opens the door for live changing the legend when editing the layer.

But we have to clarify that "reactive" pattern at some point, as we have some concurrent pattern laying around: the render(), which coupled with the schema and this is nice, but for now it's a bit rough (changing the whole UI each time); the propagate way, which is more specific, but not coupled to the schema; the dataChanged; and the onDataLoaded now, which is a bit different, as it's about the data being loaded, not changed/modified, but for the DOM it may at the end be the same. Well, food for thoughts…