mirror of
https://github.com/Azgaar/Fantasy-Map-Generator.git
synced 2025-12-18 02:01:22 +01:00
refactor(es modules): migrate a few more functions
This commit is contained in:
parent
14a8a31366
commit
63e9b9c87e
6 changed files with 13 additions and 10 deletions
|
|
@ -1,4 +1,6 @@
|
|||
import {rn} from "/src/utils/numberUtils";
|
||||
import {drawCoordinates} from "/src/modules/ui/layers";
|
||||
import {drawScaleBar} from "/src/modules/measurers";
|
||||
|
||||
export function handleZoom(isScaleChanged, isPositionChanged) {
|
||||
viewbox.attr("transform", `translate(${viewX} ${viewY}) scale(${scale})`);
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import {round} from "/src/utils/stringUtils";
|
|||
window.OceanLayers = (function () {
|
||||
let cells, vertices, pointsN, used;
|
||||
|
||||
const OceanLayers = function OceanLayers() {
|
||||
function OceanLayers() {
|
||||
const outline = oceanLayers.attr("layers");
|
||||
if (outline === "none") return;
|
||||
TIME && console.time("drawOceanLayers");
|
||||
|
|
@ -52,7 +52,7 @@ window.OceanLayers = (function () {
|
|||
}
|
||||
|
||||
TIME && console.timeEnd("drawOceanLayers");
|
||||
};
|
||||
}
|
||||
|
||||
function randomizeOutline() {
|
||||
const limits = [];
|
||||
|
|
|
|||
|
|
@ -2,7 +2,8 @@ import {findCell, findGridCell} from "/src/utils/graphUtils";
|
|||
import {rn} from "/src/utils/numberUtils";
|
||||
import {link} from "/src/utils/linkUtils";
|
||||
import {getCoordinates, toDMS} from "/src/utils/coordinateUtils";
|
||||
import {si} from "/src/utils/unitUtils";
|
||||
import {si, convertTemperature} from "/src/utils/unitUtils";
|
||||
import {stored} from "/src/utils/shorthands";
|
||||
|
||||
// fit full-screen map if window is resized
|
||||
window.addEventListener("resize", function (e) {
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ function getCurrentPreset() {
|
|||
}
|
||||
|
||||
// run on map regeneration
|
||||
function restoreLayers() {
|
||||
export function restoreLayers() {
|
||||
if (layerIsOn("toggleHeight")) drawHeightmap();
|
||||
if (layerIsOn("toggleCells")) drawCells();
|
||||
if (layerIsOn("toggleGrid")) drawGrid();
|
||||
|
|
@ -1474,7 +1474,7 @@ function toggleCoordinates(event) {
|
|||
}
|
||||
}
|
||||
|
||||
function drawCoordinates() {
|
||||
export function drawCoordinates() {
|
||||
if (!layerIsOn("toggleCoordinates")) return;
|
||||
coordinates.selectAll("*").remove(); // remove every time
|
||||
const steps = [0.5, 1, 2, 5, 10, 15, 30]; // possible steps
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import {debounce} from "/src/utils/functionUtils";
|
||||
import {handleZoom} from "/src/modules/activeZooming";
|
||||
|
||||
// temporary expose to global
|
||||
window.scale = 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue