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 {TIME} from "config/logging";
import {isLand} from "utils/graphUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import FlatQueue from "flatqueue";
import Delaunator from "delaunator";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {ERROR, TIME} from "config/logging";
import {reMarkFeatures} from "modules/markup";
import {clipPoly} from "utils/lineUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import FlatQueue from "flatqueue";
import {TIME} from "config/logging";

View file

@ -29,3 +29,54 @@ let distanceScale;
let urbanization;
let urbanDensity;
let statesNeutral;
// svg d3 selections
let svg,
defs,
viewbox,
scaleBar,
legend,
ocean,
oceanLayers,
oceanPattern,
lakes,
landmass,
texture,
terrs,
biomes,
cells,
gridOverlay,
coordinates,
compass,
rivers,
terrain,
relig,
cults,
regions,
statesBody,
statesHalo,
provs,
zones,
borders,
stateBorders,
provinceBorders,
routes,
roads,
trails,
searoutes,
temperature,
coastline,
ice,
prec,
population,
emblems,
labels,
icons,
burgLabels,
burgIcons,
anchors,
armies,
markers,
fogging,
ruler,
debug;

View file

@ -1,57 +1,6 @@
"use strict";
// temporary define svg elements as globals
import * as d3 from "d3";
let svg,
defs,
viewbox,
scaleBar,
legend,
ocean,
oceanLayers,
oceanPattern,
lakes,
landmass,
texture,
terrs,
biomes,
cells,
gridOverlay,
coordinates,
compass,
rivers,
terrain,
relig,
cults,
regions,
statesBody,
statesHalo,
provs,
zones,
borders,
stateBorders,
provinceBorders,
routes,
roads,
trails,
searoutes,
temperature,
coastline,
ice,
prec,
population,
emblems,
labels,
icons,
burgLabels,
burgIcons,
anchors,
armies,
markers,
fogging,
ruler,
debug;
function defineSvg(width, height) {
export function defineSvg(width, height) {
// append svg layers (in default order)
svg = d3.select("#map");
defs = svg.select("#deftemp");

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findCell} from "utils/graphUtils";
import {rn} from "utils/numberUtils";
import {rand, P, rw} from "utils/probabilityUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findAll, findCell, getPackPolygon, isLand} from "utils/graphUtils";
import {tip, showMainTip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findAll, findCell, getPackPolygon, isLand} from "utils/graphUtils";
import {tip, showMainTip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findAll, findCell, getPackPolygon, isLand} from "utils/graphUtils";
import {byId} from "utils/shorthands";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {heightmapTemplates} from "config/heightmap-templates";
import {precreatedHeightmaps} from "config/precreated-heightmaps";
import {shouldRegenerateGrid, generateGrid} from "utils/graphUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {byId} from "utils/shorthands";
import {tip} from "scripts/tooltips";
import {capitalize} from "utils/stringUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {isWater} from "utils/graphUtils";
import {tip} from "scripts/tooltips";
import {byId} from "utils/shorthands";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {heightmapTemplates} from "config/heightmap-templates";
import {TIME} from "config/logging";
import {createTypedArray} from "utils/arrayUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {getGridPolygon} from "utils/graphUtils";
import {unique} from "utils/arrayUtils";
import {tip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {updatePresetInput} from "layers";
import {restoreDefaultEvents} from "scripts/events";
import {ldb} from "scripts/indexedDB";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME} from "config/logging";
import {rn} from "utils/numberUtils";
import {aleaPRNG} from "scripts/aleaPRNG";

View file

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

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME} from "config/logging";
import {last} from "utils/arrayUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import polylabel from "polylabel";
import {last} from "utils/arrayUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME} from "config/logging";
import {rn, minmax} from "utils/numberUtils";
import {rand, gauss, ra} from "utils/probabilityUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME} from "config/logging";
import {clipPoly} from "utils/lineUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME} from "config/logging";
import {minmax} from "utils/numberUtils";
import {rand} from "utils/probabilityUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {getPackPolygon} from "utils/graphUtils";
import {rn, minmax} from "utils/numberUtils";
import {rand} from "utils/probabilityUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import FlatQueue from "flatqueue";
import {TIME} from "config/logging";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME, WARN} from "config/logging";
import {last} from "utils/arrayUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import FlatQueue from "flatqueue";
import {TIME} from "config/logging";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findCell} from "utils/graphUtils";
import {getMiddlePoint} from "utils/lineUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {TIME} from "config/logging";
import {minmax, rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {last} from "utils/arrayUtils";
import {tip} from "scripts/tooltips";
import {wiki} from "utils/linkUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findAll, findCell, getPackPolygon, isLand} from "utils/graphUtils";
import {tip, showMainTip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findCell} from "utils/graphUtils";
import {tip, clearMainTip} from "scripts/tooltips";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {tip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {getPackPolygon} from "utils/graphUtils";
import {tip} from "scripts/tooltips";
import {clipPoly} from "utils/lineUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {tip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {byId} from "utils/shorthands";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findCell} from "utils/graphUtils";
import {rn} from "utils/numberUtils";
import {getColorScheme, getHeightColor} from "utils/colorUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {clearMainTip} from "scripts/tooltips";
import {tip} from "scripts/tooltips";
import {openURL} from "utils/linkUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import RgbQuant from "rgbquant";
import {heightmapTemplates} from "config/heightmap-templates";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findGridCell, getGridPolygon} from "utils/graphUtils";
import {tip, clearMainTip} from "scripts/tooltips";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {getPackPolygon} from "utils/graphUtils";
import {tip} from "scripts/tooltips";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {tip} from "scripts/tooltips";
import {wiki} from "utils/linkUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {unique} from "utils/arrayUtils";
import {tip} from "scripts/tooltips";
import {openURL} from "utils/linkUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {heightmapTemplates} from "config/heightmap-templates";
import {precreatedHeightmaps} from "config/precreated-heightmaps";
import {lock, locked} from "scripts/options/lock";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findAll, findCell, getPackPolygon, isLand} from "utils/graphUtils";
import {unique} from "utils/arrayUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {last} from "utils/arrayUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findCell} from "utils/graphUtils";
import {last} from "utils/arrayUtils";
import {tip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {tip, showMainTip, clearMainTip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {getPackPolygon, findCell} from "utils/graphUtils";
import {last} from "utils/arrayUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {findCell, getPackPolygon} from "utils/graphUtils";
import {tip, clearMainTip} from "scripts/tooltips";
import {getSegmentId} from "utils/lineUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {rn} from "utils/numberUtils";
export function overviewRivers() {

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {tip, showMainTip, clearMainTip} from "scripts/tooltips";
import {getSegmentId} from "utils/lineUtils";
import {rn} from "utils/numberUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {tip} from "scripts/tooltips";
import {rn} from "utils/numberUtils";
import {parseTransform} from "utils/stringUtils";

View file

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

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {last} from "utils/arrayUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findCell} from "utils/graphUtils";
import {tip} from "scripts/tooltips";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {tip} from "scripts/tooltips";
import {rn} from "utils/numberUtils";
import {round, parseTransform} from "utils/stringUtils";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {restoreDefaultEvents} from "scripts/events";
import {findAll, findCell, getPackPolygon} from "utils/graphUtils";
import {unique} from "utils/arrayUtils";

View file

@ -1,3 +1,4 @@
import * as d3 from "d3";
import FlatQueue from "flatqueue";
import {TIME} from "config/logging";

View file

@ -1,3 +1,5 @@
import * as d3 from "d3";
import {debounce} from "utils/functionUtils";
import {handleZoom, invokeActiveZooming} from "/src/modules/activeZooming";