mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-17 09:41:24 +01:00
grid patterns
This commit is contained in:
parent
38c8a20c45
commit
6fd8862d7a
5 changed files with 90 additions and 84 deletions
|
|
@ -135,10 +135,15 @@ async function getMapURL(type, subtype) {
|
|||
}
|
||||
|
||||
// replace ocean pattern href to base64
|
||||
if (cloneEl.getElementById("oceanicPattern")) {
|
||||
if (PRODUCTION && cloneEl.getElementById("oceanicPattern")) {
|
||||
const el = cloneEl.getElementById("oceanicPattern");
|
||||
const url = el.getAttribute("href");
|
||||
getBase64(url, base64 => el.setAttribute("href", base64));
|
||||
await new Promise(resolve => {
|
||||
getBase64(url, base64 => {
|
||||
el.setAttribute("href", base64);
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
// add relief icons
|
||||
|
|
@ -169,6 +174,13 @@ async function getMapURL(type, subtype) {
|
|||
if (anchor) cloneDefs.appendChild(anchor.cloneNode(true));
|
||||
}
|
||||
|
||||
// add grid pattern
|
||||
if (cloneEl.getElementById("gridOverlay")?.hasChildNodes()) {
|
||||
const type = cloneEl.getElementById("gridOverlay").getAttribute("type");
|
||||
const pattern = svgDefs.getElementById("pattern_"+type);
|
||||
if (pattern) cloneDefs.appendChild(pattern.cloneNode(true));
|
||||
}
|
||||
|
||||
if (!cloneEl.getElementById("hatching").children.length) cloneEl.getElementById("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
|
||||
|
|
@ -1185,6 +1197,11 @@ function parseLoadedData(data) {
|
|||
}
|
||||
}()
|
||||
|
||||
if (version < 1.62) {
|
||||
// v 1.62 changed grid data
|
||||
gridOverlay.attr("size", null);
|
||||
}
|
||||
|
||||
void function checkDataIntegrity() {
|
||||
const cells = pack.cells;
|
||||
|
||||
|
|
@ -1274,6 +1291,7 @@ function parseLoadedData(data) {
|
|||
|
||||
// draw data layers (no kept in svg)
|
||||
if (rulers && layerIsOn("toggleRulers")) rulers.draw();
|
||||
if (layerIsOn("toggleGrid")) drawGrid();
|
||||
|
||||
// set options
|
||||
yearInput.value = options.year;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue