Hatching copy for clone is now done before unused pattern removal

This commit is contained in:
Evolvedexperiment 2022-01-29 15:06:35 +00:00
parent db84364aa5
commit 2e413b57d7

View file

@ -184,6 +184,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++) {
@ -262,9 +265,6 @@ async function getMapURL(type, options = {}) {
if (pattern) cloneDefs.appendChild(pattern.cloneNode(true));
}
const hatching = svgDefs.getElementById("defs-hatching");
if (hatching) cloneDefs.appendChild(hatching.cloneNode(true));
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