diff --git a/index.html b/index.html index e6799da1..ad93e0cf 100644 --- a/index.html +++ b/index.html @@ -7682,214 +7682,152 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/modules/export.js b/modules/export.js index eb33d531..06257d60 100644 --- a/modules/export.js +++ b/modules/export.js @@ -180,6 +180,9 @@ async function getMapURL(type, options = {}) { filters[i].remove(); } + const hatching = svgDefs.getElementById("defs-hatching"); + if (hatching) cloneDefs.appendChild(hatching.cloneNode(true)); + // remove unused patterns const patterns = cloneEl.querySelectorAll("pattern"); for (let i = 0; i < patterns.length; i++) { @@ -258,7 +261,7 @@ async function getMapURL(type, options = {}) { if (pattern) cloneDefs.appendChild(pattern.cloneNode(true)); } - if (!cloneEl.getElementById("hatching").children.length) cloneEl.getElementById("hatching")?.remove(); // remove unused hatching group + if (!cloneEl.getElementById("defs-hatching").children.length) cloneEl.getElementById("defs-hatching")?.remove(); // remove unused hatching group if (!cloneEl.getElementById("fogging-cont")) cloneEl.getElementById("fog")?.remove(); // remove unused fog if (!cloneEl.getElementById("regions")) cloneEl.getElementById("statePaths")?.remove(); // removed unused statePaths if (!cloneEl.getElementById("labels")) cloneEl.getElementById("textPaths")?.remove(); // removed unused textPaths diff --git a/modules/load.js b/modules/load.js index d9c944c0..2217bd8f 100644 --- a/modules/load.js +++ b/modules/load.js @@ -189,8 +189,7 @@ function parseLoadedData(data) { customization = 0; if (customizationMenu.offsetParent) styleTab.click(); - const reliefIcons = document.getElementById('defs-relief').innerHTML; // save relief icons - const hatching = document.getElementById('hatching').cloneNode(true); // save hatching + const reliefIcons = document.getElementById("defs-relief").innerHTML; // save relief icons void (function parseParameters() { const params = data[0].split('|'); @@ -473,9 +472,6 @@ function parseLoadedData(data) { if (!layerIsOn('toggleBorders')) $('#borders').fadeOut(); if (!layerIsOn('toggleStates')) regions.attr('display', 'none').selectAll('path').remove(); - // 1.0 adds hatching - document.getElementsByTagName('defs')[0].appendChild(hatching); - // 1.0 adds zones layer zones = viewbox.insert('g', '#borders').attr('id', 'zones').attr('display', 'none'); zones.attr('opacity', 0.6).attr('stroke', null).attr('stroke-width', 0).attr('stroke-dasharray', null).attr('stroke-linecap', 'butt'); @@ -883,6 +879,11 @@ function parseLoadedData(data) { // v 1.7 changed markers data // TODO: get markers data from svg } + + if (version < 1.73) { + // v1.73 moved the hatching patterns out of the user's SVG + document.getElementById("hatching")?.remove(); + } })(); void (function checkDataIntegrity() { @@ -993,7 +994,7 @@ function parseLoadedData(data) { // sort markers by index pack.markers.sort((a, b) => a.i - b.i); } - })(); + })(); changeMapSize();