refactor: import d3

This commit is contained in:
Azgaar 2022-07-05 21:12:55 +03:00
parent 1847772d74
commit 98ae3292fc
83 changed files with 709 additions and 69 deletions

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {rn} from "utils/numberUtils";
import {round} from "utils/stringUtils";
import {byId} from "utils/shorthands";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {getProvincesVertices} from "./drawProvinces";
import {minmax, rn} from "utils/numberUtils";
import {byId} from "utils/shorthands";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
export function drawGrid() {
gridOverlay.selectAll("*").remove();
const pattern = "#pattern_" + (gridOverlay.attr("type") || "pointyHex");

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {getColorScheme, getHeightColor} from "utils/colorUtils";
export function drawHeightmap() {

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
export function drawPopulation(event) {
population.selectAll("line").remove();

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
export function drawPrecipitation() {
prec.selectAll("circle").remove();
const {cells, points} = grid;

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import polylabel from "polylabel";
export function drawStates() {

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {convertTemperature} from "utils/unitUtils";
export function drawTemperature() {

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {tip} from "scripts/tooltips";
import {getBase64} from "utils/functionUtils";
import {isCtrlPressed} from "utils/keyboardUtils";
@ -139,14 +141,14 @@ function togglePopulation(event?: MouseEvent) {
.select("#rural")
.selectAll("line")
.transition(hide)
.attr("y2", d => d[1])
.attr("y2", (d: any[]) => d[1])
.remove();
population
.select("#urban")
.selectAll("line")
.transition(hide)
.delay(1000)
.attr("y2", d => d[1])
.attr("y2", (d: any[]) => d[1])
.remove();
}
}
@ -473,8 +475,8 @@ function toggleScaleBar(event?: MouseEvent) {
}
async function openUnitsEditor() {
// @ts-ignore fix dynamic import
const {editUnits} = await import("./../modules/ui/unitsEditor.js");
// @ts-ignore untyped module
const {editUnits} = await import("../modules/ui/units-editor.js");
editUnits();
}
}