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
b8ae515425
commit
4814bce58d
14 changed files with 99 additions and 83 deletions
|
|
@ -6,6 +6,7 @@ import {rn} from "/src/utils/numberUtils";
|
|||
import {capitalize} from "@/utils/stringUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
import {abbreviate} from "@/utils/languageUtils";
|
||||
import {debounce} from "@/utils/functionUtils";
|
||||
|
||||
const $body = insertEditorHtml();
|
||||
addListeners();
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ import {byId} from "/src/utils/shorthands";
|
|||
import {rn} from "/src/utils/numberUtils";
|
||||
import {si} from "@/utils/unitUtils";
|
||||
import {abbreviate} from "@/utils/languageUtils";
|
||||
import {debounce} from "@/utils/functionUtils";
|
||||
|
||||
const $body = insertEditorHtml();
|
||||
addListeners();
|
||||
|
|
|
|||
|
|
@ -1,10 +1,10 @@
|
|||
import {rollups} from "../../../utils/functionUtils.js";
|
||||
import {isWater} from "/src/utils/graphUtils";
|
||||
import {tip} from "/src/scripts/tooltips";
|
||||
import {byId} from "/src/utils/shorthands";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {capitalize} from "@/utils/stringUtils";
|
||||
import {si, convertTemperature} from "@/utils/unitUtils";
|
||||
import {rollups} from "@/utils/functionUtils";
|
||||
|
||||
const entitiesMap = {
|
||||
states: {
|
||||
|
|
|
|||
|
|
@ -3,6 +3,7 @@ import {unique} from "/src/utils/arrayUtils";
|
|||
import {tip} from "/src/scripts/tooltips";
|
||||
import {getCoordinates} from "@/utils/coordinateUtils";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {getBase64} from "@/utils/functionUtils";
|
||||
|
||||
// download map as SVG
|
||||
async function saveSVG() {
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
import {tip} from "/src/scripts/tooltips";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {throttle} from "@/utils/functionUtils";
|
||||
|
||||
window.ThreeD = (function () {
|
||||
const options = {
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import {byId} from "/src/utils/shorthands";
|
|||
import {rn, minmax, lim} from "/src/utils/numberUtils";
|
||||
import {link} from "@/utils/linkUtils";
|
||||
import {prompt} from "@/scripts/prompt";
|
||||
import {throttle} from "@/utils/functionUtils";
|
||||
|
||||
export function editHeightmap(options) {
|
||||
const {mode, tool} = options || {};
|
||||
|
|
|
|||
|
|
@ -11,6 +11,7 @@ import {isCtrlClick} from "@/utils/keyboardUtils";
|
|||
import {prompt} from "@/scripts/prompt";
|
||||
import {rand, P} from "@/utils/probabilityUtils";
|
||||
import {convertTemperature} from "@/utils/unitUtils";
|
||||
import {getBase64} from "@/utils/functionUtils";
|
||||
|
||||
let presets = {};
|
||||
restoreCustomPresets(); // run on-load
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {tip} from "/src/scripts/tooltips";
|
||||
import {rn} from "/src/utils/numberUtils";
|
||||
import {parseTransform} from "@/utils/stringUtils";
|
||||
import {getBase64} from "@/utils/functionUtils";
|
||||
|
||||
// add available filters to lists
|
||||
{
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ import {byId} from "/src/utils/shorthands";
|
|||
import {clearMainTip} from "/src/scripts/tooltips";
|
||||
import {parseError} from "@/utils/errorUtils";
|
||||
import {rn, minmax} from "/src/utils/numberUtils";
|
||||
import {debounce} from "@/utils/functionUtils";
|
||||
|
||||
window.UISubmap = (function () {
|
||||
byId("submapPointsInput").addEventListener("input", function () {
|
||||
|
|
|
|||
|
|
@ -1,9 +1,9 @@
|
|||
"use strict";
|
||||
import {debounce} from "@/utils/functionUtils";
|
||||
|
||||
// temporary expose to global
|
||||
let scale = 1;
|
||||
let viewX = 0;
|
||||
let viewY = 0;
|
||||
window.scale = 1;
|
||||
window.viewX = 0;
|
||||
window.viewY = 0;
|
||||
|
||||
window.Zoom = (function () {
|
||||
function onZoom() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue