From 50ee5150c1a1d95cb7ab5a8393439d332f18e412 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 13 Dec 2024 11:58:53 +0100 Subject: [PATCH] fix: #1174 --- index.html | 4 +-- modules/dynamic/editors/states-editor.js | 36 ++++++------------------ modules/ui/editors.js | 2 +- modules/ui/provinces-editor.js | 9 +++--- versioning.js | 2 +- 5 files changed, 18 insertions(+), 35 deletions(-) diff --git a/index.html b/index.html index 8a268152..02dc06f9 100644 --- a/index.html +++ b/index.html @@ -8097,11 +8097,11 @@ - + - + diff --git a/modules/dynamic/editors/states-editor.js b/modules/dynamic/editors/states-editor.js index 9c4a0299..81836f31 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,38 +1249,21 @@ function addState() { culture, military: [], alert: 1, - coa, - pole + coa }); + + BurgsAndStates.getPoles(); BurgsAndStates.collectStatistics(); BurgsAndStates.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 a7df5ca3..752593dd 100644 --- a/modules/ui/editors.js +++ b/modules/ui/editors.js @@ -1249,7 +1249,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 9bd046a3..c41acf6a 100644 --- a/modules/ui/provinces-editor.js +++ b/modules/ui/provinces-editor.js @@ -367,10 +367,7 @@ function editProvinces() { function updateStatesPostRelease(oldStates, newStates) { const allStates = unique([...oldStates, ...newStates]); - layerIsOn("toggleProvinces") && toggleProvinces(); - layerIsOn("toggleStates") ? drawStates() : toggleStates(); - layerIsOn("toggleBorders") ? drawBorders() : toggleBorders(); - + BurgsAndStates.getPoles(); BurgsAndStates.collectStatistics(); BurgsAndStates.defineStateForms(newStates); drawStateLabels(allStates); @@ -382,6 +379,10 @@ function editProvinces() { COArenderer.add("state", stateId, coa, ...pole); }); + layerIsOn("toggleProvinces") && toggleProvinces(); + layerIsOn("toggleStates") ? drawStates() : toggleStates(); + layerIsOn("toggleBorders") ? drawBorders() : toggleBorders(); + unfog(); closeDialogs(); editStates(); diff --git a/versioning.js b/versioning.js index f6d2d6e6..cc02cdbf 100644 --- a/versioning.js +++ b/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.106.0"; +const VERSION = "1.106.1"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); {