Zone filter (#728)

* Adding zone type dropdown to index.html

* added zone type filter to zones-editor.js

* zoneTypes dialog

add and delete types, dialog

* filtering types

* correct filter button and prompt

The filter button now works on click with an added zonesEditorAddLines(); on function toggleFilterTable().

If the table is empty, a message appears on a line giving advice.

* Amount of types and fixes

Fixed some spacing in zoneTypes dialog, and made a count for the amount of zones per type.

* Minor changes for zone types

* dialog for types on a button

New button for the zone Types dialog.

* typo in index.html

* update on click add type

Co-authored-by: Evolvedexperiment <evolvedexperiment@gmail.com>
Co-authored-by: Azgaar <maxganiev@yandex.ru>
This commit is contained in:
Ángel Montero Lamas 2022-02-06 21:09:30 +01:00 committed by GitHub
parent ca2716a5c4
commit 8e7ccbd50d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 165 additions and 3 deletions

View file

@ -122,6 +122,7 @@ let customization = 0;
let biomesData = applyDefaultBiomesSystem();
let nameBases = Names.getNameBases(); // cultures-related data
const zoneTypes = ["Invasion", "Rebels", "Proselytism", "Crusade", "Disease", "Disaster"];
let color = d3.scaleSequential(d3.interpolateSpectral); // default color scheme
const lineGen = d3.line().curve(d3.curveBasis); // d3 line generator with default curve interpolation
@ -1871,6 +1872,14 @@ function addZones(number = 1) {
TIME && console.timeEnd("addZones");
}
// Update zone types
function updateZoneType(zoneId, newType) {
const zone = document.getElementById(zoneId);
if (zone) {
zone.dataset.type = newType;
}
}
// show map stats on generation complete
function showStatistics() {
const template = templateInput.options[templateInput.selectedIndex].text;