From 576fb9a6d0e5b49d074e04a8e875fb6c4f4b3e90 Mon Sep 17 00:00:00 2001 From: Azgaar Date: Tue, 12 Oct 2021 16:36:15 +0300 Subject: [PATCH] showMFCGMap option --- index.html | 5 +++-- main.js | 8 +++++--- modules/ui/burg-editor.js | 16 ++++++++++++++-- 3 files changed, 22 insertions(+), 7 deletions(-) diff --git a/index.html b/index.html index 12565de5..43a3f11e 100644 --- a/index.html +++ b/index.html @@ -2018,7 +2018,7 @@ -
+
See in City Generator by Watabou. Seed: @@ -2047,6 +2047,7 @@
+ @@ -3072,7 +3073,7 @@
Size:
- +
diff --git a/main.js b/main.js index dd84298f..faac4544 100644 --- a/main.js +++ b/main.js @@ -147,10 +147,12 @@ function zoomed() { const zoom = d3.zoom().scaleExtent([1, 20]).on("zoom", zoomed); // default options -let options = {pinNotes: false}; // options object +let options = { + pinNotes: false, + showMFCGMap: true, + winds: [225, 45, 225, 315, 135, 315] +}; let mapCoordinates = {}; // map coordinates on globe -options.winds = [225, 45, 225, 315, 135, 315]; // default wind directions - let populationRate = +document.getElementById("populationRateInput").value; let urbanization = +document.getElementById("urbanizationInput").value; diff --git a/modules/ui/burg-editor.js b/modules/ui/burg-editor.js index 98cae1a5..c61b6ed9 100644 --- a/modules/ui/burg-editor.js +++ b/modules/ui/burg-editor.js @@ -45,6 +45,7 @@ function editBurg(id) { document.getElementById("burgEditAnchorStyle").addEventListener("click", editGroupAnchorStyle); document.getElementById("burgEmblem").addEventListener("click", openEmblemEdit); + document.getElementById("burgToggleMFCGMap").addEventListener("click", toggleMFCGMap); document.getElementById("burgEditEmblem").addEventListener("click", openEmblemEdit); document.getElementById("burgRelocate").addEventListener("click", toggleRelocateBurg); document.getElementById("burglLegend").addEventListener("click", editBurgLegend); @@ -108,8 +109,13 @@ function editBurg(id) { COArenderer.trigger(coaID, b.coa); document.getElementById("burgEmblem").setAttribute("href", "#" + coaID); - updateMFCGFrame(b); - document.getElementById("mfcgBurgSeed").value = getBurgSeed(b); + if (options.showMFCGMap) { + document.getElementById("mfcgPreviewSection").style.display = "block"; + updateMFCGFrame(b); + document.getElementById("mfcgBurgSeed").value = getBurgSeed(b); + } else { + document.getElementById("mfcgPreviewSection").style.display = "none"; + } } // in °C, array from -1 °C; source: https://en.wikipedia.org/wiki/List_of_cities_by_average_temperature @@ -462,6 +468,12 @@ function editBurg(id) { editEmblem("burg", "burgCOA" + id, burg); } + function toggleMFCGMap() { + options.showMFCGMap = !options.showMFCGMap; + document.getElementById("mfcgPreviewSection").style.display = options.showMFCGMap ? "block" : "none"; + document.getElementById("burgToggleMFCGMap").className = options.showMFCGMap ? "icon-map" : "icon-map-o"; + } + function toggleRelocateBurg() { const toggler = document.getElementById("toggleCells"); document.getElementById("burgRelocate").classList.toggle("pressed");