Update script.js

196 fix
This commit is contained in:
Azgaar 2019-02-23 13:02:44 +03:00 committed by GitHub
parent 97eea31488
commit d1124c600b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2455,8 +2455,10 @@ function fantasyMap() {
} }
let group = this.value.toLowerCase().replace(/ /g, "_").replace(/[^\w\s]/gi, ""); let group = this.value.toLowerCase().replace(/ /g, "_").replace(/[^\w\s]/gi, "");
if (Number.isFinite(+group.charAt(0))) group = "g" + group; if (Number.isFinite(+group.charAt(0))) group = "g" + group;
// if el with this id exists, add size to id if (d3.selectAll("#"+group).size()) {
while (labels.selectAll("#"+group).size()) {group += "_new";} tip("Element with this id already exists. Please provide a unique name");
return;
}
createNewLabelGroup(group); createNewLabelGroup(group);
}); });