From 166399cdeabcb3a2a40587ae28443f146d0e2a31 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Tue, 8 Aug 2023 13:39:39 +0400 Subject: [PATCH] fix: restore layers after heightmap edit --- index.html | 2 +- modules/ui/heightmap-editor.js | 11 +++++++---- versioning.js | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/index.html b/index.html index 45eac37c..3ebfce42 100644 --- a/index.html +++ b/index.html @@ -7969,7 +7969,7 @@ - + diff --git a/modules/ui/heightmap-editor.js b/modules/ui/heightmap-editor.js index bd41cefe..44be3fa0 100644 --- a/modules/ui/heightmap-editor.js +++ b/modules/ui/heightmap-editor.js @@ -192,11 +192,14 @@ function editHeightmap(options) { document .getElementById("mapLayers") .querySelectorAll("li") - .forEach(function (e) { - if (editHeightmap.layers.includes(e.id) && !layerIsOn(e.id)) e.click(); - // turn on - else if (!editHeightmap.layers.includes(e.id) && layerIsOn(e.id)) e.click(); // turn off + .forEach(e => { + const wasOn = editHeightmap.layers.includes(e.id); + if ((wasOn && !layerIsOn(e.id)) || (!wasOn && layerIsOn(e.id))) e.click(); }); + if (!layerIsOn("toggleBorders")) borders.selectAll("path").remove(); + if (!layerIsOn("toggleStates")) regions.selectAll("path").remove(); + if (!layerIsOn("toggleRivers")) rivers.selectAll("*").remove(); + getCurrentPreset(); } diff --git a/versioning.js b/versioning.js index e3faa023..bdbd43cb 100644 --- a/versioning.js +++ b/versioning.js @@ -1,7 +1,7 @@ "use strict"; // version and caching control -const version = "1.90.03"; // generator version, update each time +const version = "1.90.04"; // generator version, update each time { document.title += " v" + version;