mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +01:00
Merge 30261ce962 into ec993d1a9b
This commit is contained in:
commit
d325f52fc8
2 changed files with 13 additions and 0 deletions
|
|
@ -4579,6 +4579,7 @@
|
||||||
<div id="provincesBottom">
|
<div id="provincesBottom">
|
||||||
<button id="provincesEditorRefresh" data-tip="Refresh the Editor" class="icon-cw"></button>
|
<button id="provincesEditorRefresh" data-tip="Refresh the Editor" class="icon-cw"></button>
|
||||||
<button id="provincesEditStyle" data-tip="Edit provinces style in Style Editor" class="icon-adjust"></button>
|
<button id="provincesEditStyle" data-tip="Edit provinces style in Style Editor" class="icon-adjust"></button>
|
||||||
|
<button id="provincesLegend" data-tip="Toggle Legend box" class="icon-list-bullet"></button>
|
||||||
<button
|
<button
|
||||||
id="provincesRecolor"
|
id="provincesRecolor"
|
||||||
data-tip="Recolor listed provinces based on state color"
|
data-tip="Recolor listed provinces based on state color"
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@ function editProvinces() {
|
||||||
document.getElementById("provincesEditorRefresh").addEventListener("click", refreshProvincesEditor);
|
document.getElementById("provincesEditorRefresh").addEventListener("click", refreshProvincesEditor);
|
||||||
document.getElementById("provincesEditStyle").addEventListener("click", () => editStyle("provs"));
|
document.getElementById("provincesEditStyle").addEventListener("click", () => editStyle("provs"));
|
||||||
document.getElementById("provincesFilterState").addEventListener("change", provincesEditorAddLines);
|
document.getElementById("provincesFilterState").addEventListener("change", provincesEditorAddLines);
|
||||||
|
document.getElementById("provincesLegend").addEventListener("click", toggleLegend);
|
||||||
document.getElementById("provincesPercentage").addEventListener("click", togglePercentageMode);
|
document.getElementById("provincesPercentage").addEventListener("click", togglePercentageMode);
|
||||||
document.getElementById("provincesChart").addEventListener("click", showChart);
|
document.getElementById("provincesChart").addEventListener("click", showChart);
|
||||||
document.getElementById("provincesToggleLabels").addEventListener("click", toggleLabels);
|
document.getElementById("provincesToggleLabels").addEventListener("click", toggleLabels);
|
||||||
|
|
@ -583,6 +584,17 @@ function editProvinces() {
|
||||||
pack.provinces[p].center = pack.burgs[+value].cell;
|
pack.provinces[p].center = pack.burgs[+value].cell;
|
||||||
pack.provinces[p].burg = +value;
|
pack.provinces[p].burg = +value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function toggleLegend() {
|
||||||
|
if (legend.selectAll("*").size()) return clearLegend(); // hide legend
|
||||||
|
|
||||||
|
const selectedState = +document.getElementById("provincesFilterState").value;
|
||||||
|
const data = pack.provinces
|
||||||
|
.filter(p => p.i && !p.removed && ((selectedState < 0) || (selectedState >= 0 && p.state == selectedState)))
|
||||||
|
.sort((a, b) => b.area - a.area)
|
||||||
|
.map(p => [p.i, p.color, p.name]);
|
||||||
|
drawLegend("Provinces", data);
|
||||||
|
}
|
||||||
|
|
||||||
function togglePercentageMode() {
|
function togglePercentageMode() {
|
||||||
if (body.dataset.type === "absolute") {
|
if (body.dataset.type === "absolute") {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue