mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
v1.5.15 - svg save data cleansing
This commit is contained in:
parent
6987474c2e
commit
002160ed21
8 changed files with 164 additions and 135 deletions
|
|
@ -205,6 +205,7 @@ function editEmblem(type, id, el) {
|
|||
reader.onload = function(readerEvent) {
|
||||
const result = readerEvent.target.result;
|
||||
const defs = document.getElementById("defs-emblems");
|
||||
const coa = document.getElementById(id); // old emblem
|
||||
|
||||
if (type === "image") {
|
||||
const svg = `<svg id="${id}" xmlns="http://www.w3.org/2000/svg" width="200" height="200" viewBox="0 0 200 200"><image x="0" y="0" width="200" height="200" href="${result}"/></svg>`;
|
||||
|
|
@ -217,9 +218,7 @@ function editEmblem(type, id, el) {
|
|||
newEmblem.setAttribute("height", 200);
|
||||
}
|
||||
|
||||
const coa = document.getElementById(id);
|
||||
if (coa) coa.remove(); // remove old emblem
|
||||
|
||||
el.coa = "custom";
|
||||
emblemShapeSelector.disabled = true;
|
||||
};
|
||||
|
|
@ -282,7 +281,6 @@ function editEmblem(type, id, el) {
|
|||
|
||||
function getSVG(svg, coa, size) {
|
||||
const clone = svg.cloneNode(true); // clone svg
|
||||
const d = clone.getElementsByTagName("defs")[0];
|
||||
|
||||
clone.setAttribute("width", size);
|
||||
clone.setAttribute("height", size);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue