mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 03:51:23 +01:00
fix: export texture
This commit is contained in:
parent
418df1cec5
commit
c38aff758a
4 changed files with 16 additions and 16 deletions
|
|
@ -1,5 +1,5 @@
|
||||||
(window => {
|
(window => {
|
||||||
const noTrack = !location.hostname || window.localStorage.getItem("noTrack");
|
const noTrack = window.localStorage.getItem("noTrack");
|
||||||
|
|
||||||
const {
|
const {
|
||||||
screen: {width, height},
|
screen: {width, height},
|
||||||
|
|
|
||||||
|
|
@ -1953,9 +1953,9 @@ window.COArenderer = (function () {
|
||||||
return fetchedCharges.join("");
|
return fetchedCharges.join("");
|
||||||
}
|
}
|
||||||
|
|
||||||
const url = location.hostname ? "./charges/" : "http://armoria.herokuapp.com/charges/"; // on local machine fetch files from server
|
const PATH = "./charges/";
|
||||||
async function fetchCharge(charge, id) {
|
async function fetchCharge(charge, id) {
|
||||||
const fetched = fetch(url + charge + ".svg")
|
const fetched = fetch(PATH + charge + ".svg")
|
||||||
.then(res => {
|
.then(res => {
|
||||||
if (res.ok) return res.text();
|
if (res.ok) return res.text();
|
||||||
else throw new Error("Cannot fetch charge");
|
else throw new Error("Cannot fetch charge");
|
||||||
|
|
|
||||||
|
|
@ -236,27 +236,27 @@ async function getMapURL(type, options = {}) {
|
||||||
cloneDefs.querySelector("#defs-emblems")?.remove();
|
cloneDefs.querySelector("#defs-emblems")?.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace ocean pattern href to base64
|
{
|
||||||
if (location.hostname) {
|
// replace ocean pattern href to base64
|
||||||
const el = cloneEl.getElementById("oceanicPattern");
|
const image = cloneEl.getElementById("oceanicPattern");
|
||||||
const url = el?.getAttribute("href");
|
const href = image?.getAttribute("href");
|
||||||
if (url) {
|
if (href) {
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
getBase64(url, base64 => {
|
getBase64(href, base64 => {
|
||||||
el.setAttribute("href", base64);
|
image.setAttribute("href", base64);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// replace texture href to base64
|
{
|
||||||
if (location.hostname) {
|
// replace texture href to base64
|
||||||
const image = document.querySelector("#texture > image");
|
const image = cloneEl.querySelector("#texture > image");
|
||||||
if (image) {
|
if (image) {
|
||||||
const url = image.getAttribute("href");
|
const href = image.getAttribute("href");
|
||||||
await new Promise(resolve => {
|
await new Promise(resolve => {
|
||||||
getBase64(url, base64 => {
|
getBase64(href, base64 => {
|
||||||
image.setAttribute("href", base64);
|
image.setAttribute("href", base64);
|
||||||
resolve();
|
resolve();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -9,7 +9,7 @@ window.addEventListener("resize", function (e) {
|
||||||
changeMapSize();
|
changeMapSize();
|
||||||
});
|
});
|
||||||
|
|
||||||
if (location.hostname && location.hostname !== "localhost" && location.hostname !== "127.0.0.1") {
|
if (location.hostname !== "localhost" && location.hostname !== "127.0.0.1") {
|
||||||
window.onbeforeunload = () => "Are you sure you want to navigate away?";
|
window.onbeforeunload = () => "Are you sure you want to navigate away?";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue