fix: zones editor - legend to be toggable

This commit is contained in:
Azgaar 2024-10-19 14:02:04 +02:00 committed by sofronaspe
parent ed92b5e23c
commit bf1a40776d
3 changed files with 4 additions and 2 deletions

View file

@ -341,6 +341,8 @@ function editZones() {
}
function toggleLegend() {
if (legend.selectAll("*").size()) return clearLegend(); // hide legend
const filterBy = byId("zonesFilterType").value;
const isFiltered = filterBy && filterBy !== "all";
const visibleZones = pack.zones.filter(zone => !zone.hidden && (!isFiltered || zone.type === filterBy));