diff --git a/index.html b/index.html index 44d15c25..ecc43d23 100644 --- a/index.html +++ b/index.html @@ -8132,11 +8132,11 @@ - + - + diff --git a/modules/dynamic/editors/states-editor.js b/modules/dynamic/editors/states-editor.js index 91845a68..37a489c9 100644 --- a/modules/dynamic/editors/states-editor.js +++ b/modules/dynamic/editors/states-editor.js @@ -1200,7 +1200,6 @@ function addState() { const basename = center % 5 === 0 ? burgs[burg].name : Names.getCulture(culture); const name = Names.getState(basename, culture); const color = getRandomColor(); - const pole = cells.p[center]; // generate emblem const cultureType = pack.cultures[culture].type; @@ -1250,40 +1249,22 @@ function addState() { culture, military: [], alert: 1, - coa, - pole + coa }); + States.getPoles(); States.findNeighbors(); States.collectStatistics(); States.defineStateForms([newState]); adjustProvinces([cells.province[center]]); - if (layerIsOn("toggleProvinces")) toggleProvinces(); - if (!layerIsOn("toggleStates")) toggleStates(); - else drawStates(); - if (!layerIsOn("toggleBorders")) toggleBorders(); - else drawBorders(); - - // add label - defs - .select("#textPaths") - .append("path") - .attr("d", `M${pole[0] - 50},${pole[1] + 6}h${100}`) - .attr("id", "textPath_stateLabel" + newState); - labels - .select("#states") - .append("text") - .attr("id", "stateLabel" + newState) - .append("textPath") - .attr("xlink:href", "#textPath_stateLabel" + newState) - .attr("startOffset", "50%") - .attr("font-size", "50%") - .append("tspan") - .attr("x", name.length * -3) - .text(name); - + drawStateLabels([newState]); COArenderer.add("state", newState, coa, states[newState].pole[0], states[newState].pole[1]); + + layerIsOn("toggleProvinces") && toggleProvinces(); + layerIsOn("toggleStates") ? drawStates() : toggleStates(); + layerIsOn("toggleBorders") ? drawBorders() : toggleBorders(); + statesEditorAddLines(); } diff --git a/modules/ui/editors.js b/modules/ui/editors.js index 0526c858..a58c8e73 100644 --- a/modules/ui/editors.js +++ b/modules/ui/editors.js @@ -1060,7 +1060,7 @@ function refreshAllEditors() { // dynamically loaded editors async function editStates() { if (customization) return; - const Editor = await import("../dynamic/editors/states-editor.js?v=1.104.0"); + const Editor = await import("../dynamic/editors/states-editor.js?v=1.106.1"); Editor.open(); } diff --git a/modules/ui/provinces-editor.js b/modules/ui/provinces-editor.js index 76e103cd..480958a3 100644 --- a/modules/ui/provinces-editor.js +++ b/modules/ui/provinces-editor.js @@ -371,6 +371,7 @@ function editProvinces() { layerIsOn("toggleStates") ? drawStates() : toggleStates(); layerIsOn("toggleBorders") ? drawBorders() : toggleBorders(); + States.getPoles(); States.findNeighbors(); States.collectStatistics(); States.defineStateForms(newStates); @@ -383,6 +384,10 @@ function editProvinces() { COArenderer.add("state", stateId, coa, ...pole); }); + layerIsOn("toggleProvinces") && toggleProvinces(); + layerIsOn("toggleStates") ? drawStates() : toggleStates(); + layerIsOn("toggleBorders") ? drawBorders() : toggleBorders(); + unfog(); closeDialogs(); editStates();