v 0.8.05b

This commit is contained in:
Azgaar 2019-04-25 21:47:08 +03:00
parent 9aa369b6df
commit 6cb21bbead
6 changed files with 66 additions and 44 deletions

View file

@ -337,9 +337,6 @@ function togglePopulation() {
function drawPopulation() {
population.selectAll("line").remove();
const cells = pack.cells, p = cells.p, burgs = pack.burgs;
// pack.cells.pop.reduce((s=0,v) => s+v)
// pack.burgs.map(b => b.population).reduce((s=0,v) => s+v)
const show = d3.transition().duration(2000).ease(d3.easeSinIn);
const rural = Array.from(cells.i.filter(i => cells.pop[i] > 0), i => [p[i][0], p[i][1], p[i][1] - cells.pop[i] / 8]);
@ -348,7 +345,7 @@ function drawPopulation() {
.attr("x2", d => d[0]).attr("y2", d => d[1])
.transition(show).attr("y2", d => d[2]);
const urban = burgs.filter(b => b.i).map(b => [b.x, b.y, b.y - b.population / 8 * urbanization.value]);
const urban = burgs.filter(b => b.i && !b.removed).map(b => [b.x, b.y, b.y - b.population / 8 * urbanization.value]);
population.select("#urban").selectAll("line").data(urban).enter().append("line")
.attr("x1", d => d[0]).attr("y1", d => d[1])
.attr("x2", d => d[0]).attr("y2", d => d[1])