mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-16 17:31:24 +01:00
v1.0.38
This commit is contained in:
parent
842361ae16
commit
ed720300ff
4 changed files with 29 additions and 17 deletions
|
|
@ -2602,10 +2602,11 @@
|
|||
<div id="burgsEditor" class="dialog stable" style="display: none">
|
||||
<div id="burgsHeader" class="header">
|
||||
<div style="left:1.4em" data-tip="Click to sort by burg name" class="sortable alphabetically" data-sortby="name">Burg </div>
|
||||
<div style="left:7.7em" data-tip="Click to sort by culture name" class="sortable alphabetically" data-sortby="culture">Culture </div>
|
||||
<div style="left:12em" data-tip="Click to sort by burg population" class="sortable" data-sortby="population">Population </div>
|
||||
<div style="left:18.7em" data-tip="Click to sort by burg type" class="sortable alphabetically" data-sortby="type">Type </div>
|
||||
<div style="left:22em" data-tip="Click to sort by state name" class="sortable alphabetically" data-sortby="state" id="burgStateHeader">State </div>
|
||||
<div style="left:7.6em" data-tip="Click to sort by province name" class="sortable alphabetically" data-sortby="province">Province </div>
|
||||
<div style="left:14em" data-tip="Click to sort by state name" class="sortable alphabetically" data-sortby="state">State </div>
|
||||
<div style="left:20.1em" data-tip="Click to sort by culture name" class="sortable alphabetically" data-sortby="culture">Culture </div>
|
||||
<div style="left:24.7em" data-tip="Click to sort by burg population" class="sortable" data-sortby="population">Population </div>
|
||||
<div style="left:31.2em" data-tip="Click to sort by burg type" class="sortable alphabetically" data-sortby="type">Type </div>
|
||||
</div>
|
||||
|
||||
<div id="burgsBody" class="burgs-table"></div>
|
||||
|
|
|
|||
|
|
@ -60,8 +60,6 @@ function editBurgs() {
|
|||
if (selectedState != -1) filtered = filtered.filter(b => b.state === selectedState); // filtered by state
|
||||
if (selectedCulture != -1) filtered = filtered.filter(b => b.culture === selectedCulture); // filtered by culture
|
||||
|
||||
const showState = selectedState == -1 ? "visible" : "hidden";
|
||||
document.getElementById("burgStateHeader").style.display = `${selectedState == -1 ? "inline-block" : "none"}`;
|
||||
body.innerHTML = "";
|
||||
let lines = "", totalPopulation = 0;
|
||||
|
||||
|
|
@ -70,11 +68,15 @@ function editBurgs() {
|
|||
totalPopulation += population;
|
||||
const type = b.capital && b.port ? "a-capital-port" : b.capital ? "c-capital" : b.port ? "p-port" : "z-burg";
|
||||
const state = pack.states[b.state].name;
|
||||
const prov = pack.cells.province[b.cell];
|
||||
const province = prov ? pack.provinces[prov].name : "";
|
||||
const culture = pack.cultures[b.culture].name;
|
||||
|
||||
lines += `<div class="states" data-id=${b.i} data-name=${b.name} data-state=${state} data-culture=${culture} data-population=${population} data-type=${type}>
|
||||
lines += `<div class="states" data-id=${b.i} data-name=${b.name} data-state=${state} data-province=${province} data-culture=${culture} data-population=${population} data-type=${type}>
|
||||
<span data-tip="Click to zoom into view" class="icon-dot-circled pointer"></span>
|
||||
<input data-tip="Burg name. Click and type to change" class="burgName" value="${b.name}" autocorrect="off" spellcheck="false">
|
||||
<input data-tip="Burg province" class="burgState" value="${province}" disabled>
|
||||
<input data-tip="Burg state" class="burgState" value="${state}" disabled>
|
||||
<select data-tip="Dominant culture. Click to change" class="stateCulture">${getCultureOptions(b.culture)}</select>
|
||||
<span data-tip="Burg population" class="icon-male"></span>
|
||||
<input data-tip="Burg population. Type to change" class="burgPopulation" value=${si(population)}>
|
||||
|
|
@ -82,7 +84,6 @@ function editBurgs() {
|
|||
<span data-tip="${b.capital ? ' This burg is a state capital' : 'Click to assign a capital status'}" class="icon-star-empty${b.capital ? '' : ' inactive pointer'}"></span>
|
||||
<span data-tip="Click to toggle port status" class="icon-anchor pointer${b.port ? '' : ' inactive'}" style="font-size:.9em"></span>
|
||||
</div>
|
||||
<span data-tip="Burg state" class="burgState ${showState}">${state}</span>
|
||||
<span data-tip="Remove burg" class="icon-trash-empty"></span>
|
||||
</div>`;
|
||||
}
|
||||
|
|
@ -226,7 +227,6 @@ function editBurgs() {
|
|||
this.classList.add("pressed");
|
||||
tip("Click on the map to create a new burg. Hold Shift to add multiple", true);
|
||||
viewbox.style("cursor", "crosshair").on("click", addBurgOnClick);
|
||||
body.querySelectorAll("div > *").forEach(e => e.disabled = true);
|
||||
}
|
||||
|
||||
function addBurgOnClick() {
|
||||
|
|
@ -246,20 +246,22 @@ function editBurgs() {
|
|||
customization = 0;
|
||||
restoreDefaultEvents();
|
||||
clearMainTip();
|
||||
body.querySelectorAll("div > *").forEach(e => e.disabled = false);
|
||||
if (addBurgTool.classList.contains("pressed")) addBurgTool.classList.remove("pressed");
|
||||
if (addNewBurg.classList.contains("pressed")) addNewBurg.classList.remove("pressed");
|
||||
}
|
||||
|
||||
function downloadBurgsData() {
|
||||
let data = "Id,Burg,State,Culture,Population,Longitude,Latitude,Elevation ("+heightUnit.value+"),Capital,Port\n"; // headers
|
||||
let data = "Id,Burg,Province,State,Culture,Religion,Population,Longitude,Latitude,Elevation ("+heightUnit.value+"),Capital,Port\n"; // headers
|
||||
const valid = pack.burgs.filter(b => b.i && !b.removed); // all valid burgs
|
||||
|
||||
valid.forEach(b => {
|
||||
data += b.i + ",";
|
||||
data += b.name + ",";
|
||||
data += pack.states[b.state].name + ",";
|
||||
const province = pack.cells.province[b.cell];
|
||||
data += province ? pack.provinces[province].fullName + "," : ",";
|
||||
data += b.state ? pack.states[b.state].fullName : pack.states[b.state].name + ",";
|
||||
data += pack.cultures[b.culture].name + ",";
|
||||
data += pack.religions[pack.cells.religion[b.cell]].name + ",";
|
||||
data += rn(b.population * populationRate.value * urbanization.value) + ",";
|
||||
|
||||
// add geography data
|
||||
|
|
|
|||
|
|
@ -379,7 +379,7 @@ function editProvinces() {
|
|||
.attr("x", d => d.x0).attr("y", d => d.y0)
|
||||
.attr("width", d => d.x1 - d.x0).attr("height", d => d.y1 - d.y0);
|
||||
|
||||
node.select("text").attr("opacity", 1).transition().duration(1500)
|
||||
node.select("text").transition().duration(1500)
|
||||
.attr("x", d => d.x0).attr("y", d => d.y0);
|
||||
|
||||
setTimeout(hideNonfittingLabels, 2000);
|
||||
|
|
|
|||
|
|
@ -150,8 +150,8 @@ function editReligions() {
|
|||
const rural = r.rural * populationRate.value;
|
||||
const urban = r.urban * populationRate.value * urbanization.value;
|
||||
const population = rural + urban > 0 ? ". " + si(rn(rural + urban)) + " believers" : ". Extinct";
|
||||
const hint = ". Drag to change the origin";
|
||||
info.innerHTML = `${r.name}${type}${form}${population}${hint}`;
|
||||
info.innerHTML = `${r.name}${type}${form}${population}`;
|
||||
tip("Drag to change parent. Hold CTRL and click to change abbrebiation");
|
||||
}
|
||||
|
||||
const el = body.querySelector(`div[data-id='${religion}']`);
|
||||
|
|
@ -169,6 +169,7 @@ function editReligions() {
|
|||
if (info) {
|
||||
d3.select("#religionHierarchy").select("g[data-id='"+religion+"'] > path").classed("selected", 0);
|
||||
info.innerHTML = "‍";
|
||||
tip("");
|
||||
}
|
||||
|
||||
const el = body.querySelector(`div[data-id='${religion}']`)
|
||||
|
|
@ -349,7 +350,8 @@ function editReligions() {
|
|||
});
|
||||
|
||||
function dragToReorigin(d) {
|
||||
console.log("dragToReorigin");
|
||||
if (d3.event.sourceEvent.ctrlKey) {changeReligionCode(d); return;}
|
||||
|
||||
const originLine = graph.append("path")
|
||||
.attr("class", "dragLine").attr("d", `M${d.x},${d.y}L${d.x},${d.y}`);
|
||||
|
||||
|
|
@ -371,6 +373,13 @@ function editReligions() {
|
|||
showHierarchy() // update hierarchy
|
||||
});
|
||||
}
|
||||
|
||||
function changeReligionCode(d) {
|
||||
const code = prompt(`Please provide an abbreviation for ${d.data.name}`, d.data.code);
|
||||
if (!code) return;
|
||||
pack.religions[d.data.i].code = code;
|
||||
nodes.select("g[data-id='"+d.data.i+"']").select("text").text(code);
|
||||
}
|
||||
}
|
||||
|
||||
function toggleExtinct() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue