diff --git a/index.html b/index.html
index c0f73e2f..4d71f944 100644
--- a/index.html
+++ b/index.html
@@ -148,6 +148,8 @@
+
+
diff --git a/main.js b/main.js
index 4de5b137..d58be361 100644
--- a/main.js
+++ b/main.js
@@ -656,6 +656,7 @@ function generate() {
Military.generate();
Markers.generate();
+ copyHatching();
addZones();
Names.getMapName();
@@ -1483,6 +1484,11 @@ function rankCells() {
TIME && console.timeEnd("rankCells");
}
+// copy the hatching (patterns)
+function copyHatching() {
+ document.getElementById("hatching").innerHTML = document.getElementById("defs-hatching").innerHTML;
+}
+
// regenerate some zones
function addZones(number = 1) {
TIME && console.time("addZones");
diff --git a/modules/load.js b/modules/load.js
index 4c10c48b..86aa79a1 100644
--- a/modules/load.js
+++ b/modules/load.js
@@ -190,7 +190,6 @@ function parseLoadedData(data) {
if (customizationMenu.offsetParent) styleTab.click();
const reliefIcons = document.getElementById("defs-relief").innerHTML; // save relief icons
- const newHatching = document.getElementById("hatching").cloneNode(true); // save hatching
void (function parseParameters() {
const params = data[0].split("|");
@@ -474,7 +473,9 @@ function parseLoadedData(data) {
if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove();
// 1.0 adds hatching
- document.getElementsByTagName("defs")[0].appendChild(newHatching);
+ const gHatching = document.createElementNS("http://www.w3.org/2000/svg", "g");
+ gHatching.setAttribute("id", "hatching");
+ document.getElementsByTagName("defs")[0].appendChild(gHatching);
// 1.0 adds zones layer
zones = viewbox.insert("g", "#borders").attr("id", "zones").attr("display", "none");
@@ -930,11 +931,7 @@ function parseLoadedData(data) {
}
}
- if (version < 1.72) {
- // v 1.72 changed hatching data
- document.getElementById("hatching").remove();
- document.getElementsByTagName("defs")[0].appendChild(newHatching);
- };
+ copyHatching();
})();
diff --git a/modules/save.js b/modules/save.js
index 04f3e665..fe9b64da 100644
--- a/modules/save.js
+++ b/modules/save.js
@@ -51,6 +51,7 @@ function getMapData() {
cloneEl.querySelector("#viewbox").removeAttribute("transform");
cloneEl.querySelector("#ruler").innerHTML = ""; // always remove rulers
+ cloneEl.querySelector("#hatching").innerHTML = ""; // remove hatching patterns
const serializedSVG = new XMLSerializer().serializeToString(cloneEl);