v1.5.81 - svg coa load fix

This commit is contained in:
Azgaar 2021-03-01 02:46:41 +03:00
parent 49b9895b0b
commit 2f70df6c59
2 changed files with 4 additions and 6 deletions

View file

@ -1104,9 +1104,9 @@ function parseLoadedData(data) {
for (const river of pack.rivers) {
const el = document.getElementById("river"+river.i);
if (el) {
river.widthFactor = +el.getAttribute("data-width");
el.removeAttribute("data-width");
el.removeAttribute("data-increment");
river.widthFactor = +this.getAttribute("data-width");
river.discharge = pack.cells.fl[river.mouth] || 1;
river.width = rn(river.length / 100, 2);
river.sourceWidth = .1;

View file

@ -238,7 +238,6 @@ function editEmblem(type, id, el) {
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>`;
defs.insertAdjacentHTML("beforeend", svg);
} else {
const el = document.createElement("html");
el.innerHTML = result;
@ -250,14 +249,13 @@ function editEmblem(type, id, el) {
});
});
const g = el.querySelector("g");
if (!g) {
const svg = el.querySelector("svg");
if (!svg) {
tip("The file should be prepated for load to FMG. Please use Armoria or other relevant tools", false, "error");
return;
}
const newEmblem = defs.appendChild(g);
const newEmblem = defs.appendChild(svg);
newEmblem.id = id;
newEmblem.setAttribute("width", 200);
newEmblem.setAttribute("height", 200);