v1.5.82 - bug fixes

This commit is contained in:
Azgaar 2021-03-01 17:56:51 +03:00
parent 2f70df6c59
commit 4fdb265b56
7 changed files with 26 additions and 606 deletions

View file

@ -924,11 +924,12 @@
const max = percentage == 100 ? 1000 : gauss(20, 5, 5, 100) * percentage ** .5; // max growth
const forms = {
Monarchy:{County:11, Earldom:3, Shire:1, Landgrave:1, Margrave:1, Barony:1},
Republic:{Province:6, Department:2, Governorate:2, District:1, Canton:1, Prefecture:1},
Theocracy:{Parish:3, Deanery:1},
Union:{Province:1, State:1, Canton:1, Republic:1, County:1, Council:1},
Wild:{Territory:10, Land:5, Region:2, Tribe:1, Clan:1, Dependency:1, Area: 1}
Monarchy: {County:11, Earldom:3, Shire:1, Landgrave:1, Margrave:1, Barony:1},
Republic: {Province:6, Department:2, Governorate:2, District:1, Canton:1, Prefecture:1},
Theocracy: {Parish:3, Deanery:1},
Union: {Province:1, State:1, Canton:1, Republic:1, County:1, Council:1},
Anarchy: {Council:1, Commune:1, Community:1, Tribe:1},
Wild: {Territory:10, Land:5, Region:2, Tribe:1, Clan:1, Dependency:1, Area: 1}
}
// generate provinces for a selected burgs
@ -952,7 +953,7 @@
const nameByBurg = P(.5);
const name = nameByBurg ? stateBurgs[i].name : Names.getState(Names.getCultureShort(c), c);
const formName = rw(form);
form[formName] += 5;
form[formName] += 10;
const fullName = name + " " + formName;
const color = getMixedColor(s.color);
const kinship = nameByBurg ? .8 : .4;

View file

@ -488,7 +488,7 @@
const getShield = function(culture, state) {
const emblemShape = document.getElementById("emblemShape");
const shapeGroup = emblemShape.selectedOptions[0].parentNode.label;
const shapeGroup = emblemShape.selectedOptions[0]?.parentNode.label || "Diversiform";
if (shapeGroup !== "Diversiform") return emblemShape.value;
if (emblemShape.value === "state" && state && pack.states[state].coa) return pack.states[state].coa.shield;

View file

@ -115,20 +115,20 @@ async function getMapURL(type, subtype) {
const symbols = cloneEl.querySelectorAll("symbol");
for (let i=0; i < symbols.length; i++) {
const id = symbols[i].id;
if (cloneEl.querySelector("use[href='#"+id+"']")) continue;
if (cloneEl.querySelector("use[*|href='#"+id+"']")) continue;
symbols[i].remove();
}
// add displayed emblems
if (layerIsOn("toggleEmblems") && emblems.selectAll("use").size()) {
Array.from(cloneEl.getElementById("emblems").querySelectorAll("use")).forEach(el => {
const href = el.getAttribute("href");
cloneEl.getElementById("emblems")?.querySelectorAll("use").forEach(el => {
const href = el.getAttribute("href") || el.getAttribute("xlink:href");
if (!href) return;
const emblem = document.getElementById(href.slice(1));
if (emblem) cloneDefs.append(emblem.cloneNode(true));
});
} else {
cloneDefs.querySelector("#defs-emblems").remove();
cloneDefs.querySelector("#defs-emblems")?.remove();
}
// add ocean pattern
@ -141,9 +141,10 @@ async function getMapURL(type, subtype) {
// add relief icons
if (cloneEl.getElementById("terrain")) {
const uniqueElements = new Set();
const terrainElements = cloneEl.getElementById("terrain").childNodes;
for (let i=0; i < terrainElements.length; i++) {
uniqueElements.add(terrainElements[i].getAttribute("href"));
const terrainNodes = cloneEl.getElementById("terrain").childNodes;
for (let i=0; i < terrainNodes.length; i++) {
const href = terrainNodes[i].getAttribute("href") || terrainNodes[i].getAttribute("xlink:href");
uniqueElements.add(href);
}
const defsRelief = svgDefs.getElementById("defs-relief");

View file

@ -414,9 +414,16 @@ function togglePopulation(event) {
} else {
if (event && isCtrlClick(event)) {editStyle("population"); return;}
turnButtonOff("togglePopulation");
const hide = d3.transition().duration(1000).ease(d3.easeSinIn);
population.select("#rural").selectAll("line").transition(hide).attr("y2", d => d[1]).remove();
population.select("#urban").selectAll("line").transition(hide).delay(1000).attr("y2", d => d[1]).remove();
const isD3data = population.select("line").datum();
if (!isD3data) {
// just remove
population.selectAll("line").remove();
} else {
// remove with animation
const hide = d3.transition().duration(1000).ease(d3.easeSinIn);
population.select("#rural").selectAll("line").transition(hide).attr("y2", d => d[1]).remove();
population.select("#urban").selectAll("line").transition(hide).delay(1000).attr("y2", d => d[1]).remove();
}
}
}