mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
Merge pull request #3 from evolvedexperiment/color-picker3
Hatching copy and remove from saved .map files.
This commit is contained in:
commit
87b6eb4c12
4 changed files with 13 additions and 7 deletions
|
|
@ -148,6 +148,8 @@
|
||||||
</filter>
|
</filter>
|
||||||
</g>
|
</g>
|
||||||
|
|
||||||
|
<g id="hatching"/>
|
||||||
|
|
||||||
<g id="deftemp">
|
<g id="deftemp">
|
||||||
<mask id="land"></mask>
|
<mask id="land"></mask>
|
||||||
<mask id="water">
|
<mask id="water">
|
||||||
|
|
|
||||||
6
main.js
6
main.js
|
|
@ -656,6 +656,7 @@ function generate() {
|
||||||
|
|
||||||
Military.generate();
|
Military.generate();
|
||||||
Markers.generate();
|
Markers.generate();
|
||||||
|
copyHatching();
|
||||||
addZones();
|
addZones();
|
||||||
Names.getMapName();
|
Names.getMapName();
|
||||||
|
|
||||||
|
|
@ -1483,6 +1484,11 @@ function rankCells() {
|
||||||
TIME && console.timeEnd("rankCells");
|
TIME && console.timeEnd("rankCells");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// copy the hatching (patterns)
|
||||||
|
function copyHatching() {
|
||||||
|
document.getElementById("hatching").innerHTML = document.getElementById("defs-hatching").innerHTML;
|
||||||
|
}
|
||||||
|
|
||||||
// regenerate some zones
|
// regenerate some zones
|
||||||
function addZones(number = 1) {
|
function addZones(number = 1) {
|
||||||
TIME && console.time("addZones");
|
TIME && console.time("addZones");
|
||||||
|
|
|
||||||
|
|
@ -190,7 +190,6 @@ function parseLoadedData(data) {
|
||||||
if (customizationMenu.offsetParent) styleTab.click();
|
if (customizationMenu.offsetParent) styleTab.click();
|
||||||
|
|
||||||
const reliefIcons = document.getElementById("defs-relief").innerHTML; // save relief icons
|
const reliefIcons = document.getElementById("defs-relief").innerHTML; // save relief icons
|
||||||
const newHatching = document.getElementById("hatching").cloneNode(true); // save hatching
|
|
||||||
|
|
||||||
void (function parseParameters() {
|
void (function parseParameters() {
|
||||||
const params = data[0].split("|");
|
const params = data[0].split("|");
|
||||||
|
|
@ -474,7 +473,9 @@ function parseLoadedData(data) {
|
||||||
if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove();
|
if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove();
|
||||||
|
|
||||||
// 1.0 adds hatching
|
// 1.0 adds hatching
|
||||||
document.getElementsByTagName("defs")[0].appendChild(newHatching);
|
const gHatching = document.createElementNS("http://www.w3.org/2000/svg", "g");
|
||||||
|
gHatching.setAttribute("id", "hatching");
|
||||||
|
document.getElementsByTagName("defs")[0].appendChild(gHatching);
|
||||||
|
|
||||||
// 1.0 adds zones layer
|
// 1.0 adds zones layer
|
||||||
zones = viewbox.insert("g", "#borders").attr("id", "zones").attr("display", "none");
|
zones = viewbox.insert("g", "#borders").attr("id", "zones").attr("display", "none");
|
||||||
|
|
@ -930,11 +931,7 @@ function parseLoadedData(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version < 1.72) {
|
copyHatching();
|
||||||
// v 1.72 changed hatching data
|
|
||||||
document.getElementById("hatching").remove();
|
|
||||||
document.getElementsByTagName("defs")[0].appendChild(newHatching);
|
|
||||||
};
|
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -51,6 +51,7 @@ function getMapData() {
|
||||||
cloneEl.querySelector("#viewbox").removeAttribute("transform");
|
cloneEl.querySelector("#viewbox").removeAttribute("transform");
|
||||||
|
|
||||||
cloneEl.querySelector("#ruler").innerHTML = ""; // always remove rulers
|
cloneEl.querySelector("#ruler").innerHTML = ""; // always remove rulers
|
||||||
|
cloneEl.querySelector("#hatching").innerHTML = ""; // remove hatching patterns
|
||||||
|
|
||||||
const serializedSVG = new XMLSerializer().serializeToString(cloneEl);
|
const serializedSVG = new XMLSerializer().serializeToString(cloneEl);
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue