From 634c7dba4bca06a73f8d53c3806805dc84d08551 Mon Sep 17 00:00:00 2001 From: Marc Emmanuel Date: Thu, 5 Mar 2026 11:57:53 +0100 Subject: [PATCH] fix: enhance emblem rendering for states and burgs in the editor (#1343) * fix: enhance emblem rendering for states and burgs in the editor * fix: update tools.js version to 1.112.0 for improved functionality * Update src/index.html Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --------- Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- public/modules/ui/tools.js | 15 +++++++++------ src/index.html | 2 +- src/modules/burgs-generator.ts | 1 + 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/public/modules/ui/tools.js b/public/modules/ui/tools.js index eade993f..34c1cd12 100644 --- a/public/modules/ui/tools.js +++ b/public/modules/ui/tools.js @@ -101,14 +101,17 @@ function processFeatureRegeneration(event, button) { async function openEmblemEditor() { let type, id, el; - if (pack.states[1]?.coa) { + const firstState = pack.states.find(s => s.i && !s.removed && s.coa); + const firstBurg = pack.burgs.find(b => b.i && !b.removed && b.coa); + + if (firstState) { type = "state"; - id = "stateCOA1"; - el = pack.states[1]; - } else if (pack.burgs[1]?.coa) { + id = `stateCOA${firstState.i}`; + el = firstState; + } else if (firstBurg) { type = "burg"; - id = "burgCOA1"; - el = pack.burgs[1]; + id = `burgCOA${firstBurg.i}`; + el = firstBurg; } else { tip("No emblems to edit, please generate states and burgs first", false, "error"); return; diff --git a/src/index.html b/src/index.html index 054f45ba..52d2c51e 100644 --- a/src/index.html +++ b/src/index.html @@ -8548,7 +8548,7 @@ - + diff --git a/src/modules/burgs-generator.ts b/src/modules/burgs-generator.ts index 6fccd517..debdab69 100644 --- a/src/modules/burgs-generator.ts +++ b/src/modules/burgs-generator.ts @@ -676,6 +676,7 @@ class BurgModule { }; this.definePopulation(burg); this.defineEmblem(burg); + COArenderer.add("burg", burgId, burg.coa, x, y); this.defineFeatures(burg); const populations = pack.burgs