From ec5e44b94a86a6a713416642d97805253d2743fc Mon Sep 17 00:00:00 2001 From: Azgaar Date: Mon, 4 Mar 2024 19:04:27 +0100 Subject: [PATCH] fix: #1051 --- index.html | 2 +- modules/ui/tools.js | 17 ++++++++++------- versioning.js | 2 +- 3 files changed, 12 insertions(+), 9 deletions(-) diff --git a/index.html b/index.html index c71a7708..5465e6c4 100644 --- a/index.html +++ b/index.html @@ -8064,7 +8064,7 @@ - + diff --git a/modules/ui/tools.js b/modules/ui/tools.js index 5d9d0d40..4d62305c 100644 --- a/modules/ui/tools.js +++ b/modules/ui/tools.js @@ -247,13 +247,16 @@ function recreateStates() { capitalsTree.add([x, y]); // update label id reference - labels - .select("#states") - .select(`#stateLabel${state.i}`) - .attr("id", `stateLabel${newId}`) - .select("textPath") - .attr("xlink:href", `#textPath_stateLabel${newId}`); - defs.select("#textPaths").select(`#textPath_stateLabel${state.i}`).attr("id", `textPath_stateLabel${newId}`); + byId(`textPath_stateLabel${state.i}`)?.setAttribute("id", `textPath_stateLabel${newId}`); + const $label = byId(`stateLabel${state.i}`); + if ($label) { + $label.setAttribute("id", `stateLabel${newId}`); + const $textPath = $label.querySelector("textPath"); + if ($textPath) { + $textPath.removeAttribute("href"); + $textPath.setAttribute("href", `#textPath_stateLabel${newId}`); + } + } // update emblem id reference byId(`stateCOA${state.i}`)?.setAttribute("id", `stateCOA${newId}`); diff --git a/versioning.js b/versioning.js index bdaaca35..2bcedad9 100644 --- a/versioning.js +++ b/versioning.js @@ -1,7 +1,7 @@ "use strict"; // version and caching control -const version = "1.96.02"; // generator version, update each time +const version = "1.96.03"; // generator version, update each time { document.title += " v" + version;