From 1fe6156ea21e46078b42ca38c988febeb1525c64 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Fri, 30 Aug 2024 13:43:50 +0200 Subject: [PATCH] chore: update version --- index.html | 30 +++++++++---------- modules/dynamic/export-json.js | 6 ++-- modules/io/load.js | 1 + modules/io/save.js | 4 ++- modules/ui/options.js | 2 +- .../ui/{stylePresets.js => style-presets.js} | 0 modules/ui/zones-editor.js | 14 ++++----- 7 files changed, 31 insertions(+), 26 deletions(-) rename modules/ui/{stylePresets.js => style-presets.js} (100%) diff --git a/index.html b/index.html index 3e016977..f83db952 100644 --- a/index.html +++ b/index.html @@ -7995,7 +7995,7 @@ - + @@ -8009,25 +8009,25 @@ - + - + - - - + + + - + - + @@ -8043,14 +8043,14 @@ - + - - - + + + @@ -8065,9 +8065,9 @@ - - + + - + diff --git a/modules/dynamic/export-json.js b/modules/dynamic/export-json.js index 231c7a73..cc895b7a 100644 --- a/modules/dynamic/export-json.js +++ b/modules/dynamic/export-json.js @@ -53,7 +53,8 @@ function getMinimalDataJson() { religions: pack.religions, rivers: pack.rivers, markers: pack.markers, - routes: pack.routes + routes: pack.routes, + zones: pack.zones }; return JSON.stringify({info, settings, mapCoordinates, pack: packData, biomesData, notes, nameBases}); } @@ -172,7 +173,8 @@ function getPackCellsData() { religions: pack.religions, rivers: pack.rivers, markers: pack.markers, - routes: pack.routes + routes: pack.routes, + zones: pack.zones }; } diff --git a/modules/io/load.js b/modules/io/load.js index f8e23813..6462b35f 100644 --- a/modules/io/load.js +++ b/modules/io/load.js @@ -379,6 +379,7 @@ async function parseLoadedData(data, mapVersion) { pack.rivers = data[32] ? JSON.parse(data[32]) : []; pack.markers = data[35] ? JSON.parse(data[35]) : []; pack.routes = data[37] ? JSON.parse(data[37]) : []; + pack.zones = data[38] ? JSON.parse(data[38]) : []; const cells = pack.cells; cells.biome = Uint8Array.from(data[16].split(",")); diff --git a/modules/io/save.js b/modules/io/save.js index 83c352d3..96d1d981 100644 --- a/modules/io/save.js +++ b/modules/io/save.js @@ -100,6 +100,7 @@ function prepareMapData() { const markers = JSON.stringify(pack.markers); const cellRoutes = JSON.stringify(pack.cells.routes); const routes = JSON.stringify(pack.routes); + const zones = JSON.stringify(pack.zones); // store name array only if not the same as default const defaultNB = Names.getNameBases(); @@ -152,7 +153,8 @@ function prepareMapData() { fonts, markers, cellRoutes, - routes + routes, + zones ].join("\r\n"); return mapData; } diff --git a/modules/ui/options.js b/modules/ui/options.js index 6d0a9fef..b7b643a1 100644 --- a/modules/ui/options.js +++ b/modules/ui/options.js @@ -782,7 +782,7 @@ function showExportPane() { } async function exportToJson(type) { - const {exportToJson} = await import("../dynamic/export-json.js?v=1.97.08"); + const {exportToJson} = await import("../dynamic/export-json.js?v=1.100.00"); exportToJson(type); } diff --git a/modules/ui/stylePresets.js b/modules/ui/style-presets.js similarity index 100% rename from modules/ui/stylePresets.js rename to modules/ui/style-presets.js diff --git a/modules/ui/zones-editor.js b/modules/ui/zones-editor.js index 5234e8a0..6b466448 100644 --- a/modules/ui/zones-editor.js +++ b/modules/ui/zones-editor.js @@ -34,8 +34,8 @@ function editZones() { body.on("click", function (ev) { const el = ev.target; - const cl = el.classList; - const zoneId = +(cl.contains("states") ? el.dataset.id : el.parentNode.dataset.id); + const classList = el.classList; + const zoneId = +(classList.contains("states") ? el.dataset.id : el.parentNode.dataset.id); const zone = pack.zones.find(z => z.i === zoneId); if (!zone) return; @@ -46,11 +46,11 @@ function editZones() { return; } - if (el.tagName === "FILL-BOX") changeFill(el.getAttribute("fill"), zone); - else if (cl.contains("zonePopulation")) changePopulation(zone); - else if (cl.contains("icon-trash-empty")) zoneRemove(zone); - else if (cl.contains("icon-eye")) toggleVisibility(zone); - else if (cl.contains("icon-pin")) toggleFog(zone, cl); + if (el.closest("fill-box")) changeFill(el.getAttribute("fill"), zone); + else if (classList.contains("zonePopulation")) changePopulation(zone); + else if (classList.contains("icon-trash-empty")) zoneRemove(zone); + else if (classList.contains("icon-eye")) toggleVisibility(zone); + else if (classList.contains("icon-pin")) toggleFog(zone, classList); }); body.on("input", function (ev) {