diff --git a/index.html b/index.html
index 0958b5f3..5fc64660 100644
--- a/index.html
+++ b/index.html
@@ -3,19 +3,12 @@
-
-
Azgaar's Fantasy Map Generator
-
+
diff --git a/modules/burgs-and-states.js b/modules/burgs-and-states.js
index 521f3ba4..ec807a70 100644
--- a/modules/burgs-and-states.js
+++ b/modules/burgs-and-states.js
@@ -433,10 +433,10 @@
void function drawLabels() {
const g = labels.select("#states"), p = defs.select("#textPaths");
g.selectAll("text").remove();
- p.selectAll("path").remove();
+ p.selectAll("path[id*='stateLabel']").remove();
const data = paths.map(p => [round(lineGen(p[1])), "stateLabel"+p[0], states[p[0]].name, p[1]]);
- p.selectAll("path").data(data).enter().append("path").attr("d", d => d[0]).attr("id", d => "textPath_"+d[1]);
+ p.selectAll(".path").data(data).enter().append("path").attr("d", d => d[0]).attr("id", d => "textPath_"+d[1]);
g.selectAll("text").data(data).enter()
.append("text").attr("id", d => d[1])
diff --git a/modules/ui/editors.js b/modules/ui/editors.js
index 141f58e2..99d85bd4 100644
--- a/modules/ui/editors.js
+++ b/modules/ui/editors.js
@@ -143,6 +143,7 @@ function addBurg(point) {
const population = Math.max((cells.s[cell] + cells.road[cell]) / 3 + i / 1000 + cell % 100 / 1000, .1);
pack.burgs.push({name, cell, x, y, state, i, culture, feature, capital: false, port: 0, population});
+ cells.burg[cell] = i;
const townSize = burgIcons.select("#towns").attr("size") || 0.5;
burgIcons.select("#towns").append("circle").attr("id", "burg"+i).attr("data-id", i)
diff --git a/modules/ui/states-editor.js b/modules/ui/states-editor.js
index 2b349b0a..25e0c86e 100644
--- a/modules/ui/states-editor.js
+++ b/modules/ui/states-editor.js
@@ -467,8 +467,18 @@ function editStates() {
const basename = center%5 === 0 ? pack.burgs[burg].name : Names.getCulture(culture);
const name = Names.getState(basename, culture);
const color = d3.color(d3.scaleSequential(d3.interpolateRainbow)(Math.random())).hex();
+
+ pack.cells.state[center] = pack.states.length;
+ pack.cells.c[center].forEach(c => {
+ if (pack.cells.h[c] < 20) return;
+ if (pack.cells.burg[c]) return;
+ pack.cells.state[c] = pack.states.length;
+ });
pack.states.push({i:pack.states.length, name, color, expansionism:.5, capital:burg, type:"Generic", center, culture});
- recalculateStates();
+
+ if (!layerIsOn("toggleStates")) toggleStates(); else drawStatesWithBorders();
+ if (adjustLabels.checked) BurgsAndStates.drawStateLabels();
+ refreshStatesEditor();
}
function exitAddStateMode() {