From 81f037004ca05563bf65bb738d9c9b70200e13a0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=81ngel=20Montero=20Lamas?= Date: Sun, 6 Feb 2022 19:56:16 +0100 Subject: [PATCH 1/3] Color picker hatches 14-60 (#726) * Color picker hatches 14-60 Added hatches to number 14 to 60. Updated the code of the color picker to accept multiples rows of hatches. Changed the size of fillRectPointer from 0.9 em to 1.5 em. Added an Update code to upgrade maps to 1.72 to have a grid of 60 svg hatches. Without the update, loaded files appeared with the rectangles for hatches 14-60 empty. * Hatches ordered Reworked the code to put back rows of 14 hatches. Reordered the first 14 hatches to defaault. Made 3 rows, so 42 hatches. * Cleaned code and fixes Cleaned in index.html line 152. Put back: width=".9em" height=".9em" style="margin-bottom:-1px"> for fill. * mouseover hatches Fixed some typos. Changed mousemove for mouseover and moved the calling of the function tip from the each function to the original place at 519. The arrow function changed to one that tells the id. * Copies hatching from defElements into map svg, and hatching removed from saved map files. * Removed haching completely from map svg * Hatching copy for clone is now done before unused pattern removal * Added back code that removes the unused hatching group Co-authored-by: Evolvedexperiment Co-authored-by: Azgaar --- index.html | 196 +++++++++++++++++++++++++++---------- main.js | 2 +- modules/export.js | 5 +- modules/load.js | 11 ++- modules/ui/editors.js | 28 +++--- modules/ui/zones-editor.js | 2 +- 6 files changed, 173 insertions(+), 71 deletions(-) diff --git a/index.html b/index.html index d515b96d..a7d19f8a 100644 --- a/index.html +++ b/index.html @@ -148,55 +148,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -4356,6 +4307,153 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/main.js b/main.js index 99afe18a..fdf26386 100644 --- a/main.js +++ b/main.js @@ -2,7 +2,7 @@ // https://github.com/Azgaar/Fantasy-Map-Generator "use strict"; -const version = "1.722"; // generator version +const version = "1.73"; // generator version document.title += " v" + version; // switches to disable/enable logging features diff --git a/modules/export.js b/modules/export.js index 7b88a7e6..73308169 100644 --- a/modules/export.js +++ b/modules/export.js @@ -184,6 +184,9 @@ async function getMapURL(type, options = {}) { filters[i].remove(); } + const hatching = svgDefs.getElementById("defs-hatching"); + if (hatching) cloneDefs.appendChild(hatching.cloneNode(true)); + // remove unused patterns const patterns = cloneEl.querySelectorAll("pattern"); for (let i = 0; i < patterns.length; i++) { @@ -262,7 +265,7 @@ async function getMapURL(type, options = {}) { if (pattern) cloneDefs.appendChild(pattern.cloneNode(true)); } - if (!cloneEl.getElementById("hatching").children.length) cloneEl.getElementById("hatching")?.remove(); // remove unused hatching group + if (!cloneEl.getElementById("defs-hatching").children.length) cloneEl.getElementById("defs-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 if (!cloneEl.getElementById("labels")) cloneEl.getElementById("textPaths")?.remove(); // removed unused textPaths diff --git a/modules/load.js b/modules/load.js index 07d95925..519678d4 100644 --- a/modules/load.js +++ b/modules/load.js @@ -190,7 +190,6 @@ function parseLoadedData(data) { if (customizationMenu.offsetParent) styleTab.click(); const reliefIcons = document.getElementById("defs-relief").innerHTML; // save relief icons - const hatching = document.getElementById("hatching").cloneNode(true); // save hatching void (function parseParameters() { const params = data[0].split("|"); @@ -473,9 +472,6 @@ function parseLoadedData(data) { if (!layerIsOn("toggleBorders")) $("#borders").fadeOut(); if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove(); - // 1.0 adds hatching - document.getElementsByTagName("defs")[0].appendChild(hatching); - // 1.0 adds zones layer 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"); @@ -939,6 +935,11 @@ function parseLoadedData(data) { localStorage.removeItem(styleName); }); } + + if (version < 1.73) { + // v1.73 moved the hatching patterns out of the user's SVG + document.getElementById("hatching")?.remove(); + } })(); void (function checkDataIntegrity() { @@ -1049,7 +1050,7 @@ function parseLoadedData(data) { // sort markers by index pack.markers.sort((a, b) => a.i - b.i); } - })(); + })(); changeMapSize(); diff --git a/modules/ui/editors.js b/modules/ui/editors.js index 3c14c149..be97102c 100644 --- a/modules/ui/editors.js +++ b/modules/ui/editors.js @@ -425,10 +425,10 @@ function clearLegend() { function createPicker() { const pos = () => tip("Drag to change the picker position"); const cl = () => tip("Click to close the picker"); - const closePicker = () => contaiter.style("display", "none"); + const closePicker = () => container.style("display", "none"); - const contaiter = d3.select("body").append("svg").attr("id", "pickerContainer").attr("width", "100%").attr("height", "100%"); - contaiter + const container = d3.select("body").append("svg").attr("id", "pickerContainer").attr("width", "100%").attr("height", "100%"); + container .append("rect") .attr("x", 0) .attr("y", 0) @@ -437,7 +437,7 @@ function createPicker() { .attr("opacity", 0.2) .on("mousemove", cl) .on("click", closePicker); - const picker = contaiter + const picker = container .append("g") .attr("id", "picker") .call( @@ -494,7 +494,7 @@ function createPicker() { const colors = picker.append("g").attr("id", "pickerColors").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 clr = d3.range(number).map(i => d3.hsl((i / number) * 360, 0.7, 0.7).hex()); @@ -504,8 +504,8 @@ function createPicker() { .attr("id", "picker_" + d) .attr("fill", d) .attr("class", i ? "" : "selected") - .attr("x", i * 22 + 4) - .attr("y", 40) + .attr("x", (i % 14) * 22 + 4) + .attr("y", 40 + Math.floor(i / 14)*20) .attr("width", 16) .attr("height", 16); }); @@ -515,20 +515,20 @@ function createPicker() { .append("rect") .attr("id", "picker_" + this.id) .attr("fill", "url(#" + this.id + ")") - .attr("x", i * 22 + 4) - .attr("y", 61) + .attr("x", (i % 14) * 22 + 4) + .attr("y", Math.floor(i / 14)*20 + 20 + (number * 2)) .attr("width", 16) - .attr("height", 16); + .attr("height", 16) }); colors .selectAll("rect") .on("click", pickerFillClicked) - .on("mousemove", () => tip("Click to fill with the color")); + .on("mouseover", () => tip("Click to fill with the color")); hatches .selectAll("rect") .on("click", pickerFillClicked) - .on("mousemove", () => tip("Click to fill with the hatching")); + .on("mouseover", function() { tip("Click to fill with the hatching " + this.id) }); // append box const bbox = picker.node().getBBox(); @@ -544,10 +544,10 @@ function createPicker() { .attr("fill", "#ffffff") .attr("stroke", "#5d4651") .on("mousemove", pos); - picker.insert("text", ":first-child").attr("x", 291).attr("y", -10).attr("id", "pickerCloseText").text("✕"); + picker.insert("text", ":first-child").attr("x", width-20).attr("y", -10).attr("id", "pickerCloseText").text("✕"); picker .insert("rect", ":first-child") - .attr("x", 288) + .attr("x", width-23) .attr("y", -21) .attr("id", "pickerCloseRect") .attr("width", 14) diff --git a/modules/ui/zones-editor.js b/modules/ui/zones-editor.js index f011f47b..13e8b31b 100644 --- a/modules/ui/zones-editor.js +++ b/modules/ui/zones-editor.js @@ -331,7 +331,7 @@ function editZones() { function addZonesLayer() { const id = getNextId("zone"); const description = "Unknown zone"; - const fill = "url(#hatch" + (id.slice(4) % 14) + ")"; + const fill = "url(#hatch" + (id.slice(4) % 42) + ")"; zones.append("g").attr("id", id).attr("data-description", description).attr("data-cells", "").attr("fill", fill); const unit = areaUnit.value === "square" ? " " + distanceUnitInput.value + "²" : " " + areaUnit.value; From 451cd60d4d6c95d4094586fb2ce9931d5b622328 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 6 Feb 2022 22:38:58 +0300 Subject: [PATCH 2/3] add only used hatchings on export --- modules/export.js | 19 +++++++---- modules/load.js | 85 ++++++++++++++++++++++++----------------------- 2 files changed, 56 insertions(+), 48 deletions(-) diff --git a/modules/export.js b/modules/export.js index 73308169..5d30d013 100644 --- a/modules/export.js +++ b/modules/export.js @@ -184,9 +184,6 @@ async function getMapURL(type, options = {}) { filters[i].remove(); } - const hatching = svgDefs.getElementById("defs-hatching"); - if (hatching) cloneDefs.appendChild(hatching.cloneNode(true)); - // remove unused patterns const patterns = cloneEl.querySelectorAll("pattern"); for (let i = 0; i < patterns.length; i++) { @@ -265,19 +262,19 @@ async function getMapURL(type, options = {}) { if (pattern) cloneDefs.appendChild(pattern.cloneNode(true)); } - if (!cloneEl.getElementById("defs-hatching").children.length) cloneEl.getElementById("defs-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 if (!cloneEl.getElementById("labels")) cloneEl.getElementById("textPaths")?.remove(); // removed unused textPaths // add armies style - if (cloneEl.getElementById("armies")) + if (cloneEl.getElementById("armies")) { cloneEl.insertAdjacentHTML( "afterbegin", "" ); + } - // add xlink: for href to support svg1.1 + // add xlink: for href to support svg 1.1 if (type === "svg") { cloneEl.querySelectorAll("[href]").forEach(el => { const href = el.getAttribute("href"); @@ -286,6 +283,16 @@ async function getMapURL(type, options = {}) { }); } + // add hatchings + const hatchingUsers = cloneEl.querySelectorAll(`[fill^='url(#hatch']`); + const hatchingFills = unique(Array.from(hatchingUsers).map(el => el.getAttribute("fill"))); + const hatchingIds = hatchingFills.map(fill => fill.slice(5, -1)); + for (const hatchingId of hatchingIds) { + const hatching = svgDefs.getElementById(hatchingId); + if (hatching) cloneDefs.appendChild(hatching.cloneNode(true)); + } + + // load fonts const usedFonts = getUsedFonts(cloneEl); const fontsToLoad = usedFonts.filter(font => font.src); if (fontsToLoad.length) { diff --git a/modules/load.js b/modules/load.js index 519678d4..a170e056 100644 --- a/modules/load.js +++ b/modules/load.js @@ -425,16 +425,16 @@ function parseLoadedData(data) { void (function resolveVersionConflicts() { const version = parseFloat(data[0].split("|")[0]); if (version < 0.9) { - // 0.9 has additional relief icons to be included into older maps + // v0.9 has additional relief icons to be included into older maps document.getElementById("defs-relief").innerHTML = reliefIcons; } if (version < 1) { - // 1.0 adds a new religions layer + // v1.0 adds a new religions layer relig = viewbox.insert("g", "#terrain").attr("id", "relig"); Religions.generate(); - // 1.0 adds a legend box + // v1.0 adds a legend box legend = svg.append("g").attr("id", "legend"); legend .attr("font-family", "Almendra SC") @@ -447,7 +447,7 @@ function parseLoadedData(data) { .attr("stroke-dasharray", "0 4 10 4") .attr("stroke-linecap", "round"); - // 1.0 separated drawBorders fron drawStates() + // v1.0 separated drawBorders fron drawStates() stateBorders = borders.append("g").attr("id", "stateBorders"); provinceBorders = borders.append("g").attr("id", "provinceBorders"); borders @@ -460,7 +460,7 @@ function parseLoadedData(data) { stateBorders.attr("opacity", 0.8).attr("stroke", "#56566d").attr("stroke-width", 1).attr("stroke-dasharray", "2").attr("stroke-linecap", "butt"); provinceBorders.attr("opacity", 0.8).attr("stroke", "#56566d").attr("stroke-width", 0.5).attr("stroke-dasharray", "1").attr("stroke-linecap", "butt"); - // 1.0 adds state relations, provinces, forms and full names + // v1.0 adds state relations, provinces, forms and full names provs = viewbox.insert("g", "#borders").attr("id", "provs").attr("opacity", 0.6); BurgsAndStates.collectStatistics(); BurgsAndStates.generateCampaigns(); @@ -472,7 +472,7 @@ function parseLoadedData(data) { if (!layerIsOn("toggleBorders")) $("#borders").fadeOut(); if (!layerIsOn("toggleStates")) regions.attr("display", "none").selectAll("path").remove(); - // 1.0 adds zones layer + // v1.0 adds zones layer 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"); addZones(); @@ -481,35 +481,35 @@ function parseLoadedData(data) { turnButtonOn("toggleMarkers"); } - // 1.0 add fogging layer (state focus) + // v1.0 add fogging layer (state focus) fogging = viewbox.insert("g", "#ruler").attr("id", "fogging-cont").attr("mask", "url(#fog)").append("g").attr("id", "fogging").style("display", "none"); fogging.append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%"); defs.append("mask").attr("id", "fog").append("rect").attr("x", 0).attr("y", 0).attr("width", "100%").attr("height", "100%").attr("fill", "white"); - // 1.0 changes states opacity bask to regions level + // v1.0 changes states opacity bask to regions level if (statesBody.attr("opacity")) { regions.attr("opacity", statesBody.attr("opacity")); statesBody.attr("opacity", null); } - // 1.0 changed labels to multi-lined + // v1.0 changed labels to multi-lined labels.selectAll("textPath").each(function () { const text = this.textContent; const shift = this.getComputedTextLength() / -1.5; this.innerHTML = `${text}`; }); - // 1.0 added new biome - Wetland + // v1.0 added new biome - Wetland biomesData.name.push("Wetland"); biomesData.color.push("#0b9131"); biomesData.habitability.push(12); } if (version < 1.1) { - // v 1.0 initial code had a bug with religion layer id + // v1.0 initial code had a bug with religion layer id if (!relig.size()) relig = viewbox.insert("g", "#terrain").attr("id", "relig"); - // v 1.0 initially has Sympathy status then relaced with Friendly + // v1.0 initially has Sympathy status then relaced with Friendly for (const s of pack.states) { if (!s.diplomacy) continue; s.diplomacy = s.diplomacy.map(r => (r === "Sympathy" ? "Friendly" : r)); @@ -518,7 +518,7 @@ function parseLoadedData(data) { // labels should be toggled via style attribute, so remove display attribute labels.attr("display", null); - // v 1.0 added religions heirarchy tree + // v1.0 added religions heirarchy tree if (pack.religions[1] && !pack.religions[1].code) { pack.religions .filter(r => r.i) @@ -538,7 +538,7 @@ function parseLoadedData(data) { lakes.select("#salt").attr("opacity", 0.5).attr("fill", "#409b8a").attr("stroke", "#388985").attr("stroke-width", 0.7).attr("filter", null); } - // v 1.1 added new lake and coast groups + // v1.1 added new lake and coast groups if (!document.getElementById("sinkhole")) { lakes.append("g").attr("id", "sinkhole"); lakes.append("g").attr("id", "frozen"); @@ -553,7 +553,7 @@ function parseLoadedData(data) { coastline.select("#lake_island").attr("opacity", 1).attr("stroke", "#7c8eaf").attr("stroke-width", 0.35).attr("filter", null); } - // v 1.1 features stores more data + // v1.1 features stores more data defs.select("#land").selectAll("path").remove(); defs.select("#water").selectAll("path").remove(); coastline.selectAll("path").remove(); @@ -562,13 +562,13 @@ function parseLoadedData(data) { } if (version < 1.11) { - // v 1.11 added new attributes + // v1.11 added new attributes terrs.attr("scheme", "bright").attr("terracing", 0).attr("skip", 5).attr("relax", 0).attr("curve", 0); svg.select("#oceanic > *").attr("id", "oceanicPattern"); oceanLayers.attr("layers", "-6,-3,-1"); gridOverlay.attr("type", "pointyHex").attr("size", 10); - // v 1.11 added cultures heirarchy tree + // v1.11 added cultures heirarchy tree if (pack.cultures[1] && !pack.cultures[1].code) { pack.cultures .filter(c => c.i) @@ -578,17 +578,17 @@ function parseLoadedData(data) { }); } - // v 1.11 had an issue with fogging being displayed on load + // v1.11 had an issue with fogging being displayed on load unfog(); - // v 1.2 added new terrain attributes + // v1.2 added new terrain attributes if (!terrain.attr("set")) terrain.attr("set", "simple"); if (!terrain.attr("size")) terrain.attr("size", 1); if (!terrain.attr("density")) terrain.attr("density", 0.4); } if (version < 1.21) { - // v 1.11 replaced "display" attribute by "display" style + // v1.11 replaced "display" attribute by "display" style viewbox.selectAll("g").each(function () { if (this.hasAttribute("display")) { this.removeAttribute("display"); @@ -596,7 +596,7 @@ function parseLoadedData(data) { } }); - // v 1.21 added rivers data to pack + // v1.21 added rivers data to pack pack.rivers = []; // rivers data rivers.selectAll("path").each(function () { const i = +this.id.slice(5); @@ -612,12 +612,12 @@ function parseLoadedData(data) { } if (version < 1.22) { - // v 1.22 changed state neighbors from Set object to array + // v1.22 changed state neighbors from Set object to array BurgsAndStates.collectStatistics(); } if (version < 1.3) { - // v 1.3 added global options object + // v1.3 added global options object const winds = options.slice(); // previostly wind was saved in settings[19] const year = rand(100, 2000); const era = Names.getBaseShort(P(0.7) ? 1 : rand(nameBases.length)) + " Era"; @@ -625,10 +625,10 @@ function parseLoadedData(data) { const military = Military.getDefaultOptions(); options = {winds, year, era, eraShort, military}; - // v 1.3 added campaings data for all states + // v1.3 added campaings data for all states BurgsAndStates.generateCampaigns(); - // v 1.3 added militry layer + // v1.3 added militry layer armies = viewbox.insert("g", "#icons").attr("id", "armies"); armies.attr("opacity", 1).attr("fill-opacity", 1).attr("font-size", 6).attr("box-size", 3).attr("stroke", "#000").attr("stroke-width", 0.3); turnButtonOn("toggleMilitary"); @@ -636,18 +636,18 @@ function parseLoadedData(data) { } if (version < 1.4) { - // v 1.35 added dry lakes + // v1.35 added dry lakes if (!lakes.select("#dry").size()) { lakes.append("g").attr("id", "dry"); lakes.select("#dry").attr("opacity", 1).attr("fill", "#c9bfa7").attr("stroke", "#8e816f").attr("stroke-width", 0.7).attr("filter", null); } - // v 1.4 added ice layer + // v1.4 added ice layer ice = viewbox.insert("g", "#coastline").attr("id", "ice").style("display", "none"); ice.attr("opacity", null).attr("fill", "#e8f0f6").attr("stroke", "#e8f0f6").attr("stroke-width", 1).attr("filter", "url(#dropShadow05)"); drawIce(); - // v 1.4 added icon and power attributes for units + // v1.4 added icon and power attributes for units for (const unit of options.military) { if (!unit.icon) unit.icon = getUnitIcon(unit.type); if (!unit.power) unit.power = unit.crew; @@ -664,7 +664,7 @@ function parseLoadedData(data) { else return "⚔️"; } - // 1.4 added state reference for regiments + // v1.4 added state reference for regiments pack.states.filter(s => s.military).forEach(s => s.military.forEach(r => (r.state = s.i))); } @@ -675,19 +675,19 @@ function parseLoadedData(data) { localStorage.removeItem("styleAncient"); localStorage.removeItem("styleMonochrome"); - // v 1.5 cultures has shield attribute + // v1.5 cultures has shield attribute pack.cultures.forEach(culture => { if (culture.removed) return; culture.shield = Cultures.getRandomShield(); }); - // v 1.5 added burg type value + // v1.5 added burg type value pack.burgs.forEach(burg => { if (!burg.i || burg.removed) return; burg.type = BurgsAndStates.getType(burg.cell, burg.port); }); - // v 1.5 added emblems + // v1.5 added emblems defs.append("g").attr("id", "defs-emblems"); emblems = viewbox.insert("g", "#population").attr("id", "emblems").style("display", "none"); emblems.append("g").attr("id", "burgEmblems"); @@ -696,7 +696,7 @@ function parseLoadedData(data) { regenerateEmblems(); toggleEmblems(); - // v 1.5 changed releif icons data + // v1.5 changed releif icons data terrain.selectAll("use").each(function () { const type = this.getAttribute("data-type") || this.getAttribute("xlink:href"); this.removeAttribute("xlink:href"); @@ -707,7 +707,7 @@ function parseLoadedData(data) { } if (version < 1.6) { - // v 1.6 changed rivers data + // v1.6 changed rivers data for (const river of pack.rivers) { const el = document.getElementById("river" + river.i); if (el) { @@ -722,7 +722,7 @@ function parseLoadedData(data) { } } - // v 1.6 changed lakes data + // v1.6 changed lakes data for (const f of pack.features) { if (f.type !== "lake") continue; if (f.evaporation) continue; @@ -739,7 +739,7 @@ function parseLoadedData(data) { } if (version < 1.61) { - // v 1.61 changed rulers data + // v1.61 changed rulers data ruler.style("display", null); rulers = new Rulers(); @@ -793,12 +793,12 @@ function parseLoadedData(data) { } if (version < 1.62) { - // v 1.62 changed grid data + // v1.62 changed grid data gridOverlay.attr("size", null); } if (version < 1.63) { - // v.1.63 changed ocean pattern opacity element + // v1.63 changed ocean pattern opacity element const oceanPattern = document.getElementById("oceanPattern"); if (oceanPattern) oceanPattern.removeAttribute("opacity"); const oceanicPattern = document.getElementById("oceanicPattern"); @@ -812,7 +812,7 @@ function parseLoadedData(data) { } if (version < 1.64) { - // v.1.64 change states style + // v1.64 change states style const opacity = regions.attr("opacity"); const filter = regions.attr("filter"); statesBody.attr("opacity", opacity).attr("filter", filter); @@ -821,7 +821,7 @@ function parseLoadedData(data) { } if (version < 1.65) { - // v 1.65 changed rivers data + // v1.65 changed rivers data d3.select("#rivers").attr("style", null); // remove style to unhide layer const {cells, rivers} = pack; const defaultWidthFactor = rn(1 / (pointsInput.dataset.cells / 10000) ** 0.25, 2); @@ -869,7 +869,7 @@ function parseLoadedData(data) { } if (version < 1.7) { - // v 1.7 changed markers data + // v1.7 changed markers data const defs = document.getElementById("defs-markers"); const markersGroup = document.getElementById("markers"); @@ -927,6 +927,7 @@ function parseLoadedData(data) { } if (version < 1.72) { + // v1.72 renamed custom style presets const storedStyles = Object.keys(localStorage).filter(key => key.startsWith("style")); storedStyles.forEach(styleName => { const style = localStorage.getItem(styleName); @@ -1050,7 +1051,7 @@ function parseLoadedData(data) { // sort markers by index pack.markers.sort((a, b) => a.i - b.i); } - })(); + })(); changeMapSize(); From d551e42e0c9406368652dc64614b012566a9b662 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Sun, 6 Feb 2022 22:41:02 +0300 Subject: [PATCH 3/3] pump version to v1.73 --- main.js | 1 + 1 file changed, 1 insertion(+) diff --git a/main.js b/main.js index fdf26386..9753d659 100644 --- a/main.js +++ b/main.js @@ -435,6 +435,7 @@ function showWelcomeMessage() { alertMessage.innerHTML = `The Fantasy Map Generator is updated up to version ${version}. This version is compatible with ${changelog}, loaded .map files will be auto-updated.
    Latest changes: +
  • Color picker: new hatchings
  • New style presets: Cyberpunk and Atlas
  • Burg temperature graph
  • 4 new textures