From e8b0b19ff0753f7f1d24f3e3ae72497af68828fb Mon Sep 17 00:00:00 2001 From: Marc Emmanuel Date: Sun, 1 Feb 2026 22:18:05 +0100 Subject: [PATCH] feat: show total land percentage in biomes editor footer (#1301) * feat: show total land percentage in biomes editor footer * feat: update version to 1.112.0 in versioning.js and biomes-editor.js --- public/modules/ui/biomes-editor.js | 6 ++++++ public/versioning.js | 2 +- src/index.html | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-) diff --git a/public/modules/ui/biomes-editor.js b/public/modules/ui/biomes-editor.js index 8c50993d..125aa0da 100644 --- a/public/modules/ui/biomes-editor.js +++ b/public/modules/ui/biomes-editor.js @@ -136,11 +136,13 @@ function editBiomes() { body.innerHTML = lines; // update footer + const totalMapArea = getArea(d3.sum(pack.cells.area)); biomesFooterBiomes.innerHTML = body.querySelectorAll(":scope > div").length; biomesFooterCells.innerHTML = pack.cells.h.filter(h => h >= 20).length; biomesFooterArea.innerHTML = si(totalArea) + unit; biomesFooterPopulation.innerHTML = si(totalPopulation); biomesFooterArea.dataset.area = totalArea; + biomesFooterArea.dataset.mapArea = totalMapArea; biomesFooterPopulation.dataset.population = totalPopulation; // add listeners @@ -255,6 +257,7 @@ function editBiomes() { body.dataset.type = "percentage"; const totalCells = +biomesFooterCells.innerHTML; const totalArea = +biomesFooterArea.dataset.area; + const totalMapArea = +biomesFooterArea.dataset.mapArea; const totalPopulation = +biomesFooterPopulation.dataset.population; body.querySelectorAll(":scope> div").forEach(function (el) { @@ -262,6 +265,9 @@ function editBiomes() { el.querySelector(".biomeArea").innerHTML = rn((+el.dataset.area / totalArea) * 100) + "%"; el.querySelector(".biomePopulation").innerHTML = rn((+el.dataset.population / totalPopulation) * 100) + "%"; }); + + // update footer to show land percentage of total map + biomesFooterArea.innerHTML = rn((totalArea / totalMapArea) * 100) + "%"; } else { body.dataset.type = "absolute"; biomesEditorAddLines(); diff --git a/public/versioning.js b/public/versioning.js index 8069c818..fc81870d 100644 --- a/public/versioning.js +++ b/public/versioning.js @@ -13,7 +13,7 @@ * Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2 */ -const VERSION = "1.111.0"; +const VERSION = "1.112.0"; if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function"); { diff --git a/src/index.html b/src/index.html index 3f46d62c..b1c83815 100644 --- a/src/index.html +++ b/src/index.html @@ -8518,7 +8518,7 @@ - +