disallow adding custom labels to state group

This commit is contained in:
Azgaar 2021-11-30 21:47:22 +03:00
parent 6d5c109d78
commit 19a8db4a17
2 changed files with 30 additions and 5 deletions

View file

@ -470,9 +470,10 @@ function addLabelOnClick() {
const id = getNextId("label");
// use most recently selected label group
let selected = labelGroupSelect.value;
const symbol = selected ? "#" + selected : "#addedLabels";
let group = labels.select(symbol);
const lastSelected = labelGroupSelect.value;
const groupId = ["", "states", "burgLabels"].includes(lastSelected) ? "#addedLabels" : "#" + lastSelected;
let group = labels.select(groupId);
if (!group.size())
group = labels
.append("g")