mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 18:11:24 +01:00
refactor: drawPrec
This commit is contained in:
parent
dffe7f4774
commit
b3dc8da683
1 changed files with 3 additions and 5 deletions
|
|
@ -261,7 +261,6 @@ function drawPrec() {
|
||||||
prec.selectAll("circle").remove();
|
prec.selectAll("circle").remove();
|
||||||
const {cells, points} = grid;
|
const {cells, points} = grid;
|
||||||
|
|
||||||
prec.style("display", "block");
|
|
||||||
const show = d3.transition().duration(800).ease(d3.easeSinIn);
|
const show = d3.transition().duration(800).ease(d3.easeSinIn);
|
||||||
prec.selectAll("text").attr("opacity", 0).transition(show).attr("opacity", 1);
|
prec.selectAll("text").attr("opacity", 0).transition(show).attr("opacity", 1);
|
||||||
|
|
||||||
|
|
@ -270,6 +269,7 @@ function drawPrec() {
|
||||||
const getRadius = prec => rn(Math.sqrt(prec / 4) / cellsNumberModifier, 2);
|
const getRadius = prec => rn(Math.sqrt(prec / 4) / cellsNumberModifier, 2);
|
||||||
|
|
||||||
prec
|
prec
|
||||||
|
.style("display", "block")
|
||||||
.selectAll("circle")
|
.selectAll("circle")
|
||||||
.data(data)
|
.data(data)
|
||||||
.enter()
|
.enter()
|
||||||
|
|
@ -287,11 +287,9 @@ function togglePopulation(event) {
|
||||||
drawPopulation();
|
drawPopulation();
|
||||||
if (event && isCtrlClick(event)) editStyle("population");
|
if (event && isCtrlClick(event)) editStyle("population");
|
||||||
} else {
|
} else {
|
||||||
if (event && isCtrlClick(event)) {
|
if (event && isCtrlClick(event)) return editStyle("population");
|
||||||
editStyle("population");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
turnButtonOff("togglePopulation");
|
turnButtonOff("togglePopulation");
|
||||||
|
|
||||||
const isD3data = population.select("line").datum();
|
const isD3data = population.select("line").datum();
|
||||||
if (!isD3data) {
|
if (!isD3data) {
|
||||||
// just remove
|
// just remove
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue