Skip to content

Commit 634c7db

Browse files
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>
1 parent 3222751 commit 634c7db

3 files changed

Lines changed: 11 additions & 7 deletions

File tree

public/modules/ui/tools.js

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,17 @@ function processFeatureRegeneration(event, button) {
101101
async function openEmblemEditor() {
102102
let type, id, el;
103103

104-
if (pack.states[1]?.coa) {
104+
const firstState = pack.states.find(s => s.i && !s.removed && s.coa);
105+
const firstBurg = pack.burgs.find(b => b.i && !b.removed && b.coa);
106+
107+
if (firstState) {
105108
type = "state";
106-
id = "stateCOA1";
107-
el = pack.states[1];
108-
} else if (pack.burgs[1]?.coa) {
109+
id = `stateCOA${firstState.i}`;
110+
el = firstState;
111+
} else if (firstBurg) {
109112
type = "burg";
110-
id = "burgCOA1";
111-
el = pack.burgs[1];
113+
id = `burgCOA${firstBurg.i}`;
114+
el = firstBurg;
112115
} else {
113116
tip("No emblems to edit, please generate states and burgs first", false, "error");
114117
return;

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8548,7 +8548,7 @@
85488548

85498549
<script defer src="modules/ui/style.js?v=1.108.4"></script>
85508550
<script defer src="modules/ui/editors.js?v=1.112.1"></script>
8551-
<script defer src="modules/ui/tools.js?v=1.111.0"></script>
8551+
<script defer src="modules/ui/tools.js?v=1.113.3"></script>
85528552
<script defer src="modules/ui/world-configurator.js?v=1.105.4"></script>
85538553
<script defer src="modules/ui/heightmap-editor.js?v=1.113.0"></script>
85548554
<script defer src="modules/ui/provinces-editor.js?v=1.108.1"></script>

src/modules/burgs-generator.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -676,6 +676,7 @@ class BurgModule {
676676
};
677677
this.definePopulation(burg);
678678
this.defineEmblem(burg);
679+
COArenderer.add("burg", burgId, burg.coa, x, y);
679680
this.defineFeatures(burg);
680681

681682
const populations = pack.burgs

0 commit comments

Comments
 (0)