Skip to content

Commit e8b0b19

Browse files
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
1 parent 0f19902 commit e8b0b19

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

public/modules/ui/biomes-editor.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -136,11 +136,13 @@ function editBiomes() {
136136
body.innerHTML = lines;
137137

138138
// update footer
139+
const totalMapArea = getArea(d3.sum(pack.cells.area));
139140
biomesFooterBiomes.innerHTML = body.querySelectorAll(":scope > div").length;
140141
biomesFooterCells.innerHTML = pack.cells.h.filter(h => h >= 20).length;
141142
biomesFooterArea.innerHTML = si(totalArea) + unit;
142143
biomesFooterPopulation.innerHTML = si(totalPopulation);
143144
biomesFooterArea.dataset.area = totalArea;
145+
biomesFooterArea.dataset.mapArea = totalMapArea;
144146
biomesFooterPopulation.dataset.population = totalPopulation;
145147

146148
// add listeners
@@ -255,13 +257,17 @@ function editBiomes() {
255257
body.dataset.type = "percentage";
256258
const totalCells = +biomesFooterCells.innerHTML;
257259
const totalArea = +biomesFooterArea.dataset.area;
260+
const totalMapArea = +biomesFooterArea.dataset.mapArea;
258261
const totalPopulation = +biomesFooterPopulation.dataset.population;
259262

260263
body.querySelectorAll(":scope> div").forEach(function (el) {
261264
el.querySelector(".biomeCells").innerHTML = rn((+el.dataset.cells / totalCells) * 100) + "%";
262265
el.querySelector(".biomeArea").innerHTML = rn((+el.dataset.area / totalArea) * 100) + "%";
263266
el.querySelector(".biomePopulation").innerHTML = rn((+el.dataset.population / totalPopulation) * 100) + "%";
264267
});
268+
269+
// update footer to show land percentage of total map
270+
biomesFooterArea.innerHTML = rn((totalArea / totalMapArea) * 100) + "%";
265271
} else {
266272
body.dataset.type = "absolute";
267273
biomesEditorAddLines();

public/versioning.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
* Example: 1.102.2 -> Major version 1, Minor version 102, Patch version 2
1414
*/
1515

16-
const VERSION = "1.111.0";
16+
const VERSION = "1.112.0";
1717
if (parseMapVersion(VERSION) !== VERSION) alert("versioning.js: Invalid format or parsing function");
1818

1919
{

src/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8518,7 +8518,7 @@
85188518
<script defer src="modules/ui/world-configurator.js?v=1.105.4"></script>
85198519
<script defer src="modules/ui/heightmap-editor.js?v=1.105.2"></script>
85208520
<script defer src="modules/ui/provinces-editor.js?v=1.108.1"></script>
8521-
<script defer src="modules/ui/biomes-editor.js?v=1.108.4"></script>
8521+
<script defer src="modules/ui/biomes-editor.js?v=1.112.0"></script>
85228522
<script defer src="modules/ui/namesbase-editor.js?v=1.105.11"></script>
85238523
<script defer src="modules/ui/elevation-profile.js?v=1.99.00"></script>
85248524
<script defer src="modules/ui/temperature-graph.js?v=1.106.6"></script>

0 commit comments

Comments
 (0)