Copies hatching from defElements into map svg, and hatching removed from saved map files.

This commit is contained in:
Evolvedexperiment 2022-01-27 13:17:04 +00:00
parent ec7f53454f
commit e7503d14b7
4 changed files with 13 additions and 7 deletions

View file

@ -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();
})();

View file

@ -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);