mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-20 02:51:23 +01:00
refactor: drawPopulation
This commit is contained in:
parent
7d461aa8f1
commit
bfc83e8f7b
1 changed files with 6 additions and 6 deletions
|
|
@ -318,17 +318,17 @@ function togglePopulation(event) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function drawPopulation(event) {
|
function drawPopulation() {
|
||||||
population.selectAll("line").remove();
|
population.selectAll("line").remove();
|
||||||
const cells = pack.cells,
|
|
||||||
p = cells.p,
|
const {cells, burgs} = pack;
|
||||||
burgs = pack.burgs;
|
|
||||||
const show = d3.transition().duration(2000).ease(d3.easeSinIn);
|
const show = d3.transition().duration(2000).ease(d3.easeSinIn);
|
||||||
|
|
||||||
const rural = Array.from(
|
const rural = Array.from(
|
||||||
cells.i.filter(i => cells.pop[i] > 0),
|
cells.i.filter(i => cells.pop[i] > 0),
|
||||||
i => [p[i][0], p[i][1], p[i][1] - cells.pop[i] / 8]
|
i => [...cells.p[i], cells.p[i][1] - cells.pop[i] / 5]
|
||||||
);
|
);
|
||||||
|
|
||||||
population
|
population
|
||||||
.select("#rural")
|
.select("#rural")
|
||||||
.selectAll("line")
|
.selectAll("line")
|
||||||
|
|
@ -342,7 +342,7 @@ function drawPopulation(event) {
|
||||||
.transition(show)
|
.transition(show)
|
||||||
.attr("y2", d => d[2]);
|
.attr("y2", d => d[2]);
|
||||||
|
|
||||||
const urban = burgs.filter(b => b.i && !b.removed).map(b => [b.x, b.y, b.y - (b.population / 8) * urbanization]);
|
const urban = burgs.filter(b => b.i && !b.removed).map(b => [b.x, b.y, b.y - (b.population / 5) * urbanization]);
|
||||||
population
|
population
|
||||||
.select("#urban")
|
.select("#urban")
|
||||||
.selectAll("line")
|
.selectAll("line")
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue