Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 6 additions & 5 deletions public/modules/dynamic/editors/states-editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -1391,7 +1391,8 @@ function openStateMergeDialog() {
if (!layerIsOn("toggleStates")) return;
const state = +event.currentTarget.dataset.id;
if (!state) return;
const d = regions.select("#state" + state).attr("d");
const stateNode = regions.select("#state" + state).node();
const d = stateNode && stateNode.getAttribute("d");
if (!d) return;

stateHighlightOff();
Expand Down Expand Up @@ -1467,7 +1468,7 @@ function openStateMergeDialog() {

function mergeStates(statesToMerge, rulingStateId, mergeToProvinces = false) {
const rulingState = pack.states[rulingStateId];
const rulingStateArmy = ensureEl("army" + rulingStateId);
const rulingStateArmy = document.getElementById("army" + rulingStateId);

// demote a merged state into a single province of the ruling state, collapsing
// any of its existing internal provinces into that one new province
Expand All @@ -1479,7 +1480,7 @@ function openStateMergeDialog() {
pack.provinces.forEach(province => {
if (!province.i || province.removed || province.state !== stateId) return;
const coaId = "provinceCOA" + province.i;
if (ensureEl(coaId)) ensureEl(coaId).remove();
document.getElementById(coaId)?.remove();
emblems.select(`#provinceEmblems > use[data-i='${province.i}']`).remove();
pack.provinces[province.i] = {i: province.i, removed: true};
});
Expand Down Expand Up @@ -1516,7 +1517,7 @@ function openStateMergeDialog() {
labels.select("#stateLabel" + stateId).remove();
defs.select("#textPath_stateLabel" + stateId).remove();

ensureEl("stateCOA" + stateId).remove();
document.getElementById("stateCOA" + stateId)?.remove();
emblems.select(`#stateEmblems > use[data-i='${stateId}']`).remove();

// add merged state regiments to the ruling state
Expand All @@ -1534,7 +1535,7 @@ function openStateMergeDialog() {
element.id = newId;
element.dataset.state = rulingStateId;
element.dataset.id = newIndex;
rulingStateArmy.appendChild(element);
rulingStateArmy?.appendChild(element);
}
});

Expand Down
2 changes: 1 addition & 1 deletion public/modules/ui/editors.js
Original file line number Diff line number Diff line change
Expand Up @@ -1079,7 +1079,7 @@ function refreshAllEditors() {
// dynamically loaded editors
async function editStates() {
if (customization) return;
const Editor = await import("../dynamic/editors/states-editor.js?v=1.122.13");
const Editor = await import("../dynamic/editors/states-editor.js?v=1.122.14");
Editor.open();
}

Expand Down
Loading