feat: show total land percentage in biomes editor footer (#1301)
Some checks are pending
Deploy static content to Pages / deploy (push) Waiting to run
Code quality / quality (push) Waiting to run

* feat: show total land percentage in biomes editor footer

* feat: update version to 1.112.0 in versioning.js and biomes-editor.js
This commit is contained in:
Marc Emmanuel 2026-02-01 22:18:05 +01:00 committed by GitHub
parent 0f19902a56
commit e8b0b19ff0
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 8 additions and 2 deletions

View file

@ -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();

View file

@ -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");
{