mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 10:01:23 +01:00
refactor(es modules): modulize utils
This commit is contained in:
parent
7ccebec048
commit
21fc303320
20 changed files with 25 additions and 6 deletions
|
|
@ -4,6 +4,7 @@ import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
|||
import {getRandomColor} from "/src/utils/colorUtils";
|
||||
import {openURL} from "@/utils/linkUtils";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function editBiomes() {
|
||||
if (customization) return;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {findCell} from "/src/utils/graphUtils";
|
|||
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||
import {getCoordinates} from "@/utils/coordinateUtils";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {si, siToInteger} from "@/utils/unitUtils";
|
||||
|
||||
export function overviewBurgs() {
|
||||
if (customization) return;
|
||||
|
|
@ -202,7 +203,7 @@ export function overviewBurgs() {
|
|||
this.value = si(this.value);
|
||||
|
||||
const population = [];
|
||||
body.querySelectorAll(":scope > div").forEach(el => population.push(+getInteger(el.dataset.population)));
|
||||
body.querySelectorAll(":scope > div").forEach(el => population.push(siToInteger(el.dataset.population)));
|
||||
burgsFooterPopulation.innerHTML = si(d3.mean(population));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {tip} from "/src/scripts/tooltips";
|
|||
import {clipPoly} from "@/utils/lineUtils";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {round} from "@/utils/stringUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function editCoastline(node = d3.event.target) {
|
||||
if (customization) return;
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {findCell, findGridCell} from "/src/utils/graphUtils";
|
|||
import {rn} from "/src/utils/numberUtils";
|
||||
import {link} from "@/utils/linkUtils";
|
||||
import {getCoordinates, toDMS} from "@/utils/coordinateUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
// fit full-screen map if window is resized
|
||||
window.addEventListener("resize", function (e) {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {tip} from "/src/scripts/tooltips";
|
|||
import {rn} from "/src/utils/numberUtils";
|
||||
import {rand} from "@/utils/probabilityUtils";
|
||||
import {round} from "@/utils/stringUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function editLake() {
|
||||
if (customization) return;
|
||||
|
|
|
|||
|
|
@ -10,6 +10,7 @@ import {rn, minmax, normalize} from "/src/utils/numberUtils";
|
|||
import {isCtrlClick} from "@/utils/keyboardUtils";
|
||||
import {prompt} from "@/scripts/prompt";
|
||||
import {rand, P} from "@/utils/probabilityUtils";
|
||||
import {convertTemperature} from "@/utils/unitUtils";
|
||||
|
||||
let presets = {};
|
||||
restoreCustomPresets(); // run on-load
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {tip} from "/src/scripts/tooltips";
|
|||
import {wiki} from "@/utils/linkUtils";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {capitalize} from "@/utils/stringUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function overviewMilitary() {
|
||||
if (customization) return;
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {getRandomColor} from "/src/utils/colorUtils";
|
|||
import {rn} from "/src/utils/numberUtils";
|
||||
import {rand, P} from "@/utils/probabilityUtils";
|
||||
import {parseTransform} from "@/utils/stringUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function editProvinces() {
|
||||
if (customization) return;
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {last} from "/src/utils/arrayUtils";
|
|||
import {tip, clearMainTip} from "/src/scripts/tooltips";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {capitalize} from "@/utils/stringUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function overviewRegiments(state) {
|
||||
if (customization) return;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {tip} from "/src/scripts/tooltips";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {round} from "@/utils/stringUtils";
|
||||
import {convertTemperature} from "@/utils/unitUtils";
|
||||
|
||||
export function showBurgTemperatureGraph(id) {
|
||||
const b = pack.burgs[id];
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import {unique} from "/src/utils/arrayUtils";
|
|||
import {tip, showMainTip, clearMainTip} from "/src/scripts/tooltips";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {getNextId} from "@/utils/nodeUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
|
||||
export function editZones() {
|
||||
closeDialogs();
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue