mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-22 20:11:24 +01:00
Removed haching completely from map svg
This commit is contained in:
parent
e7503d14b7
commit
db84364aa5
6 changed files with 9 additions and 18 deletions
|
|
@ -148,8 +148,6 @@
|
||||||
</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,7 +656,6 @@ function generate() {
|
||||||
|
|
||||||
Military.generate();
|
Military.generate();
|
||||||
Markers.generate();
|
Markers.generate();
|
||||||
copyHatching();
|
|
||||||
addZones();
|
addZones();
|
||||||
Names.getMapName();
|
Names.getMapName();
|
||||||
|
|
||||||
|
|
@ -1484,11 +1483,6 @@ 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");
|
||||||
|
|
|
||||||
|
|
@ -262,7 +262,9 @@ async function getMapURL(type, options = {}) {
|
||||||
if (pattern) cloneDefs.appendChild(pattern.cloneNode(true));
|
if (pattern) cloneDefs.appendChild(pattern.cloneNode(true));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!cloneEl.getElementById("hatching").children.length) cloneEl.getElementById("hatching")?.remove(); // remove unused hatching group
|
const hatching = svgDefs.getElementById("defs-hatching");
|
||||||
|
if (hatching) cloneDefs.appendChild(hatching.cloneNode(true));
|
||||||
|
|
||||||
if (!cloneEl.getElementById("fogging-cont")) cloneEl.getElementById("fog")?.remove(); // remove unused fog
|
if (!cloneEl.getElementById("fogging-cont")) cloneEl.getElementById("fog")?.remove(); // remove unused fog
|
||||||
if (!cloneEl.getElementById("regions")) cloneEl.getElementById("statePaths")?.remove(); // removed unused statePaths
|
if (!cloneEl.getElementById("regions")) cloneEl.getElementById("statePaths")?.remove(); // removed unused statePaths
|
||||||
if (!cloneEl.getElementById("labels")) cloneEl.getElementById("textPaths")?.remove(); // removed unused textPaths
|
if (!cloneEl.getElementById("labels")) cloneEl.getElementById("textPaths")?.remove(); // removed unused textPaths
|
||||||
|
|
|
||||||
|
|
@ -472,11 +472,6 @@ function parseLoadedData(data) {
|
||||||
if (!layerIsOn("toggleBorders")) $("#borders").fadeOut();
|
if (!layerIsOn("toggleBorders")) $("#borders").fadeOut();
|
||||||
if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove();
|
if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove();
|
||||||
|
|
||||||
// 1.0 adds hatching
|
|
||||||
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");
|
||||||
zones.attr("opacity", 0.6).attr("stroke", null).attr("stroke-width", 0).attr("stroke-dasharray", null).attr("stroke-linecap", "butt");
|
zones.attr("opacity", 0.6).attr("stroke", null).attr("stroke-width", 0).attr("stroke-dasharray", null).attr("stroke-linecap", "butt");
|
||||||
|
|
@ -931,8 +926,11 @@ function parseLoadedData(data) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
copyHatching();
|
if (version < 1.72) {
|
||||||
|
// 1.72 moves the hatching patterns out of the SVG
|
||||||
|
document.getElementById("hatching")?.remove();
|
||||||
|
}
|
||||||
|
|
||||||
})();
|
})();
|
||||||
|
|
||||||
void (function checkDataIntegrity() {
|
void (function checkDataIntegrity() {
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,6 @@ 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);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -482,7 +482,7 @@ function createPicker() {
|
||||||
|
|
||||||
const colors = picker.append("g").attr("id", "pickerColors").attr("stroke", "#333333");
|
const colors = picker.append("g").attr("id", "pickerColors").attr("stroke", "#333333");
|
||||||
const hatches = picker.append("g").attr("id", "pickerHatches").attr("stroke", "#333333");
|
const hatches = picker.append("g").attr("id", "pickerHatches").attr("stroke", "#333333");
|
||||||
const hatching = d3.selectAll("g#hatching > pattern");
|
const hatching = d3.selectAll("g#defs-hatching > pattern");
|
||||||
const number = hatching.size();
|
const number = hatching.size();
|
||||||
|
|
||||||
const clr = d3.range(number).map(i => d3.hsl((i / number) * 360, 0.7, 0.7).hex());
|
const clr = d3.range(number).map(i => d3.hsl((i / number) * 360, 0.7, 0.7).hex());
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue