mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 17:51:24 +01:00
refactor: replace fmg.modules with local vars
This commit is contained in:
parent
80bf0ef688
commit
a97e7f44f6
31 changed files with 141 additions and 95 deletions
|
|
@ -30,7 +30,7 @@ function clicked() {
|
|||
const p = d3.mouse(this);
|
||||
const i = findCell(p[0], p[1]);
|
||||
|
||||
if (grand.id === "emblems") editEmblem();
|
||||
if (grand.id === "emblems") openDialog("emblemEditor", null, defineEmblemData(+el.dataset.i, parent));
|
||||
else if (parent.id === "rivers") editRiver(el.id);
|
||||
else if (grand.id === "routes") editRoute();
|
||||
else if (el.tagName === "tspan" && grand.parentNode.parentNode.id === "labels") editLabel();
|
||||
|
|
@ -45,6 +45,16 @@ function clicked() {
|
|||
} else if (grand.id === "lakes") editLake();
|
||||
}
|
||||
|
||||
function defineEmblemData(i, parent) {
|
||||
const [g, type] =
|
||||
parent.id === "burgEmblems"
|
||||
? [pack.burgs, "burg"]
|
||||
: parent.id === "provinceEmblems"
|
||||
? [pack.provinces, "province"]
|
||||
: [pack.states, "state"];
|
||||
return {type, id: type + "COA" + i, el: g[i]};
|
||||
}
|
||||
|
||||
const onMouseMove = debounce(handleMouseMove, 100);
|
||||
function handleMouseMove() {
|
||||
const point = d3.mouse(this);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue