chore: modularize main.js

This commit is contained in:
Azgaar 2022-07-03 15:45:51 +03:00
parent 51df2f90b0
commit e739698346
24 changed files with 1775 additions and 1706 deletions

View file

@ -94,3 +94,18 @@ export function invokeActiveZooming() {
ruler.selectAll("text").attr("font-size", size);
}
}
async function renderGroupCOAs(g) {
const [group, type] =
g.id === "burgEmblems"
? [pack.burgs, "burg"]
: g.id === "provinceEmblems"
? [pack.provinces, "province"]
: [pack.states, "state"];
for (let use of g.children) {
const i = +use.dataset.i;
const id = type + "COA" + i;
COArenderer.trigger(id, group[i].coa);
use.setAttribute("href", "#" + id);
}
}