refactor: dynamically load modules

This commit is contained in:
Azgaar 2022-07-08 22:01:11 +03:00
parent a107c58643
commit 347083291f
46 changed files with 161 additions and 164 deletions

View file

@ -11,14 +11,8 @@ import {Rulers} from "./modules/measurers";
// @ts-expect-error js-module
import {applyStoredOptions} from "./modules/ui/options";
import {addGlobalListeners} from "./scripts/listeners";
import {tip} from "./scripts/tooltips";
import {checkForUpdates} from "./scripts/updater";
import {getInputNumber} from "utils/nodeUtils";
// @ts-expect-error js module
import {editUnits} from "modules/ui/editors";
checkForUpdates();
addGlobalListeners();
window.fmg = {
modules: {}
@ -32,14 +26,15 @@ options = {
stateLabelsMode: "auto"
};
checkForUpdates();
applyStoredOptions();
populationRate = getInputNumber("populationRateInput");
distanceScale = getInputNumber("distanceScaleInput");
urbanization = getInputNumber("urbanizationInput");
urbanDensity = getInputNumber("urbanDensityInput");
statesNeutral = 1; // statesEditor growth parameter
applyStoredOptions();
rulers = new Rulers();
biomesData = window.Biomes.getDefault();
nameBases = window.Names.getNameBases(); // cultures-related data
@ -53,8 +48,4 @@ svgWidth = graphWidth;
svgHeight = graphHeight;
defineSvg(graphWidth, graphHeight);
scaleBar.on("mousemove", () => tip("Click to open Units Editor")).on("click", editUnits);
legend
.on("mousemove", () => tip("Drag to change the position. Click to hide the legend"))
.on("click", () => clearLegend());
addGlobalListeners();