Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion public/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -2203,7 +2203,7 @@ svg.button {
}

#globeLatLabels {
font-size: 12px;
font-size: 9px;
font-family: var(--monospace);
stroke: none;
fill: #001754;
Expand Down
24 changes: 14 additions & 10 deletions public/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,10 @@ let options = {
temperatureEquator: 27,
temperatureNorthPole: -30,
temperatureSouthPole: -15,
mapSize: 100, // map size in % of the world
latitude: 50, // North-South map shift in %, 50 is centered on equator
longitude: 50, // West-East map shift in %, 50 is centered on prime meridian
prec: 100, // precipitation modifier in %
stateLabelsMode: "auto",
showBurgPreview: true,
burgs: {
Expand Down Expand Up @@ -870,9 +874,9 @@ function openNearSeaLakes() {
function defineMapSize() {
const [size, latitude, longitude] = getSizeAndLatitude();
const randomize = new URL(window.location.href).searchParams.get("options") === "default"; // ignore stored options
if (randomize || !locked("mapSize")) mapSizeOutput.value = mapSizeInput.value = size;
if (randomize || !locked("latitude")) latitudeOutput.value = latitudeInput.value = latitude;
if (randomize || !locked("longitude")) longitudeOutput.value = longitudeInput.value = longitude;
if (randomize || !stored("mapSize")) options.mapSize = size;
if (randomize || !stored("latitude")) options.latitude = latitude;
if (randomize || !stored("longitude")) options.longitude = longitude;

function getSizeAndLatitude() {
const template = ensureEl("templateInput").value; // heightmap template
Expand Down Expand Up @@ -927,9 +931,9 @@ function defineMapSize() {

// calculate map position on globe
function calculateMapCoordinates() {
const sizeFraction = +ensureEl("mapSizeOutput").value / 100;
const latShift = +ensureEl("latitudeOutput").value / 100;
const lonShift = +ensureEl("longitudeOutput").value / 100;
const sizeFraction = options.mapSize / 100;
const latShift = options.latitude / 100;
const lonShift = options.longitude / 100;

const latT = rn(sizeFraction * 180, 1);
const latN = rn(90 - (180 - latT) * latShift, 1);
Expand Down Expand Up @@ -999,7 +1003,7 @@ function generatePrecipitation() {
cells.prec = new Uint8Array(cells.i.length); // precipitation array

const cellsNumberModifier = (pointsInput.dataset.cells / 10000) ** 0.25;
const precInputModifier = precInput.value / 100;
const precInputModifier = options.prec / 100;
const modifier = cellsNumberModifier * precInputModifier;

const westerly = [];
Expand Down Expand Up @@ -1278,15 +1282,15 @@ function showStatistics() {
const heightmap = ensureEl("templateInput").value;
const isTemplate = heightmap in heightmapTemplates;
const heightmapType = isTemplate ? "template" : "precreated";
const isRandomTemplate = isTemplate && !locked("template") ? "random " : "";
const isRandomTemplate = isTemplate && !stored("template") ? "random " : "";

const stats = ` Seed: ${seed}
Canvas size: ${graphWidth}x${graphHeight} px
Heightmap: ${heightmap}
Template: ${isRandomTemplate}${heightmapType}
Points: ${grid.points.length}
Cells: ${pack.cells.i.length}
Map size: ${mapSizeOutput.value}%
Map size: ${options.mapSize}%
States: ${pack.states.length - 1}
Provinces: ${pack.provinces.length - 1}
Burgs: ${pack.burgs.length - 1}
Expand Down Expand Up @@ -1317,7 +1321,7 @@ const regenerateMap = debounce(async function (config) {
await generate(config);
drawLayers();
if (options.threeD.isOn) window.Controllers.View3d.redraw();
if ($("#worldConfigurator").is(":visible")) editWorld();
if (findEl("worldConfigurator")?.offsetParent) window.Controllers.WorldConfigurator.open();

fitMapToScreen();
shouldShowLoading && hideLoading();
Expand Down
231 changes: 0 additions & 231 deletions public/modules/ui/ai-generator.js

This file was deleted.

8 changes: 0 additions & 8 deletions public/modules/ui/general.js
Original file line number Diff line number Diff line change
Expand Up @@ -567,18 +567,10 @@ function unlock(id) {
el.className = "icon-lock-open";
}

// check if option is locked
function locked(id) {
const lockEl = document.getElementById("lock_" + id);
return lockEl.dataset.locked === "1";
}

// return key value stored in localStorage or null
function stored(key) {
return localStorage.getItem(key) || null;
}

// store key value in localStorage
function store(key, value) {
return localStorage.setItem(key, value);
}
Expand Down
Loading
Loading