feat: burg group editor - apply changes

This commit is contained in:
Azgaar 2024-10-09 00:33:22 +02:00
parent b6708bf698
commit b700bf0630
8 changed files with 102 additions and 29 deletions

View file

@ -211,6 +211,7 @@ function editBurgGroups() {
el.previousElementSibling.value = JSON.stringify(values);
el.innerHTML = Object.keys(values).length ? "some" : "any";
$(this).dialog("close");
},
Cancel: function () {
@ -305,6 +306,14 @@ function editBurgGroups() {
return group;
});
// put burgs to new groups
const validBurgs = pack.burgs.filter(b => b.i && !b.removed);
const populations = validBurgs.map(b => b.population).sort((a, b) => a - b);
validBurgs.forEach(burg => Burgs.defineGroup(burg, populations));
if (layerIsOn("toggleBurgIcons")) drawBurgIcons();
if (layerIsOn("toggleLabels")) drawBurgLabels();
$("#burgGroupsEditor").dialog("close");
}
}